//javascript/closure/base.js
/**
 * @license
 * Copyright The Closure Library Authors.
 * SPDX-License-Identifier: Apache-2.0
 */

/**
 * @fileoverview Bootstrap for the Google JS Library (Closure).
 *
 * In uncompiled mode base.js will attempt to load Closure's deps file, unless
 * the global <code>CLOSURE_NO_DEPS</code> is set to true.  This allows projects
 * to include their own deps file(s) from different locations.
 *
 * Avoid including base.js more than once. This is strictly discouraged and not
 * supported. goog.require(...) won't work properly in that case.
 *
 * @provideGoog
 */


/**
 * @define {boolean} Overridden to true by the compiler.
 */
var COMPILED = false;


/**
 * Base namespace for the Closure library.  Checks to see goog is already
 * defined in the current scope before assigning to prevent clobbering if
 * base.js is loaded more than once.
 *
 * @const
 */
var goog = goog || {};

/**
 * Reference to the global object.
 * https://www.ecma-international.org/ecma-262/9.0/index.html#sec-global-object
 *
 * More info on this implementation here:
 * https://docs.google.com/document/d/1NAeW4Wk7I7FV0Y2tcUFvQdGMc89k2vdgSXInw8_nvCI/edit
 *
 * @const
 * @suppress {undefinedVars} self won't be referenced unless `this` is falsy.
 * @type {!Global}
 */
goog.global =
    // Check `this` first for backwards compatibility.
    // Valid unless running as an ES module or in a function wrapper called
    //   without setting `this` properly.
    // Note that base.js can't usefully be imported as an ES module, but it may
    // be compiled into bundles that are loadable as ES modules.
    this ||
    // https://developer.mozilla.org/en-US/docs/Web/API/Window/self
    // For in-page browser environments and workers.
    self;


/**
 * A hook for overriding the define values in uncompiled mode.
 *
 * In uncompiled mode, `CLOSURE_UNCOMPILED_DEFINES` may be defined before
 * loading base.js.  If a key is defined in `CLOSURE_UNCOMPILED_DEFINES`,
 * `goog.define` will use the value instead of the default value.  This
 * allows flags to be overwritten without compilation (this is normally
 * accomplished with the compiler's "define" flag).
 *
 * Example:
 * <pre>
 *   var CLOSURE_UNCOMPILED_DEFINES = {'goog.DEBUG': false};
 * </pre>
 *
 * @type {Object<string, (string|number|boolean)>|undefined}
 */
goog.global.CLOSURE_UNCOMPILED_DEFINES;


/**
 * A hook for overriding the define values in uncompiled or compiled mode,
 * like CLOSURE_UNCOMPILED_DEFINES but effective in compiled code.  In
 * uncompiled code CLOSURE_UNCOMPILED_DEFINES takes precedence.
 *
 * Also unlike CLOSURE_UNCOMPILED_DEFINES the values must be number, boolean or
 * string literals or the compiler will emit an error.
 *
 * While any @define value may be set, only those set with goog.define will be
 * effective for uncompiled code.
 *
 * Example:
 * <pre>
 *   var CLOSURE_DEFINES = {'goog.DEBUG': false} ;
 * </pre>
 *
 * @type {Object<string, (string|number|boolean)>|undefined}
 */
goog.global.CLOSURE_DEFINES;


/**
 * Builds an object structure for the provided namespace path, ensuring that
 * names that already exist are not overwritten. For example:
 * "a.b.c" -> a = {};a.b={};a.b.c={};
 * Used by goog.provide and goog.exportSymbol.
 * @param {string} name The name of the object that this file defines.
 * @param {*=} object The object to expose at the end of the path.
 * @param {boolean=} overwriteImplicit If object is set and a previous call
 *     implicitly constructed the namespace given by name, this parameter
 *     controls whether object should overwrite the implicitly constructed
 *     namespace or be merged into it. Defaults to false.
 * @param {?Object=} objectToExportTo The object to add the path to; if this
 *     field is not specified, its value defaults to `goog.global`.
 * @private
 */
goog.exportPath_ = function(name, object, overwriteImplicit, objectToExportTo) {
  var parts = name.split('.');
  var cur = objectToExportTo || goog.global;

  // Internet Explorer exhibits strange behavior when throwing errors from
  // methods externed in this manner.  See the testExportSymbolExceptions in
  // base_test.html for an example.
  if (!(parts[0] in cur) && typeof cur.execScript != 'undefined') {
    cur.execScript('var ' + parts[0]);
  }

  for (var part; parts.length && (part = parts.shift());) {
    if (!parts.length && object !== undefined) {
      if (!overwriteImplicit && goog.isObject(object) &&
          goog.isObject(cur[part])) {
        // Merge properties on object (the input parameter) with the existing
        // implicitly defined namespace, so as to not clobber previously
        // defined child namespaces.
        for (var prop in object) {
          if (object.hasOwnProperty(prop)) {
            cur[part][prop] = object[prop];
          }
        }
      } else {
        // Either there is no existing implicit namespace, or overwriteImplicit
        // is set to true, so directly assign object (the input parameter) to
        // the namespace.
        cur[part] = object;
      }
    } else if (cur[part] && cur[part] !== Object.prototype[part]) {
      cur = cur[part];
    } else {
      cur = cur[part] = {};
    }
  }
};


/**
 * Defines a named value. In uncompiled mode, the value is retrieved from
 * CLOSURE_DEFINES or CLOSURE_UNCOMPILED_DEFINES if the object is defined and
 * has the property specified, and otherwise used the defined defaultValue.
 * When compiled the default can be overridden using the compiler options or the
 * value set in the CLOSURE_DEFINES object. Returns the defined value so that it
 * can be used safely in modules. Note that the value type MUST be either
 * boolean, number, or string.
 *
 * @param {string} name The distinguished name to provide.
 * @param {T} defaultValue
 * @return {T} The defined value.
 * @template T
 */
goog.define = function(name, defaultValue) {
  var value = defaultValue;
  if (!COMPILED) {
    var uncompiledDefines = goog.global.CLOSURE_UNCOMPILED_DEFINES;
    var defines = goog.global.CLOSURE_DEFINES;
    if (uncompiledDefines &&
        // Anti DOM-clobbering runtime check (b/37736576).
        /** @type {?} */ (uncompiledDefines).nodeType === undefined &&
        Object.prototype.hasOwnProperty.call(uncompiledDefines, name)) {
      value = uncompiledDefines[name];
    } else if (
        defines &&
        // Anti DOM-clobbering runtime check (b/37736576).
        /** @type {?} */ (defines).nodeType === undefined &&
        Object.prototype.hasOwnProperty.call(defines, name)) {
      value = defines[name];
    }
  }
  return value;
};


/**
 * @define {number} Integer year indicating the set of browser features that are
 * guaranteed to be present.  This is defined to include exactly features that
 * work correctly on all "modern" browsers that are stable on January 1 of the
 * specified year.  For example,
 * ```js
 * if (goog.FEATURESET_YEAR >= 2019) {
 *   // use APIs known to be available on all major stable browsers Jan 1, 2019
 * } else {
 *   // polyfill for older browsers
 * }
 * ```
 * This is intended to be the primary define for removing
 * unnecessary browser compatibility code (such as ponyfills and workarounds),
 * and should inform the default value for most other defines:
 * ```js
 * const ASSUME_NATIVE_PROMISE =
 *     goog.define('ASSUME_NATIVE_PROMISE', goog.FEATURESET_YEAR >= 2016);
 * ```
 *
 * The default assumption is that IE9 is the lowest supported browser, which was
 * first available Jan 1, 2012.
 *
 * TODO(mathiasb): Reference more thorough documentation when it's available.
 */
goog.FEATURESET_YEAR = goog.define('goog.FEATURESET_YEAR', 2012);


/**
 * @define {boolean} DEBUG is provided as a convenience so that debugging code
 * that should not be included in a production. It can be easily stripped
 * by specifying --define goog.DEBUG=false to the Closure Compiler aka
 * JSCompiler. For example, most toString() methods should be declared inside an
 * "if (goog.DEBUG)" conditional because they are generally used for debugging
 * purposes and it is difficult for the JSCompiler to statically determine
 * whether they are used.
 */
goog.DEBUG = goog.define('goog.DEBUG', true);


/**
 * @define {string} LOCALE defines the locale being used for compilation. It is
 * used to select locale specific data to be compiled in js binary. BUILD rule
 * can specify this value by "--define goog.LOCALE=<locale_name>" as a compiler
 * option.
 *
 * Take into account that the locale code format is important. You should use
 * the canonical Unicode format with hyphen as a delimiter. Language must be
 * lowercase, Language Script - Capitalized, Region - UPPERCASE.
 * There are few examples: pt-BR, en, en-US, sr-Latin-BO, zh-Hans-CN.
 *
 * See more info about locale codes here:
 * http://www.unicode.org/reports/tr35/#Unicode_Language_and_Locale_Identifiers
 *
 * For language codes you should use values defined by ISO 693-1. See it here
 * http://www.w3.org/WAI/ER/IG/ert/iso639.htm. There is only one exception from
 * this rule: the Hebrew language. For legacy reasons the old code (iw) should
 * be used instead of the new code (he).
 *
 * MOE:begin_intracomment_strip
 * See http://g3doc/i18n/identifiers/g3doc/synonyms.
 * MOE:end_intracomment_strip
 */
goog.LOCALE = goog.define('goog.LOCALE', 'en');  // default to en


/**
 * @define {boolean} Whether this code is running on trusted sites.
 *
 * On untrusted sites, several native functions can be defined or overridden by
 * external libraries like Prototype, Datejs, and JQuery and setting this flag
 * to false forces closure to use its own implementations when possible.
 *
 * If your JavaScript can be loaded by a third party site and you are wary about
 * relying on non-standard implementations, specify
 * "--define goog.TRUSTED_SITE=false" to the compiler.
 */
goog.TRUSTED_SITE = goog.define('goog.TRUSTED_SITE', true);


/**
 * @define {boolean} Whether code that calls {@link goog.setTestOnly} should
 *     be disallowed in the compilation unit.
 */
goog.DISALLOW_TEST_ONLY_CODE =
    goog.define('goog.DISALLOW_TEST_ONLY_CODE', COMPILED && !goog.DEBUG);


/**
 * @define {boolean} Whether to use a Chrome app CSP-compliant method for
 *     loading scripts via goog.require. @see appendScriptSrcNode_.
 */
goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING =
    goog.define('goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING', false);


/**
 * Defines a namespace in Closure.
 *
 * A namespace may only be defined once in a codebase. It may be defined using
 * goog.provide() or goog.module().
 *
 * The presence of one or more goog.provide() calls in a file indicates
 * that the file defines the given objects/namespaces.
 * Provided symbols must not be null or undefined.
 *
 * In addition, goog.provide() creates the object stubs for a namespace
 * (for example, goog.provide("goog.foo.bar") will create the object
 * goog.foo.bar if it does not already exist).
 *
 * Build tools also scan for provide/require/module statements
 * to discern dependencies, build dependency files (see deps.js), etc.
 *
 * @see goog.require
 * @see goog.module
 * @param {string} name Namespace provided by this file in the form
 *     "goog.package.part".
 * deprecated Use goog.module (see b/159289405)
 */
goog.provide = function(name) {
  if (goog.isInModuleLoader_()) {
    throw new Error('goog.provide cannot be used within a module.');
  }
  if (!COMPILED) {
    // Ensure that the same namespace isn't provided twice.
    // A goog.module/goog.provide maps a goog.require to a specific file
    if (goog.isProvided_(name)) {
      throw new Error('Namespace "' + name + '" already declared.');
    }
  }

  goog.constructNamespace_(name);
};


/**
 * @param {string} name Namespace provided by this file in the form
 *     "goog.package.part".
 * @param {?Object=} object The object to embed in the namespace.
 * @param {boolean=} overwriteImplicit If object is set and a previous call
 *     implicitly constructed the namespace given by name, this parameter
 *     controls whether opt_obj should overwrite the implicitly constructed
 *     namespace or be merged into it. Defaults to false.
 * @private
 */
goog.constructNamespace_ = function(name, object, overwriteImplicit) {
  if (!COMPILED) {
    delete goog.implicitNamespaces_[name];

    var namespace = name;
    while ((namespace = namespace.substring(0, namespace.lastIndexOf('.')))) {
      if (goog.getObjectByName(namespace)) {
        break;
      }
      goog.implicitNamespaces_[namespace] = true;
    }
  }

  goog.exportPath_(name, object, overwriteImplicit);
};


/**
 * Returns CSP nonce, if set for any script tag.
 * @param {?Window=} opt_window The window context used to retrieve the nonce.
 *     Defaults to global context.
 * @return {string} CSP nonce or empty string if no nonce is present.
 */
goog.getScriptNonce = function(opt_window) {
  if (opt_window && opt_window != goog.global) {
    return goog.getScriptNonce_(opt_window.document);
  }
  if (goog.cspNonce_ === null) {
    goog.cspNonce_ = goog.getScriptNonce_(goog.global.document);
  }
  return goog.cspNonce_;
};


/**
 * According to the CSP3 spec a nonce must be a valid base64 string.
 * @see https://www.w3.org/TR/CSP3/#grammardef-base64-value
 * @private @const
 */
goog.NONCE_PATTERN_ = /^[\w+/_-]+[=]{0,2}$/;


/**
 * @private {?string}
 */
goog.cspNonce_ = null;


/**
 * Returns CSP nonce, if set for any script tag.
 * @param {!Document} doc
 * @return {string} CSP nonce or empty string if no nonce is present.
 * @private
 */
goog.getScriptNonce_ = function(doc) {
  var script = doc.querySelector && doc.querySelector('script[nonce]');
  if (script) {
    // Try to get the nonce from the IDL property first, because browsers that
    // implement additional nonce protection features (currently only Chrome) to
    // prevent nonce stealing via CSS do not expose the nonce via attributes.
    // See https://github.com/whatwg/html/issues/2369
    var nonce = script['nonce'] || script.getAttribute('nonce');
    if (nonce && goog.NONCE_PATTERN_.test(nonce)) {
      return nonce;
    }
  }
  return '';
};


/**
 * Module identifier validation regexp.
 * Note: This is a conservative check, it is very possible to be more lenient,
 *   the primary exclusion here is "/" and "\" and a leading ".", these
 *   restrictions are intended to leave the door open for using goog.require
 *   with relative file paths rather than module identifiers.
 * @private
 */
goog.VALID_MODULE_RE_ = /^[a-zA-Z_$][a-zA-Z0-9._$]*$/;


/**
 * Defines a module in Closure.
 *
 * Marks that this file must be loaded as a module and claims the namespace.
 *
 * A namespace may only be defined once in a codebase. It may be defined using
 * goog.provide() or goog.module().
 *
 * goog.module() has three requirements:
 * - goog.module may not be used in the same file as goog.provide.
 * - goog.module must be the first statement in the file.
 * - only one goog.module is allowed per file.
 *
 * When a goog.module annotated file is loaded, it is enclosed in
 * a strict function closure. This means that:
 * - any variables declared in a goog.module file are private to the file
 * (not global), though the compiler is expected to inline the module.
 * - The code must obey all the rules of "strict" JavaScript.
 * - the file will be marked as "use strict"
 *
 * NOTE: unlike goog.provide, goog.module does not declare any symbols by
 * itself. If declared symbols are desired, use
 * goog.module.declareLegacyNamespace().
 *
 * MOE:begin_intracomment_strip
 * See the goog.module announcement at http://go/goog.module-announce
 * MOE:end_intracomment_strip
 *
 * See the public goog.module proposal: http://goo.gl/Va1hin
 *
 * @param {string} name Namespace provided by this file in the form
 *     "goog.package.part", is expected but not required.
 * @return {void}
 */
goog.module = function(name) {
  if (typeof name !== 'string' || !name ||
      name.search(goog.VALID_MODULE_RE_) == -1) {
    throw new Error('Invalid module identifier');
  }
  if (!goog.isInGoogModuleLoader_()) {
    throw new Error(
        'Module ' + name + ' has been loaded incorrectly. Note, ' +
        'modules cannot be loaded as normal scripts. They require some kind of ' +
        'pre-processing step. You\'re likely trying to load a module via a ' +
        'script tag or as a part of a concatenated bundle without rewriting the ' +
        'module. For more info see: ' +
        'https://github.com/google/closure-library/wiki/goog.module:-an-ES6-module-like-alternative-to-goog.provide.');
  }
  if (goog.moduleLoaderState_.moduleName) {
    throw new Error('goog.module may only be called once per module.');
  }

  // Store the module name for the loader.
  goog.moduleLoaderState_.moduleName = name;
  if (!COMPILED) {
    // Ensure that the same namespace isn't provided twice.
    // A goog.module/goog.provide maps a goog.require to a specific file
    if (goog.isProvided_(name)) {
      throw new Error('Namespace "' + name + '" already declared.');
    }
    delete goog.implicitNamespaces_[name];
  }
};


/**
 * @param {string} name The module identifier.
 * @return {?} The module exports for an already loaded module or null.
 *
 * Note: This is not an alternative to goog.require, it does not
 * indicate a hard dependency, instead it is used to indicate
 * an optional dependency or to access the exports of a module
 * that has already been loaded.
 * @suppress {missingProvide}
 */
goog.module.get = function(name) {
  return goog.module.getInternal_(name);
};


/**
 * @param {string} name The module identifier.
 * @return {?} The module exports for an already loaded module or null.
 * @private
 */
goog.module.getInternal_ = function(name) {
  if (!COMPILED) {
    if (name in goog.loadedModules_) {
      return goog.loadedModules_[name].exports;
    } else if (!goog.implicitNamespaces_[name]) {
      var ns = goog.getObjectByName(name);
      return ns != null ? ns : null;
    }
  }
  return null;
};


/**
 * Types of modules the debug loader can load.
 * @enum {string}
 */
goog.ModuleType = {
  ES6: 'es6',
  GOOG: 'goog'
};


/**
 * @private {?{
 *   moduleName: (string|undefined),
 *   declareLegacyNamespace:boolean,
 *   type: ?goog.ModuleType
 * }}
 */
goog.moduleLoaderState_ = null;


/**
 * @private
 * @return {boolean} Whether a goog.module or an es6 module is currently being
 *     initialized.
 */
goog.isInModuleLoader_ = function() {
  return goog.isInGoogModuleLoader_() || goog.isInEs6ModuleLoader_();
};


/**
 * @private
 * @return {boolean} Whether a goog.module is currently being initialized.
 */
goog.isInGoogModuleLoader_ = function() {
  return !!goog.moduleLoaderState_ &&
      goog.moduleLoaderState_.type == goog.ModuleType.GOOG;
};


/**
 * @private
 * @return {boolean} Whether an es6 module is currently being initialized.
 */
goog.isInEs6ModuleLoader_ = function() {
  var inLoader = !!goog.moduleLoaderState_ &&
      goog.moduleLoaderState_.type == goog.ModuleType.ES6;

  if (inLoader) {
    return true;
  }

  var jscomp = goog.global['$jscomp'];

  if (jscomp) {
    // jscomp may not have getCurrentModulePath if this is a compiled bundle
    // that has some of the runtime, but not all of it. This can happen if
    // optimizations are turned on so the unused runtime is removed but renaming
    // and Closure pass are off (so $jscomp is still named $jscomp and the
    // goog.provide/require calls still exist).
    if (typeof jscomp.getCurrentModulePath != 'function') {
      return false;
    }

    // Bundled ES6 module.
    return !!jscomp.getCurrentModulePath();
  }

  return false;
};


/**
 * Provide the module's exports as a globally accessible object under the
 * module's declared name.  This is intended to ease migration to goog.module
 * for files that have existing usages.
 * @suppress {missingProvide}
 */
goog.module.declareLegacyNamespace = function() {
  if (!COMPILED && !goog.isInGoogModuleLoader_()) {
    throw new Error(
        'goog.module.declareLegacyNamespace must be called from ' +
        'within a goog.module');
  }
  if (!COMPILED && !goog.moduleLoaderState_.moduleName) {
    throw new Error(
        'goog.module must be called prior to ' +
        'goog.module.declareLegacyNamespace.');
  }
  goog.moduleLoaderState_.declareLegacyNamespace = true;
};


/**
 * Associates an ES6 module with a Closure module ID so that is available via
 * goog.require. The associated ID  acts like a goog.module ID - it does not
 * create any global names, it is merely available via goog.require /
 * goog.module.get / goog.forwardDeclare / goog.requireType. goog.require and
 * goog.module.get will return the entire module as if it was import *'d. This
 * allows Closure files to reference ES6 modules for the sake of migration.
 *
 * @param {string} namespace
 * @suppress {missingProvide}
 */
goog.declareModuleId = function(namespace) {
  if (!COMPILED) {
    if (!goog.isInEs6ModuleLoader_()) {
      throw new Error(
          'goog.declareModuleId may only be called from ' +
          'within an ES6 module');
    }
    if (goog.moduleLoaderState_ && goog.moduleLoaderState_.moduleName) {
      throw new Error(
          'goog.declareModuleId may only be called once per module.');
    }
    if (namespace in goog.loadedModules_) {
      throw new Error(
          'Module with namespace "' + namespace + '" already exists.');
    }
  }
  if (goog.moduleLoaderState_) {
    // Not bundled - debug loading.
    goog.moduleLoaderState_.moduleName = namespace;
  } else {
    // Bundled - not debug loading, no module loader state.
    var jscomp = goog.global['$jscomp'];
    if (!jscomp || typeof jscomp.getCurrentModulePath != 'function') {
      throw new Error(
          'Module with namespace "' + namespace +
          '" has been loaded incorrectly.');
    }
    var exports = jscomp.require(jscomp.getCurrentModulePath());
    goog.loadedModules_[namespace] = {
      exports: exports,
      type: goog.ModuleType.ES6,
      moduleId: namespace
    };
  }
};


/**
 * Marks that the current file should only be used for testing, and never for
 * live code in production.
 *
 * In the case of unit tests, the message may optionally be an exact namespace
 * for the test (e.g. 'goog.stringTest'). The linter will then ignore the extra
 * provide (if not explicitly defined in the code).
 *
 * @param {string=} opt_message Optional message to add to the error that's
 *     raised when used in production code.
 */
goog.setTestOnly = function(opt_message) {
  if (goog.DISALLOW_TEST_ONLY_CODE) {
    opt_message = opt_message || '';
    throw new Error(
        'Importing test-only code into non-debug environment' +
        (opt_message ? ': ' + opt_message : '.'));
  }
};


/**
 * Forward declares a symbol. This is an indication to the compiler that the
 * symbol may be used in the source yet is not required and may not be provided
 * in compilation.
 *
 * The most common usage of forward declaration is code that takes a type as a
 * function parameter but does not need to require it. By forward declaring
 * instead of requiring, no hard dependency is made, and (if not required
 * elsewhere) the namespace may never be required and thus, not be pulled
 * into the JavaScript binary. If it is required elsewhere, it will be type
 * checked as normal.
 *
 * Before using goog.forwardDeclare, please read the documentation at
 * https://github.com/google/closure-compiler/wiki/Bad-Type-Annotation to
 * understand the options and tradeoffs when working with forward declarations.
 *
 * @param {string} name The namespace to forward declare in the form of
 *     "goog.package.part".
 * @deprecated See go/noforwarddeclaration, Use `goog.requireType` instead.
 */
goog.forwardDeclare = function(name) {};


/**
 * Forward declare type information. Used to assign types to goog.global
 * referenced object that would otherwise result in unknown type references
 * and thus block property disambiguation.
 */
goog.forwardDeclare('Document');
goog.forwardDeclare('HTMLScriptElement');
goog.forwardDeclare('XMLHttpRequest');


if (!COMPILED) {
  /**
   * Check if the given name has been goog.provided. This will return false for
   * names that are available only as implicit namespaces.
   * @param {string} name name of the object to look for.
   * @return {boolean} Whether the name has been provided.
   * @private
   */
  goog.isProvided_ = function(name) {
    return (name in goog.loadedModules_) ||
        (!goog.implicitNamespaces_[name] && goog.getObjectByName(name) != null);
  };

  /**
   * Namespaces implicitly defined by goog.provide. For example,
   * goog.provide('goog.events.Event') implicitly declares that 'goog' and
   * 'goog.events' must be namespaces.
   *
   * @type {!Object<string, (boolean|undefined)>}
   * @private
   */
  goog.implicitNamespaces_ = {'goog.module': true};

  // NOTE: We add goog.module as an implicit namespace as goog.module is defined
  // here and because the existing module package has not been moved yet out of
  // the goog.module namespace. This satisifies both the debug loader and
  // ahead-of-time dependency management.
}


/**
 * Returns an object based on its fully qualified external name.  The object
 * is not found if null or undefined.  If you are using a compilation pass that
 * renames property names beware that using this function will not find renamed
 * properties.
 *
 * @param {string} name The fully qualified name.
 * @param {Object=} opt_obj The object within which to look; default is
 *     |goog.global|.
 * @return {?} The value (object or primitive) or, if not found, null.
 */
goog.getObjectByName = function(name, opt_obj) {
  var parts = name.split('.');
  var cur = opt_obj || goog.global;
  for (var i = 0; i < parts.length; i++) {
    cur = cur[parts[i]];
    if (cur == null) {
      return null;
    }
  }
  return cur;
};


/**
 * Adds a dependency from a file to the files it requires.
 * @param {string} relPath The path to the js file.
 * @param {!Array<string>} provides An array of strings with
 *     the names of the objects this file provides.
 * @param {!Array<string>} requires An array of strings with
 *     the names of the objects this file requires.
 * @param {boolean|!Object<string>=} opt_loadFlags Parameters indicating
 *     how the file must be loaded.  The boolean 'true' is equivalent
 *     to {'module': 'goog'} for backwards-compatibility.  Valid properties
 *     and values include {'module': 'goog'} and {'lang': 'es6'}.
 */
goog.addDependency = function(relPath, provides, requires, opt_loadFlags) {
  if (!COMPILED && goog.DEPENDENCIES_ENABLED) {
    goog.debugLoader_.addDependency(relPath, provides, requires, opt_loadFlags);
  }
};


// MOE:begin_strip
/**
 * Whether goog.require should throw an exception if it fails.
 * @type {boolean}
 */
goog.useStrictRequires = false;


// MOE:end_strip


// NOTE(nnaze): The debug DOM loader was included in base.js as an original way
// to do "debug-mode" development.  The dependency system can sometimes be
// confusing, as can the debug DOM loader's asynchronous nature.
//
// With the DOM loader, a call to goog.require() is not blocking -- the script
// will not load until some point after the current script.  If a namespace is
// needed at runtime, it needs to be defined in a previous script, or loaded via
// require() with its registered dependencies.
//
// User-defined namespaces may need their own deps file. For a reference on
// creating a deps file, see:
// MOE:begin_strip
// Internally: http://go/deps-files and http://go/be#js_deps
// MOE:end_strip
// Externally: https://developers.google.com/closure/library/docs/depswriter
//
// Because of legacy clients, the DOM loader can't be easily removed from
// base.js.  Work was done to make it disableable or replaceable for
// different environments (DOM-less JavaScript interpreters like Rhino or V8,
// for example). See bootstrap/ for more information.


/**
 * @define {boolean} Whether to enable the debug loader.
 *
 * If enabled, a call to goog.require() will attempt to load the namespace by
 * appending a script tag to the DOM (if the namespace has been registered).
 *
 * If disabled, goog.require() will simply assert that the namespace has been
 * provided (and depend on the fact that some outside tool correctly ordered
 * the script).
 */
goog.ENABLE_DEBUG_LOADER = goog.define('goog.ENABLE_DEBUG_LOADER', true);


/**
 * @param {string} msg
 * @private
 */
goog.logToConsole_ = function(msg) {
  if (goog.global.console) {
    goog.global.console['error'](msg);
  }
};


/**
 * Implements a system for the dynamic resolution of dependencies that works in
 * parallel with the BUILD system.
 *
 * Note that all calls to goog.require will be stripped by the compiler.
 *
 * @see goog.provide
 * @param {string} namespace Namespace (as was given in goog.provide,
 *     goog.module, or goog.declareModuleId) in the form
 *     "goog.package.part".
 * @return {?} If called within a goog.module or ES6 module file, the associated
 *     namespace or module otherwise null.
 */
goog.require = function(namespace) {
  if (!COMPILED) {
    // Might need to lazy load on old IE.
    if (goog.ENABLE_DEBUG_LOADER) {
      goog.debugLoader_.requested(namespace);
    }

    // If the object already exists we do not need to do anything.
    if (goog.isProvided_(namespace)) {
      if (goog.isInModuleLoader_()) {
        return goog.module.getInternal_(namespace);
      }
    } else if (goog.ENABLE_DEBUG_LOADER) {
      var moduleLoaderState = goog.moduleLoaderState_;
      goog.moduleLoaderState_ = null;
      try {
        goog.debugLoader_.load_(namespace);
      } finally {
        goog.moduleLoaderState_ = moduleLoaderState;
      }
    }

    return null;
  }
};


/**
 * Requires a symbol for its type information. This is an indication to the
 * compiler that the symbol may appear in type annotations, yet it is not
 * referenced at runtime.
 *
 * When called within a goog.module or ES6 module file, the return value may be
 * assigned to or destructured into a variable, but it may not be otherwise used
 * in code outside of a type annotation.
 *
 * Note that all calls to goog.requireType will be stripped by the compiler.
 *
 * @param {string} namespace Namespace (as was given in goog.provide,
 *     goog.module, or goog.declareModuleId) in the form
 *     "goog.package.part".
 * @return {?}
 */
goog.requireType = function(namespace) {
  // Return an empty object so that single-level destructuring of the return
  // value doesn't crash at runtime when using the debug loader. Multi-level
  // destructuring isn't supported.
  return {};
};


/**
 * Path for included scripts.
 * @type {string}
 */
goog.basePath = '';


/**
 * A hook for overriding the base path.
 * @type {string|undefined}
 */
goog.global.CLOSURE_BASE_PATH;


/**
 * Whether to attempt to load Closure's deps file. By default, when uncompiled,
 * deps files will attempt to be loaded.
 * @type {boolean|undefined}
 */
goog.global.CLOSURE_NO_DEPS;


/**
 * A function to import a single script. This is meant to be overridden when
 * Closure is being run in non-HTML contexts, such as web workers. It's defined
 * in the global scope so that it can be set before base.js is loaded, which
 * allows deps.js to be imported properly.
 *
 * The first parameter the script source, which is a relative URI. The second,
 * optional parameter is the script contents, in the event the script needed
 * transformation. It should return true if the script was imported, false
 * otherwise.
 * @type {(function(string, string=): boolean)|undefined}
 */
goog.global.CLOSURE_IMPORT_SCRIPT;


/**
 * Null function used for default values of callbacks, etc.
 * @return {void} Nothing.
 * @deprecated use '()=>{}' or 'function(){}' instead.
 */
goog.nullFunction = function() {};


/**
 * When defining a class Foo with an abstract method bar(), you can do:
 * Foo.prototype.bar = goog.abstractMethod
 *
 * Now if a subclass of Foo fails to override bar(), an error will be thrown
 * when bar() is invoked.
 *
 * @type {!Function}
 * @throws {Error} when invoked to indicate the method should be overridden.
 * @deprecated Use "@abstract" annotation instead of goog.abstractMethod in new
 *     code. See
 *     https://github.com/google/closure-compiler/wiki/@abstract-classes-and-methods
 */
goog.abstractMethod = function() {
  throw new Error('unimplemented abstract method');
};


/**
 * Adds a `getInstance` static method that always returns the same
 * instance object.
 * @param {!Function} ctor The constructor for the class to add the static
 *     method to.
 * @suppress {missingProperties} 'instance_' isn't a property on 'Function'
 *     but we don't have a better type to use here.
 */
goog.addSingletonGetter = function(ctor) {
  // instance_ is immediately set to prevent issues with sealed constructors
  // such as are encountered when a constructor is returned as the export object
  // of a goog.module in unoptimized code.
  // Delcare type to avoid conformance violations that ctor.instance_ is unknown
  /** @type {undefined|!Object} @suppress {underscore} */
  ctor.instance_ = undefined;
  ctor.getInstance = function() {
    if (ctor.instance_) {
      return ctor.instance_;
    }
    if (goog.DEBUG) {
      // NOTE: JSCompiler can't optimize away Array#push.
      goog.instantiatedSingletons_[goog.instantiatedSingletons_.length] = ctor;
    }
    // Cast to avoid conformance violations that ctor.instance_ is unknown
    return /** @type {!Object|undefined} */ (ctor.instance_) = new ctor;
  };
};


/**
 * All singleton classes that have been instantiated, for testing. Don't read
 * it directly, use the `goog.testing.singleton` module. The compiler
 * removes this variable if unused.
 * @type {!Array<!Function>}
 * @private
 */
goog.instantiatedSingletons_ = [];


/**
 * @define {boolean} Whether to load goog.modules using `eval` when using
 * the debug loader.  This provides a better debugging experience as the
 * source is unmodified and can be edited using Chrome Workspaces or similar.
 * However in some environments the use of `eval` is banned
 * so we provide an alternative.
 */
goog.LOAD_MODULE_USING_EVAL = goog.define('goog.LOAD_MODULE_USING_EVAL', true);


/**
 * @define {boolean} Whether the exports of goog.modules should be sealed when
 * possible.
 */
goog.SEAL_MODULE_EXPORTS = goog.define('goog.SEAL_MODULE_EXPORTS', goog.DEBUG);


/**
 * The registry of initialized modules:
 * The module identifier or path to module exports map.
 * @private @const {!Object<string, {exports:?,type:string,moduleId:string}>}
 */
goog.loadedModules_ = {};


/**
 * True if the debug loader enabled and used.
 * @const {boolean}
 */
goog.DEPENDENCIES_ENABLED = !COMPILED && goog.ENABLE_DEBUG_LOADER;


/**
 * @define {string} How to decide whether to transpile.  Valid values
 * are 'always', 'never', and 'detect'.  The default ('detect') is to
 * use feature detection to determine which language levels need
 * transpilation.
 */
// NOTE(sdh): we could expand this to accept a language level to bypass
// detection: e.g. goog.TRANSPILE == 'es5' would transpile ES6 files but
// would leave ES3 and ES5 files alone.
goog.TRANSPILE = goog.define('goog.TRANSPILE', 'detect');

/**
 * @define {boolean} If true assume that ES modules have already been
 * transpiled by the jscompiler (in the same way that transpile.js would
 * transpile them - to jscomp modules). Useful only for servers that wish to use
 * the debug loader and transpile server side. Thus this is only respected if
 * goog.TRANSPILE is "never".
 */
goog.ASSUME_ES_MODULES_TRANSPILED =
    goog.define('goog.ASSUME_ES_MODULES_TRANSPILED', false);


/**
 * @define {string} If a file needs to be transpiled what the output language
 * should be. By default this is the highest language level this file detects
 * the current environment supports. Generally this flag should not be set, but
 * it could be useful to override. Example: If the current environment supports
 * ES6 then by default ES7+ files will be transpiled to ES6, unless this is
 * overridden.
 *
 * Valid values include: es3, es5, es6, es7, and es8. Anything not recognized
 * is treated as es3.
 *
 * Note that setting this value does not force transpilation. Just if
 * transpilation occurs this will be the output. So this is most useful when
 * goog.TRANSPILE is set to 'always' and then forcing the language level to be
 * something lower than what the environment detects.
 */
goog.TRANSPILE_TO_LANGUAGE = goog.define('goog.TRANSPILE_TO_LANGUAGE', '');


/**
 * @define {string} Path to the transpiler.  Executing the script at this
 * path (relative to base.js) should define a function $jscomp.transpile.
 */
goog.TRANSPILER = goog.define('goog.TRANSPILER', 'transpile.js');


/**
 * @define {string} Trusted Types policy name. If non-empty then Closure will
 * use Trusted Types.
 */
goog.TRUSTED_TYPES_POLICY_NAME =
    goog.define('goog.TRUSTED_TYPES_POLICY_NAME', 'goog');


/**
 * @package {?boolean}
 * Visible for testing.
 */
goog.hasBadLetScoping = null;


/**
 * @param {function(?):?|string} moduleDef The module definition.
 */
goog.loadModule = function(moduleDef) {
  // NOTE: we allow function definitions to be either in the from
  // of a string to eval (which keeps the original source intact) or
  // in a eval forbidden environment (CSP) we allow a function definition
  // which in its body must call `goog.module`, and return the exports
  // of the module.
  var previousState = goog.moduleLoaderState_;
  try {
    goog.moduleLoaderState_ = {
      moduleName: '',
      declareLegacyNamespace: false,
      type: goog.ModuleType.GOOG
    };
    var origExports = {};
    var exports = origExports;
    if (typeof moduleDef === 'function') {
      exports = moduleDef.call(undefined, exports);
    } else if (typeof moduleDef === 'string') {
      exports = goog.loadModuleFromSource_.call(undefined, exports, moduleDef);
    } else {
      throw new Error('Invalid module definition');
    }

    var moduleName = goog.moduleLoaderState_.moduleName;
    if (typeof moduleName === 'string' && moduleName) {
      // Don't seal legacy namespaces as they may be used as a parent of
      // another namespace
      if (goog.moduleLoaderState_.declareLegacyNamespace) {
        // Whether exports was overwritten via default export assignment.
        // This is important for legacy namespaces as it dictates whether
        // previously a previously loaded implicit namespace should be clobbered
        // or not.
        var isDefaultExport = origExports !== exports;
        goog.constructNamespace_(moduleName, exports, isDefaultExport);
      } else if (
          goog.SEAL_MODULE_EXPORTS && Object.seal &&
          typeof exports == 'object' && exports != null) {
        Object.seal(exports);
      }

      var data = {
        exports: exports,
        type: goog.ModuleType.GOOG,
        moduleId: goog.moduleLoaderState_.moduleName
      };
      goog.loadedModules_[moduleName] = data;
    } else {
      throw new Error('Invalid module name \"' + moduleName + '\"');
    }
  } finally {
    goog.moduleLoaderState_ = previousState;
  }
};


/**
 * @private @const
 */
goog.loadModuleFromSource_ =
    /** @type {function(!Object, string):?} */ (function(exports) {
      // NOTE: we avoid declaring parameters or local variables here to avoid
      // masking globals or leaking values into the module definition.
      'use strict';
      eval(goog.CLOSURE_EVAL_PREFILTER_.createScript(arguments[1]));
      return exports;
    });


/**
 * Normalize a file path by removing redundant ".." and extraneous "." file
 * path components.
 * @param {string} path
 * @return {string}
 * @private
 */
goog.normalizePath_ = function(path) {
  var components = path.split('/');
  var i = 0;
  while (i < components.length) {
    if (components[i] == '.') {
      components.splice(i, 1);
    } else if (
        i && components[i] == '..' && components[i - 1] &&
        components[i - 1] != '..') {
      components.splice(--i, 2);
    } else {
      i++;
    }
  }
  return components.join('/');
};


/**
 * Provides a hook for loading a file when using Closure's goog.require() API
 * with goog.modules.  In particular this hook is provided to support Node.js.
 *
 * @type {(function(string):string)|undefined}
 */
goog.global.CLOSURE_LOAD_FILE_SYNC;


/**
 * Loads file by synchronous XHR. Should not be used in production environments.
 * @param {string} src Source URL.
 * @return {?string} File contents, or null if load failed.
 * @private
 */
goog.loadFileSync_ = function(src) {
  if (goog.global.CLOSURE_LOAD_FILE_SYNC) {
    return goog.global.CLOSURE_LOAD_FILE_SYNC(src);
  } else {
    try {
      /** @type {XMLHttpRequest} */
      var xhr = new goog.global['XMLHttpRequest']();
      xhr.open('get', src, false);
      xhr.send();
      // NOTE: Successful http: requests have a status of 200, but successful
      // file: requests may have a status of zero.  Any other status, or a
      // thrown exception (particularly in case of file: requests) indicates
      // some sort of error, which we treat as a missing or unavailable file.
      return xhr.status == 0 || xhr.status == 200 ? xhr.responseText : null;
    } catch (err) {
      // No need to rethrow or log, since errors should show up on their own.
      return null;
    }
  }
};


/**
 * Lazily retrieves the transpiler and applies it to the source.
 * @param {string} code JS code.
 * @param {string} path Path to the code.
 * @param {string} target Language level output.
 * @return {string} The transpiled code.
 * @private
 */
goog.transpile_ = function(code, path, target) {
  var jscomp = goog.global['$jscomp'];
  if (!jscomp) {
    goog.global['$jscomp'] = jscomp = {};
  }
  var transpile = jscomp.transpile;
  if (!transpile) {
    var transpilerPath = goog.basePath + goog.TRANSPILER;
    var transpilerCode = goog.loadFileSync_(transpilerPath);
    if (transpilerCode) {
      // This must be executed synchronously, since by the time we know we
      // need it, we're about to load and write the ES6 code synchronously,
      // so a normal script-tag load will be too slow. Wrapped in a function
      // so that code is eval'd in the global scope.
      (function() {
        (0, eval)(transpilerCode + '\n//# sourceURL=' + transpilerPath);
      }).call(goog.global);
      // Even though the transpiler is optional, if $gwtExport is found, it's
      // a sign the transpiler was loaded and the $jscomp.transpile *should*
      // be there.
      if (goog.global['$gwtExport'] && goog.global['$gwtExport']['$jscomp'] &&
          !goog.global['$gwtExport']['$jscomp']['transpile']) {
        throw new Error(
            'The transpiler did not properly export the "transpile" ' +
            'method. $gwtExport: ' + JSON.stringify(goog.global['$gwtExport']));
      }
      // transpile.js only exports a single $jscomp function, transpile. We
      // grab just that and add it to the existing definition of $jscomp which
      // contains the polyfills.
      goog.global['$jscomp'].transpile =
          goog.global['$gwtExport']['$jscomp']['transpile'];
      jscomp = goog.global['$jscomp'];
      transpile = jscomp.transpile;
    }
  }
  if (!transpile) {
    // The transpiler is an optional component.  If it's not available then
    // replace it with a pass-through function that simply logs.
    var suffix = ' requires transpilation but no transpiler was found.';
    // MOE:begin_strip
    suffix +=  // Provide a more appropriate message internally.
        ' Please add "//javascript/closure:transpiler" as a data ' +
        'dependency to ensure it is included.';
    // MOE:end_strip
    transpile = jscomp.transpile = function(code, path) {
      // TODO(sdh): figure out some way to get this error to show up
      // in test results, noting that the failure may occur in many
      // different ways, including in loadModule() before the test
      // runner even comes up.
      goog.logToConsole_(path + suffix);
      return code;
    };
  }
  // Note: any transpilation errors/warnings will be logged to the console.
  return transpile(code, path, target);
};

//==============================================================================
// Language Enhancements
//==============================================================================


/**
 * This is a "fixed" version of the typeof operator.  It differs from the typeof
 * operator in such a way that null returns 'null' and arrays return 'array'.
 * @param {?} value The value to get the type of.
 * @return {string} The name of the type.
 */
goog.typeOf = function(value) {
  var s = typeof value;

  if (s != 'object') {
    return s;
  }

  if (!value) {
    return 'null';
  }

  if (Array.isArray(value)) {
    return 'array';
  }
  return s;
};


/**
 * Returns true if the object looks like an array. To qualify as array like
 * the value needs to be either a NodeList or an object with a Number length
 * property. Note that for this function neither strings nor functions are
 * considered "array-like".
 *
 * @param {?} val Variable to test.
 * @return {boolean} Whether variable is an array.
 */
goog.isArrayLike = function(val) {
  var type = goog.typeOf(val);
  // We do not use goog.isObject here in order to exclude function values.
  return type == 'array' || type == 'object' && typeof val.length == 'number';
};


/**
 * Returns true if the object looks like a Date. To qualify as Date-like the
 * value needs to be an object and have a getFullYear() function.
 * @param {?} val Variable to test.
 * @return {boolean} Whether variable is a like a Date.
 */
goog.isDateLike = function(val) {
  return goog.isObject(val) && typeof val.getFullYear == 'function';
};


/**
 * Returns true if the specified value is an object.  This includes arrays and
 * functions.
 * @param {?} val Variable to test.
 * @return {boolean} Whether variable is an object.
 */
goog.isObject = function(val) {
  var type = typeof val;
  return type == 'object' && val != null || type == 'function';
  // return Object(val) === val also works, but is slower, especially if val is
  // not an object.
};


/**
 * Gets a unique ID for an object. This mutates the object so that further calls
 * with the same object as a parameter returns the same value. The unique ID is
 * guaranteed to be unique across the current session amongst objects that are
 * passed into `getUid`. There is no guarantee that the ID is unique or
 * consistent across sessions. It is unsafe to generate unique ID for function
 * prototypes.
 *
 * @param {Object} obj The object to get the unique ID for.
 * @return {number} The unique ID for the object.
 */
goog.getUid = function(obj) {
  // TODO(arv): Make the type stricter, do not accept null.
  return Object.prototype.hasOwnProperty.call(obj, goog.UID_PROPERTY_) &&
      obj[goog.UID_PROPERTY_] ||
      (obj[goog.UID_PROPERTY_] = ++goog.uidCounter_);
};


/**
 * Whether the given object is already assigned a unique ID.
 *
 * This does not modify the object.
 *
 * @param {!Object} obj The object to check.
 * @return {boolean} Whether there is an assigned unique id for the object.
 */
goog.hasUid = function(obj) {
  return !!obj[goog.UID_PROPERTY_];
};


/**
 * Removes the unique ID from an object. This is useful if the object was
 * previously mutated using `goog.getUid` in which case the mutation is
 * undone.
 * @param {Object} obj The object to remove the unique ID field from.
 */
goog.removeUid = function(obj) {
  // TODO(arv): Make the type stricter, do not accept null.

  // In IE, DOM nodes are not instances of Object and throw an exception if we
  // try to delete.  Instead we try to use removeAttribute.
  if (obj !== null && 'removeAttribute' in obj) {
    obj.removeAttribute(goog.UID_PROPERTY_);
  }

  try {
    delete obj[goog.UID_PROPERTY_];
  } catch (ex) {
  }
};


/**
 * Name for unique ID property. Initialized in a way to help avoid collisions
 * with other closure JavaScript on the same page.
 * @type {string}
 * @private
 */
goog.UID_PROPERTY_ = 'closure_uid_' + ((Math.random() * 1e9) >>> 0);


/**
 * Counter for UID.
 * @type {number}
 * @private
 */
goog.uidCounter_ = 0;


/**
 * Clones a value. The input may be an Object, Array, or basic type. Objects and
 * arrays will be cloned recursively.
 *
 * WARNINGS:
 * <code>goog.cloneObject</code> does not detect reference loops. Objects that
 * refer to themselves will cause infinite recursion.
 *
 * <code>goog.cloneObject</code> is unaware of unique identifiers, and copies
 * UIDs created by <code>getUid</code> into cloned results.
 *
 * @param {*} obj The value to clone.
 * @return {*} A clone of the input value.
 * @deprecated goog.cloneObject is unsafe. Prefer the goog.object methods.
 */
goog.cloneObject = function(obj) {
  var type = goog.typeOf(obj);
  if (type == 'object' || type == 'array') {
    if (typeof obj.clone === 'function') {
      return obj.clone();
    }
    var clone = type == 'array' ? [] : {};
    for (var key in obj) {
      clone[key] = goog.cloneObject(obj[key]);
    }
    return clone;
  }

  return obj;
};


/**
 * A native implementation of goog.bind.
 * @param {?function(this:T, ...)} fn A function to partially apply.
 * @param {T} selfObj Specifies the object which this should point to when the
 *     function is run.
 * @param {...*} var_args Additional arguments that are partially applied to the
 *     function.
 * @return {!Function} A partially-applied form of the function goog.bind() was
 *     invoked as a method of.
 * @template T
 * @private
 */
goog.bindNative_ = function(fn, selfObj, var_args) {
  return /** @type {!Function} */ (fn.call.apply(fn.bind, arguments));
};


/**
 * A pure-JS implementation of goog.bind.
 * @param {?function(this:T, ...)} fn A function to partially apply.
 * @param {T} selfObj Specifies the object which this should point to when the
 *     function is run.
 * @param {...*} var_args Additional arguments that are partially applied to the
 *     function.
 * @return {!Function} A partially-applied form of the function goog.bind() was
 *     invoked as a method of.
 * @template T
 * @private
 */
goog.bindJs_ = function(fn, selfObj, var_args) {
  if (!fn) {
    throw new Error();
  }

  if (arguments.length > 2) {
    var boundArgs = Array.prototype.slice.call(arguments, 2);
    return function() {
      // Prepend the bound arguments to the current arguments.
      var newArgs = Array.prototype.slice.call(arguments);
      Array.prototype.unshift.apply(newArgs, boundArgs);
      return fn.apply(selfObj, newArgs);
    };

  } else {
    return function() {
      return fn.apply(selfObj, arguments);
    };
  }
};


/**
 * Partially applies this function to a particular 'this object' and zero or
 * more arguments. The result is a new function with some arguments of the first
 * function pre-filled and the value of this 'pre-specified'.
 *
 * Remaining arguments specified at call-time are appended to the pre-specified
 * ones.
 *
 * Also see: {@link #partial}.
 *
 * Usage:
 * <pre>var barMethBound = goog.bind(myFunction, myObj, 'arg1', 'arg2');
 * barMethBound('arg3', 'arg4');</pre>
 *
 * @param {?function(this:T, ...)} fn A function to partially apply.
 * @param {T} selfObj Specifies the object which this should point to when the
 *     function is run.
 * @param {...*} var_args Additional arguments that are partially applied to the
 *     function.
 * @return {!Function} A partially-applied form of the function goog.bind() was
 *     invoked as a method of.
 * @template T
 * @suppress {deprecated} See above.
 * @deprecated use `=> {}` or Function.prototype.bind instead.
 */
goog.bind = function(fn, selfObj, var_args) {
  // TODO(nicksantos): narrow the type signature.
  if (Function.prototype.bind &&
      // NOTE(nicksantos): Somebody pulled base.js into the default Chrome
      // extension environment. This means that for Chrome extensions, they get
      // the implementation of Function.prototype.bind that calls goog.bind
      // instead of the native one. Even worse, we don't want to introduce a
      // circular dependency between goog.bind and Function.prototype.bind, so
      // we have to hack this to make sure it works correctly.
      Function.prototype.bind.toString().indexOf('native code') != -1) {
    goog.bind = goog.bindNative_;
  } else {
    goog.bind = goog.bindJs_;
  }
  return goog.bind.apply(null, arguments);
};


/**
 * Like goog.bind(), except that a 'this object' is not required. Useful when
 * the target function is already bound.
 *
 * Usage:
 * var g = goog.partial(f, arg1, arg2);
 * g(arg3, arg4);
 *
 * @param {Function} fn A function to partially apply.
 * @param {...*} var_args Additional arguments that are partially applied to fn.
 * @return {!Function} A partially-applied form of the function goog.partial()
 *     was invoked as a method of.
 */
goog.partial = function(fn, var_args) {
  var args = Array.prototype.slice.call(arguments, 1);
  return function() {
    // Clone the array (with slice()) and append additional arguments
    // to the existing arguments.
    var newArgs = args.slice();
    newArgs.push.apply(newArgs, arguments);
    return fn.apply(/** @type {?} */ (this), newArgs);
  };
};


/**
 * Copies all the members of a source object to a target object. This method
 * does not work on all browsers for all objects that contain keys such as
 * toString or hasOwnProperty. Use goog.object.extend for this purpose.
 *
 * NOTE: Some have advocated for the use of goog.mixin to setup classes
 * with multiple inheritence (traits, mixins, etc).  However, as it simply
 * uses "for in", this is not compatible with ES6 classes whose methods are
 * non-enumerable.  Changing this, would break cases where non-enumerable
 * properties are not expected.
 *
 * @param {Object} target Target.
 * @param {Object} source Source.
 * @deprecated Prefer Object.assign
 */
goog.mixin = function(target, source) {
  for (var x in source) {
    target[x] = source[x];
  }

  // For IE7 or lower, the for-in-loop does not contain any properties that are
  // not enumerable on the prototype object (for example, isPrototypeOf from
  // Object.prototype) but also it will not include 'replace' on objects that
  // extend String and change 'replace' (not that it is common for anyone to
  // extend anything except Object).
};


/**
 * @return {number} An integer value representing the number of milliseconds
 *     between midnight, January 1, 1970 and the current time.
 * @deprecated Use Date.now
 */
goog.now = function() {
  return Date.now();
};


/**
 * Evals JavaScript in the global scope.
 *
 * Throws an exception if neither execScript or eval is defined.
 * @param {string|!TrustedScript} script JavaScript string.
 */
goog.globalEval = function(script) {
  (0, eval)(script);
};


/**
 * Optional map of CSS class names to obfuscated names used with
 * goog.getCssName().
 * @private {!Object<string, string>|undefined}
 * @see goog.setCssNameMapping
 */
goog.cssNameMapping_;


/**
 * Optional obfuscation style for CSS class names. Should be set to either
 * 'BY_WHOLE' or 'BY_PART' if defined.
 * @type {string|undefined}
 * @private
 * @see goog.setCssNameMapping
 */
goog.cssNameMappingStyle_;



/**
 * A hook for modifying the default behavior goog.getCssName. The function
 * if present, will receive the standard output of the goog.getCssName as
 * its input.
 *
 * @type {(function(string):string)|undefined}
 */
goog.global.CLOSURE_CSS_NAME_MAP_FN;


/**
 * Handles strings that are intended to be used as CSS class names.
 *
 * This function works in tandem with @see goog.setCssNameMapping.
 *
 * Without any mapping set, the arguments are simple joined with a hyphen and
 * passed through unaltered.
 *
 * When there is a mapping, there are two possible styles in which these
 * mappings are used. In the BY_PART style, each part (i.e. in between hyphens)
 * of the passed in css name is rewritten according to the map. In the BY_WHOLE
 * style, the full css name is looked up in the map directly. If a rewrite is
 * not specified by the map, the compiler will output a warning.
 *
 * When the mapping is passed to the compiler, it will replace calls to
 * goog.getCssName with the strings from the mapping, e.g.
 *     var x = goog.getCssName('foo');
 *     var y = goog.getCssName(this.baseClass, 'active');
 *  becomes:
 *     var x = 'foo';
 *     var y = this.baseClass + '-active';
 *
 * If one argument is passed it will be processed, if two are passed only the
 * modifier will be processed, as it is assumed the first argument was generated
 * as a result of calling goog.getCssName.
 *
 * @param {string} className The class name.
 * @param {string=} opt_modifier A modifier to be appended to the class name.
 * @return {string} The class name or the concatenation of the class name and
 *     the modifier.
 */
goog.getCssName = function(className, opt_modifier) {
  // String() is used for compatibility with compiled soy where the passed
  // className can be non-string objects.
  if (String(className).charAt(0) == '.') {
    throw new Error(
        'className passed in goog.getCssName must not start with ".".' +
        ' You passed: ' + className);
  }

  var getMapping = function(cssName) {
    return goog.cssNameMapping_[cssName] || cssName;
  };

  var renameByParts = function(cssName) {
    // Remap all the parts individually.
    var parts = cssName.split('-');
    var mapped = [];
    for (var i = 0; i < parts.length; i++) {
      mapped.push(getMapping(parts[i]));
    }
    return mapped.join('-');
  };

  var rename;
  if (goog.cssNameMapping_) {
    rename =
        goog.cssNameMappingStyle_ == 'BY_WHOLE' ? getMapping : renameByParts;
  } else {
    rename = function(a) {
      return a;
    };
  }

  var result =
      opt_modifier ? className + '-' + rename(opt_modifier) : rename(className);

  // The special CLOSURE_CSS_NAME_MAP_FN allows users to specify further
  // processing of the class name.
  if (goog.global.CLOSURE_CSS_NAME_MAP_FN) {
    return goog.global.CLOSURE_CSS_NAME_MAP_FN(result);
  }

  return result;
};


/**
 * Sets the map to check when returning a value from goog.getCssName(). Example:
 * <pre>
 * goog.setCssNameMapping({
 *   "goog": "a",
 *   "disabled": "b",
 * });
 *
 * var x = goog.getCssName('goog');
 * // The following evaluates to: "a a-b".
 * goog.getCssName('goog') + ' ' + goog.getCssName(x, 'disabled')
 * </pre>
 * When declared as a map of string literals to string literals, the JSCompiler
 * will replace all calls to goog.getCssName() using the supplied map if the
 * --process_closure_primitives flag is set.
 *
 * @param {!Object} mapping A map of strings to strings where keys are possible
 *     arguments to goog.getCssName() and values are the corresponding values
 *     that should be returned.
 * @param {string=} opt_style The style of css name mapping. There are two valid
 *     options: 'BY_PART', and 'BY_WHOLE'.
 * @see goog.getCssName for a description.
 */
goog.setCssNameMapping = function(mapping, opt_style) {
  goog.cssNameMapping_ = mapping;
  goog.cssNameMappingStyle_ = opt_style;
};


/**
 * To use CSS renaming in compiled mode, one of the input files should have a
 * call to goog.setCssNameMapping() with an object literal that the JSCompiler
 * can extract and use to replace all calls to goog.getCssName(). In uncompiled
 * mode, JavaScript code should be loaded before this base.js file that declares
 * a global variable, CLOSURE_CSS_NAME_MAPPING, which is used below. This is
 * to ensure that the mapping is loaded before any calls to goog.getCssName()
 * are made in uncompiled mode.
 *
 * A hook for overriding the CSS name mapping.
 * @type {!Object<string, string>|undefined}
 */
goog.global.CLOSURE_CSS_NAME_MAPPING;


if (!COMPILED && goog.global.CLOSURE_CSS_NAME_MAPPING) {
  // This does not call goog.setCssNameMapping() because the JSCompiler
  // requires that goog.setCssNameMapping() be called with an object literal.
  goog.cssNameMapping_ = goog.global.CLOSURE_CSS_NAME_MAPPING;
}


/**
 * Gets a localized message.
 *
 * This function is a compiler primitive. If you give the compiler a localized
 * message bundle, it will replace the string at compile-time with a localized
 * version, and expand goog.getMsg call to a concatenated string.
 *
 * Messages must be initialized in the form:
 * <code>
 * var MSG_NAME = goog.getMsg('Hello {$placeholder}', {'placeholder': 'world'});
 * </code>
 *
 * This function produces a string which should be treated as plain text. Use
 * {@link goog.html.SafeHtmlFormatter} in conjunction with goog.getMsg to
 * produce SafeHtml.
 *
 * @param {string} str Translatable string, places holders in the form {$foo}.
 * @param {Object<string, string>=} opt_values Maps place holder name to value.
 * @param {{html: (boolean|undefined),
 *         unescapeHtmlEntities: (boolean|undefined)}=} opt_options Options:
 *     html: Escape '<' in str to '&lt;'. Used by Closure Templates where the
 *     generated code size and performance is critical which is why {@link
 *     goog.html.SafeHtmlFormatter} is not used. The value must be literal true
 *     or false.
 *     unescapeHtmlEntities: Unescape common html entities: &gt;, &lt;, &apos;,
 *     &quot; and &amp;. Used for messages not in HTML context, such as with
 *     `textContent` property.
 * @return {string} message with placeholders filled.
 */
goog.getMsg = function(str, opt_values, opt_options) {
  if (opt_options && opt_options.html) {
    // Note that '&' is not replaced because the translation can contain HTML
    // entities.
    str = str.replace(/</g, '&lt;');
  }
  if (opt_options && opt_options.unescapeHtmlEntities) {
    // Note that "&amp;" must be the last to avoid "creating" new entities.
    str = str.replace(/&lt;/g, '<')
              .replace(/&gt;/g, '>')
              .replace(/&apos;/g, '\'')
              .replace(/&quot;/g, '"')
              .replace(/&amp;/g, '&');
  }
  if (opt_values) {
    str = str.replace(/\{\$([^}]+)}/g, function(match, key) {
      return (opt_values != null && key in opt_values) ? opt_values[key] :
                                                         match;
    });
  }
  return str;
};


/**
 * Gets a localized message. If the message does not have a translation, gives a
 * fallback message.
 *
 * This is useful when introducing a new message that has not yet been
 * translated into all languages.
 *
 * This function is a compiler primitive. Must be used in the form:
 * <code>var x = goog.getMsgWithFallback(MSG_A, MSG_B);</code>
 * where MSG_A and MSG_B were initialized with goog.getMsg.
 *
 * @param {string} a The preferred message.
 * @param {string} b The fallback message.
 * @return {string} The best translated message.
 */
goog.getMsgWithFallback = function(a, b) {
  return a;
};


/**
 * Exposes an unobfuscated global namespace path for the given object.
 * Note that fields of the exported object *will* be obfuscated, unless they are
 * exported in turn via this function or goog.exportProperty.
 *
 * Also handy for making public items that are defined in anonymous closures.
 *
 * ex. goog.exportSymbol('public.path.Foo', Foo);
 *
 * ex. goog.exportSymbol('public.path.Foo.staticFunction', Foo.staticFunction);
 *     public.path.Foo.staticFunction();
 *
 * ex. goog.exportSymbol('public.path.Foo.prototype.myMethod',
 *                       Foo.prototype.myMethod);
 *     new public.path.Foo().myMethod();
 *
 * @param {string} publicPath Unobfuscated name to export.
 * @param {*} object Object the name should point to.
 * @param {?Object=} objectToExportTo The object to add the path to; default
 *     is goog.global.
 */
goog.exportSymbol = function(publicPath, object, objectToExportTo) {
  goog.exportPath_(
      publicPath, object, /* overwriteImplicit= */ true, objectToExportTo);
};


/**
 * Exports a property unobfuscated into the object's namespace.
 * ex. goog.exportProperty(Foo, 'staticFunction', Foo.staticFunction);
 * ex. goog.exportProperty(Foo.prototype, 'myMethod', Foo.prototype.myMethod);
 * @param {Object} object Object whose static property is being exported.
 * @param {string} publicName Unobfuscated name to export.
 * @param {*} symbol Object the name should point to.
 */
goog.exportProperty = function(object, publicName, symbol) {
  object[publicName] = symbol;
};


/**
 * Inherit the prototype methods from one constructor into another.
 *
 * Usage:
 * <pre>
 * function ParentClass(a, b) { }
 * ParentClass.prototype.foo = function(a) { };
 *
 * function ChildClass(a, b, c) {
 *   ChildClass.base(this, 'constructor', a, b);
 * }
 * goog.inherits(ChildClass, ParentClass);
 *
 * var child = new ChildClass('a', 'b', 'see');
 * child.foo(); // This works.
 * </pre>
 *
 * @param {!Function} childCtor Child class.
 * @param {!Function} parentCtor Parent class.
 * @suppress {strictMissingProperties} superClass_ and base is not defined on
 *    Function.
 * @deprecated Use ECMAScript class syntax instead.
 */
goog.inherits = function(childCtor, parentCtor) {
  /** @constructor */
  function tempCtor() {}
  tempCtor.prototype = parentCtor.prototype;
  childCtor.superClass_ = parentCtor.prototype;
  childCtor.prototype = new tempCtor();
  /** @override */
  childCtor.prototype.constructor = childCtor;

  /**
   * Calls superclass constructor/method.
   *
   * This function is only available if you use goog.inherits to
   * express inheritance relationships between classes.
   *
   * NOTE: This is a replacement for goog.base and for superClass_
   * property defined in childCtor.
   *
   * @param {!Object} me Should always be "this".
   * @param {string} methodName The method name to call. Calling
   *     superclass constructor can be done with the special string
   *     'constructor'.
   * @param {...*} var_args The arguments to pass to superclass
   *     method/constructor.
   * @return {*} The return value of the superclass method/constructor.
   */
  childCtor.base = function(me, methodName, var_args) {
    // Copying using loop to avoid deop due to passing arguments object to
    // function. This is faster in many JS engines as of late 2014.
    var args = new Array(arguments.length - 2);
    for (var i = 2; i < arguments.length; i++) {
      args[i - 2] = arguments[i];
    }
    return parentCtor.prototype[methodName].apply(me, args);
  };
};


/**
 * Allow for aliasing within scope functions.  This function exists for
 * uncompiled code - in compiled code the calls will be inlined and the aliases
 * applied.  In uncompiled code the function is simply run since the aliases as
 * written are valid JavaScript.
 *
 * MOE:begin_intracomment_strip
 * See the goog.scope document at http://go/goog.scope
 *
 * For more on goog.scope deprecation, see the style guide entry:
 * http://go/jsstyle#appendices-legacy-exceptions-goog-scope
 * MOE:end_intracomment_strip
 *
 * @param {function()} fn Function to call.  This function can contain aliases
 *     to namespaces (e.g. "var dom = goog.dom") or classes
 *     (e.g. "var Timer = goog.Timer").
 * @deprecated Use goog.module instead.
 */
goog.scope = function(fn) {
  if (goog.isInModuleLoader_()) {
    throw new Error('goog.scope is not supported within a module.');
  }
  fn.call(goog.global);
};


/*
 * To support uncompiled, strict mode bundles that use eval to divide source
 * like so:
 *    eval('someSource;//# sourceUrl sourcefile.js');
 * We need to export the globally defined symbols "goog" and "COMPILED".
 * Exporting "goog" breaks the compiler optimizations, so we required that
 * be defined externally.
 * NOTE: We don't use goog.exportSymbol here because we don't want to trigger
 * extern generation when that compiler option is enabled.
 */
if (!COMPILED) {
  goog.global['COMPILED'] = COMPILED;
}


//==============================================================================
// goog.defineClass implementation
//==============================================================================


/**
 * Creates a restricted form of a Closure "class":
 *   - from the compiler's perspective, the instance returned from the
 *     constructor is sealed (no new properties may be added).  This enables
 *     better checks.
 *   - the compiler will rewrite this definition to a form that is optimal
 *     for type checking and optimization (initially this will be a more
 *     traditional form).
 *
 * @param {Function} superClass The superclass, Object or null.
 * @param {goog.defineClass.ClassDescriptor} def
 *     An object literal describing
 *     the class.  It may have the following properties:
 *     "constructor": the constructor function
 *     "statics": an object literal containing methods to add to the constructor
 *        as "static" methods or a function that will receive the constructor
 *        function as its only parameter to which static properties can
 *        be added.
 *     all other properties are added to the prototype.
 * @return {!Function} The class constructor.
 * @deprecated Use ECMAScript class syntax instead.
 */
goog.defineClass = function(superClass, def) {
  // TODO(johnlenz): consider making the superClass an optional parameter.
  var constructor = def.constructor;
  var statics = def.statics;
  // Wrap the constructor prior to setting up the prototype and static methods.
  if (!constructor || constructor == Object.prototype.constructor) {
    constructor = function() {
      throw new Error(
          'cannot instantiate an interface (no constructor defined).');
    };
  }

  var cls = goog.defineClass.createSealingConstructor_(constructor, superClass);
  if (superClass) {
    goog.inherits(cls, superClass);
  }

  // Remove all the properties that should not be copied to the prototype.
  delete def.constructor;
  delete def.statics;

  goog.defineClass.applyProperties_(cls.prototype, def);
  if (statics != null) {
    if (statics instanceof Function) {
      statics(cls);
    } else {
      goog.defineClass.applyProperties_(cls, statics);
    }
  }

  return cls;
};


/**
 * @typedef {{
 *   constructor: (!Function|undefined),
 *   statics: (Object|undefined|function(Function):void)
 * }}
 */
goog.defineClass.ClassDescriptor;


/**
 * @define {boolean} Whether the instances returned by goog.defineClass should
 *     be sealed when possible.
 *
 * When sealing is disabled the constructor function will not be wrapped by
 * goog.defineClass, making it incompatible with ES6 class methods.
 */
goog.defineClass.SEAL_CLASS_INSTANCES =
    goog.define('goog.defineClass.SEAL_CLASS_INSTANCES', goog.DEBUG);


/**
 * If goog.defineClass.SEAL_CLASS_INSTANCES is enabled and Object.seal is
 * defined, this function will wrap the constructor in a function that seals the
 * results of the provided constructor function.
 *
 * @param {!Function} ctr The constructor whose results maybe be sealed.
 * @param {Function} superClass The superclass constructor.
 * @return {!Function} The replacement constructor.
 * @private
 */
goog.defineClass.createSealingConstructor_ = function(ctr, superClass) {
  if (!goog.defineClass.SEAL_CLASS_INSTANCES) {
    // Do now wrap the constructor when sealing is disabled. Angular code
    // depends on this for injection to work properly.
    return ctr;
  }

  // NOTE: The sealing behavior has been removed

  /**
   * @this {Object}
   * @return {?}
   */
  var wrappedCtr = function() {
    // Don't seal an instance of a subclass when it calls the constructor of
    // its super class as there is most likely still setup to do.
    var instance = ctr.apply(this, arguments) || this;
    instance[goog.UID_PROPERTY_] = instance[goog.UID_PROPERTY_];

    return instance;
  };

  return wrappedCtr;
};



// TODO(johnlenz): share these values with the goog.object
/**
 * The names of the fields that are defined on Object.prototype.
 * @type {!Array<string>}
 * @private
 * @const
 */
goog.defineClass.OBJECT_PROTOTYPE_FIELDS_ = [
  'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable',
  'toLocaleString', 'toString', 'valueOf'
];


// TODO(johnlenz): share this function with the goog.object
/**
 * @param {!Object} target The object to add properties to.
 * @param {!Object} source The object to copy properties from.
 * @private
 */
goog.defineClass.applyProperties_ = function(target, source) {
  // TODO(johnlenz): update this to support ES5 getters/setters

  var key;
  for (key in source) {
    if (Object.prototype.hasOwnProperty.call(source, key)) {
      target[key] = source[key];
    }
  }

  // For IE the for-in-loop does not contain any properties that are not
  // enumerable on the prototype object (for example isPrototypeOf from
  // Object.prototype) and it will also not include 'replace' on objects that
  // extend String and change 'replace' (not that it is common for anyone to
  // extend anything except Object).
  for (var i = 0; i < goog.defineClass.OBJECT_PROTOTYPE_FIELDS_.length; i++) {
    key = goog.defineClass.OBJECT_PROTOTYPE_FIELDS_[i];
    if (Object.prototype.hasOwnProperty.call(source, key)) {
      target[key] = source[key];
    }
  }
};

/**
 * Returns the parameter.
 * @param {string} s
 * @return {string}
 * @private
 */
goog.identity_ = function(s) {
  return s;
};


/**
 * Creates Trusted Types policy if Trusted Types are supported by the browser.
 * The policy just blesses any string as a Trusted Type. It is not visibility
 * restricted because anyone can also call trustedTypes.createPolicy directly.
 * However, the allowed names should be restricted by a HTTP header and the
 * reference to the created policy should be visibility restricted.
 * @param {string} name
 * @return {?TrustedTypePolicy}
 */
goog.createTrustedTypesPolicy = function(name) {
  var policy = null;
  var policyFactory = goog.global.trustedTypes;
  if (!policyFactory || !policyFactory.createPolicy) {
    return policy;
  }
  // trustedTypes.createPolicy throws if called with a name that is already
  // registered, even in report-only mode. Until the API changes, catch the
  // error not to break the applications functionally. In such case, the code
  // will fall back to using regular Safe Types.
  // TODO(koto): Remove catching once createPolicy API stops throwing.
  try {
    policy = policyFactory.createPolicy(name, {
      createHTML: goog.identity_,
      createScript: goog.identity_,
      createScriptURL: goog.identity_
    });
  } catch (e) {
    goog.logToConsole_(e.message);
  }
  return policy;
};

// There's a bug in the compiler where without collapse properties the
// Closure namespace defines do not guard code correctly. To help reduce code
// size also check for !COMPILED even though it redundant until this is fixed.
if (!COMPILED && goog.DEPENDENCIES_ENABLED) {
  // MOE:begin_strip
  // TODO(b/67050526) This object is obsolete but some people are relying on
  // it internally. Keep it around until we migrate them.
  /**
   * @private
   * @type {{
   *   loadFlags: !Object<string, !Object<string, string>>,
   *   nameToPath: !Object<string, string>,
   *   requires: !Object<string, !Object<string, boolean>>,
   *   visited: !Object<string, boolean>,
   *   written: !Object<string, boolean>,
   *   deferred: !Object<string, string>
   * }}
   */
  goog.dependencies_ = {
    loadFlags: {},  // 1 to 1

    nameToPath: {},  // 1 to 1

    requires: {},  // 1 to many

    // Used when resolving dependencies to prevent us from visiting file
    // twice.
    visited: {},

    written: {},  // Used to keep track of script files we have written.

    deferred: {}  // Used to track deferred module evaluations in old IEs
  };

  /**
   * @return {!Object}
   * @private
   */
  goog.getLoader_ = function() {
    return {
      dependencies_: goog.dependencies_,
      writeScriptTag_: goog.writeScriptTag_
    };
  };


  /**
   * @param {string} src The script url.
   * @param {string=} opt_sourceText The optionally source text to evaluate
   * @return {boolean} True if the script was imported, false otherwise.
   * @private
   */
  goog.writeScriptTag_ = function(src, opt_sourceText) {
    if (goog.inHtmlDocument_()) {
      /** @type {!HTMLDocument} */
      var doc = goog.global.document;

      // If the user tries to require a new symbol after document load,
      // something has gone terribly wrong. Doing a document.write would
      // wipe out the page. This does not apply to the CSP-compliant method
      // of writing script tags.
      if (!goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING &&
          doc.readyState == 'complete') {
        // Certain test frameworks load base.js multiple times, which tries
        // to write deps.js each time. If that happens, just fail silently.
        // These frameworks wipe the page between each load of base.js, so this
        // is OK.
        var isDeps = /\bdeps.js$/.test(src);
        if (isDeps) {
          return false;
        } else {
          throw Error('Cannot write "' + src + '" after document load');
        }
      }

      var nonceAttr = '';
      var nonce = goog.getScriptNonce();
      if (nonce) {
        nonceAttr = ' nonce="' + nonce + '"';
      }

      if (opt_sourceText === undefined) {
        var script = '<script src="' + src + '"' + nonceAttr + '></' +
            'script>';
        doc.write(
            goog.TRUSTED_TYPES_POLICY_ ?
                goog.TRUSTED_TYPES_POLICY_.createHTML(script) :
                script);
      } else {
        var script = '<script' + nonceAttr + '>' +
            goog.protectScriptTag_(opt_sourceText) + '</' +
            'script>';
        doc.write(
            goog.TRUSTED_TYPES_POLICY_ ?
                goog.TRUSTED_TYPES_POLICY_.createHTML(script) :
                script);
      }
      return true;
    } else {
      return false;
    }
  };
  // MOE:end_strip


  /**
   * Tries to detect whether the current browser is Edge, based on the user
   * agent. This matches only pre-Chromium Edge.
   * @see https://docs.microsoft.com/en-us/microsoft-edge/web-platform/user-agent-string
   * @return {boolean} True if the current browser is Edge.
   * @private
   */
  goog.isEdge_ = function() {
    var userAgent = goog.global.navigator && goog.global.navigator.userAgent ?
        goog.global.navigator.userAgent :
        '';
    var edgeRe = /Edge\/(\d+)(\.\d)*/i;
    return !!userAgent.match(edgeRe);
  };


  /**
   * Tries to detect whether is in the context of an HTML document.
   * @return {boolean} True if it looks like HTML document.
   * @private
   */
  goog.inHtmlDocument_ = function() {
    /** @type {!Document} */
    var doc = goog.global.document;
    return doc != null && 'write' in doc;  // XULDocument misses write.
  };


  /**
   * We'd like to check for if the document readyState is 'loading'; however
   * there are bugs on IE 10 and below where the readyState being anything other
   * than 'complete' is not reliable.
   * @return {boolean}
   * @private
   */
  goog.isDocumentLoading_ = function() {
    // attachEvent is available on IE 6 thru 10 only, and thus can be used to
    // detect those browsers.
    /** @type {!HTMLDocument} */
    var doc = goog.global.document;
    return doc.attachEvent ? doc.readyState != 'complete' :
                             doc.readyState == 'loading';
  };


  /**
   * Tries to detect the base path of base.js script that bootstraps Closure.
   * @private
   */
  goog.findBasePath_ = function() {
    if (goog.global.CLOSURE_BASE_PATH != undefined &&
        // Anti DOM-clobbering runtime check (b/37736576).
        typeof goog.global.CLOSURE_BASE_PATH === 'string') {
      goog.basePath = goog.global.CLOSURE_BASE_PATH;
      return;
    } else if (!goog.inHtmlDocument_()) {
      return;
    }
    /** @type {!Document} */
    var doc = goog.global.document;
    // If we have a currentScript available, use it exclusively.
    var currentScript = doc.currentScript;
    if (currentScript) {
      var scripts = [currentScript];
    } else {
      var scripts = doc.getElementsByTagName('SCRIPT');
    }
    // Search backwards since the current script is in almost all cases the one
    // that has base.js.
    for (var i = scripts.length - 1; i >= 0; --i) {
      var script = /** @type {!HTMLScriptElement} */ (scripts[i]);
      var src = script.src;
      var qmark = src.lastIndexOf('?');
      var l = qmark == -1 ? src.length : qmark;
      if (src.substr(l - 7, 7) == 'base.js') {
        goog.basePath = src.substr(0, l - 7);
        return;
      }
    }
  };

  goog.findBasePath_();

  /** @struct @constructor @final */
  goog.Transpiler = function() {
    /** @private {?Object<string, boolean>} */
    this.requiresTranspilation_ = null;
    /** @private {string} */
    this.transpilationTarget_ = goog.TRANSPILE_TO_LANGUAGE;
  };


  // MOE:begin_strip
  // LINT.IfChange
  // MOE:end_strip
  /**
   * Returns a newly created map from language mode string to a boolean
   * indicating whether transpilation should be done for that mode as well as
   * the highest level language that this environment supports.
   *
   * Guaranteed invariant:
   * For any two modes, l1 and l2 where l2 is a newer mode than l1,
   * `map[l1] == true` implies that `map[l2] == true`.
   *
   * Note this method is extracted and used elsewhere, so it cannot rely on
   * anything external (it should easily be able to be transformed into a
   * standalone, top level function).
   *
   * @private
   * @return {{
   *   target: string,
   *   map: !Object<string, boolean>
   * }}
   */
  goog.Transpiler.prototype.createRequiresTranspilation_ = function() {
    var transpilationTarget = 'es3';
    var /** !Object<string, boolean> */ requiresTranspilation = {'es3': false};
    var transpilationRequiredForAllLaterModes = false;

    /**
     * Adds an entry to requiresTranspliation for the given language mode.
     *
     * IMPORTANT: Calls must be made in order from oldest to newest language
     * mode.
     * @param {string} modeName
     * @param {function(): boolean} isSupported Returns true if the JS engine
     *     supports the given mode.
     */
    function addNewerLanguageTranspilationCheck(modeName, isSupported) {
      if (transpilationRequiredForAllLaterModes) {
        requiresTranspilation[modeName] = true;
      } else if (isSupported()) {
        transpilationTarget = modeName;
        requiresTranspilation[modeName] = false;
      } else {
        requiresTranspilation[modeName] = true;
        transpilationRequiredForAllLaterModes = true;
      }
    }

    /**
     * Does the given code evaluate without syntax errors and return a truthy
     * result?
     */
    function /** boolean */ evalCheck(/** string */ code) {
      try {
        return !!eval(goog.CLOSURE_EVAL_PREFILTER_.createScript(code));
      } catch (ignored) {
        return false;
      }
    }

    // Identify ES3-only browsers by their incorrect treatment of commas.
    addNewerLanguageTranspilationCheck('es5', function() {
      return evalCheck('[1,].length==1');
    });
    addNewerLanguageTranspilationCheck('es6', function() {
      // Edge has a non-deterministic (i.e., not reproducible) bug with ES6:
      // https://github.com/Microsoft/ChakraCore/issues/1496.
      // MOE:begin_strip
      // TODO(joeltine): Our internal web-testing version of Edge will need to
      // be updated before we can remove this check. See http://b/34945376.
      // MOE:end_strip
      if (goog.isEdge_()) {
        // The Reflect.construct test below is flaky on Edge. It can sometimes
        // pass or fail on 40 15.15063, so just exit early for Edge and treat
        // it as ES5. Until we're on a more up to date version just always use
        // ES5. See https://github.com/Microsoft/ChakraCore/issues/3217.
        return false;
      }
      // Test es6: [FF50 (?), Edge 14 (?), Chrome 50]
      //   (a) default params (specifically shadowing locals),
      //   (b) destructuring, (c) block-scoped functions,
      //   (d) for-of (const), (e) new.target/Reflect.construct
      var es6fullTest =
          'class X{constructor(){if(new.target!=String)throw 1;this.x=42}}' +
          'let q=Reflect.construct(X,[],String);if(q.x!=42||!(q instanceof ' +
          'String))throw 1;for(const a of[2,3]){if(a==2)continue;function ' +
          'f(z={a}){let a=0;return z.a}{function f(){return 0;}}return f()' +
          '==3}';

      return evalCheck('(()=>{"use strict";' + es6fullTest + '})()');
    });
    // ** and **= are the only new features in 'es7'
    addNewerLanguageTranspilationCheck('es7', function() {
      return evalCheck('2**3==8');
    });
    // async functions are the only new features in 'es8'
    addNewerLanguageTranspilationCheck('es8', function() {
      return evalCheck('async()=>1,1');
    });
    addNewerLanguageTranspilationCheck('es9', function() {
      return evalCheck('({...rest}={}),1');
    });
    // optional catch binding, unescaped unicode paragraph separator in strings
    addNewerLanguageTranspilationCheck('es_2019', function() {
      return evalCheck('let r;try{throw 0}catch{r="\u2029"};r');
    });
    // optional chaining, nullish coalescing
    // untested/unsupported: bigint, import meta
    addNewerLanguageTranspilationCheck('es_2020', function() {
      return evalCheck('null?.x??1');
    });
    addNewerLanguageTranspilationCheck('es_next', function() {
      return false;  // assume it always need to transpile
    });
    return {target: transpilationTarget, map: requiresTranspilation};
  };
  // MOE:begin_strip
  // LINT.ThenChange(//depot/google3/java/com/google/testing/web/devtools/updatebrowserinfo/requires_transpilation.js)
  // MOE:end_strip


  /**
   * Determines whether the given language needs to be transpiled.
   * @param {string} lang
   * @param {string|undefined} module
   * @return {boolean}
   */
  goog.Transpiler.prototype.needsTranspile = function(lang, module) {
    if (goog.TRANSPILE == 'always') {
      return true;
    } else if (goog.TRANSPILE == 'never') {
      return false;
    } else if (!this.requiresTranspilation_) {
      var obj = this.createRequiresTranspilation_();
      this.requiresTranspilation_ = obj.map;
      this.transpilationTarget_ = this.transpilationTarget_ || obj.target;
    }
    if (lang in this.requiresTranspilation_) {
      if (this.requiresTranspilation_[lang]) {
        return true;
      } else if (
          goog.inHtmlDocument_() && module == 'es6' &&
          !('noModule' in goog.global.document.createElement('script'))) {
        return true;
      } else {
        return false;
      }
    } else {
      throw new Error('Unknown language mode: ' + lang);
    }
  };


  /**
   * Lazily retrieves the transpiler and applies it to the source.
   * @param {string} code JS code.
   * @param {string} path Path to the code.
   * @return {string} The transpiled code.
   */
  goog.Transpiler.prototype.transpile = function(code, path) {
    // TODO(johnplaisted): We should delete goog.transpile_ and just have this
    // function. But there's some compile error atm where goog.global is being
    // stripped incorrectly without this.
    return goog.transpile_(code, path, this.transpilationTarget_);
  };


  /** @private @final {!goog.Transpiler} */
  goog.transpiler_ = new goog.Transpiler();

  /**
   * Rewrites closing script tags in input to avoid ending an enclosing script
   * tag.
   *
   * @param {string} str
   * @return {string}
   * @private
   */
  goog.protectScriptTag_ = function(str) {
    return str.replace(/<\/(SCRIPT)/ig, '\\x3c/$1');
  };


  /**
   * A debug loader is responsible for downloading and executing javascript
   * files in an unbundled, uncompiled environment.
   *
   * This can be custimized via the setDependencyFactory method, or by
   * CLOSURE_IMPORT_SCRIPT/CLOSURE_LOAD_FILE_SYNC.
   *
   * @struct @constructor @final @private
   */
  goog.DebugLoader_ = function() {
    /** @private @const {!Object<string, !goog.Dependency>} */
    this.dependencies_ = {};
    /** @private @const {!Object<string, string>} */
    this.idToPath_ = {};
    /** @private @const {!Object<string, boolean>} */
    this.written_ = {};
    /** @private @const {!Array<!goog.Dependency>} */
    this.loadingDeps_ = [];
    /** @private {!Array<!goog.Dependency>} */
    this.depsToLoad_ = [];
    /** @private {boolean} */
    this.paused_ = false;
    /** @private {!goog.DependencyFactory} */
    this.factory_ = new goog.DependencyFactory(goog.transpiler_);
    /** @private @const {!Object<string, !Function>} */
    this.deferredCallbacks_ = {};
    /** @private @const {!Array<string>} */
    this.deferredQueue_ = [];
  };

  /**
   * @param {!Array<string>} namespaces
   * @param {function(): undefined} callback Function to call once all the
   *     namespaces have loaded.
   */
  goog.DebugLoader_.prototype.bootstrap = function(namespaces, callback) {
    var cb = callback;
    function resolve() {
      if (cb) {
        goog.global.setTimeout(cb, 0);
        cb = null;
      }
    }

    if (!namespaces.length) {
      resolve();
      return;
    }

    var deps = [];
    for (var i = 0; i < namespaces.length; i++) {
      var path = this.getPathFromDeps_(namespaces[i]);
      if (!path) {
        throw new Error('Unregonized namespace: ' + namespaces[i]);
      }
      deps.push(this.dependencies_[path]);
    }

    var require = goog.require;
    var loaded = 0;
    for (var i = 0; i < namespaces.length; i++) {
      require(namespaces[i]);
      deps[i].onLoad(function() {
        if (++loaded == namespaces.length) {
          resolve();
        }
      });
    }
  };


  /**
   * Loads the Closure Dependency file.
   *
   * Exposed a public function so CLOSURE_NO_DEPS can be set to false, base
   * loaded, setDependencyFactory called, and then this called. i.e. allows
   * custom loading of the deps file.
   */
  goog.DebugLoader_.prototype.loadClosureDeps = function() {
    // Circumvent addDependency, which would try to transpile deps.js if
    // transpile is set to always.
    var relPath = 'deps.js';
    this.depsToLoad_.push(this.factory_.createDependency(
        goog.normalizePath_(goog.basePath + relPath), relPath, [], [], {},
        false));
    this.loadDeps_();
  };


  /**
   * Notifies the debug loader when a dependency has been requested.
   *
   * @param {string} absPathOrId Path of the dependency or goog id.
   * @param {boolean=} opt_force
   */
  goog.DebugLoader_.prototype.requested = function(absPathOrId, opt_force) {
    var path = this.getPathFromDeps_(absPathOrId);
    if (path &&
        (opt_force || this.areDepsLoaded_(this.dependencies_[path].requires))) {
      var callback = this.deferredCallbacks_[path];
      if (callback) {
        delete this.deferredCallbacks_[path];
        callback();
      }
    }
  };


  /**
   * Sets the dependency factory, which can be used to create custom
   * goog.Dependency implementations to control how dependencies are loaded.
   *
   * @param {!goog.DependencyFactory} factory
   */
  goog.DebugLoader_.prototype.setDependencyFactory = function(factory) {
    this.factory_ = factory;
  };


  /**
   * Travserses the dependency graph and queues the given dependency, and all of
   * its transitive dependencies, for loading and then starts loading if not
   * paused.
   *
   * @param {string} namespace
   * @private
   */
  goog.DebugLoader_.prototype.load_ = function(namespace) {
    if (!this.getPathFromDeps_(namespace)) {
      var errorMessage = 'goog.require could not find: ' + namespace;
      goog.logToConsole_(errorMessage);
    } else {
      var loader = this;

      var deps = [];

      /** @param {string} namespace */
      var visit = function(namespace) {
        var path = loader.getPathFromDeps_(namespace);

        if (!path) {
          throw new Error('Bad dependency path or symbol: ' + namespace);
        }

        if (loader.written_[path]) {
          return;
        }

        loader.written_[path] = true;

        var dep = loader.dependencies_[path];
        // MOE:begin_strip
        if (goog.dependencies_.written[dep.relativePath]) {
          return;
        }
        // MOE:end_strip
        for (var i = 0; i < dep.requires.length; i++) {
          if (!goog.isProvided_(dep.requires[i])) {
            visit(dep.requires[i]);
          }
        }

        deps.push(dep);
      };

      visit(namespace);

      var wasLoading = !!this.depsToLoad_.length;
      this.depsToLoad_ = this.depsToLoad_.concat(deps);

      if (!this.paused_ && !wasLoading) {
        this.loadDeps_();
      }
    }
  };


  /**
   * Loads any queued dependencies until they are all loaded or paused.
   *
   * @private
   */
  goog.DebugLoader_.prototype.loadDeps_ = function() {
    var loader = this;
    var paused = this.paused_;

    while (this.depsToLoad_.length && !paused) {
      (function() {
        var loadCallDone = false;
        var dep = loader.depsToLoad_.shift();

        var loaded = false;
        loader.loading_(dep);

        var controller = {
          pause: function() {
            if (loadCallDone) {
              throw new Error('Cannot call pause after the call to load.');
            } else {
              paused = true;
            }
          },
          resume: function() {
            if (loadCallDone) {
              loader.resume_();
            } else {
              // Some dep called pause and then resume in the same load call.
              // Just keep running this same loop.
              paused = false;
            }
          },
          loaded: function() {
            if (loaded) {
              throw new Error('Double call to loaded.');
            }

            loaded = true;
            loader.loaded_(dep);
          },
          pending: function() {
            // Defensive copy.
            var pending = [];
            for (var i = 0; i < loader.loadingDeps_.length; i++) {
              pending.push(loader.loadingDeps_[i]);
            }
            return pending;
          },
          /**
           * @param {goog.ModuleType} type
           */
          setModuleState: function(type) {
            goog.moduleLoaderState_ = {
              type: type,
              moduleName: '',
              declareLegacyNamespace: false
            };
          },
          /** @type {function(string, string, string=)} */
          registerEs6ModuleExports: function(
              path, exports, opt_closureNamespace) {
            if (opt_closureNamespace) {
              goog.loadedModules_[opt_closureNamespace] = {
                exports: exports,
                type: goog.ModuleType.ES6,
                moduleId: opt_closureNamespace || ''
              };
            }
          },
          /** @type {function(string, ?)} */
          registerGoogModuleExports: function(moduleId, exports) {
            goog.loadedModules_[moduleId] = {
              exports: exports,
              type: goog.ModuleType.GOOG,
              moduleId: moduleId
            };
          },
          clearModuleState: function() {
            goog.moduleLoaderState_ = null;
          },
          defer: function(callback) {
            if (loadCallDone) {
              throw new Error(
                  'Cannot register with defer after the call to load.');
            }
            loader.defer_(dep, callback);
          },
          areDepsLoaded: function() {
            return loader.areDepsLoaded_(dep.requires);
          }
        };

        try {
          dep.load(controller);
        } finally {
          loadCallDone = true;
        }
      })();
    }

    if (paused) {
      this.pause_();
    }
  };


  /** @private */
  goog.DebugLoader_.prototype.pause_ = function() {
    this.paused_ = true;
  };


  /** @private */
  goog.DebugLoader_.prototype.resume_ = function() {
    if (this.paused_) {
      this.paused_ = false;
      this.loadDeps_();
    }
  };


  /**
   * Marks the given dependency as loading (load has been called but it has not
   * yet marked itself as finished). Useful for dependencies that want to know
   * what else is loading. Example: goog.modules cannot eval if there are
   * loading dependencies.
   *
   * @param {!goog.Dependency} dep
   * @private
   */
  goog.DebugLoader_.prototype.loading_ = function(dep) {
    this.loadingDeps_.push(dep);
  };


  /**
   * Marks the given dependency as having finished loading and being available
   * for require.
   *
   * @param {!goog.Dependency} dep
   * @private
   */
  goog.DebugLoader_.prototype.loaded_ = function(dep) {
    for (var i = 0; i < this.loadingDeps_.length; i++) {
      if (this.loadingDeps_[i] == dep) {
        this.loadingDeps_.splice(i, 1);
        break;
      }
    }

    for (var i = 0; i < this.deferredQueue_.length; i++) {
      if (this.deferredQueue_[i] == dep.path) {
        this.deferredQueue_.splice(i, 1);
        break;
      }
    }

    if (this.loadingDeps_.length == this.deferredQueue_.length &&
        !this.depsToLoad_.length) {
      // Something has asked to load these, but they may not be directly
      // required again later, so load them now that we know we're done loading
      // everything else. e.g. a goog module entry point.
      while (this.deferredQueue_.length) {
        this.requested(this.deferredQueue_.shift(), true);
      }
    }

    dep.loaded();
  };


  /**
   * @param {!Array<string>} pathsOrIds
   * @return {boolean}
   * @private
   */
  goog.DebugLoader_.prototype.areDepsLoaded_ = function(pathsOrIds) {
    for (var i = 0; i < pathsOrIds.length; i++) {
      var path = this.getPathFromDeps_(pathsOrIds[i]);
      if (!path ||
          (!(path in this.deferredCallbacks_) &&
           !goog.isProvided_(pathsOrIds[i]))) {
        return false;
      }
    }

    return true;
  };


  /**
   * @param {string} absPathOrId
   * @return {?string}
   * @private
   */
  goog.DebugLoader_.prototype.getPathFromDeps_ = function(absPathOrId) {
    if (absPathOrId in this.idToPath_) {
      return this.idToPath_[absPathOrId];
    } else if (absPathOrId in this.dependencies_) {
      return absPathOrId;
    } else {
      return null;
    }
  };


  /**
   * @param {!goog.Dependency} dependency
   * @param {!Function} callback
   * @private
   */
  goog.DebugLoader_.prototype.defer_ = function(dependency, callback) {
    this.deferredCallbacks_[dependency.path] = callback;
    this.deferredQueue_.push(dependency.path);
  };


  /**
   * Interface for goog.Dependency implementations to have some control over
   * loading of dependencies.
   *
   * @record
   */
  goog.LoadController = function() {};


  /**
   * Tells the controller to halt loading of more dependencies.
   */
  goog.LoadController.prototype.pause = function() {};


  /**
   * Tells the controller to resume loading of more dependencies if paused.
   */
  goog.LoadController.prototype.resume = function() {};


  /**
   * Tells the controller that this dependency has finished loading.
   *
   * This causes this to be removed from pending() and any load callbacks to
   * fire.
   */
  goog.LoadController.prototype.loaded = function() {};


  /**
   * List of dependencies on which load has been called but which have not
   * called loaded on their controller. This includes the current dependency.
   *
   * @return {!Array<!goog.Dependency>}
   */
  goog.LoadController.prototype.pending = function() {};


  /**
   * Registers an object as an ES6 module's exports so that goog.modules may
   * require it by path.
   *
   * @param {string} path Full path of the module.
   * @param {?} exports
   * @param {string=} opt_closureNamespace Closure namespace to associate with
   *     this module.
   */
  goog.LoadController.prototype.registerEs6ModuleExports = function(
      path, exports, opt_closureNamespace) {};


  /**
   * Sets the current module state.
   *
   * @param {goog.ModuleType} type Type of module.
   */
  goog.LoadController.prototype.setModuleState = function(type) {};


  /**
   * Clears the current module state.
   */
  goog.LoadController.prototype.clearModuleState = function() {};


  /**
   * Registers a callback to call once the dependency is actually requested
   * via goog.require + all of the immediate dependencies have been loaded or
   * all other files have been loaded. Allows for lazy loading until
   * require'd without pausing dependency loading, which is needed on old IE.
   *
   * @param {!Function} callback
   */
  goog.LoadController.prototype.defer = function(callback) {};


  /**
   * @return {boolean}
   */
  goog.LoadController.prototype.areDepsLoaded = function() {};


  /**
   * Basic super class for all dependencies Closure Library can load.
   *
   * This default implementation is designed to load untranspiled, non-module
   * scripts in a web broswer.
   *
   * For transpiled non-goog.module files {@see goog.TranspiledDependency}.
   * For goog.modules see {@see goog.GoogModuleDependency}.
   * For untranspiled ES6 modules {@see goog.Es6ModuleDependency}.
   *
   * @param {string} path Absolute path of this script.
   * @param {string} relativePath Path of this script relative to goog.basePath.
   * @param {!Array<string>} provides goog.provided or goog.module symbols
   *     in this file.
   * @param {!Array<string>} requires goog symbols or relative paths to Closure
   *     this depends on.
   * @param {!Object<string, string>} loadFlags
   * @struct @constructor
   */
  goog.Dependency = function(
      path, relativePath, provides, requires, loadFlags) {
    /** @const */
    this.path = path;
    /** @const */
    this.relativePath = relativePath;
    /** @const */
    this.provides = provides;
    /** @const */
    this.requires = requires;
    /** @const */
    this.loadFlags = loadFlags;
    /** @private {boolean} */
    this.loaded_ = false;
    /** @private {!Array<function()>} */
    this.loadCallbacks_ = [];
  };


  /**
   * @return {string} The pathname part of this dependency's path if it is a
   *     URI.
   */
  goog.Dependency.prototype.getPathName = function() {
    var pathName = this.path;
    var protocolIndex = pathName.indexOf('://');
    if (protocolIndex >= 0) {
      pathName = pathName.substring(protocolIndex + 3);
      var slashIndex = pathName.indexOf('/');
      if (slashIndex >= 0) {
        pathName = pathName.substring(slashIndex + 1);
      }
    }
    return pathName;
  };


  /**
   * @param {function()} callback Callback to fire as soon as this has loaded.
   * @final
   */
  goog.Dependency.prototype.onLoad = function(callback) {
    if (this.loaded_) {
      callback();
    } else {
      this.loadCallbacks_.push(callback);
    }
  };


  /**
   * Marks this dependency as loaded and fires any callbacks registered with
   * onLoad.
   * @final
   */
  goog.Dependency.prototype.loaded = function() {
    this.loaded_ = true;
    var callbacks = this.loadCallbacks_;
    this.loadCallbacks_ = [];
    for (var i = 0; i < callbacks.length; i++) {
      callbacks[i]();
    }
  };


  /**
   * Whether or not document.written / appended script tags should be deferred.
   *
   * @private {boolean}
   */
  goog.Dependency.defer_ = false;


  /**
   * Map of script ready / state change callbacks. Old IE cannot handle putting
   * these properties on goog.global.
   *
   * @private @const {!Object<string, function(?):undefined>}
   */
  goog.Dependency.callbackMap_ = {};


  /**
   * @param {function(...?):?} callback
   * @return {string}
   * @private
   */
  goog.Dependency.registerCallback_ = function(callback) {
    var key = Math.random().toString(32);
    goog.Dependency.callbackMap_[key] = callback;
    return key;
  };


  /**
   * @param {string} key
   * @private
   */
  goog.Dependency.unregisterCallback_ = function(key) {
    delete goog.Dependency.callbackMap_[key];
  };


  /**
   * @param {string} key
   * @param {...?} var_args
   * @private
   * @suppress {unusedPrivateMembers}
   */
  goog.Dependency.callback_ = function(key, var_args) {
    if (key in goog.Dependency.callbackMap_) {
      var callback = goog.Dependency.callbackMap_[key];
      var args = [];
      for (var i = 1; i < arguments.length; i++) {
        args.push(arguments[i]);
      }
      callback.apply(undefined, args);
    } else {
      var errorMessage = 'Callback key ' + key +
          ' does not exist (was base.js loaded more than once?).';
      // MOE:begin_strip
      // TODO(johnplaisted): Some people internally are mistakenly loading
      // base.js twice, and this can happen while a dependency is loading,
      // wiping out state.
      goog.logToConsole_(errorMessage);
      // MOE:end_strip
      // MOE:insert throw Error(errorMessage);
    }
  };


  /**
   * Starts loading this dependency. This dependency can pause loading if it
   * needs to and resume it later via the controller interface.
   *
   * When this is loaded it should call controller.loaded(). Note that this will
   * end up calling the loaded method of this dependency; there is no need to
   * call it explicitly.
   *
   * @param {!goog.LoadController} controller
   */
  goog.Dependency.prototype.load = function(controller) {
    if (goog.global.CLOSURE_IMPORT_SCRIPT) {
      if (goog.global.CLOSURE_IMPORT_SCRIPT(this.path)) {
        controller.loaded();
      } else {
        controller.pause();
      }
      return;
    }

    if (!goog.inHtmlDocument_()) {
      goog.logToConsole_(
          'Cannot use default debug loader outside of HTML documents.');
      if (this.relativePath == 'deps.js') {
        // Some old code is relying on base.js auto loading deps.js failing with
        // no error before later setting CLOSURE_IMPORT_SCRIPT.
        // CLOSURE_IMPORT_SCRIPT should be set *before* base.js is loaded, or
        // CLOSURE_NO_DEPS set to true.
        goog.logToConsole_(
            'Consider setting CLOSURE_IMPORT_SCRIPT before loading base.js, ' +
            'or setting CLOSURE_NO_DEPS to true.');
        controller.loaded();
      } else {
        controller.pause();
      }
      return;
    }

    /** @type {!HTMLDocument} */
    var doc = goog.global.document;

    // If the user tries to require a new symbol after document load,
    // something has gone terribly wrong. Doing a document.write would
    // wipe out the page. This does not apply to the CSP-compliant method
    // of writing script tags.
    if (doc.readyState == 'complete' &&
        !goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING) {
      // Certain test frameworks load base.js multiple times, which tries
      // to write deps.js each time. If that happens, just fail silently.
      // These frameworks wipe the page between each load of base.js, so this
      // is OK.
      var isDeps = /\bdeps.js$/.test(this.path);
      if (isDeps) {
        controller.loaded();
        return;
      } else {
        throw Error('Cannot write "' + this.path + '" after document load');
      }
    }

    var nonce = goog.getScriptNonce();
    if (!goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING &&
        goog.isDocumentLoading_()) {
      var key;
      var callback = function(script) {
        if (script.readyState && script.readyState != 'complete') {
          script.onload = callback;
          return;
        }
        goog.Dependency.unregisterCallback_(key);
        controller.loaded();
      };
      key = goog.Dependency.registerCallback_(callback);

      var defer = goog.Dependency.defer_ ? ' defer' : '';
      var nonceAttr = nonce ? ' nonce="' + nonce + '"' : '';
      var script = '<script src="' + this.path + '"' + nonceAttr + defer +
          ' id="script-' + key + '"><\/script>';

      script += '<script' + nonceAttr + '>';

      if (goog.Dependency.defer_) {
        script += 'document.getElementById(\'script-' + key +
            '\').onload = function() {\n' +
            '  goog.Dependency.callback_(\'' + key + '\', this);\n' +
            '};\n';
      } else {
        script += 'goog.Dependency.callback_(\'' + key +
            '\', document.getElementById(\'script-' + key + '\'));';
      }

      script += '<\/script>';

      doc.write(
          goog.TRUSTED_TYPES_POLICY_ ?
              goog.TRUSTED_TYPES_POLICY_.createHTML(script) :
              script);
    } else {
      var scriptEl =
          /** @type {!HTMLScriptElement} */ (doc.createElement('script'));
      scriptEl.defer = goog.Dependency.defer_;
      scriptEl.async = false;

      // If CSP nonces are used, propagate them to dynamically created scripts.
      // This is necessary to allow nonce-based CSPs without 'strict-dynamic'.
      if (nonce) {
        scriptEl.nonce = nonce;
      }

      if (goog.DebugLoader_.IS_OLD_IE_) {
        // Execution order is not guaranteed on old IE, halt loading and write
        // these scripts one at a time, after each loads.
        controller.pause();
        scriptEl.onreadystatechange = function() {
          if (scriptEl.readyState == 'loaded' ||
              scriptEl.readyState == 'complete') {
            controller.loaded();
            controller.resume();
          }
        };
      } else {
        scriptEl.onload = function() {
          scriptEl.onload = null;
          controller.loaded();
        };
      }

      scriptEl.src = goog.TRUSTED_TYPES_POLICY_ ?
          goog.TRUSTED_TYPES_POLICY_.createScriptURL(this.path) :
          this.path;
      doc.head.appendChild(scriptEl);
    }
  };


  /**
   * @param {string} path Absolute path of this script.
   * @param {string} relativePath Path of this script relative to goog.basePath.
   * @param {!Array<string>} provides Should be an empty array.
   *     TODO(johnplaisted) add support for adding closure namespaces to ES6
   *     modules for interop purposes.
   * @param {!Array<string>} requires goog symbols or relative paths to Closure
   *     this depends on.
   * @param {!Object<string, string>} loadFlags
   * @struct @constructor
   * @extends {goog.Dependency}
   */
  goog.Es6ModuleDependency = function(
      path, relativePath, provides, requires, loadFlags) {
    goog.Es6ModuleDependency.base(
        this, 'constructor', path, relativePath, provides, requires, loadFlags);
  };
  goog.inherits(goog.Es6ModuleDependency, goog.Dependency);


  /**
   * @override
   * @param {!goog.LoadController} controller
   */
  goog.Es6ModuleDependency.prototype.load = function(controller) {
    if (goog.global.CLOSURE_IMPORT_SCRIPT) {
      if (goog.global.CLOSURE_IMPORT_SCRIPT(this.path)) {
        controller.loaded();
      } else {
        controller.pause();
      }
      return;
    }

    if (!goog.inHtmlDocument_()) {
      goog.logToConsole_(
          'Cannot use default debug loader outside of HTML documents.');
      controller.pause();
      return;
    }

    /** @type {!HTMLDocument} */
    var doc = goog.global.document;

    var dep = this;

    // TODO(johnplaisted): Does document.writing really speed up anything? Any
    // difference between this and just waiting for interactive mode and then
    // appending?
    function write(src, contents) {
      var nonceAttr = '';
      var nonce = goog.getScriptNonce();
      if (nonce) {
        nonceAttr = ' nonce="' + nonce + '"';
      }

      if (contents) {
        var script = '<script type="module" crossorigin' + nonceAttr + '>' +
            contents + '</' +
            'script>';
        doc.write(
            goog.TRUSTED_TYPES_POLICY_ ?
                goog.TRUSTED_TYPES_POLICY_.createHTML(script) :
                script);
      } else {
        var script = '<script type="module" crossorigin src="' + src + '"' +
            nonceAttr + '></' +
            'script>';
        doc.write(
            goog.TRUSTED_TYPES_POLICY_ ?
                goog.TRUSTED_TYPES_POLICY_.createHTML(script) :
                script);
      }
    }

    function append(src, contents) {
      var scriptEl =
          /** @type {!HTMLScriptElement} */ (doc.createElement('script'));
      scriptEl.defer = true;
      scriptEl.async = false;
      scriptEl.type = 'module';
      scriptEl.setAttribute('crossorigin', true);

      // If CSP nonces are used, propagate them to dynamically created scripts.
      // This is necessary to allow nonce-based CSPs without 'strict-dynamic'.
      var nonce = goog.getScriptNonce();
      if (nonce) {
        scriptEl.nonce = nonce;
      }

      if (contents) {
        scriptEl.text = goog.TRUSTED_TYPES_POLICY_ ?
            goog.TRUSTED_TYPES_POLICY_.createScript(contents) :
            contents;
      } else {
        scriptEl.src = goog.TRUSTED_TYPES_POLICY_ ?
            goog.TRUSTED_TYPES_POLICY_.createScriptURL(src) :
            src;
      }

      doc.head.appendChild(scriptEl);
    }

    var create;

    if (goog.isDocumentLoading_()) {
      create = write;
      // We can ONLY call document.write if we are guaranteed that any
      // non-module script tags document.written after this are deferred.
      // Small optimization, in theory document.writing is faster.
      goog.Dependency.defer_ = true;
    } else {
      create = append;
    }

    // Write 4 separate tags here:
    // 1) Sets the module state at the correct time (just before execution).
    // 2) A src node for this, which just hopefully lets the browser load it a
    //    little early (no need to parse #3).
    // 3) Import the module and register it.
    // 4) Clear the module state at the correct time. Guaranteed to run even
    //    if there is an error in the module (#3 will not run if there is an
    //    error in the module).
    var beforeKey = goog.Dependency.registerCallback_(function() {
      goog.Dependency.unregisterCallback_(beforeKey);
      controller.setModuleState(goog.ModuleType.ES6);
    });
    create(undefined, 'goog.Dependency.callback_("' + beforeKey + '")');

    // TODO(johnplaisted): Does this really speed up anything?
    create(this.path, undefined);

    var registerKey = goog.Dependency.registerCallback_(function(exports) {
      goog.Dependency.unregisterCallback_(registerKey);
      controller.registerEs6ModuleExports(
          dep.path, exports, goog.moduleLoaderState_.moduleName);
    });
    create(
        undefined,
        'import * as m from "' + this.path + '"; goog.Dependency.callback_("' +
            registerKey + '", m)');

    var afterKey = goog.Dependency.registerCallback_(function() {
      goog.Dependency.unregisterCallback_(afterKey);
      controller.clearModuleState();
      controller.loaded();
    });
    create(undefined, 'goog.Dependency.callback_("' + afterKey + '")');
  };


  /**
   * Superclass of any dependency that needs to be loaded into memory,
   * transformed, and then eval'd (goog.modules and transpiled files).
   *
   * @param {string} path Absolute path of this script.
   * @param {string} relativePath Path of this script relative to goog.basePath.
   * @param {!Array<string>} provides goog.provided or goog.module symbols
   *     in this file.
   * @param {!Array<string>} requires goog symbols or relative paths to Closure
   *     this depends on.
   * @param {!Object<string, string>} loadFlags
   * @struct @constructor @abstract
   * @extends {goog.Dependency}
   */
  goog.TransformedDependency = function(
      path, relativePath, provides, requires, loadFlags) {
    goog.TransformedDependency.base(
        this, 'constructor', path, relativePath, provides, requires, loadFlags);
    /** @private {?string} */
    this.contents_ = null;

    /**
     * Whether to lazily make the synchronous XHR (when goog.require'd) or make
     * the synchronous XHR when initially loading. On FireFox 61 there is a bug
     * where an ES6 module cannot make a synchronous XHR (rather, it can, but if
     * it does then no other ES6 modules will load after).
     *
     * tl;dr we lazy load due to bugs on older browsers and eager load due to
     * bugs on newer ones.
     *
     * https://bugzilla.mozilla.org/show_bug.cgi?id=1477090
     *
     * @private @const {boolean}
     */
    this.lazyFetch_ = !goog.inHtmlDocument_() ||
        !('noModule' in goog.global.document.createElement('script'));
  };
  goog.inherits(goog.TransformedDependency, goog.Dependency);


  /**
   * @override
   * @param {!goog.LoadController} controller
   */
  goog.TransformedDependency.prototype.load = function(controller) {
    var dep = this;

    function fetch() {
      dep.contents_ = goog.loadFileSync_(dep.path);

      if (dep.contents_) {
        dep.contents_ = dep.transform(dep.contents_);
        if (dep.contents_) {
          dep.contents_ += '\n//# sourceURL=' + dep.path;
        }
      }
    }

    if (goog.global.CLOSURE_IMPORT_SCRIPT) {
      fetch();
      if (this.contents_ &&
          goog.global.CLOSURE_IMPORT_SCRIPT('', this.contents_)) {
        this.contents_ = null;
        controller.loaded();
      } else {
        controller.pause();
      }
      return;
    }


    var isEs6 = this.loadFlags['module'] == goog.ModuleType.ES6;

    if (!this.lazyFetch_) {
      fetch();
    }

    function load() {
      if (dep.lazyFetch_) {
        fetch();
      }

      if (!dep.contents_) {
        // loadFileSync_ or transform are responsible. Assume they logged an
        // error.
        return;
      }

      if (isEs6) {
        controller.setModuleState(goog.ModuleType.ES6);
      }

      var namespace;

      try {
        var contents = dep.contents_;
        dep.contents_ = null;
        goog.globalEval(goog.CLOSURE_EVAL_PREFILTER_.createScript(contents));
        if (isEs6) {
          namespace = goog.moduleLoaderState_.moduleName;
        }
      } finally {
        if (isEs6) {
          controller.clearModuleState();
        }
      }

      if (isEs6) {
        // Due to circular dependencies this may not be available for require
        // right now.
        goog.global['$jscomp']['require']['ensure'](
            [dep.getPathName()], function() {
              controller.registerEs6ModuleExports(
                  dep.path,
                  goog.global['$jscomp']['require'](dep.getPathName()),
                  namespace);
            });
      }

      controller.loaded();
    }

    // Do not fetch now; in FireFox 47 the synchronous XHR doesn't block all
    // events. If we fetched now and then document.write'd the contents the
    // document.write would be an eval and would execute too soon! Instead write
    // a script tag to fetch and eval synchronously at the correct time.
    function fetchInOwnScriptThenLoad() {
      /** @type {!HTMLDocument} */
      var doc = goog.global.document;

      var key = goog.Dependency.registerCallback_(function() {
        goog.Dependency.unregisterCallback_(key);
        load();
      });

      var nonce = goog.getScriptNonce();
      var nonceAttr = nonce ? ' nonce="' + nonce + '"' : '';
      var script = '<script' + nonceAttr + '>' +
          goog.protectScriptTag_('goog.Dependency.callback_("' + key + '");') +
          '</' +
          'script>';
      doc.write(
          goog.TRUSTED_TYPES_POLICY_ ?
              goog.TRUSTED_TYPES_POLICY_.createHTML(script) :
              script);
    }

    // If one thing is pending it is this.
    var anythingElsePending = controller.pending().length > 1;

    // If anything else is loading we need to lazy load due to bugs in old IE.
    // Specifically script tags with src and script tags with contents could
    // execute out of order if document.write is used, so we cannot use
    // document.write. Do not pause here; it breaks old IE as well.
    var useOldIeWorkAround =
        anythingElsePending && goog.DebugLoader_.IS_OLD_IE_;

    // Additionally if we are meant to defer scripts but the page is still
    // loading (e.g. an ES6 module is loading) then also defer. Or if we are
    // meant to defer and anything else is pending then defer (those may be
    // scripts that did not need transformation and are just script tags with
    // defer set to true, and we need to evaluate after that deferred script).
    var needsAsyncLoading = goog.Dependency.defer_ &&
        (anythingElsePending || goog.isDocumentLoading_());

    if (useOldIeWorkAround || needsAsyncLoading) {
      // Note that we only defer when we have to rather than 100% of the time.
      // Always defering would work, but then in theory the order of
      // goog.require calls would then matter. We want to enforce that most of
      // the time the order of the require calls does not matter.
      controller.defer(function() {
        load();
      });
      return;
    }
    // TODO(johnplaisted): Externs are missing onreadystatechange for
    // HTMLDocument.
    /** @type {?} */
    var doc = goog.global.document;

    var isInternetExplorerOrEdge = goog.inHtmlDocument_() &&
        ('ActiveXObject' in goog.global || goog.isEdge_());

    // Don't delay in any version of IE or pre-Chromium Edge. There's a bug
    // around this that will cause out of order script execution. This means
    // that on older IE ES6 modules will load too early (while the document is
    // still loading + the dom is not available). The other option is to load
    // too late (when the document is complete and the onload even will never
    // fire). This seems to be the lesser of two evils as scripts already act
    // like the former.
    if (isEs6 && goog.inHtmlDocument_() && goog.isDocumentLoading_() &&
        !isInternetExplorerOrEdge) {
      goog.Dependency.defer_ = true;
      // Transpiled ES6 modules still need to load like regular ES6 modules,
      // aka only after the document is interactive.
      controller.pause();
      var oldCallback = doc.onreadystatechange;
      doc.onreadystatechange = function() {
        if (doc.readyState == 'interactive') {
          doc.onreadystatechange = oldCallback;
          load();
          controller.resume();
        }
        if (typeof oldCallback === 'function') {
          oldCallback.apply(undefined, arguments);
        }
      };
    } else {
      // Always eval on old IE.
      if (goog.DebugLoader_.IS_OLD_IE_ || !goog.inHtmlDocument_() ||
          !goog.isDocumentLoading_()) {
        load();
      } else {
        fetchInOwnScriptThenLoad();
      }
    }
  };


  /**
   * @param {string} contents
   * @return {string}
   * @abstract
   */
  goog.TransformedDependency.prototype.transform = function(contents) {};


  /**
   * Any non-goog.module dependency which needs to be transpiled before eval.
   *
   * @param {string} path Absolute path of this script.
   * @param {string} relativePath Path of this script relative to goog.basePath.
   * @param {!Array<string>} provides goog.provided or goog.module symbols
   *     in this file.
   * @param {!Array<string>} requires goog symbols or relative paths to Closure
   *     this depends on.
   * @param {!Object<string, string>} loadFlags
   * @param {!goog.Transpiler} transpiler
   * @struct @constructor
   * @extends {goog.TransformedDependency}
   */
  goog.TranspiledDependency = function(
      path, relativePath, provides, requires, loadFlags, transpiler) {
    goog.TranspiledDependency.base(
        this, 'constructor', path, relativePath, provides, requires, loadFlags);
    /** @protected @const*/
    this.transpiler = transpiler;
  };
  goog.inherits(goog.TranspiledDependency, goog.TransformedDependency);


  /**
   * @override
   * @param {string} contents
   * @return {string}
   */
  goog.TranspiledDependency.prototype.transform = function(contents) {
    // Transpile with the pathname so that ES6 modules are domain agnostic.
    return this.transpiler.transpile(contents, this.getPathName());
  };


  /**
   * An ES6 module dependency that was transpiled to a jscomp module outside
   * of the debug loader, e.g. server side.
   *
   * @param {string} path Absolute path of this script.
   * @param {string} relativePath Path of this script relative to goog.basePath.
   * @param {!Array<string>} provides goog.provided or goog.module symbols
   *     in this file.
   * @param {!Array<string>} requires goog symbols or relative paths to Closure
   *     this depends on.
   * @param {!Object<string, string>} loadFlags
   * @struct @constructor
   * @extends {goog.TransformedDependency}
   */
  goog.PreTranspiledEs6ModuleDependency = function(
      path, relativePath, provides, requires, loadFlags) {
    goog.PreTranspiledEs6ModuleDependency.base(
        this, 'constructor', path, relativePath, provides, requires, loadFlags);
  };
  goog.inherits(
      goog.PreTranspiledEs6ModuleDependency, goog.TransformedDependency);


  /**
   * @override
   * @param {string} contents
   * @return {string}
   */
  goog.PreTranspiledEs6ModuleDependency.prototype.transform = function(
      contents) {
    return contents;
  };


  /**
   * A goog.module, transpiled or not. Will always perform some minimal
   * transformation even when not transpiled to wrap in a goog.loadModule
   * statement.
   *
   * @param {string} path Absolute path of this script.
   * @param {string} relativePath Path of this script relative to goog.basePath.
   * @param {!Array<string>} provides goog.provided or goog.module symbols
   *     in this file.
   * @param {!Array<string>} requires goog symbols or relative paths to Closure
   *     this depends on.
   * @param {!Object<string, string>} loadFlags
   * @param {boolean} needsTranspile
   * @param {!goog.Transpiler} transpiler
   * @struct @constructor
   * @extends {goog.TransformedDependency}
   */
  goog.GoogModuleDependency = function(
      path, relativePath, provides, requires, loadFlags, needsTranspile,
      transpiler) {
    goog.GoogModuleDependency.base(
        this, 'constructor', path, relativePath, provides, requires, loadFlags);
    /** @private @const */
    this.needsTranspile_ = needsTranspile;
    /** @private @const */
    this.transpiler_ = transpiler;
  };
  goog.inherits(goog.GoogModuleDependency, goog.TransformedDependency);


  /**
   * @override
   * @param {string} contents
   * @return {string}
   */
  goog.GoogModuleDependency.prototype.transform = function(contents) {
    if (this.needsTranspile_) {
      contents = this.transpiler_.transpile(contents, this.getPathName());
    }

    if (!goog.LOAD_MODULE_USING_EVAL || goog.global.JSON === undefined) {
      return '' +
          'goog.loadModule(function(exports) {' +
          '"use strict";' + contents +
          '\n' +  // terminate any trailing single line comment.
          ';return exports' +
          '});' +
          '\n//# sourceURL=' + this.path + '\n';
    } else {
      return '' +
          'goog.loadModule(' +
          goog.global.JSON.stringify(
              contents + '\n//# sourceURL=' + this.path + '\n') +
          ');';
    }
  };


  /**
   * Whether the browser is IE9 or earlier, which needs special handling
   * for deferred modules.
   * @const @private {boolean}
   */
  goog.DebugLoader_.IS_OLD_IE_ = !!(
      !goog.global.atob && goog.global.document && goog.global.document['all']);


  /**
   * @param {string} relPath
   * @param {!Array<string>|undefined} provides
   * @param {!Array<string>} requires
   * @param {boolean|!Object<string>=} opt_loadFlags
   * @see goog.addDependency
   */
  goog.DebugLoader_.prototype.addDependency = function(
      relPath, provides, requires, opt_loadFlags) {
    provides = provides || [];
    relPath = relPath.replace(/\\/g, '/');
    var path = goog.normalizePath_(goog.basePath + relPath);
    if (!opt_loadFlags || typeof opt_loadFlags === 'boolean') {
      opt_loadFlags = opt_loadFlags ? {'module': goog.ModuleType.GOOG} : {};
    }
    var dep = this.factory_.createDependency(
        path, relPath, provides, requires, opt_loadFlags,
        goog.transpiler_.needsTranspile(
            opt_loadFlags['lang'] || 'es3', opt_loadFlags['module']));
    this.dependencies_[path] = dep;
    for (var i = 0; i < provides.length; i++) {
      this.idToPath_[provides[i]] = path;
    }
    this.idToPath_[relPath] = path;
  };


  /**
   * Creates goog.Dependency instances for the debug loader to load.
   *
   * Should be overridden to have the debug loader use custom subclasses of
   * goog.Dependency.
   *
   * @param {!goog.Transpiler} transpiler
   * @struct @constructor
   */
  goog.DependencyFactory = function(transpiler) {
    /** @protected @const */
    this.transpiler = transpiler;
  };


  /**
   * @param {string} path Absolute path of the file.
   * @param {string} relativePath Path relative to closure’s base.js.
   * @param {!Array<string>} provides Array of provided goog.provide/module ids.
   * @param {!Array<string>} requires Array of required goog.provide/module /
   *     relative ES6 module paths.
   * @param {!Object<string, string>} loadFlags
   * @param {boolean} needsTranspile True if the file needs to be transpiled
   *     per the goog.Transpiler.
   * @return {!goog.Dependency}
   */
  goog.DependencyFactory.prototype.createDependency = function(
      path, relativePath, provides, requires, loadFlags, needsTranspile) {
    // MOE:begin_strip
    var provide, require;
    for (var i = 0; provide = provides[i]; i++) {
      goog.dependencies_.nameToPath[provide] = relativePath;
      goog.dependencies_.loadFlags[relativePath] = loadFlags;
    }
    for (var j = 0; require = requires[j]; j++) {
      if (!(relativePath in goog.dependencies_.requires)) {
        goog.dependencies_.requires[relativePath] = {};
      }
      goog.dependencies_.requires[relativePath][require] = true;
    }
    // MOE:end_strip

    if (loadFlags['module'] == goog.ModuleType.GOOG) {
      return new goog.GoogModuleDependency(
          path, relativePath, provides, requires, loadFlags, needsTranspile,
          this.transpiler);
    } else if (needsTranspile) {
      return new goog.TranspiledDependency(
          path, relativePath, provides, requires, loadFlags, this.transpiler);
    } else {
      if (loadFlags['module'] == goog.ModuleType.ES6) {
        if (goog.TRANSPILE == 'never' && goog.ASSUME_ES_MODULES_TRANSPILED) {
          return new goog.PreTranspiledEs6ModuleDependency(
              path, relativePath, provides, requires, loadFlags);
        } else {
          return new goog.Es6ModuleDependency(
              path, relativePath, provides, requires, loadFlags);
        }
      } else {
        return new goog.Dependency(
            path, relativePath, provides, requires, loadFlags);
      }
    }
  };


  /** @private @const */
  goog.debugLoader_ = new goog.DebugLoader_();


  /**
   * Loads the Closure Dependency file.
   *
   * Exposed a public function so CLOSURE_NO_DEPS can be set to false, base
   * loaded, setDependencyFactory called, and then this called. i.e. allows
   * custom loading of the deps file.
   */
  goog.loadClosureDeps = function() {
    goog.debugLoader_.loadClosureDeps();
  };


  /**
   * Sets the dependency factory, which can be used to create custom
   * goog.Dependency implementations to control how dependencies are loaded.
   *
   * Note: if you wish to call this function and provide your own implemnetation
   * it is a wise idea to set CLOSURE_NO_DEPS to true, otherwise the dependency
   * file and all of its goog.addDependency calls will use the default factory.
   * You can call goog.loadClosureDeps to load the Closure dependency file
   * later, after your factory is injected.
   *
   * @param {!goog.DependencyFactory} factory
   */
  goog.setDependencyFactory = function(factory) {
    goog.debugLoader_.setDependencyFactory(factory);
  };


  /**
   * Trusted Types policy for the debug loader.
   * @private @const {?TrustedTypePolicy}
   */
  goog.TRUSTED_TYPES_POLICY_ = goog.TRUSTED_TYPES_POLICY_NAME ?
      goog.createTrustedTypesPolicy(goog.TRUSTED_TYPES_POLICY_NAME + '#base') :
      null;

  if (!goog.global.CLOSURE_NO_DEPS) {
    goog.debugLoader_.loadClosureDeps();
  }


  /**
   * Bootstraps the given namespaces and calls the callback once they are
   * available either via goog.require. This is a replacement for using
   * `goog.require` to bootstrap Closure JavaScript. Previously a `goog.require`
   * in an HTML file would guarantee that the require'd namespace was available
   * in the next immediate script tag. With ES6 modules this no longer a
   * guarantee.
   *
   * @param {!Array<string>} namespaces
   * @param {function(): ?} callback Function to call once all the namespaces
   *     have loaded. Always called asynchronously.
   */
  goog.bootstrap = function(namespaces, callback) {
    goog.debugLoader_.bootstrap(namespaces, callback);
  };
}


if (!COMPILED) {
  var isChrome87 = false;
  // Cannot run check for Chrome <87 bug in case of strict CSP environments.
  // TODO(aaronshim): Remove once Chrome <87 bug is no longer a problem.
  try {
    isChrome87 = eval(goog.global.trustedTypes.emptyScript) !==
        goog.global.trustedTypes.emptyScript;
  } catch (err) {
  }

  /**
   * Trusted Types for running dev servers.
   *
   * @private @const
   */
  goog.CLOSURE_EVAL_PREFILTER_ =
      // Detect Chrome <87 bug with TT and eval.
      goog.global.trustedTypes && isChrome87 &&
          goog.createTrustedTypesPolicy('goog#base#devonly#eval') ||
      {createScript: goog.identity_};
}

//javascript/apps/jspb/binary/const_binary_message.js
goog.loadModule(function(exports) {'use strict';goog.module('jspb.ConstBinaryMessage');
goog.module.declareLegacyNamespace();

/**
 * Base interface class for all const messages.
 * @interface
 */
class ConstBinaryMessage {
  /**
   * Generate a debug string for this proto that is in proto2 text format.
   * @return {string} The debug string.
   */
  toDebugString() {}

  /**
   * Helper to generate a debug string for this proto at some indent level. The
   * first line is not indented.
   * @param {number} indentLevel The number of spaces by which to indent lines.
   * @return {string} The debug string.
   * @protected
   */
  toDebugStringInternal(indentLevel) {}
}

exports = ConstBinaryMessage;

;return exports;});

//javascript/apps/jspb/binary/binary_message.js
goog.loadModule(function(exports) {'use strict';goog.module('jspb.BinaryMessage');
goog.module.declareLegacyNamespace();

const ConstBinaryMessage = goog.require('jspb.ConstBinaryMessage');

/**
 * Base interface class for all messages. Does __not__ define any methods, as
 * doing so on a widely-used interface defeats dead-code elimination.
 * @interface
 * @extends {ConstBinaryMessage}
 */
class BinaryMessage {}

exports = BinaryMessage;

;return exports;});

//javascript/apps/jspb/binary/scalar_field_type.js
goog.loadModule(function(exports) {'use strict';goog.module('jspb.ScalarFieldType');
goog.module.declareLegacyNamespace();


/**
 * A scalar field in jspb can be a boolean, number, or string.
 * @typedef {boolean|number|string}
 */
let ScalarFieldType;


exports = ScalarFieldType;

;return exports;});

//javascript/apps/jspb/binary/repeated_field_type.js
goog.loadModule(function(exports) {'use strict';goog.module('jspb.RepeatedFieldType');
goog.module.declareLegacyNamespace();

const BinaryMessage = goog.require('jspb.BinaryMessage');
const ConstBinaryMessage = goog.require('jspb.ConstBinaryMessage');
const ScalarFieldType = goog.require('jspb.ScalarFieldType');

/**
 * A repeated field in jspb is an array of scalars, blobs, or messages.
 * @typedef {!Array<!ScalarFieldType>|
             !Array<!Uint8Array>|
             !Array<!ConstBinaryMessage>|
             !Array<!BinaryMessage>}
 */
let RepeatedFieldType;

exports = RepeatedFieldType;

;return exports;});

//javascript/apps/jspb/binary/any_field_type.js
goog.loadModule(function(exports) {'use strict';goog.module('jspb.AnyFieldType');
goog.module.declareLegacyNamespace();

const BinaryMessage = goog.require('jspb.BinaryMessage');
const ConstBinaryMessage = goog.require('jspb.ConstBinaryMessage');
const RepeatedFieldType = goog.require('jspb.RepeatedFieldType');
const ScalarFieldType = goog.require('jspb.ScalarFieldType');


/**
 * A field in jspb can be a scalar, a block of bytes, another proto, or an
 * array of any of the above.
 * @typedef {?ScalarFieldType|
             ?RepeatedFieldType|
             !Uint8Array|
             !ConstBinaryMessage|
             !BinaryMessage}
 */
let AnyFieldType;

exports = AnyFieldType;

;return exports;});

//javascript/apps/jspb/binary/arith.js
/**
 * @fileoverview This file contains helper code used by jspb.utils to
 * handle 64-bit integer conversion to/from strings.
 *
 * @author cfallin@google.com (Chris Fallin)
 *
 * TODO(haberman): move this to javascript/closure/math?
 */

goog.provide('jspb.arith.Int64');
goog.provide('jspb.arith.UInt64');

/**
 * UInt64 implements some 64-bit arithmetic routines necessary for properly
 * handling 64-bit integer fields. It implements lossless integer arithmetic on
 * top of JavaScript's number type, which has only 53 bits of precision, by
 * representing 64-bit integers as two 32-bit halves.
 * @unrestricted
 */
jspb.arith.UInt64 = class {
  /**
   * @param {number} lo The low 32 bits.
   * @param {number} hi The high 32 bits.
   */
  constructor(lo, hi) {
    /**
     * The low 32 bits.
     * @public {number}
     */
    this.lo = lo;
    /**
     * The high 32 bits.
     * @public {number}
     */
    this.hi = hi;
  }

  /**
   * Compare two 64-bit numbers. Returns -1 if the first is
   * less, +1 if the first is greater, or 0 if both are equal.
   * @param {!jspb.arith.UInt64} other
   * @return {number}
   */
  cmp(other) {
    if (this.hi < other.hi || (this.hi == other.hi && this.lo < other.lo)) {
      return -1;
    } else if (this.hi == other.hi && this.lo == other.lo) {
      return 0;
    } else {
      return 1;
    }
  }

  /**
   * Right-shift this number by one bit.
   * @return {!jspb.arith.UInt64}
   */
  rightShift() {
    var hi = this.hi >>> 1;
    var lo = (this.lo >>> 1) | ((this.hi & 1) << 31);
    return new jspb.arith.UInt64(lo >>> 0, hi >>> 0);
  }

  /**
   * Left-shift this number by one bit.
   * @return {!jspb.arith.UInt64}
   */
  leftShift() {
    var lo = this.lo << 1;
    var hi = (this.hi << 1) | (this.lo >>> 31);
    return new jspb.arith.UInt64(lo >>> 0, hi >>> 0);
  }

  /**
   * Test the MSB.
   * @return {boolean}
   */
  msb() {
    return !!(this.hi & 0x80000000);
  }

  /**
   * Test the LSB.
   * @return {boolean}
   */
  lsb() {
    return !!(this.lo & 1);
  }

  /**
   * Test whether this number is zero.
   * @return {boolean}
   */
  zero() {
    return this.lo == 0 && this.hi == 0;
  }

  /**
   * Add two 64-bit numbers to produce a 64-bit number.
   * @param {!jspb.arith.UInt64} other
   * @return {!jspb.arith.UInt64}
   */
  add(other) {
    var lo = ((this.lo + other.lo) & 0xffffffff) >>> 0;
    var hi = (((this.hi + other.hi) & 0xffffffff) >>> 0) +
        (((this.lo + other.lo) >= 0x100000000) ? 1 : 0);
    return new jspb.arith.UInt64(lo >>> 0, hi >>> 0);
  }

  /**
   * Subtract two 64-bit numbers to produce a 64-bit number.
   * @param {!jspb.arith.UInt64} other
   * @return {!jspb.arith.UInt64}
   */
  sub(other) {
    var lo = ((this.lo - other.lo) & 0xffffffff) >>> 0;
    var hi = (((this.hi - other.hi) & 0xffffffff) >>> 0) -
        (((this.lo - other.lo) < 0) ? 1 : 0);
    return new jspb.arith.UInt64(lo >>> 0, hi >>> 0);
  }

  /**
   * Multiply two 32-bit numbers to produce a 64-bit number.
   * @param {number} a The first integer:  must be in [0, 2^32-1).
   * @param {number} b The second integer: must be in [0, 2^32-1).
   * @return {!jspb.arith.UInt64}
   */
  static mul32x32(a, b) {
    // Directly multiplying two 32-bit numbers may produce up to 64 bits of
    // precision, thus losing precision because of the 53-bit mantissa of
    // JavaScript numbers. So we multiply with 16-bit digits (radix 65536)
    // instead.
    var aLow = (a & 0xffff);
    var aHigh = (a >>> 16);
    var bLow = (b & 0xffff);
    var bHigh = (b >>> 16);
    var productLow =
        // 32-bit result, result bits 0-31, take all 32 bits
        (aLow * bLow) +
        // 32-bit result, result bits 16-47, take bottom 16 as our top 16
        ((aLow * bHigh) & 0xffff) * 0x10000 +
        // 32-bit result, result bits 16-47, take bottom 16 as our top 16
        ((aHigh * bLow) & 0xffff) * 0x10000;
    var productHigh =
        // 32-bit result, result bits 32-63, take all 32 bits
        (aHigh * bHigh) +
        // 32-bit result, result bits 16-47, take top 16 as our bottom 16
        ((aLow * bHigh) >>> 16) +
        // 32-bit result, result bits 16-47, take top 16 as our bottom 16
        ((aHigh * bLow) >>> 16);

    // Carry. Note that we actually have up to *two* carries due to addition of
    // three terms.
    while (productLow >= 0x100000000) {
      productLow -= 0x100000000;
      productHigh += 1;
    }

    return new jspb.arith.UInt64(productLow >>> 0, productHigh >>> 0);
  }

  /**
   * Multiply this number by a 32-bit number, producing a 96-bit number, then
   * truncate the top 32 bits.
   * @param {number} a The multiplier.
   * @return {!jspb.arith.UInt64}
   */
  mul(a) {
    // Produce two parts: at bits 0-63, and 32-95.
    var lo = jspb.arith.UInt64.mul32x32(this.lo, a);
    var hi = jspb.arith.UInt64.mul32x32(this.hi, a);
    // Left-shift hi by 32 bits, truncating its top bits. The parts will then be
    // aligned for addition.
    hi.hi = hi.lo;
    hi.lo = 0;
    return lo.add(hi);
  }

  /**
   * Divide a 64-bit number by a 32-bit number to produce a
   * 64-bit quotient and a 32-bit remainder.
   * @param {number} _divisor
   * @return {!Array<jspb.arith.UInt64>} array of [quotient, remainder],
   * unless divisor is 0, in which case an empty array is returned.
   */
  div(_divisor) {
    if (_divisor == 0) {
      return [];
    }

    // We perform long division using a radix-2 algorithm, for simplicity (i.e.,
    // one bit at a time). TODO: optimize to a radix-2^32 algorithm, taking care
    // to get the variable shifts right.
    var quotient = new jspb.arith.UInt64(0, 0);
    var remainder = new jspb.arith.UInt64(this.lo, this.hi);
    var divisor = new jspb.arith.UInt64(_divisor, 0);
    var unit = new jspb.arith.UInt64(1, 0);

    // Left-shift the divisor and unit until the high bit of divisor is set.
    while (!divisor.msb()) {
      divisor = divisor.leftShift();
      unit = unit.leftShift();
    }

    // Perform long division one bit at a time.
    while (!unit.zero()) {
      // If divisor < remainder, add unit to quotient and subtract divisor from
      // remainder.
      if (divisor.cmp(remainder) <= 0) {
        quotient = quotient.add(unit);
        remainder = remainder.sub(divisor);
      }
      // Right-shift the divisor and unit.
      divisor = divisor.rightShift();
      unit = unit.rightShift();
    }

    return [quotient, remainder];
  }

  /**
   * Convert a 64-bit number to a string.
   * @return {string}
   * @override
   */
  toString() {
    var result = '';
    var num = this;
    while (!num.zero()) {
      var divResult = num.div(10);
      var quotient = divResult[0], remainder = divResult[1];
      result = remainder.lo + result;
      num = quotient;
    }
    if (result == '') {
      result = '0';
    }
    return result;
  }

  /**
   * Parse a string into a 64-bit number. Returns `null` on a parse error.
   * @param {string} s
   * @return {?jspb.arith.UInt64}
   */
  static fromString(s) {
    var result = new jspb.arith.UInt64(0, 0);
    // optimization: reuse this instance for each digit.
    var digit64 = new jspb.arith.UInt64(0, 0);
    for (var i = 0; i < s.length; i++) {
      if (s[i] < '0' || s[i] > '9') {
        return null;
      }
      var digit = parseInt(s[i], 10);
      digit64.lo = digit;
      result = result.mul(10).add(digit64);
    }
    return result;
  }

  /**
   * Make a copy of the uint64.
   * @return {!jspb.arith.UInt64}
   */
  clone() {
    return new jspb.arith.UInt64(this.lo, this.hi);
  }
};



/**
 * Int64 is like UInt64, but modifies string conversions to interpret the stored
 * 64-bit value as a twos-complement-signed integer. It does *not* support the
 * full range of operations that UInt64 does: only add, subtract, and string
 * conversions.
 * N.B. that multiply and divide routines are *NOT* supported. They will throw
 * exceptions. (They are not necessary to implement string conversions, which
 * are the only operations we really need in jspb.)
 * @unrestricted
 */
jspb.arith.Int64 = class {
  /**
   * @param {number} lo The low 32 bits.
   * @param {number} hi The high 32 bits.
   */
  constructor(lo, hi) {
    /**
     * The low 32 bits.
     * @public {number}
     */
    this.lo = lo;
    /**
     * The high 32 bits.
     * @public {number}
     */
    this.hi = hi;
  }

  /**
   * Add two 64-bit numbers to produce a 64-bit number.
   * @param {!jspb.arith.Int64} other
   * @return {!jspb.arith.Int64}
   */
  add(other) {
    var lo = ((this.lo + other.lo) & 0xffffffff) >>> 0;
    var hi = (((this.hi + other.hi) & 0xffffffff) >>> 0) +
        (((this.lo + other.lo) >= 0x100000000) ? 1 : 0);
    return new jspb.arith.Int64(lo >>> 0, hi >>> 0);
  }

  /**
   * Subtract two 64-bit numbers to produce a 64-bit number.
   * @param {!jspb.arith.Int64} other
   * @return {!jspb.arith.Int64}
   */
  sub(other) {
    var lo = ((this.lo - other.lo) & 0xffffffff) >>> 0;
    var hi = (((this.hi - other.hi) & 0xffffffff) >>> 0) -
        (((this.lo - other.lo) < 0) ? 1 : 0);
    return new jspb.arith.Int64(lo >>> 0, hi >>> 0);
  }

  /**
   * Make a copy of the int64.
   * @return {!jspb.arith.Int64}
   */
  clone() {
    return new jspb.arith.Int64(this.lo, this.hi);
  }

  /**
   * Convert a 64-bit number to a string.
   * @return {string}
   * @override
   */
  toString() {
    // If the number is negative, find its twos-complement inverse.
    var sign = (this.hi & 0x80000000) != 0;
    var num = new jspb.arith.UInt64(this.lo, this.hi);
    if (sign) {
      num = new jspb.arith.UInt64(0, 0).sub(num);
    }
    return (sign ? '-' : '') + num.toString();
  }

  /**
   * Parse a string into a 64-bit number. Returns `null` on a parse error.
   * @param {string} s
   * @return {?jspb.arith.Int64}
   */
  static fromString(s) {
    var hasNegative = (s.length > 0 && s[0] == '-');
    if (hasNegative) {
      s = s.substring(1);
    }
    var num = jspb.arith.UInt64.fromString(s);
    if (num === null) {
      return null;
    }
    if (hasNegative) {
      num = new jspb.arith.UInt64(0, 0).sub(num);
    }
    return new jspb.arith.Int64(num.lo, num.hi);
  }
};

//javascript/apps/jspb/binary/binary_constants.js
goog.loadModule(function(exports) {'use strict';goog.module('jspb.BinaryConstants');
goog.module.declareLegacyNamespace();

/**
 * Field type codes, taken from proto2/public/wire_format_lite.h.
 * @enum {number}
 * @package
 */
const FieldType = {
  INVALID: -1,
  DOUBLE: 1,
  FLOAT: 2,
  INT64: 3,
  UINT64: 4,
  INT32: 5,
  FIXED64: 6,
  FIXED32: 7,
  BOOL: 8,
  STRING: 9,
  GROUP: 10,
  MESSAGE: 11,
  BYTES: 12,
  UINT32: 13,
  ENUM: 14,
  SFIXED32: 15,
  SFIXED64: 16,
  SINT32: 17,
  SINT64: 18,
};


/**
 * Wire-format type codes, taken from proto2/public/wire_format_lite.h.
 * @enum {number}
 */
const WireType = {
  INVALID: -1,
  VARINT: 0,
  FIXED64: 1,
  DELIMITED: 2,
  START_GROUP: 3,
  END_GROUP: 4,
  FIXED32: 5
};


/**
 * Translates field type to wire type.
 * @param {!FieldType} fieldType
 * @return {!WireType}
 */
function FieldTypeToWireType(fieldType) {
  switch (fieldType) {
    case FieldType.INT32:
    case FieldType.INT64:
    case FieldType.UINT32:
    case FieldType.UINT64:
    case FieldType.SINT32:
    case FieldType.SINT64:
    case FieldType.BOOL:
    case FieldType.ENUM:
      return WireType.VARINT;

    case FieldType.DOUBLE:
    case FieldType.FIXED64:
    case FieldType.SFIXED64:
      return WireType.FIXED64;

    case FieldType.STRING:
    case FieldType.MESSAGE:
    case FieldType.BYTES:
      return WireType.DELIMITED;

    case FieldType.FLOAT:
    case FieldType.FIXED32:
    case FieldType.SFIXED32:
      return WireType.FIXED32;

    case FieldType.INVALID:
    case FieldType.GROUP:
    default:
      return WireType.INVALID;
  }
}


/**
 * Flag to indicate a missing field.
 * @const {number}
 */
const INVALID_FIELD_NUMBER = -1;


/**
 * The smallest denormal float32 value.
 * @const {number}
 */
const FLOAT32_EPS = 1.401298464324817e-45;


/**
 * The smallest normal float64 value.
 * @const {number}
 */
const FLOAT32_MIN = 1.1754943508222875e-38;


/**
 * The largest finite float32 value.
 * @const {number}
 */
const FLOAT32_MAX = 3.4028234663852886e+38;


/**
 * The smallest denormal float64 value.
 * @const {number}
 */
const FLOAT64_EPS = 5e-324;


/**
 * The smallest normal float64 value.
 * @const {number}
 */
const FLOAT64_MIN = 2.2250738585072014e-308;


/**
 * The largest finite float64 value.
 * @const {number}
 */
const FLOAT64_MAX = 1.7976931348623157e+308;


/**
 * Convenience constant equal to 2^20.
 * @const {number}
 */
const TWO_TO_20 = 1048576;


/**
 * Convenience constant equal to 2^23.
 * @const {number}
 */
const TWO_TO_23 = 8388608;


/**
 * Convenience constant equal to 2^31.
 * @const {number}
 */
const TWO_TO_31 = 2147483648;


/**
 * Convenience constant equal to 2^32.
 * @const {number}
 */
const TWO_TO_32 = 4294967296;


/**
 * Convenience constant equal to 2^52.
 * @const {number}
 */
const TWO_TO_52 = 4503599627370496;


/**
 * Convenience constant equal to 2^63.
 * @const {number}
 */
const TWO_TO_63 = 9223372036854775808;


/**
 * Convenience constant equal to 2^64.
 * @const {number}
 */
const TWO_TO_64 = 18446744073709551616;


/**
 * Eight-character string of zeros, used as the default 64-bit hash value.
 * @const {string}
 */
const ZERO_HASH = '\0\0\0\0\0\0\0\0';

exports = {
  FieldType,
  FieldTypeToWireType,
  FLOAT32_EPS,
  FLOAT32_MIN,
  FLOAT32_MAX,
  FLOAT64_EPS,
  FLOAT64_MIN,
  FLOAT64_MAX,
  INVALID_FIELD_NUMBER,
  TWO_TO_20,
  TWO_TO_23,
  TWO_TO_31,
  TWO_TO_32,
  TWO_TO_52,
  TWO_TO_63,
  TWO_TO_64,
  WireType,
  ZERO_HASH,
};

;return exports;});

//javascript/apps/jspb/binary/bytesource.js
goog.loadModule(function(exports) {'use strict';goog.module('jspb.ByteSource');
goog.module.declareLegacyNamespace();

/**
 * The types convertible to Uint8Arrays. Strings are assumed to be
 * base64-encoded.
 * @typedef {?ArrayBuffer|?Uint8Array|?Array<number>|string}
 */
let ByteSource;

exports = ByteSource;

;return exports;});

//third_party/javascript/closure/debug/error.js
goog.loadModule(function(exports) {'use strict';/**
 * @license
 * Copyright The Closure Library Authors.
 * SPDX-License-Identifier: Apache-2.0
 */

/**
 * @fileoverview Provides a base class for custom Error objects such that the
 * stack is correctly maintained.
 *
 * You should never need to throw DebugError(msg) directly, Error(msg) is
 * sufficient.
 */

goog.module('goog.debug.Error');
goog.module.declareLegacyNamespace();



/**
 * Base class for custom error objects.
 * @param {*=} opt_msg The message associated with the error.
 * @constructor
 * @extends {Error}
 */
function DebugError(opt_msg) {
  // Attempt to ensure there is a stack trace.
  if (Error.captureStackTrace) {
    Error.captureStackTrace(this, DebugError);
  } else {
    const stack = new Error().stack;
    if (stack) {
      /** @override */
      this.stack = stack;
    }
  }

  if (opt_msg) {
    /** @override */
    this.message = String(opt_msg);
  }

  /**
   * Whether to report this error to the server. Setting this to false will
   * cause the error reporter to not report the error back to the server,
   * which can be useful if the client knows that the error has already been
   * logged on the server.
   * @type {boolean}
   */
  this.reportErrorToServer = true;
}
goog.inherits(DebugError, Error);


/** @override */
DebugError.prototype.name = 'CustomError';


exports = DebugError;

;return exports;});

//third_party/javascript/closure/dom/nodetype.js
/**
 * @license
 * Copyright The Closure Library Authors.
 * SPDX-License-Identifier: Apache-2.0
 */

/**
 * @fileoverview Definition of goog.dom.NodeType.
 */

goog.provide('goog.dom.NodeType');


/**
 * Constants for the nodeType attribute in the Node interface.
 *
 * These constants match those specified in the Node interface. These are
 * usually present on the Node object in recent browsers, but not in older
 * browsers (specifically, early IEs) and thus are given here.
 *
 * In some browsers (early IEs), these are not defined on the Node object,
 * so they are provided here.
 *
 * See http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-1950641247
 * @enum {number}
 */
goog.dom.NodeType = {
  ELEMENT: 1,
  ATTRIBUTE: 2,
  TEXT: 3,
  CDATA_SECTION: 4,
  ENTITY_REFERENCE: 5,
  ENTITY: 6,
  PROCESSING_INSTRUCTION: 7,
  COMMENT: 8,
  DOCUMENT: 9,
  DOCUMENT_TYPE: 10,
  DOCUMENT_FRAGMENT: 11,
  NOTATION: 12
};

//third_party/javascript/closure/asserts/asserts.js
/**
 * @license
 * Copyright The Closure Library Authors.
 * SPDX-License-Identifier: Apache-2.0
 */

/**
 * @fileoverview Utilities to check the preconditions, postconditions and
 * invariants runtime.
 *
 * Methods in this package are given special treatment by the compiler
 * for type-inference. For example, <code>goog.asserts.assert(foo)</code>
 * will make the compiler treat <code>foo</code> as non-nullable. Similarly,
 * <code>goog.asserts.assertNumber(foo)</code> informs the compiler about the
 * type of <code>foo</code>. Where applicable, such assertions are preferable to
 * casts by jsdoc with <code>@type</code>.
 *
 * The compiler has an option to disable asserts. So code like:
 * <code>
 * var x = goog.asserts.assert(foo());
 * goog.asserts.assert(bar());
 * </code>
 * will be transformed into:
 * <code>
 * var x = foo();
 * </code>
 * The compiler will leave in foo() (because its return value is used),
 * but it will remove bar() because it assumes it does not have side-effects.
 *
 * Additionally, note the compiler will consider the type to be "tightened" for
 * all statements <em>after</em> the assertion. For example:
 * <code>
 * const /** ?Object &#ast;/ value = foo();
 * goog.asserts.assert(value);
 * // "value" is of type {!Object} at this point.
 * </code>
 */

goog.provide('goog.asserts');
goog.provide('goog.asserts.AssertionError');

goog.require('goog.debug.Error');
goog.require('goog.dom.NodeType');


/**
 * @define {boolean} Whether to strip out asserts or to leave them in.
 */
goog.asserts.ENABLE_ASSERTS =
    goog.define('goog.asserts.ENABLE_ASSERTS', goog.DEBUG);



/**
 * Error object for failed assertions.
 * @param {string} messagePattern The pattern that was used to form message.
 * @param {!Array<*>} messageArgs The items to substitute into the pattern.
 * @constructor
 * @extends {goog.debug.Error}
 * @final
 */
goog.asserts.AssertionError = function(messagePattern, messageArgs) {
  'use strict';
  goog.debug.Error.call(this, goog.asserts.subs_(messagePattern, messageArgs));

  /**
   * The message pattern used to format the error message. Error handlers can
   * use this to uniquely identify the assertion.
   * @type {string}
   */
  this.messagePattern = messagePattern;
};
goog.inherits(goog.asserts.AssertionError, goog.debug.Error);


/** @override */
goog.asserts.AssertionError.prototype.name = 'AssertionError';


/**
 * The default error handler.
 * @param {!goog.asserts.AssertionError} e The exception to be handled.
 */
goog.asserts.DEFAULT_ERROR_HANDLER = function(e) {
  'use strict';
  throw e;
};


/**
 * The handler responsible for throwing or logging assertion errors.
 * @private {function(!goog.asserts.AssertionError)}
 */
goog.asserts.errorHandler_ = goog.asserts.DEFAULT_ERROR_HANDLER;


/**
 * Does simple python-style string substitution.
 * subs("foo%s hot%s", "bar", "dog") becomes "foobar hotdog".
 * @param {string} pattern The string containing the pattern.
 * @param {!Array<*>} subs The items to substitute into the pattern.
 * @return {string} A copy of `str` in which each occurrence of
 *     {@code %s} has been replaced an argument from `var_args`.
 * @private
 */
goog.asserts.subs_ = function(pattern, subs) {
  'use strict';
  var splitParts = pattern.split('%s');
  var returnString = '';

  // Replace up to the last split part. We are inserting in the
  // positions between split parts.
  var subLast = splitParts.length - 1;
  for (var i = 0; i < subLast; i++) {
    // keep unsupplied as '%s'
    var sub = (i < subs.length) ? subs[i] : '%s';
    returnString += splitParts[i] + sub;
  }
  return returnString + splitParts[subLast];
};


/**
 * Throws an exception with the given message and "Assertion failed" prefixed
 * onto it.
 * @param {string} defaultMessage The message to use if givenMessage is empty.
 * @param {Array<*>} defaultArgs The substitution arguments for defaultMessage.
 * @param {string|undefined} givenMessage Message supplied by the caller.
 * @param {Array<*>} givenArgs The substitution arguments for givenMessage.
 * @throws {goog.asserts.AssertionError} When the value is not a number.
 * @private
 */
goog.asserts.doAssertFailure_ = function(
    defaultMessage, defaultArgs, givenMessage, givenArgs) {
  'use strict';
  var message = 'Assertion failed';
  if (givenMessage) {
    message += ': ' + givenMessage;
    var args = givenArgs;
  } else if (defaultMessage) {
    message += ': ' + defaultMessage;
    args = defaultArgs;
  }
  // The '' + works around an Opera 10 bug in the unit tests. Without it,
  // a stack trace is added to var message above. With this, a stack trace is
  // not added until this line (it causes the extra garbage to be added after
  // the assertion message instead of in the middle of it).
  var e = new goog.asserts.AssertionError('' + message, args || []);
  goog.asserts.errorHandler_(e);
};


/**
 * Sets a custom error handler that can be used to customize the behavior of
 * assertion failures, for example by turning all assertion failures into log
 * messages.
 * @param {function(!goog.asserts.AssertionError)} errorHandler
 */
goog.asserts.setErrorHandler = function(errorHandler) {
  'use strict';
  if (goog.asserts.ENABLE_ASSERTS) {
    goog.asserts.errorHandler_ = errorHandler;
  }
};


/**
 * Checks if the condition evaluates to true if goog.asserts.ENABLE_ASSERTS is
 * true.
 * @template T
 * @param {T} condition The condition to check.
 * @param {string=} opt_message Error message in case of failure.
 * @param {...*} var_args The items to substitute into the failure message.
 * @return {T} The value of the condition.
 * @throws {goog.asserts.AssertionError} When the condition evaluates to false.
 * @closurePrimitive {asserts.truthy}
 */
goog.asserts.assert = function(condition, opt_message, var_args) {
  'use strict';
  if (goog.asserts.ENABLE_ASSERTS && !condition) {
    goog.asserts.doAssertFailure_(
        '', null, opt_message, Array.prototype.slice.call(arguments, 2));
  }
  return condition;
};


/**
 * Checks if `value` is `null` or `undefined` if goog.asserts.ENABLE_ASSERTS is
 * true.
 *
 * @param {T} value The value to check.
 * @param {string=} opt_message Error message in case of failure.
 * @param {...*} var_args The items to substitute into the failure message.
 * @return {R} `value` with its type narrowed to exclude `null` and `undefined`.
 *
 * @template T
 * @template R :=
 *     mapunion(T, (V) =>
 *         cond(eq(V, 'null'),
 *             none(),
 *             cond(eq(V, 'undefined'),
 *                 none(),
 *                 V)))
 *  =:
 *
 * @throws {!goog.asserts.AssertionError} When `value` is `null` or `undefined`.
 * @closurePrimitive {asserts.matchesReturn}
 */
goog.asserts.assertExists = function(value, opt_message, var_args) {
  'use strict';
  if (goog.asserts.ENABLE_ASSERTS && value == null) {
    goog.asserts.doAssertFailure_(
        'Expected to exist: %s.', [value], opt_message,
        Array.prototype.slice.call(arguments, 2));
  }
  return value;
};


/**
 * Fails if goog.asserts.ENABLE_ASSERTS is true. This function is useful in case
 * when we want to add a check in the unreachable area like switch-case
 * statement:
 *
 * <pre>
 *  switch(type) {
 *    case FOO: doSomething(); break;
 *    case BAR: doSomethingElse(); break;
 *    default: goog.asserts.fail('Unrecognized type: ' + type);
 *      // We have only 2 types - "default:" section is unreachable code.
 *  }
 * </pre>
 *
 * @param {string=} opt_message Error message in case of failure.
 * @param {...*} var_args The items to substitute into the failure message.
 * @throws {goog.asserts.AssertionError} Failure.
 * @closurePrimitive {asserts.fail}
 */
goog.asserts.fail = function(opt_message, var_args) {
  'use strict';
  if (goog.asserts.ENABLE_ASSERTS) {
    goog.asserts.errorHandler_(new goog.asserts.AssertionError(
        'Failure' + (opt_message ? ': ' + opt_message : ''),
        Array.prototype.slice.call(arguments, 1)));
  }
};


/**
 * Checks if the value is a number if goog.asserts.ENABLE_ASSERTS is true.
 * @param {*} value The value to check.
 * @param {string=} opt_message Error message in case of failure.
 * @param {...*} var_args The items to substitute into the failure message.
 * @return {number} The value, guaranteed to be a number when asserts enabled.
 * @throws {goog.asserts.AssertionError} When the value is not a number.
 * @closurePrimitive {asserts.matchesReturn}
 */
goog.asserts.assertNumber = function(value, opt_message, var_args) {
  'use strict';
  if (goog.asserts.ENABLE_ASSERTS && typeof value !== 'number') {
    goog.asserts.doAssertFailure_(
        'Expected number but got %s: %s.', [goog.typeOf(value), value],
        opt_message, Array.prototype.slice.call(arguments, 2));
  }
  return /** @type {number} */ (value);
};


/**
 * Checks if the value is a string if goog.asserts.ENABLE_ASSERTS is true.
 * @param {*} value The value to check.
 * @param {string=} opt_message Error message in case of failure.
 * @param {...*} var_args The items to substitute into the failure message.
 * @return {string} The value, guaranteed to be a string when asserts enabled.
 * @throws {goog.asserts.AssertionError} When the value is not a string.
 * @closurePrimitive {asserts.matchesReturn}
 */
goog.asserts.assertString = function(value, opt_message, var_args) {
  'use strict';
  if (goog.asserts.ENABLE_ASSERTS && typeof value !== 'string') {
    goog.asserts.doAssertFailure_(
        'Expected string but got %s: %s.', [goog.typeOf(value), value],
        opt_message, Array.prototype.slice.call(arguments, 2));
  }
  return /** @type {string} */ (value);
};


/**
 * Checks if the value is a function if goog.asserts.ENABLE_ASSERTS is true.
 * @param {*} value The value to check.
 * @param {string=} opt_message Error message in case of failure.
 * @param {...*} var_args The items to substitute into the failure message.
 * @return {!Function} The value, guaranteed to be a function when asserts
 *     enabled.
 * @throws {goog.asserts.AssertionError} When the value is not a function.
 * @closurePrimitive {asserts.matchesReturn}
 */
goog.asserts.assertFunction = function(value, opt_message, var_args) {
  'use strict';
  if (goog.asserts.ENABLE_ASSERTS && typeof value !== 'function') {
    goog.asserts.doAssertFailure_(
        'Expected function but got %s: %s.', [goog.typeOf(value), value],
        opt_message, Array.prototype.slice.call(arguments, 2));
  }
  return /** @type {!Function} */ (value);
};


/**
 * Checks if the value is an Object if goog.asserts.ENABLE_ASSERTS is true.
 * @param {*} value The value to check.
 * @param {string=} opt_message Error message in case of failure.
 * @param {...*} var_args The items to substitute into the failure message.
 * @return {!Object} The value, guaranteed to be a non-null object.
 * @throws {goog.asserts.AssertionError} When the value is not an object.
 * @closurePrimitive {asserts.matchesReturn}
 */
goog.asserts.assertObject = function(value, opt_message, var_args) {
  'use strict';
  if (goog.asserts.ENABLE_ASSERTS && !goog.isObject(value)) {
    goog.asserts.doAssertFailure_(
        'Expected object but got %s: %s.', [goog.typeOf(value), value],
        opt_message, Array.prototype.slice.call(arguments, 2));
  }
  return /** @type {!Object} */ (value);
};


/**
 * Checks if the value is an Array if goog.asserts.ENABLE_ASSERTS is true.
 * @param {*} value The value to check.
 * @param {string=} opt_message Error message in case of failure.
 * @param {...*} var_args The items to substitute into the failure message.
 * @return {!Array<?>} The value, guaranteed to be a non-null array.
 * @throws {goog.asserts.AssertionError} When the value is not an array.
 * @closurePrimitive {asserts.matchesReturn}
 */
goog.asserts.assertArray = function(value, opt_message, var_args) {
  'use strict';
  if (goog.asserts.ENABLE_ASSERTS && !Array.isArray(value)) {
    goog.asserts.doAssertFailure_(
        'Expected array but got %s: %s.', [goog.typeOf(value), value],
        opt_message, Array.prototype.slice.call(arguments, 2));
  }
  return /** @type {!Array<?>} */ (value);
};


/**
 * Checks if the value is a boolean if goog.asserts.ENABLE_ASSERTS is true.
 * @param {*} value The value to check.
 * @param {string=} opt_message Error message in case of failure.
 * @param {...*} var_args The items to substitute into the failure message.
 * @return {boolean} The value, guaranteed to be a boolean when asserts are
 *     enabled.
 * @throws {goog.asserts.AssertionError} When the value is not a boolean.
 * @closurePrimitive {asserts.matchesReturn}
 */
goog.asserts.assertBoolean = function(value, opt_message, var_args) {
  'use strict';
  if (goog.asserts.ENABLE_ASSERTS && typeof value !== 'boolean') {
    goog.asserts.doAssertFailure_(
        'Expected boolean but got %s: %s.', [goog.typeOf(value), value],
        opt_message, Array.prototype.slice.call(arguments, 2));
  }
  return /** @type {boolean} */ (value);
};


/**
 * Checks if the value is a DOM Element if goog.asserts.ENABLE_ASSERTS is true.
 * @param {*} value The value to check.
 * @param {string=} opt_message Error message in case of failure.
 * @param {...*} var_args The items to substitute into the failure message.
 * @return {!Element} The value, likely to be a DOM Element when asserts are
 *     enabled.
 * @throws {goog.asserts.AssertionError} When the value is not an Element.
 * @closurePrimitive {asserts.matchesReturn}
 * @deprecated Use goog.asserts.dom.assertIsElement instead.
 */
goog.asserts.assertElement = function(value, opt_message, var_args) {
  'use strict';
  if (goog.asserts.ENABLE_ASSERTS &&
      (!goog.isObject(value) ||
       /** @type {!Node} */ (value).nodeType != goog.dom.NodeType.ELEMENT)) {
    goog.asserts.doAssertFailure_(
        'Expected Element but got %s: %s.', [goog.typeOf(value), value],
        opt_message, Array.prototype.slice.call(arguments, 2));
  }
  return /** @type {!Element} */ (value);
};


/**
 * Checks if the value is an instance of the user-defined type if
 * goog.asserts.ENABLE_ASSERTS is true.
 *
 * The compiler may tighten the type returned by this function.
 *
 * Do not use this to ensure a value is an HTMLElement or a subclass! Cross-
 * document DOM inherits from separate - though identical - browser classes, and
 * such a check will unexpectedly fail. Please use the methods in
 * goog.asserts.dom for these purposes.
 *
 * @param {?} value The value to check.
 * @param {function(new: T, ...)} type A user-defined constructor.
 * @param {string=} opt_message Error message in case of failure.
 * @param {...*} var_args The items to substitute into the failure message.
 * @throws {goog.asserts.AssertionError} When the value is not an instance of
 *     type.
 * @return {T}
 * @template T
 * @closurePrimitive {asserts.matchesReturn}
 */
goog.asserts.assertInstanceof = function(value, type, opt_message, var_args) {
  'use strict';
  if (goog.asserts.ENABLE_ASSERTS && !(value instanceof type)) {
    goog.asserts.doAssertFailure_(
        'Expected instanceof %s but got %s.',
        [goog.asserts.getType_(type), goog.asserts.getType_(value)],
        opt_message, Array.prototype.slice.call(arguments, 3));
  }
  return value;
};


/**
 * Checks whether the value is a finite number, if goog.asserts.ENABLE_ASSERTS
 * is true.
 *
 * @param {*} value The value to check.
 * @param {string=} opt_message Error message in case of failure.
 * @param {...*} var_args The items to substitute into the failure message.
 * @throws {goog.asserts.AssertionError} When the value is not a number, or is
 *     a non-finite number such as NaN, Infinity or -Infinity.
 * @return {number} The value initially passed in.
 */
goog.asserts.assertFinite = function(value, opt_message, var_args) {
  'use strict';
  if (goog.asserts.ENABLE_ASSERTS &&
      (typeof value != 'number' || !isFinite(value))) {
    goog.asserts.doAssertFailure_(
        'Expected %s to be a finite number but it is not.', [value],
        opt_message, Array.prototype.slice.call(arguments, 2));
  }
  return /** @type {number} */ (value);
};

/**
 * Returns the type of a value. If a constructor is passed, and a suitable
 * string cannot be found, 'unknown type name' will be returned.
 * @param {*} value A constructor, object, or primitive.
 * @return {string} The best display name for the value, or 'unknown type name'.
 * @private
 */
goog.asserts.getType_ = function(value) {
  'use strict';
  if (value instanceof Function) {
    return value.displayName || value.name || 'unknown type name';
  } else if (value instanceof Object) {
    return /** @type {string} */ (value.constructor.displayName) ||
        value.constructor.name || Object.prototype.toString.call(value);
  } else {
    return value === null ? 'null' : typeof value;
  }
};

//third_party/javascript/closure/array/array.js
goog.loadModule(function(exports) {'use strict';/**
 * @license
 * Copyright The Closure Library Authors.
 * SPDX-License-Identifier: Apache-2.0
 */

/**
 * @fileoverview Utilities for manipulating arrays.
 */


goog.module('goog.array');
goog.module.declareLegacyNamespace();

const asserts = goog.require('goog.asserts');


/**
 * @define {boolean} NATIVE_ARRAY_PROTOTYPES indicates whether the code should
 * rely on Array.prototype functions, if available.
 *
 * The Array.prototype functions can be defined by external libraries like
 * Prototype and setting this flag to false forces closure to use its own
 * goog.array implementation.
 *
 * If your javascript can be loaded by a third party site and you are wary about
 * relying on the prototype functions, specify
 * "--define goog.NATIVE_ARRAY_PROTOTYPES=false" to the JSCompiler.
 *
 * Setting goog.TRUSTED_SITE to false will automatically set
 * NATIVE_ARRAY_PROTOTYPES to false.
 */
goog.NATIVE_ARRAY_PROTOTYPES =
    goog.define('goog.NATIVE_ARRAY_PROTOTYPES', goog.TRUSTED_SITE);


/**
 * @define {boolean} If true, JSCompiler will use the native implementation of
 * array functions where appropriate (e.g., `Array#filter`) and remove the
 * unused pure JS implementation.
 */
const ASSUME_NATIVE_FUNCTIONS = goog.define(
    'goog.array.ASSUME_NATIVE_FUNCTIONS', goog.FEATURESET_YEAR > 2012);
exports.ASSUME_NATIVE_FUNCTIONS = ASSUME_NATIVE_FUNCTIONS;


/**
 * Returns the last element in an array without removing it.
 * Same as {@link goog.array.last}.
 * @param {IArrayLike<T>|string} array The array.
 * @return {T} Last item in array.
 * @template T
 */
function peek(array) {
  return array[array.length - 1];
}
exports.peek = peek;


/**
 * Returns the last element in an array without removing it.
 * Same as {@link goog.array.peek}.
 * @param {IArrayLike<T>|string} array The array.
 * @return {T} Last item in array.
 * @template T
 */
exports.last = peek;

// NOTE(arv): Since most of the array functions are generic it allows you to
// pass an array-like object. Strings have a length and are considered array-
// like. However, the 'in' operator does not work on strings so we cannot just
// use the array path even if the browser supports indexing into strings. We
// therefore end up splitting the string.


/**
 * Returns the index of the first element of an array with a specified value, or
 * -1 if the element is not present in the array.
 *
 * See {@link http://tinyurl.com/developer-mozilla-org-array-indexof}
 *
 * @param {IArrayLike<T>|string} arr The array to be searched.
 * @param {T} obj The object for which we are searching.
 * @param {number=} opt_fromIndex The index at which to start the search. If
 *     omitted the search starts at index 0.
 * @return {number} The index of the first matching array element.
 * @template T
 */
const indexOf = goog.NATIVE_ARRAY_PROTOTYPES &&
        (ASSUME_NATIVE_FUNCTIONS || Array.prototype.indexOf) ?
    function(arr, obj, opt_fromIndex) {
      asserts.assert(arr.length != null);

      return Array.prototype.indexOf.call(arr, obj, opt_fromIndex);
    } :
    function(arr, obj, opt_fromIndex) {
      const fromIndex = opt_fromIndex == null ?
          0 :
          (opt_fromIndex < 0 ? Math.max(0, arr.length + opt_fromIndex) :
                               opt_fromIndex);

      if (typeof arr === 'string') {
        // Array.prototype.indexOf uses === so only strings should be found.
        if (typeof obj !== 'string' || obj.length != 1) {
          return -1;
        }
        return arr.indexOf(obj, fromIndex);
      }

      for (let i = fromIndex; i < arr.length; i++) {
        if (i in arr && arr[i] === obj) return i;
      }
      return -1;
    };
exports.indexOf = indexOf;


/**
 * Returns the index of the last element of an array with a specified value, or
 * -1 if the element is not present in the array.
 *
 * See {@link http://tinyurl.com/developer-mozilla-org-array-lastindexof}
 *
 * @param {!IArrayLike<T>|string} arr The array to be searched.
 * @param {T} obj The object for which we are searching.
 * @param {?number=} opt_fromIndex The index at which to start the search. If
 *     omitted the search starts at the end of the array.
 * @return {number} The index of the last matching array element.
 * @template T
 */
const lastIndexOf = goog.NATIVE_ARRAY_PROTOTYPES &&
        (ASSUME_NATIVE_FUNCTIONS || Array.prototype.lastIndexOf) ?
    function(arr, obj, opt_fromIndex) {
      asserts.assert(arr.length != null);

      // Firefox treats undefined and null as 0 in the fromIndex argument which
      // leads it to always return -1
      const fromIndex = opt_fromIndex == null ? arr.length - 1 : opt_fromIndex;
      return Array.prototype.lastIndexOf.call(arr, obj, fromIndex);
    } :
    function(arr, obj, opt_fromIndex) {
      let fromIndex = opt_fromIndex == null ? arr.length - 1 : opt_fromIndex;

      if (fromIndex < 0) {
        fromIndex = Math.max(0, arr.length + fromIndex);
      }

      if (typeof arr === 'string') {
        // Array.prototype.lastIndexOf uses === so only strings should be found.
        if (typeof obj !== 'string' || obj.length != 1) {
          return -1;
        }
        return arr.lastIndexOf(obj, fromIndex);
      }

      for (let i = fromIndex; i >= 0; i--) {
        if (i in arr && arr[i] === obj) return i;
      }
      return -1;
    };
exports.lastIndexOf = lastIndexOf;


/**
 * Calls a function for each element in an array. Skips holes in the array.
 * See {@link http://tinyurl.com/developer-mozilla-org-array-foreach}
 *
 * @param {IArrayLike<T>|string} arr Array or array like object over
 *     which to iterate.
 * @param {?function(this: S, T, number, ?): ?} f The function to call for every
 *     element. This function takes 3 arguments (the element, the index and the
 *     array). The return value is ignored.
 * @param {S=} opt_obj The object to be used as the value of 'this' within f.
 * @template T,S
 */
const forEach = goog.NATIVE_ARRAY_PROTOTYPES &&
        (ASSUME_NATIVE_FUNCTIONS || Array.prototype.forEach) ?
    function(arr, f, opt_obj) {
      asserts.assert(arr.length != null);

      Array.prototype.forEach.call(arr, f, opt_obj);
    } :
    function(arr, f, opt_obj) {
      const l = arr.length;  // must be fixed during loop... see docs
      const arr2 = (typeof arr === 'string') ? arr.split('') : arr;
      for (let i = 0; i < l; i++) {
        if (i in arr2) {
          f.call(/** @type {?} */ (opt_obj), arr2[i], i, arr);
        }
      }
    };
exports.forEach = forEach;


/**
 * Calls a function for each element in an array, starting from the last
 * element rather than the first.
 *
 * @param {IArrayLike<T>|string} arr Array or array
 *     like object over which to iterate.
 * @param {?function(this: S, T, number, ?): ?} f The function to call for every
 *     element. This function
 *     takes 3 arguments (the element, the index and the array). The return
 *     value is ignored.
 * @param {S=} opt_obj The object to be used as the value of 'this'
 *     within f.
 * @template T,S
 */
function forEachRight(arr, f, opt_obj) {
  const l = arr.length;  // must be fixed during loop... see docs
  const arr2 = (typeof arr === 'string') ? arr.split('') : arr;
  for (let i = l - 1; i >= 0; --i) {
    if (i in arr2) {
      f.call(/** @type {?} */ (opt_obj), arr2[i], i, arr);
    }
  }
}
exports.forEachRight = forEachRight;


/**
 * Calls a function for each element in an array, and if the function returns
 * true adds the element to a new array.
 *
 * See {@link http://tinyurl.com/developer-mozilla-org-array-filter}
 *
 * @param {IArrayLike<T>|string} arr Array or array
 *     like object over which to iterate.
 * @param {?function(this:S, T, number, ?):boolean} f The function to call for
 *     every element. This function
 *     takes 3 arguments (the element, the index and the array) and must
 *     return a Boolean. If the return value is true the element is added to the
 *     result array. If it is false the element is not included.
 * @param {S=} opt_obj The object to be used as the value of 'this'
 *     within f.
 * @return {!Array<T>} a new array in which only elements that passed the test
 *     are present.
 * @template T,S
 */
const filter = goog.NATIVE_ARRAY_PROTOTYPES &&
        (ASSUME_NATIVE_FUNCTIONS || Array.prototype.filter) ?
    function(arr, f, opt_obj) {
      asserts.assert(arr.length != null);

      return Array.prototype.filter.call(arr, f, opt_obj);
    } :
    function(arr, f, opt_obj) {
      const l = arr.length;  // must be fixed during loop... see docs
      const res = [];
      let resLength = 0;
      const arr2 = (typeof arr === 'string') ? arr.split('') : arr;
      for (let i = 0; i < l; i++) {
        if (i in arr2) {
          const val = arr2[i];  // in case f mutates arr2
          if (f.call(/** @type {?} */ (opt_obj), val, i, arr)) {
            res[resLength++] = val;
          }
        }
      }
      return res;
    };
exports.filter = filter;


/**
 * Calls a function for each element in an array and inserts the result into a
 * new array.
 *
 * See {@link http://tinyurl.com/developer-mozilla-org-array-map}
 *
 * @param {IArrayLike<VALUE>|string} arr Array or array like object
 *     over which to iterate.
 * @param {function(this:THIS, VALUE, number, ?): RESULT} f The function to call
 *     for every element. This function takes 3 arguments (the element,
 *     the index and the array) and should return something. The result will be
 *     inserted into a new array.
 * @param {THIS=} opt_obj The object to be used as the value of 'this' within f.
 * @return {!Array<RESULT>} a new array with the results from f.
 * @template THIS, VALUE, RESULT
 */
const map = goog.NATIVE_ARRAY_PROTOTYPES &&
        (ASSUME_NATIVE_FUNCTIONS || Array.prototype.map) ?
    function(arr, f, opt_obj) {
      asserts.assert(arr.length != null);

      return Array.prototype.map.call(arr, f, opt_obj);
    } :
    function(arr, f, opt_obj) {
      const l = arr.length;  // must be fixed during loop... see docs
      const res = new Array(l);
      const arr2 = (typeof arr === 'string') ? arr.split('') : arr;
      for (let i = 0; i < l; i++) {
        if (i in arr2) {
          res[i] = f.call(/** @type {?} */ (opt_obj), arr2[i], i, arr);
        }
      }
      return res;
    };
exports.map = map;


/**
 * Passes every element of an array into a function and accumulates the result.
 *
 * See {@link http://tinyurl.com/developer-mozilla-org-array-reduce}
 * Note that this implementation differs from the native Array.prototype.reduce
 * in that the initial value is assumed to be defined (the MDN docs linked above
 * recommend not omitting this parameter, although it is technically optional).
 *
 * For example:
 * var a = [1, 2, 3, 4];
 * reduce(a, function(r, v, i, arr) {return r + v;}, 0);
 * returns 10
 *
 * @param {IArrayLike<T>|string} arr Array or array
 *     like object over which to iterate.
 * @param {function(this:S, R, T, number, ?) : R} f The function to call for
 *     every element. This function
 *     takes 4 arguments (the function's previous result or the initial value,
 *     the value of the current array element, the current array index, and the
 *     array itself)
 *     function(previousValue, currentValue, index, array).
 * @param {?} val The initial value to pass into the function on the first call.
 * @param {S=} opt_obj  The object to be used as the value of 'this'
 *     within f.
 * @return {R} Result of evaluating f repeatedly across the values of the array.
 * @template T,S,R
 */
const reduce = goog.NATIVE_ARRAY_PROTOTYPES &&
        (ASSUME_NATIVE_FUNCTIONS || Array.prototype.reduce) ?
    function(arr, f, val, opt_obj) {
      asserts.assert(arr.length != null);
      if (opt_obj) {
        f = goog.bind(f, opt_obj);
      }
      return Array.prototype.reduce.call(arr, f, val);
    } :
    function(arr, f, val, opt_obj) {
      let rval = val;
      forEach(arr, function(val, index) {
        rval = f.call(/** @type {?} */ (opt_obj), rval, val, index, arr);
      });
      return rval;
    };
exports.reduce = reduce;


/**
 * Passes every element of an array into a function and accumulates the result,
 * starting from the last element and working towards the first.
 *
 * See {@link http://tinyurl.com/developer-mozilla-org-array-reduceright}
 *
 * For example:
 * var a = ['a', 'b', 'c'];
 * reduceRight(a, function(r, v, i, arr) {return r + v;}, '');
 * returns 'cba'
 *
 * @param {IArrayLike<T>|string} arr Array or array
 *     like object over which to iterate.
 * @param {?function(this:S, R, T, number, ?) : R} f The function to call for
 *     every element. This function
 *     takes 4 arguments (the function's previous result or the initial value,
 *     the value of the current array element, the current array index, and the
 *     array itself)
 *     function(previousValue, currentValue, index, array).
 * @param {?} val The initial value to pass into the function on the first call.
 * @param {S=} opt_obj The object to be used as the value of 'this'
 *     within f.
 * @return {R} Object returned as a result of evaluating f repeatedly across the
 *     values of the array.
 * @template T,S,R
 */
const reduceRight = goog.NATIVE_ARRAY_PROTOTYPES &&
        (ASSUME_NATIVE_FUNCTIONS || Array.prototype.reduceRight) ?
    function(arr, f, val, opt_obj) {
      asserts.assert(arr.length != null);
      asserts.assert(f != null);
      if (opt_obj) {
        f = goog.bind(f, opt_obj);
      }
      return Array.prototype.reduceRight.call(arr, f, val);
    } :
    function(arr, f, val, opt_obj) {
      let rval = val;
      forEachRight(arr, function(val, index) {
        rval = f.call(/** @type {?} */ (opt_obj), rval, val, index, arr);
      });
      return rval;
    };
exports.reduceRight = reduceRight;


/**
 * Calls f for each element of an array. If any call returns true, some()
 * returns true (without checking the remaining elements). If all calls
 * return false, some() returns false.
 *
 * See {@link http://tinyurl.com/developer-mozilla-org-array-some}
 *
 * @param {IArrayLike<T>|string} arr Array or array
 *     like object over which to iterate.
 * @param {?function(this:S, T, number, ?) : boolean} f The function to call for
 *     for every element. This function takes 3 arguments (the element, the
 *     index and the array) and should return a boolean.
 * @param {S=} opt_obj  The object to be used as the value of 'this'
 *     within f.
 * @return {boolean} true if any element passes the test.
 * @template T,S
 */
const some = goog.NATIVE_ARRAY_PROTOTYPES &&
        (ASSUME_NATIVE_FUNCTIONS || Array.prototype.some) ?
    function(arr, f, opt_obj) {
      asserts.assert(arr.length != null);

      return Array.prototype.some.call(arr, f, opt_obj);
    } :
    function(arr, f, opt_obj) {
      const l = arr.length;  // must be fixed during loop... see docs
      const arr2 = (typeof arr === 'string') ? arr.split('') : arr;
      for (let i = 0; i < l; i++) {
        if (i in arr2 && f.call(/** @type {?} */ (opt_obj), arr2[i], i, arr)) {
          return true;
        }
      }
      return false;
    };
exports.some = some;


/**
 * Call f for each element of an array. If all calls return true, every()
 * returns true. If any call returns false, every() returns false and
 * does not continue to check the remaining elements.
 *
 * See {@link http://tinyurl.com/developer-mozilla-org-array-every}
 *
 * @param {IArrayLike<T>|string} arr Array or array
 *     like object over which to iterate.
 * @param {?function(this:S, T, number, ?) : boolean} f The function to call for
 *     for every element. This function takes 3 arguments (the element, the
 *     index and the array) and should return a boolean.
 * @param {S=} opt_obj The object to be used as the value of 'this'
 *     within f.
 * @return {boolean} false if any element fails the test.
 * @template T,S
 */
const every = goog.NATIVE_ARRAY_PROTOTYPES &&
        (ASSUME_NATIVE_FUNCTIONS || Array.prototype.every) ?
    function(arr, f, opt_obj) {
      asserts.assert(arr.length != null);

      return Array.prototype.every.call(arr, f, opt_obj);
    } :
    function(arr, f, opt_obj) {
      const l = arr.length;  // must be fixed during loop... see docs
      const arr2 = (typeof arr === 'string') ? arr.split('') : arr;
      for (let i = 0; i < l; i++) {
        if (i in arr2 && !f.call(/** @type {?} */ (opt_obj), arr2[i], i, arr)) {
          return false;
        }
      }
      return true;
    };
exports.every = every;


/**
 * Counts the array elements that fulfill the predicate, i.e. for which the
 * callback function returns true. Skips holes in the array.
 *
 * @param {!IArrayLike<T>|string} arr Array or array like object
 *     over which to iterate.
 * @param {function(this: S, T, number, ?): boolean} f The function to call for
 *     every element. Takes 3 arguments (the element, the index and the array).
 * @param {S=} opt_obj The object to be used as the value of 'this' within f.
 * @return {number} The number of the matching elements.
 * @template T,S
 */
function count(arr, f, opt_obj) {
  let count = 0;
  forEach(arr, function(element, index, arr) {
    if (f.call(/** @type {?} */ (opt_obj), element, index, arr)) {
      ++count;
    }
  }, opt_obj);
  return count;
}
exports.count = count;


/**
 * Search an array for the first element that satisfies a given condition and
 * return that element.
 * @param {IArrayLike<T>|string} arr Array or array
 *     like object over which to iterate.
 * @param {?function(this:S, T, number, ?) : boolean} f The function to call
 *     for every element. This function takes 3 arguments (the element, the
 *     index and the array) and should return a boolean.
 * @param {S=} opt_obj An optional "this" context for the function.
 * @return {T|null} The first array element that passes the test, or null if no
 *     element is found.
 * @template T,S
 */
function find(arr, f, opt_obj) {
  const i = findIndex(arr, f, opt_obj);
  return i < 0 ? null : typeof arr === 'string' ? arr.charAt(i) : arr[i];
}
exports.find = find;


/**
 * Search an array for the first element that satisfies a given condition and
 * return its index.
 * @param {IArrayLike<T>|string} arr Array or array
 *     like object over which to iterate.
 * @param {?function(this:S, T, number, ?) : boolean} f The function to call for
 *     every element. This function
 *     takes 3 arguments (the element, the index and the array) and should
 *     return a boolean.
 * @param {S=} opt_obj An optional "this" context for the function.
 * @return {number} The index of the first array element that passes the test,
 *     or -1 if no element is found.
 * @template T,S
 */
function findIndex(arr, f, opt_obj) {
  const l = arr.length;  // must be fixed during loop... see docs
  const arr2 = (typeof arr === 'string') ? arr.split('') : arr;
  for (let i = 0; i < l; i++) {
    if (i in arr2 && f.call(/** @type {?} */ (opt_obj), arr2[i], i, arr)) {
      return i;
    }
  }
  return -1;
}
exports.findIndex = findIndex;


/**
 * Search an array (in reverse order) for the last element that satisfies a
 * given condition and return that element.
 * @param {IArrayLike<T>|string} arr Array or array
 *     like object over which to iterate.
 * @param {?function(this:S, T, number, ?) : boolean} f The function to call
 *     for every element. This function
 *     takes 3 arguments (the element, the index and the array) and should
 *     return a boolean.
 * @param {S=} opt_obj An optional "this" context for the function.
 * @return {T|null} The last array element that passes the test, or null if no
 *     element is found.
 * @template T,S
 */
function findRight(arr, f, opt_obj) {
  const i = findIndexRight(arr, f, opt_obj);
  return i < 0 ? null : typeof arr === 'string' ? arr.charAt(i) : arr[i];
}
exports.findRight = findRight;


/**
 * Search an array (in reverse order) for the last element that satisfies a
 * given condition and return its index.
 * @param {IArrayLike<T>|string} arr Array or array
 *     like object over which to iterate.
 * @param {?function(this:S, T, number, ?) : boolean} f The function to call
 *     for every element. This function
 *     takes 3 arguments (the element, the index and the array) and should
 *     return a boolean.
 * @param {S=} opt_obj An optional "this" context for the function.
 * @return {number} The index of the last array element that passes the test,
 *     or -1 if no element is found.
 * @template T,S
 */
function findIndexRight(arr, f, opt_obj) {
  const l = arr.length;  // must be fixed during loop... see docs
  const arr2 = (typeof arr === 'string') ? arr.split('') : arr;
  for (let i = l - 1; i >= 0; i--) {
    if (i in arr2 && f.call(/** @type {?} */ (opt_obj), arr2[i], i, arr)) {
      return i;
    }
  }
  return -1;
}
exports.findIndexRight = findIndexRight;


/**
 * Whether the array contains the given object.
 * @param {IArrayLike<?>|string} arr The array to test for the presence of the
 *     element.
 * @param {*} obj The object for which to test.
 * @return {boolean} true if obj is present.
 */
function contains(arr, obj) {
  return indexOf(arr, obj) >= 0;
}
exports.contains = contains;


/**
 * Whether the array is empty.
 * @param {IArrayLike<?>|string} arr The array to test.
 * @return {boolean} true if empty.
 */
function isEmpty(arr) {
  return arr.length == 0;
}
exports.isEmpty = isEmpty;


/**
 * Clears the array.
 * @param {IArrayLike<?>} arr Array or array like object to clear.
 */
function clear(arr) {
  // For non real arrays we don't have the magic length so we delete the
  // indices.
  if (!Array.isArray(arr)) {
    for (let i = arr.length - 1; i >= 0; i--) {
      delete arr[i];
    }
  }
  arr.length = 0;
}
exports.clear = clear;


/**
 * Pushes an item into an array, if it's not already in the array.
 * @param {Array<T>} arr Array into which to insert the item.
 * @param {T} obj Value to add.
 * @template T
 */
function insert(arr, obj) {
  if (!contains(arr, obj)) {
    arr.push(obj);
  }
}
exports.insert = insert;


/**
 * Inserts an object at the given index of the array.
 * @param {IArrayLike<?>} arr The array to modify.
 * @param {*} obj The object to insert.
 * @param {number=} opt_i The index at which to insert the object. If omitted,
 *      treated as 0. A negative index is counted from the end of the array.
 */
function insertAt(arr, obj, opt_i) {
  splice(arr, opt_i, 0, obj);
}
exports.insertAt = insertAt;


/**
 * Inserts at the given index of the array, all elements of another array.
 * @param {IArrayLike<?>} arr The array to modify.
 * @param {IArrayLike<?>} elementsToAdd The array of elements to add.
 * @param {number=} opt_i The index at which to insert the object. If omitted,
 *      treated as 0. A negative index is counted from the end of the array.
 */
function insertArrayAt(arr, elementsToAdd, opt_i) {
  goog.partial(splice, arr, opt_i, 0).apply(null, elementsToAdd);
}
exports.insertArrayAt = insertArrayAt;


/**
 * Inserts an object into an array before a specified object.
 * @param {Array<T>} arr The array to modify.
 * @param {T} obj The object to insert.
 * @param {T=} opt_obj2 The object before which obj should be inserted. If obj2
 *     is omitted or not found, obj is inserted at the end of the array.
 * @template T
 */
function insertBefore(arr, obj, opt_obj2) {
  let i;
  if (arguments.length == 2 || (i = indexOf(arr, opt_obj2)) < 0) {
    arr.push(obj);
  } else {
    insertAt(arr, obj, i);
  }
}
exports.insertBefore = insertBefore;


/**
 * Removes the first occurrence of a particular value from an array.
 * @param {IArrayLike<T>} arr Array from which to remove
 *     value.
 * @param {T} obj Object to remove.
 * @return {boolean} True if an element was removed.
 * @template T
 */
function remove(arr, obj) {
  const i = indexOf(arr, obj);
  let rv;
  if ((rv = i >= 0)) {
    removeAt(arr, i);
  }
  return rv;
}
exports.remove = remove;


/**
 * Removes the last occurrence of a particular value from an array.
 * @param {!IArrayLike<T>} arr Array from which to remove value.
 * @param {T} obj Object to remove.
 * @return {boolean} True if an element was removed.
 * @template T
 */
function removeLast(arr, obj) {
  const i = lastIndexOf(arr, obj);
  if (i >= 0) {
    removeAt(arr, i);
    return true;
  }
  return false;
}
exports.removeLast = removeLast;


/**
 * Removes from an array the element at index i
 * @param {IArrayLike<?>} arr Array or array like object from which to
 *     remove value.
 * @param {number} i The index to remove.
 * @return {boolean} True if an element was removed.
 */
function removeAt(arr, i) {
  asserts.assert(arr.length != null);

  // use generic form of splice
  // splice returns the removed items and if successful the length of that
  // will be 1
  return Array.prototype.splice.call(arr, i, 1).length == 1;
}
exports.removeAt = removeAt;


/**
 * Removes the first value that satisfies the given condition.
 * @param {IArrayLike<T>} arr Array or array
 *     like object over which to iterate.
 * @param {?function(this:S, T, number, ?) : boolean} f The function to call
 *     for every element. This function
 *     takes 3 arguments (the element, the index and the array) and should
 *     return a boolean.
 * @param {S=} opt_obj An optional "this" context for the function.
 * @return {boolean} True if an element was removed.
 * @template T,S
 */
function removeIf(arr, f, opt_obj) {
  const i = findIndex(arr, f, opt_obj);
  if (i >= 0) {
    removeAt(arr, i);
    return true;
  }
  return false;
}
exports.removeIf = removeIf;


/**
 * Removes all values that satisfy the given condition.
 * @param {IArrayLike<T>} arr Array or array
 *     like object over which to iterate.
 * @param {?function(this:S, T, number, ?) : boolean} f The function to call
 *     for every element. This function
 *     takes 3 arguments (the element, the index and the array) and should
 *     return a boolean.
 * @param {S=} opt_obj An optional "this" context for the function.
 * @return {number} The number of items removed
 * @template T,S
 */
function removeAllIf(arr, f, opt_obj) {
  let removedCount = 0;
  forEachRight(arr, function(val, index) {
    if (f.call(/** @type {?} */ (opt_obj), val, index, arr)) {
      if (removeAt(arr, index)) {
        removedCount++;
      }
    }
  });
  return removedCount;
}
exports.removeAllIf = removeAllIf;


/**
 * Returns a new array that is the result of joining the arguments.  If arrays
 * are passed then their items are added, however, if non-arrays are passed they
 * will be added to the return array as is.
 *
 * Note that ArrayLike objects will be added as is, rather than having their
 * items added.
 *
 * concat([1, 2], [3, 4]) -> [1, 2, 3, 4]
 * concat(0, [1, 2]) -> [0, 1, 2]
 * concat([1, 2], null) -> [1, 2, null]
 *
 * There is bug in all current versions of IE (6, 7 and 8) where arrays created
 * in an iframe become corrupted soon (not immediately) after the iframe is
 * destroyed. This is common if loading data via goog.net.IframeIo, for example.
 * This corruption only affects the concat method which will start throwing
 * Catastrophic Errors (#-2147418113).
 *
 * See http://endoflow.com/scratch/corrupted-arrays.html for a test case.
 *
 * Internally goog.array should use this, so that all methods will continue to
 * work on these broken array objects.
 *
 * @param {...*} var_args Items to concatenate.  Arrays will have each item
 *     added, while primitives and objects will be added as is.
 * @return {!Array<?>} The new resultant array.
 */
function concat(var_args) {
  return Array.prototype.concat.apply([], arguments);
}
exports.concat = concat;


/**
 * Returns a new array that contains the contents of all the arrays passed.
 * @param {...!Array<T>} var_args
 * @return {!Array<T>}
 * @template T
 */
function join(var_args) {
  return Array.prototype.concat.apply([], arguments);
}
exports.join = join;


/**
 * Converts an object to an array.
 * @param {IArrayLike<T>|string} object  The object to convert to an
 *     array.
 * @return {!Array<T>} The object converted into an array. If object has a
 *     length property, every property indexed with a non-negative number
 *     less than length will be included in the result. If object does not
 *     have a length property, an empty array will be returned.
 * @template T
 */
function toArray(object) {
  const length = object.length;

  // If length is not a number the following is false. This case is kept for
  // backwards compatibility since there are callers that pass objects that are
  // not array like.
  if (length > 0) {
    const rv = new Array(length);
    for (let i = 0; i < length; i++) {
      rv[i] = object[i];
    }
    return rv;
  }
  return [];
}
exports.toArray = toArray;


/**
 * Does a shallow copy of an array.
 * @param {IArrayLike<T>|string} arr  Array or array-like object to
 *     clone.
 * @return {!Array<T>} Clone of the input array.
 * @template T
 */
const clone = toArray;
exports.clone = clone;


/**
 * Extends an array with another array, element, or "array like" object.
 * This function operates 'in-place', it does not create a new Array.
 *
 * Example:
 * var a = [];
 * extend(a, [0, 1]);
 * a; // [0, 1]
 * extend(a, 2);
 * a; // [0, 1, 2]
 *
 * @param {Array<VALUE>} arr1  The array to modify.
 * @param {...(IArrayLike<VALUE>|VALUE)} var_args The elements or arrays of
 *     elements to add to arr1.
 * @template VALUE
 */
function extend(arr1, var_args) {
  for (let i = 1; i < arguments.length; i++) {
    const arr2 = arguments[i];
    if (goog.isArrayLike(arr2)) {
      const len1 = arr1.length || 0;
      const len2 = arr2.length || 0;
      arr1.length = len1 + len2;
      for (let j = 0; j < len2; j++) {
        arr1[len1 + j] = arr2[j];
      }
    } else {
      arr1.push(arr2);
    }
  }
}
exports.extend = extend;


/**
 * Adds or removes elements from an array. This is a generic version of Array
 * splice. This means that it might work on other objects similar to arrays,
 * such as the arguments object.
 *
 * @param {IArrayLike<T>} arr The array to modify.
 * @param {number|undefined} index The index at which to start changing the
 *     array. If not defined, treated as 0.
 * @param {number} howMany How many elements to remove (0 means no removal. A
 *     value below 0 is treated as zero and so is any other non number. Numbers
 *     are floored).
 * @param {...T} var_args Optional, additional elements to insert into the
 *     array.
 * @return {!Array<T>} the removed elements.
 * @template T
 */
function splice(arr, index, howMany, var_args) {
  asserts.assert(arr.length != null);

  return Array.prototype.splice.apply(arr, slice(arguments, 1));
}
exports.splice = splice;


/**
 * Returns a new array from a segment of an array. This is a generic version of
 * Array slice. This means that it might work on other objects similar to
 * arrays, such as the arguments object.
 *
 * @param {IArrayLike<T>|string} arr The array from
 * which to copy a segment.
 * @param {number} start The index of the first element to copy.
 * @param {number=} opt_end The index after the last element to copy.
 * @return {!Array<T>} A new array containing the specified segment of the
 *     original array.
 * @template T
 */
function slice(arr, start, opt_end) {
  asserts.assert(arr.length != null);

  // passing 1 arg to slice is not the same as passing 2 where the second is
  // null or undefined (in that case the second argument is treated as 0).
  // we could use slice on the arguments object and then use apply instead of
  // testing the length
  if (arguments.length <= 2) {
    return Array.prototype.slice.call(arr, start);
  } else {
    return Array.prototype.slice.call(arr, start, opt_end);
  }
}
exports.slice = slice;


/**
 * Removes all duplicates from an array (retaining only the first
 * occurrence of each array element).  This function modifies the
 * array in place and doesn't change the order of the non-duplicate items.
 *
 * For objects, duplicates are identified as having the same unique ID as
 * defined by {@link goog.getUid}.
 *
 * Alternatively you can specify a custom hash function that returns a unique
 * value for each item in the array it should consider unique.
 *
 * Runtime: N,
 * Worstcase space: 2N (no dupes)
 *
 * @param {IArrayLike<T>} arr The array from which to remove
 *     duplicates.
 * @param {Array=} opt_rv An optional array in which to return the results,
 *     instead of performing the removal inplace.  If specified, the original
 *     array will remain unchanged.
 * @param {function(T):string=} opt_hashFn An optional function to use to
 *     apply to every item in the array. This function should return a unique
 *     value for each item in the array it should consider unique.
 * @template T
 */
function removeDuplicates(arr, opt_rv, opt_hashFn) {
  const returnArray = opt_rv || arr;
  const defaultHashFn = function(item) {
    // Prefix each type with a single character representing the type to
    // prevent conflicting keys (e.g. true and 'true').
    return goog.isObject(item) ? 'o' + goog.getUid(item) :
                                 (typeof item).charAt(0) + item;
  };
  const hashFn = opt_hashFn || defaultHashFn;

  let cursorInsert = 0;
  let cursorRead = 0;
  const seen = {};

  while (cursorRead < arr.length) {
    const current = arr[cursorRead++];
    const key = hashFn(current);
    if (!Object.prototype.hasOwnProperty.call(seen, key)) {
      seen[key] = true;
      returnArray[cursorInsert++] = current;
    }
  }
  returnArray.length = cursorInsert;
}
exports.removeDuplicates = removeDuplicates;


/**
 * Searches the specified array for the specified target using the binary
 * search algorithm.  If no opt_compareFn is specified, elements are compared
 * using <code>defaultCompare</code>, which compares the elements
 * using the built in < and > operators.  This will produce the expected
 * behavior for homogeneous arrays of String(s) and Number(s). The array
 * specified <b>must</b> be sorted in ascending order (as defined by the
 * comparison function).  If the array is not sorted, results are undefined.
 * If the array contains multiple instances of the specified target value, the
 * left-most instance will be found.
 *
 * Runtime: O(log n)
 *
 * @param {IArrayLike<VALUE>} arr The array to be searched.
 * @param {TARGET} target The sought value.
 * @param {function(TARGET, VALUE): number=} opt_compareFn Optional comparison
 *     function by which the array is ordered. Should take 2 arguments to
 *     compare, the target value and an element from your array, and return a
 *     negative number, zero, or a positive number depending on whether the
 *     first argument is less than, equal to, or greater than the second.
 * @return {number} Lowest index of the target value if found, otherwise
 *     (-(insertion point) - 1). The insertion point is where the value should
 *     be inserted into arr to preserve the sorted property.  Return value >= 0
 *     iff target is found.
 * @template TARGET, VALUE
 */
function binarySearch(arr, target, opt_compareFn) {
  return binarySearch_(
      arr, opt_compareFn || defaultCompare, false /* isEvaluator */, target);
}
exports.binarySearch = binarySearch;


/**
 * Selects an index in the specified array using the binary search algorithm.
 * The evaluator receives an element and determines whether the desired index
 * is before, at, or after it.  The evaluator must be consistent (formally,
 * map(map(arr, evaluator, opt_obj), goog.math.sign)
 * must be monotonically non-increasing).
 *
 * Runtime: O(log n)
 *
 * @param {IArrayLike<VALUE>} arr The array to be searched.
 * @param {function(this:THIS, VALUE, number, ?): number} evaluator
 *     Evaluator function that receives 3 arguments (the element, the index and
 *     the array). Should return a negative number, zero, or a positive number
 *     depending on whether the desired index is before, at, or after the
 *     element passed to it.
 * @param {THIS=} opt_obj The object to be used as the value of 'this'
 *     within evaluator.
 * @return {number} Index of the leftmost element matched by the evaluator, if
 *     such exists; otherwise (-(insertion point) - 1). The insertion point is
 *     the index of the first element for which the evaluator returns negative,
 *     or arr.length if no such element exists. The return value is non-negative
 *     iff a match is found.
 * @template THIS, VALUE
 */
function binarySelect(arr, evaluator, opt_obj) {
  return binarySearch_(
      arr, evaluator, true /* isEvaluator */, undefined /* opt_target */,
      opt_obj);
}
exports.binarySelect = binarySelect;


/**
 * Implementation of a binary search algorithm which knows how to use both
 * comparison functions and evaluators. If an evaluator is provided, will call
 * the evaluator with the given optional data object, conforming to the
 * interface defined in binarySelect. Otherwise, if a comparison function is
 * provided, will call the comparison function against the given data object.
 *
 * This implementation purposefully does not use goog.bind or goog.partial for
 * performance reasons.
 *
 * Runtime: O(log n)
 *
 * @param {IArrayLike<?>} arr The array to be searched.
 * @param {function(?, ?, ?): number | function(?, ?): number} compareFn
 *     Either an evaluator or a comparison function, as defined by binarySearch
 *     and binarySelect above.
 * @param {boolean} isEvaluator Whether the function is an evaluator or a
 *     comparison function.
 * @param {?=} opt_target If the function is a comparison function, then
 *     this is the target to binary search for.
 * @param {Object=} opt_selfObj If the function is an evaluator, this is an
 *     optional this object for the evaluator.
 * @return {number} Lowest index of the target value if found, otherwise
 *     (-(insertion point) - 1). The insertion point is where the value should
 *     be inserted into arr to preserve the sorted property.  Return value >= 0
 *     iff target is found.
 * @private
 */
function binarySearch_(arr, compareFn, isEvaluator, opt_target, opt_selfObj) {
  let left = 0;            // inclusive
  let right = arr.length;  // exclusive
  let found;
  while (left < right) {
    const middle = left + ((right - left) >>> 1);
    let compareResult;
    if (isEvaluator) {
      compareResult = compareFn.call(opt_selfObj, arr[middle], middle, arr);
    } else {
      // NOTE(dimvar): To avoid this cast, we'd have to use function overloading
      // for the type of binarySearch_, which the type system can't express yet.
      compareResult = /** @type {function(?, ?): number} */ (compareFn)(
          opt_target, arr[middle]);
    }
    if (compareResult > 0) {
      left = middle + 1;
    } else {
      right = middle;
      // We are looking for the lowest index so we can't return immediately.
      found = !compareResult;
    }
  }
  // left is the index if found, or the insertion point otherwise.
  // Avoiding bitwise not operator, as that causes a loss in precision for array
  // indexes outside the bounds of a 32-bit signed integer.  Array indexes have
  // a maximum value of 2^32-2 https://tc39.es/ecma262/#array-index
  return found ? left : -left - 1;
}


/**
 * Sorts the specified array into ascending order.  If no opt_compareFn is
 * specified, elements are compared using
 * <code>defaultCompare</code>, which compares the elements using
 * the built in < and > operators.  This will produce the expected behavior
 * for homogeneous arrays of String(s) and Number(s), unlike the native sort,
 * but will give unpredictable results for heterogeneous lists of strings and
 * numbers with different numbers of digits.
 *
 * This sort is not guaranteed to be stable.
 *
 * Runtime: Same as `Array.prototype.sort`
 *
 * @param {Array<T>} arr The array to be sorted.
 * @param {?function(T,T):number=} opt_compareFn Optional comparison
 *     function by which the
 *     array is to be ordered. Should take 2 arguments to compare, and return a
 *     negative number, zero, or a positive number depending on whether the
 *     first argument is less than, equal to, or greater than the second.
 * @template T
 */
function sort(arr, opt_compareFn) {
  // TODO(arv): Update type annotation since null is not accepted.
  arr.sort(opt_compareFn || defaultCompare);
}
exports.sort = sort;


/**
 * Sorts the specified array into ascending order in a stable way.  If no
 * opt_compareFn is specified, elements are compared using
 * <code>defaultCompare</code>, which compares the elements using
 * the built in < and > operators.  This will produce the expected behavior
 * for homogeneous arrays of String(s) and Number(s).
 *
 * Runtime: Same as `Array.prototype.sort`, plus an additional
 * O(n) overhead of copying the array twice.
 *
 * @param {Array<T>} arr The array to be sorted.
 * @param {?function(T, T): number=} opt_compareFn Optional comparison function
 *     by which the array is to be ordered. Should take 2 arguments to compare,
 *     and return a negative number, zero, or a positive number depending on
 *     whether the first argument is less than, equal to, or greater than the
 *     second.
 * @template T
 */
function stableSort(arr, opt_compareFn) {
  const compArr = new Array(arr.length);
  for (let i = 0; i < arr.length; i++) {
    compArr[i] = {index: i, value: arr[i]};
  }
  const valueCompareFn = opt_compareFn || defaultCompare;
  function stableCompareFn(obj1, obj2) {
    return valueCompareFn(obj1.value, obj2.value) || obj1.index - obj2.index;
  }
  sort(compArr, stableCompareFn);
  for (let i = 0; i < arr.length; i++) {
    arr[i] = compArr[i].value;
  }
}
exports.stableSort = stableSort;


/**
 * Sort the specified array into ascending order based on item keys
 * returned by the specified key function.
 * If no opt_compareFn is specified, the keys are compared in ascending order
 * using <code>defaultCompare</code>.
 *
 * Runtime: O(S(f(n)), where S is runtime of <code>sort</code>
 * and f(n) is runtime of the key function.
 *
 * @param {Array<T>} arr The array to be sorted.
 * @param {function(T): K} keyFn Function taking array element and returning
 *     a key used for sorting this element.
 * @param {?function(K, K): number=} opt_compareFn Optional comparison function
 *     by which the keys are to be ordered. Should take 2 arguments to compare,
 *     and return a negative number, zero, or a positive number depending on
 *     whether the first argument is less than, equal to, or greater than the
 *     second.
 * @template T,K
 */
function sortByKey(arr, keyFn, opt_compareFn) {
  const keyCompareFn = opt_compareFn || defaultCompare;
  sort(arr, function(a, b) {
    return keyCompareFn(keyFn(a), keyFn(b));
  });
}
exports.sortByKey = sortByKey;


/**
 * Sorts an array of objects by the specified object key and compare
 * function. If no compare function is provided, the key values are
 * compared in ascending order using <code>defaultCompare</code>.
 * This won't work for keys that get renamed by the compiler. So use
 * {'foo': 1, 'bar': 2} rather than {foo: 1, bar: 2}.
 * @param {Array<Object>} arr An array of objects to sort.
 * @param {string} key The object key to sort by.
 * @param {Function=} opt_compareFn The function to use to compare key
 *     values.
 */
function sortObjectsByKey(arr, key, opt_compareFn) {
  sortByKey(arr, function(obj) {
    return obj[key];
  }, opt_compareFn);
}
exports.sortObjectsByKey = sortObjectsByKey;


/**
 * Tells if the array is sorted.
 * @param {!IArrayLike<T>} arr The array.
 * @param {?function(T,T):number=} opt_compareFn Function to compare the
 *     array elements.
 *     Should take 2 arguments to compare, and return a negative number, zero,
 *     or a positive number depending on whether the first argument is less
 *     than, equal to, or greater than the second.
 * @param {boolean=} opt_strict If true no equal elements are allowed.
 * @return {boolean} Whether the array is sorted.
 * @template T
 */
function isSorted(arr, opt_compareFn, opt_strict) {
  const compare = opt_compareFn || defaultCompare;
  for (let i = 1; i < arr.length; i++) {
    const compareResult = compare(arr[i - 1], arr[i]);
    if (compareResult > 0 || compareResult == 0 && opt_strict) {
      return false;
    }
  }
  return true;
}
exports.isSorted = isSorted;


/**
 * Compares two arrays for equality. Two arrays are considered equal if they
 * have the same length and their corresponding elements are equal according to
 * the comparison function.
 *
 * @param {IArrayLike<A>} arr1 The first array to compare.
 * @param {IArrayLike<B>} arr2 The second array to compare.
 * @param {?function(A,B):boolean=} opt_equalsFn Optional comparison function.
 *     Should take 2 arguments to compare, and return true if the arguments
 *     are equal. Defaults to {@link goog.array.defaultCompareEquality} which
 *     compares the elements using the built-in '===' operator.
 * @return {boolean} Whether the two arrays are equal.
 * @template A
 * @template B
 */
function equals(arr1, arr2, opt_equalsFn) {
  if (!goog.isArrayLike(arr1) || !goog.isArrayLike(arr2) ||
      arr1.length != arr2.length) {
    return false;
  }
  const l = arr1.length;
  const equalsFn = opt_equalsFn || defaultCompareEquality;
  for (let i = 0; i < l; i++) {
    if (!equalsFn(arr1[i], arr2[i])) {
      return false;
    }
  }
  return true;
}
exports.equals = equals;


/**
 * 3-way array compare function.
 * @param {!IArrayLike<VALUE>} arr1 The first array to
 *     compare.
 * @param {!IArrayLike<VALUE>} arr2 The second array to
 *     compare.
 * @param {function(VALUE, VALUE): number=} opt_compareFn Optional comparison
 *     function by which the array is to be ordered. Should take 2 arguments to
 *     compare, and return a negative number, zero, or a positive number
 *     depending on whether the first argument is less than, equal to, or
 *     greater than the second.
 * @return {number} Negative number, zero, or a positive number depending on
 *     whether the first argument is less than, equal to, or greater than the
 *     second.
 * @template VALUE
 */
function compare3(arr1, arr2, opt_compareFn) {
  const compare = opt_compareFn || defaultCompare;
  const l = Math.min(arr1.length, arr2.length);
  for (let i = 0; i < l; i++) {
    const result = compare(arr1[i], arr2[i]);
    if (result != 0) {
      return result;
    }
  }
  return defaultCompare(arr1.length, arr2.length);
}
exports.compare3 = compare3;


/**
 * Compares its two arguments for order, using the built in < and >
 * operators.
 * @param {VALUE} a The first object to be compared.
 * @param {VALUE} b The second object to be compared.
 * @return {number} A negative number, zero, or a positive number as the first
 *     argument is less than, equal to, or greater than the second,
 *     respectively.
 * @template VALUE
 */
function defaultCompare(a, b) {
  return a > b ? 1 : a < b ? -1 : 0;
}
exports.defaultCompare = defaultCompare;


/**
 * Compares its two arguments for inverse order, using the built in < and >
 * operators.
 * @param {VALUE} a The first object to be compared.
 * @param {VALUE} b The second object to be compared.
 * @return {number} A negative number, zero, or a positive number as the first
 *     argument is greater than, equal to, or less than the second,
 *     respectively.
 * @template VALUE
 */
function inverseDefaultCompare(a, b) {
  return -defaultCompare(a, b);
}
exports.inverseDefaultCompare = inverseDefaultCompare;


/**
 * Compares its two arguments for equality, using the built in === operator.
 * @param {*} a The first object to compare.
 * @param {*} b The second object to compare.
 * @return {boolean} True if the two arguments are equal, false otherwise.
 */
function defaultCompareEquality(a, b) {
  return a === b;
}
exports.defaultCompareEquality = defaultCompareEquality;


/**
 * Inserts a value into a sorted array. The array is not modified if the
 * value is already present.
 * @param {IArrayLike<VALUE>} array The array to modify.
 * @param {VALUE} value The object to insert.
 * @param {function(VALUE, VALUE): number=} opt_compareFn Optional comparison
 *     function by which the array is ordered. Should take 2 arguments to
 *     compare, and return a negative number, zero, or a positive number
 *     depending on whether the first argument is less than, equal to, or
 *     greater than the second.
 * @return {boolean} True if an element was inserted.
 * @template VALUE
 */
function binaryInsert(array, value, opt_compareFn) {
  const index = binarySearch(array, value, opt_compareFn);
  if (index < 0) {
    insertAt(array, value, -(index + 1));
    return true;
  }
  return false;
}
exports.binaryInsert = binaryInsert;


/**
 * Removes a value from a sorted array.
 * @param {!IArrayLike<VALUE>} array The array to modify.
 * @param {VALUE} value The object to remove.
 * @param {function(VALUE, VALUE): number=} opt_compareFn Optional comparison
 *     function by which the array is ordered. Should take 2 arguments to
 *     compare, and return a negative number, zero, or a positive number
 *     depending on whether the first argument is less than, equal to, or
 *     greater than the second.
 * @return {boolean} True if an element was removed.
 * @template VALUE
 */
function binaryRemove(array, value, opt_compareFn) {
  const index = binarySearch(array, value, opt_compareFn);
  return (index >= 0) ? removeAt(array, index) : false;
}
exports.binaryRemove = binaryRemove;


/**
 * Splits an array into disjoint buckets according to a splitting function.
 * @param {IArrayLike<T>} array The array.
 * @param {function(this:S, T, number, !IArrayLike<T>):?} sorter Function to
 *     call for every element.  This takes 3 arguments (the element, the index
 *     and the array) and must return a valid object key (a string, number,
 *     etc), or undefined, if that object should not be placed in a bucket.
 * @param {S=} opt_obj The object to be used as the value of 'this' within
 *     sorter.
 * @return {!Object<!Array<T>>} An object, with keys being all of the unique
 *     return values of sorter, and values being arrays containing the items for
 *     which the splitter returned that key.
 * @template T,S
 */
function bucket(array, sorter, opt_obj) {
  const buckets = {};

  for (let i = 0; i < array.length; i++) {
    const value = array[i];
    const key = sorter.call(/** @type {?} */ (opt_obj), value, i, array);
    if (key !== undefined) {
      // Push the value to the right bucket, creating it if necessary.
      const bucket = buckets[key] || (buckets[key] = []);
      bucket.push(value);
    }
  }

  return buckets;
}
exports.bucket = bucket;


/**
 * Creates a new object built from the provided array and the key-generation
 * function.
 * @param {IArrayLike<T>} arr Array or array like object over
 *     which to iterate whose elements will be the values in the new object.
 * @param {?function(this:S, T, number, ?) : string} keyFunc The function to
 *     call for every element. This function takes 3 arguments (the element, the
 *     index and the array) and should return a string that will be used as the
 *     key for the element in the new object. If the function returns the same
 *     key for more than one element, the value for that key is
 *     implementation-defined.
 * @param {S=} opt_obj The object to be used as the value of 'this'
 *     within keyFunc.
 * @return {!Object<T>} The new object.
 * @template T,S
 */
function toObject(arr, keyFunc, opt_obj) {
  const ret = {};
  forEach(arr, function(element, index) {
    ret[keyFunc.call(/** @type {?} */ (opt_obj), element, index, arr)] =
        element;
  });
  return ret;
}
exports.toObject = toObject;


/**
 * Creates a range of numbers in an arithmetic progression.
 *
 * Range takes 1, 2, or 3 arguments:
 * <pre>
 * range(5) is the same as range(0, 5, 1) and produces [0, 1, 2, 3, 4]
 * range(2, 5) is the same as range(2, 5, 1) and produces [2, 3, 4]
 * range(-2, -5, -1) produces [-2, -3, -4]
 * range(-2, -5, 1) produces [], since stepping by 1 wouldn't ever reach -5.
 * </pre>
 *
 * @param {number} startOrEnd The starting value of the range if an end argument
 *     is provided. Otherwise, the start value is 0, and this is the end value.
 * @param {number=} opt_end The optional end value of the range.
 * @param {number=} opt_step The step size between range values. Defaults to 1
 *     if opt_step is undefined or 0.
 * @return {!Array<number>} An array of numbers for the requested range. May be
 *     an empty array if adding the step would not converge toward the end
 *     value.
 */
function range(startOrEnd, opt_end, opt_step) {
  const array = [];
  let start = 0;
  let end = startOrEnd;
  const step = opt_step || 1;
  if (opt_end !== undefined) {
    start = startOrEnd;
    end = opt_end;
  }

  if (step * (end - start) < 0) {
    // Sign mismatch: start + step will never reach the end value.
    return [];
  }

  if (step > 0) {
    for (let i = start; i < end; i += step) {
      array.push(i);
    }
  } else {
    for (let i = start; i > end; i += step) {
      array.push(i);
    }
  }
  return array;
}
exports.range = range;


/**
 * Returns an array consisting of the given value repeated N times.
 *
 * @param {VALUE} value The value to repeat.
 * @param {number} n The repeat count.
 * @return {!Array<VALUE>} An array with the repeated value.
 * @template VALUE
 */
function repeat(value, n) {
  const array = [];
  for (let i = 0; i < n; i++) {
    array[i] = value;
  }
  return array;
}
exports.repeat = repeat;


/**
 * Returns an array consisting of every argument with all arrays
 * expanded in-place recursively.
 *
 * @param {...*} var_args The values to flatten.
 * @return {!Array<?>} An array containing the flattened values.
 */
function flatten(var_args) {
  const CHUNK_SIZE = 8192;

  const result = [];
  for (let i = 0; i < arguments.length; i++) {
    const element = arguments[i];
    if (Array.isArray(element)) {
      for (let c = 0; c < element.length; c += CHUNK_SIZE) {
        const chunk = slice(element, c, c + CHUNK_SIZE);
        const recurseResult = flatten.apply(null, chunk);
        for (let r = 0; r < recurseResult.length; r++) {
          result.push(recurseResult[r]);
        }
      }
    } else {
      result.push(element);
    }
  }
  return result;
}
exports.flatten = flatten;


/**
 * Rotates an array in-place. After calling this method, the element at
 * index i will be the element previously at index (i - n) %
 * array.length, for all values of i between 0 and array.length - 1,
 * inclusive.
 *
 * For example, suppose list comprises [t, a, n, k, s]. After invoking
 * rotate(array, 1) (or rotate(array, -4)), array will comprise [s, t, a, n, k].
 *
 * @param {!Array<T>} array The array to rotate.
 * @param {number} n The amount to rotate.
 * @return {!Array<T>} The array.
 * @template T
 */
function rotate(array, n) {
  asserts.assert(array.length != null);

  if (array.length) {
    n %= array.length;
    if (n > 0) {
      Array.prototype.unshift.apply(array, array.splice(-n, n));
    } else if (n < 0) {
      Array.prototype.push.apply(array, array.splice(0, -n));
    }
  }
  return array;
}
exports.rotate = rotate;


/**
 * Moves one item of an array to a new position keeping the order of the rest
 * of the items. Example use case: keeping a list of JavaScript objects
 * synchronized with the corresponding list of DOM elements after one of the
 * elements has been dragged to a new position.
 * @param {!IArrayLike<?>} arr The array to modify.
 * @param {number} fromIndex Index of the item to move between 0 and
 *     `arr.length - 1`.
 * @param {number} toIndex Target index between 0 and `arr.length - 1`.
 */
function moveItem(arr, fromIndex, toIndex) {
  asserts.assert(fromIndex >= 0 && fromIndex < arr.length);
  asserts.assert(toIndex >= 0 && toIndex < arr.length);
  // Remove 1 item at fromIndex.
  const removedItems = Array.prototype.splice.call(arr, fromIndex, 1);
  // Insert the removed item at toIndex.
  Array.prototype.splice.call(arr, toIndex, 0, removedItems[0]);
  // We don't use goog.array.insertAt and goog.array.removeAt, because they're
  // significantly slower than splice.
}
exports.moveItem = moveItem;


/**
 * Creates a new array for which the element at position i is an array of the
 * ith element of the provided arrays.  The returned array will only be as long
 * as the shortest array provided; additional values are ignored.  For example,
 * the result of zipping [1, 2] and [3, 4, 5] is [[1,3], [2, 4]].
 *
 * This is similar to the zip() function in Python.  See {@link
 * http://docs.python.org/library/functions.html#zip}
 *
 * @param {...!IArrayLike<?>} var_args Arrays to be combined.
 * @return {!Array<!Array<?>>} A new array of arrays created from
 *     provided arrays.
 */
function zip(var_args) {
  if (!arguments.length) {
    return [];
  }
  const result = [];
  let minLen = arguments[0].length;
  for (let i = 1; i < arguments.length; i++) {
    if (arguments[i].length < minLen) {
      minLen = arguments[i].length;
    }
  }
  for (let i = 0; i < minLen; i++) {
    const value = [];
    for (let j = 0; j < arguments.length; j++) {
      value.push(arguments[j][i]);
    }
    result.push(value);
  }
  return result;
}
exports.zip = zip;


/**
 * Shuffles the values in the specified array using the Fisher-Yates in-place
 * shuffle (also known as the Knuth Shuffle). By default, calls Math.random()
 * and so resets the state of that random number generator. Similarly, may reset
 * the state of any other specified random number generator.
 *
 * Runtime: O(n)
 *
 * @param {!Array<?>} arr The array to be shuffled.
 * @param {function():number=} opt_randFn Optional random function to use for
 *     shuffling.
 *     Takes no arguments, and returns a random number on the interval [0, 1).
 *     Defaults to Math.random() using JavaScript's built-in Math library.
 */
function shuffle(arr, opt_randFn) {
  const randFn = opt_randFn || Math.random;

  for (let i = arr.length - 1; i > 0; i--) {
    // Choose a random array index in [0, i] (inclusive with i).
    const j = Math.floor(randFn() * (i + 1));

    const tmp = arr[i];
    arr[i] = arr[j];
    arr[j] = tmp;
  }
}
exports.shuffle = shuffle;


/**
 * Returns a new array of elements from arr, based on the indexes of elements
 * provided by index_arr. For example, the result of index copying
 * ['a', 'b', 'c'] with index_arr [1,0,0,2] is ['b', 'a', 'a', 'c'].
 *
 * @param {!IArrayLike<T>} arr The array to get a indexed copy from.
 * @param {!IArrayLike<number>} index_arr An array of indexes to get from arr.
 * @return {!Array<T>} A new array of elements from arr in index_arr order.
 * @template T
 */
function copyByIndex(arr, index_arr) {
  const result = [];
  forEach(index_arr, function(index) {
    result.push(arr[index]);
  });
  return result;
}
exports.copyByIndex = copyByIndex;


/**
 * Maps each element of the input array into zero or more elements of the output
 * array.
 *
 * @param {!IArrayLike<VALUE>|string} arr Array or array like object
 *     over which to iterate.
 * @param {function(this:THIS, VALUE, number, ?): !Array<RESULT>} f The function
 *     to call for every element. This function takes 3 arguments (the element,
 *     the index and the array) and should return an array. The result will be
 *     used to extend a new array.
 * @param {THIS=} opt_obj The object to be used as the value of 'this' within f.
 * @return {!Array<RESULT>} a new array with the concatenation of all arrays
 *     returned from f.
 * @template THIS, VALUE, RESULT
 */
function concatMap(arr, f, opt_obj) {
  return concat.apply([], map(arr, f, opt_obj));
}
exports.concatMap = concatMap;

;return exports;});

//third_party/javascript/closure/crypt/crypt.js
/**
 * @license
 * Copyright The Closure Library Authors.
 * SPDX-License-Identifier: Apache-2.0
 */

/**
 * @fileoverview Namespace with crypto related helper functions.
 */

goog.provide('goog.crypt');

goog.require('goog.array');
goog.require('goog.asserts');


/**
 * Turns a string into an array of bytes; a "byte" being a JS number in the
 * range 0-255. Multi-byte characters are written as little-endian.
 * @param {string} str String value to arrify.
 * @return {!Array<number>} Array of numbers corresponding to the
 *     UCS character codes of each character in str.
 */
goog.crypt.stringToByteArray = function(str) {
  'use strict';
  var output = [], p = 0;
  for (var i = 0; i < str.length; i++) {
    var c = str.charCodeAt(i);
    // NOTE: c <= 0xffff since JavaScript strings are UTF-16.
    if (c > 0xff) {
      output[p++] = c & 0xff;
      c >>= 8;
    }
    output[p++] = c;
  }
  return output;
};


/**
 * Turns an array of numbers into the string given by the concatenation of the
 * characters to which the numbers correspond.
 * @param {!Uint8Array|!Array<number>} bytes Array of numbers representing
 *     characters.
 * @return {string} Stringification of the array.
 */
goog.crypt.byteArrayToString = function(bytes) {
  'use strict';
  var CHUNK_SIZE = 8192;

  // Special-case the simple case for speed's sake.
  if (bytes.length <= CHUNK_SIZE) {
    return String.fromCharCode.apply(null, bytes);
  }

  // The remaining logic splits conversion by chunks since
  // Function#apply() has a maximum parameter count.
  // See discussion: http://goo.gl/LrWmZ9

  var str = '';
  for (var i = 0; i < bytes.length; i += CHUNK_SIZE) {
    var chunk = goog.array.slice(bytes, i, i + CHUNK_SIZE);
    str += String.fromCharCode.apply(null, chunk);
  }
  return str;
};


/**
 * Turns an array of numbers into the hex string given by the concatenation of
 * the hex values to which the numbers correspond.
 * @param {Uint8Array|Array<number>} array Array of numbers representing
 *     characters.
 * @param {string=} opt_separator Optional separator between values
 * @return {string} Hex string.
 */
goog.crypt.byteArrayToHex = function(array, opt_separator) {
  'use strict';
  return goog.array
      .map(
          array,
          function(numByte) {
            'use strict';
            var hexByte = numByte.toString(16);
            return hexByte.length > 1 ? hexByte : '0' + hexByte;
          })
      .join(opt_separator || '');
};


/**
 * Converts a hex string into an integer array.
 * @param {string} hexString Hex string of 16-bit integers (two characters
 *     per integer).
 * @return {!Array<number>} Array of {0,255} integers for the given string.
 */
goog.crypt.hexToByteArray = function(hexString) {
  'use strict';
  goog.asserts.assert(
      hexString.length % 2 == 0, 'Key string length must be multiple of 2');
  var arr = [];
  for (var i = 0; i < hexString.length; i += 2) {
    arr.push(parseInt(hexString.substring(i, i + 2), 16));
  }
  return arr;
};


/**
 * Converts a JS string to a UTF-8 "byte" array.
 * @param {string} str 16-bit unicode string.
 * @return {!Array<number>} UTF-8 byte array.
 */
goog.crypt.stringToUtf8ByteArray = function(str) {
  'use strict';
  // TODO(pupius): Use native implementations if/when available
  var out = [], p = 0;
  for (var i = 0; i < str.length; i++) {
    var c = str.charCodeAt(i);
    if (c < 128) {
      out[p++] = c;
    } else if (c < 2048) {
      out[p++] = (c >> 6) | 192;
      out[p++] = (c & 63) | 128;
    } else if (
        ((c & 0xFC00) == 0xD800) && (i + 1) < str.length &&
        ((str.charCodeAt(i + 1) & 0xFC00) == 0xDC00)) {
      // Surrogate Pair
      c = 0x10000 + ((c & 0x03FF) << 10) + (str.charCodeAt(++i) & 0x03FF);
      out[p++] = (c >> 18) | 240;
      out[p++] = ((c >> 12) & 63) | 128;
      out[p++] = ((c >> 6) & 63) | 128;
      out[p++] = (c & 63) | 128;
    } else {
      out[p++] = (c >> 12) | 224;
      out[p++] = ((c >> 6) & 63) | 128;
      out[p++] = (c & 63) | 128;
    }
  }
  return out;
};


/**
 * Converts a UTF-8 byte array to JavaScript's 16-bit Unicode.
 * @param {Uint8Array|Array<number>} bytes UTF-8 byte array.
 * @return {string} 16-bit Unicode string.
 */
goog.crypt.utf8ByteArrayToString = function(bytes) {
  'use strict';
  // TODO(pupius): Use native implementations if/when available
  var out = [], pos = 0, c = 0;
  while (pos < bytes.length) {
    var c1 = bytes[pos++];
    if (c1 < 128) {
      out[c++] = String.fromCharCode(c1);
    } else if (c1 > 191 && c1 < 224) {
      var c2 = bytes[pos++];
      out[c++] = String.fromCharCode((c1 & 31) << 6 | c2 & 63);
    } else if (c1 > 239 && c1 < 365) {
      // Surrogate Pair
      var c2 = bytes[pos++];
      var c3 = bytes[pos++];
      var c4 = bytes[pos++];
      var u = ((c1 & 7) << 18 | (c2 & 63) << 12 | (c3 & 63) << 6 | c4 & 63) -
          0x10000;
      out[c++] = String.fromCharCode(0xD800 + (u >> 10));
      out[c++] = String.fromCharCode(0xDC00 + (u & 1023));
    } else {
      var c2 = bytes[pos++];
      var c3 = bytes[pos++];
      out[c++] =
          String.fromCharCode((c1 & 15) << 12 | (c2 & 63) << 6 | c3 & 63);
    }
  }
  return out.join('');
};


/**
 * XOR two byte arrays.
 * @param {!Uint8Array|!Int8Array|!Array<number>} bytes1 Byte array 1.
 * @param {!Uint8Array|!Int8Array|!Array<number>} bytes2 Byte array 2.
 * @return {!Array<number>} Resulting XOR of the two byte arrays.
 */
goog.crypt.xorByteArray = function(bytes1, bytes2) {
  'use strict';
  goog.asserts.assert(
      bytes1.length == bytes2.length, 'XOR array lengths must match');

  var result = [];
  for (var i = 0; i < bytes1.length; i++) {
    result.push(bytes1[i] ^ bytes2[i]);
  }
  return result;
};

//third_party/javascript/closure/dom/asserts.js
/**
 * @license
 * Copyright The Closure Library Authors.
 * SPDX-License-Identifier: Apache-2.0
 */

goog.provide('goog.dom.asserts');

goog.require('goog.asserts');

/**
 * @fileoverview Custom assertions to ensure that an element has the appropriate
 * type.
 *
 * Using a goog.dom.safe wrapper on an object on the incorrect type (via an
 * incorrect static type cast) can result in security bugs: For instance,
 * g.d.s.setAnchorHref ensures that the URL assigned to the .href attribute
 * satisfies the SafeUrl contract, i.e., is safe to dereference as a hyperlink.
 * However, the value assigned to a HTMLLinkElement's .href property requires
 * the stronger TrustedResourceUrl contract, since it can refer to a stylesheet.
 * Thus, using g.d.s.setAnchorHref on an (incorrectly statically typed) object
 * of type HTMLLinkElement can result in a security vulnerability.
 * Assertions of the correct run-time type help prevent such incorrect use.
 *
 * In some cases, code using the DOM API is tested using mock objects (e.g., a
 * plain object such as {'href': url} instead of an actual Location object).
 * To allow such mocking, the assertions permit objects of types that are not
 * relevant DOM API objects at all (for instance, not Element or Location).
 *
 * Note that instanceof checks don't work straightforwardly in older versions of
 * IE, or across frames (see,
 * http://stackoverflow.com/questions/384286/javascript-isdom-how-do-you-check-if-a-javascript-object-is-a-dom-object,
 * http://stackoverflow.com/questions/26248599/instanceof-htmlelement-in-iframe-is-not-element-or-object).
 *
 * Hence, these assertions may pass vacuously in such scenarios. The resulting
 * risk of security bugs is limited by the following factors:
 *  - A bug can only arise in scenarios involving incorrect static typing (the
 *    wrapper methods are statically typed to demand objects of the appropriate,
 *    precise type).
 *  - Typically, code is tested and exercised in multiple browsers.
 */

/**
 * Asserts that a given object is a Location.
 *
 * To permit this assertion to pass in the context of tests where DOM APIs might
 * be mocked, also accepts any other type except for subtypes of {!Element}.
 * This is to ensure that, for instance, HTMLLinkElement is not being used in
 * place of a Location, since this could result in security bugs due to stronger
 * contracts required for assignments to the href property of the latter.
 *
 * @param {?Object} o The object whose type to assert.
 * @return {!Location}
 */
goog.dom.asserts.assertIsLocation = function(o) {
  'use strict';
  if (goog.asserts.ENABLE_ASSERTS) {
    var win = goog.dom.asserts.getWindow_(o);
    if (win) {
      if (!o || (!(o instanceof win.Location) && o instanceof win.Element)) {
        goog.asserts.fail(
            'Argument is not a Location (or a non-Element mock); got: %s',
            goog.dom.asserts.debugStringForType_(o));
      }
    }
  }
  return /** @type {!Location} */ (o);
};


/**
 * Asserts that a given object is either the given subtype of Element
 * or a non-Element, non-Location Mock.
 *
 * To permit this assertion to pass in the context of tests where DOM
 * APIs might be mocked, also accepts any other type except for
 * subtypes of {!Element}.  This is to ensure that, for instance,
 * HTMLScriptElement is not being used in place of a HTMLImageElement,
 * since this could result in security bugs due to stronger contracts
 * required for assignments to the src property of the latter.
 *
 * The DOM type is looked up in the window the object belongs to.  In
 * some contexts, this might not be possible (e.g. when running tests
 * outside a browser, cross-domain lookup). In this case, the
 * assertions are skipped.
 *
 * @param {?Object} o The object whose type to assert.
 * @param {string} typename The name of the DOM type.
 * @return {!Element} The object.
 * @private
 */
// TODO(bangert): Make an analog of goog.dom.TagName to correctly handle casts?
goog.dom.asserts.assertIsElementType_ = function(o, typename) {
  'use strict';
  if (goog.asserts.ENABLE_ASSERTS) {
    var win = goog.dom.asserts.getWindow_(o);
    if (win && typeof win[typename] != 'undefined') {
      if (!o ||
          (!(o instanceof win[typename]) &&
           (o instanceof win.Location || o instanceof win.Element))) {
        goog.asserts.fail(
            'Argument is not a %s (or a non-Element, non-Location mock); ' +
                'got: %s',
            typename, goog.dom.asserts.debugStringForType_(o));
      }
    }
  }
  return /** @type {!Element} */ (o);
};

/**
 * Asserts that a given object is a HTMLAnchorElement.
 *
 * To permit this assertion to pass in the context of tests where elements might
 * be mocked, also accepts objects that are not of type Location nor a subtype
 * of Element.
 *
 * @param {?Object} o The object whose type to assert.
 * @return {!HTMLAnchorElement}
 * @deprecated Use goog.asserts.dom.assertIsHtmlAnchorElement instead.
 */
goog.dom.asserts.assertIsHTMLAnchorElement = function(o) {
  'use strict';
  return /** @type {!HTMLAnchorElement} */ (
      goog.dom.asserts.assertIsElementType_(o, 'HTMLAnchorElement'));
};

/**
 * Asserts that a given object is a HTMLButtonElement.
 *
 * To permit this assertion to pass in the context of tests where elements might
 * be mocked, also accepts objects that are not a subtype of Element.
 *
 * @param {?Object} o The object whose type to assert.
 * @return {!HTMLButtonElement}
 * @deprecated Use goog.asserts.dom.assertIsHtmlButtonElement instead.
 */
goog.dom.asserts.assertIsHTMLButtonElement = function(o) {
  'use strict';
  return /** @type {!HTMLButtonElement} */ (
      goog.dom.asserts.assertIsElementType_(o, 'HTMLButtonElement'));
};

/**
 * Asserts that a given object is a HTMLLinkElement.
 *
 * To permit this assertion to pass in the context of tests where elements might
 * be mocked, also accepts objects that are not a subtype of Element.
 *
 * @param {?Object} o The object whose type to assert.
 * @return {!HTMLLinkElement}
 * @deprecated Use goog.asserts.dom.assertIsHtmlLinkElement instead.
 */
goog.dom.asserts.assertIsHTMLLinkElement = function(o) {
  'use strict';
  return /** @type {!HTMLLinkElement} */ (
      goog.dom.asserts.assertIsElementType_(o, 'HTMLLinkElement'));
};

/**
 * Asserts that a given object is a HTMLImageElement.
 *
 * To permit this assertion to pass in the context of tests where elements might
 * be mocked, also accepts objects that are not a subtype of Element.
 *
 * @param {?Object} o The object whose type to assert.
 * @return {!HTMLImageElement}
 * @deprecated Use goog.asserts.dom.assertIsHtmlImageElement instead.
 */
goog.dom.asserts.assertIsHTMLImageElement = function(o) {
  'use strict';
  return /** @type {!HTMLImageElement} */ (
      goog.dom.asserts.assertIsElementType_(o, 'HTMLImageElement'));
};

/**
 * Asserts that a given object is a HTMLAudioElement.
 *
 * To permit this assertion to pass in the context of tests where elements might
 * be mocked, also accepts objects that are not a subtype of Element.
 *
 * @param {?Object} o The object whose type to assert.
 * @return {!HTMLAudioElement}
 * @deprecated Use goog.asserts.dom.assertIsHtmlAudioElement instead.
 */
goog.dom.asserts.assertIsHTMLAudioElement = function(o) {
  'use strict';
  return /** @type {!HTMLAudioElement} */ (
      goog.dom.asserts.assertIsElementType_(o, 'HTMLAudioElement'));
};

/**
 * Asserts that a given object is a HTMLVideoElement.
 *
 * To permit this assertion to pass in the context of tests where elements might
 * be mocked, also accepts objects that are not a subtype of Element.
 *
 * @param {?Object} o The object whose type to assert.
 * @return {!HTMLVideoElement}
 * @deprecated Use goog.asserts.dom.assertIsHtmlVideoElement instead.
 */
goog.dom.asserts.assertIsHTMLVideoElement = function(o) {
  'use strict';
  return /** @type {!HTMLVideoElement} */ (
      goog.dom.asserts.assertIsElementType_(o, 'HTMLVideoElement'));
};

/**
 * Asserts that a given object is a HTMLInputElement.
 *
 * To permit this assertion to pass in the context of tests where elements might
 * be mocked, also accepts objects that are not a subtype of Element.
 *
 * @param {?Object} o The object whose type to assert.
 * @return {!HTMLInputElement}
 * @deprecated Use goog.asserts.dom.assertIsHtmlInputElement instead.
 */
goog.dom.asserts.assertIsHTMLInputElement = function(o) {
  'use strict';
  return /** @type {!HTMLInputElement} */ (
      goog.dom.asserts.assertIsElementType_(o, 'HTMLInputElement'));
};

/**
 * Asserts that a given object is a HTMLTextAreaElement.
 *
 * To permit this assertion to pass in the context of tests where elements might
 * be mocked, also accepts objects that are not a subtype of Element.
 *
 * @param {?Object} o The object whose type to assert.
 * @return {!HTMLTextAreaElement}
 * @deprecated Use goog.asserts.dom.assertIsHtmlTextAreaElement instead.
 */
goog.dom.asserts.assertIsHTMLTextAreaElement = function(o) {
  'use strict';
  return /** @type {!HTMLTextAreaElement} */ (
      goog.dom.asserts.assertIsElementType_(o, 'HTMLTextAreaElement'));
};

/**
 * Asserts that a given object is a HTMLCanvasElement.
 *
 * To permit this assertion to pass in the context of tests where elements might
 * be mocked, also accepts objects that are not a subtype of Element.
 *
 * @param {?Object} o The object whose type to assert.
 * @return {!HTMLCanvasElement}
 * @deprecated Use goog.asserts.dom.assertIsHtmlCanvasElement instead.
 */
goog.dom.asserts.assertIsHTMLCanvasElement = function(o) {
  'use strict';
  return /** @type {!HTMLCanvasElement} */ (
      goog.dom.asserts.assertIsElementType_(o, 'HTMLCanvasElement'));
};

/**
 * Asserts that a given object is a HTMLEmbedElement.
 *
 * To permit this assertion to pass in the context of tests where elements might
 * be mocked, also accepts objects that are not a subtype of Element.
 *
 * @param {?Object} o The object whose type to assert.
 * @return {!HTMLEmbedElement}
 * @deprecated Use goog.asserts.dom.assertIsHtmlEmbedElement instead.
 */
goog.dom.asserts.assertIsHTMLEmbedElement = function(o) {
  'use strict';
  return /** @type {!HTMLEmbedElement} */ (
      goog.dom.asserts.assertIsElementType_(o, 'HTMLEmbedElement'));
};

/**
 * Asserts that a given object is a HTMLFormElement.
 *
 * To permit this assertion to pass in the context of tests where elements might
 * be mocked, also accepts objects that are not a subtype of Element.
 *
 * @param {?Object} o The object whose type to assert.
 * @return {!HTMLFormElement}
 * @deprecated Use goog.asserts.dom.assertIsHtmlFormElement instead.
 */
goog.dom.asserts.assertIsHTMLFormElement = function(o) {
  'use strict';
  return /** @type {!HTMLFormElement} */ (
      goog.dom.asserts.assertIsElementType_(o, 'HTMLFormElement'));
};

/**
 * Asserts that a given object is a HTMLFrameElement.
 *
 * To permit this assertion to pass in the context of tests where elements might
 * be mocked, also accepts objects that are not a subtype of Element.
 *
 * @param {?Object} o The object whose type to assert.
 * @return {!HTMLFrameElement}
 * @deprecated Use goog.asserts.dom.assertIsHtmlFrameElement instead.
 */
goog.dom.asserts.assertIsHTMLFrameElement = function(o) {
  'use strict';
  return /** @type {!HTMLFrameElement} */ (
      goog.dom.asserts.assertIsElementType_(o, 'HTMLFrameElement'));
};

/**
 * Asserts that a given object is a HTMLIFrameElement.
 *
 * To permit this assertion to pass in the context of tests where elements might
 * be mocked, also accepts objects that are not a subtype of Element.
 *
 * @param {?Object} o The object whose type to assert.
 * @return {!HTMLIFrameElement}
 * @deprecated Use goog.asserts.dom.assertIsHtmlIFrameElement instead.
 */
goog.dom.asserts.assertIsHTMLIFrameElement = function(o) {
  'use strict';
  return /** @type {!HTMLIFrameElement} */ (
      goog.dom.asserts.assertIsElementType_(o, 'HTMLIFrameElement'));
};

/**
 * Asserts that a given object is a HTMLObjectElement.
 *
 * To permit this assertion to pass in the context of tests where elements might
 * be mocked, also accepts objects that are not a subtype of Element.
 *
 * @param {?Object} o The object whose type to assert.
 * @return {!HTMLObjectElement}
 * @deprecated Use goog.asserts.dom.assertIsHtmlObjectElement instead.
 */
goog.dom.asserts.assertIsHTMLObjectElement = function(o) {
  'use strict';
  return /** @type {!HTMLObjectElement} */ (
      goog.dom.asserts.assertIsElementType_(o, 'HTMLObjectElement'));
};

/**
 * Asserts that a given object is a HTMLScriptElement.
 *
 * To permit this assertion to pass in the context of tests where elements might
 * be mocked, also accepts objects that are not a subtype of Element.
 *
 * @param {?Object} o The object whose type to assert.
 * @return {!HTMLScriptElement}
 * @deprecated Use goog.asserts.dom.assertIsHtmlScriptElement instead.
 */
goog.dom.asserts.assertIsHTMLScriptElement = function(o) {
  'use strict';
  return /** @type {!HTMLScriptElement} */ (
      goog.dom.asserts.assertIsElementType_(o, 'HTMLScriptElement'));
};

/**
 * Returns a string representation of a value's type.
 *
 * @param {*} value An object, or primitive.
 * @return {string} The best display name for the value.
 * @private
 */
goog.dom.asserts.debugStringForType_ = function(value) {
  'use strict';
  if (goog.isObject(value)) {
    try {
      return /** @type {string|undefined} */ (value.constructor.displayName) ||
          value.constructor.name || Object.prototype.toString.call(value);
    } catch (e) {
      return '<object could not be stringified>';
    }
  } else {
    return value === undefined ? 'undefined' :
                                 value === null ? 'null' : typeof value;
  }
};

/**
 * Gets window of element.
 * @param {?Object} o
 * @return {?Window}
 * @private
 * @suppress {strictMissingProperties} ownerDocument not defined on Object
 */
goog.dom.asserts.getWindow_ = function(o) {
  'use strict';
  try {
    var doc = o && o.ownerDocument;
    // This can throw “Blocked a frame with origin "chrome-extension://..." from
    // accessing a cross-origin frame” in Chrome extension.
    // MOE:begin_strip See
    // http://yaqs/6574360854528000#a6424563401097216.
    // MOE:end_strip
    var win =
        doc && /** @type {?Window} */ (doc.defaultView || doc.parentWindow);
    win = win || /** @type {!Window} */ (goog.global);
    // This can throw “Permission denied to access property "Element" on
    // cross-origin object”.
    if (win.Element && win.Location) {
      return win;
    }
  } catch (ex) {
  }
  return null;
};

//third_party/javascript/closure/functions/functions.js
/**
 * @license
 * Copyright The Closure Library Authors.
 * SPDX-License-Identifier: Apache-2.0
 */

/**
 * @fileoverview Utilities for creating functions. Loosely inspired by these
 * java classes from the Guava library:
 * com.google.common.base.Functions
 * https://google.github.io/guava/releases/snapshot-jre/api/docs/index.html?com/google/common/base/Functions.html
 *
 * com.google.common.base.Predicates
 * https://google.github.io/guava/releases/snapshot-jre/api/docs/index.html?com/google/common/base/Predicates.html
 *
 * More about these can be found at
 * https://github.com/google/guava/wiki/FunctionalExplained
 */


goog.provide('goog.functions');


/**
 * Creates a function that always returns the same value.
 * @param {T} retValue The value to return.
 * @return {function():T} The new function.
 * @template T
 */
goog.functions.constant = function(retValue) {
  'use strict';
  return function() {
    'use strict';
    return retValue;
  };
};


/**
 * Always returns false.
 * @type {function(...): boolean}
 */
goog.functions.FALSE = function() {
  'use strict';
  return false;
};


/**
 * Always returns true.
 * @type {function(...): boolean}
 */
goog.functions.TRUE = function() {
  'use strict';
  return true;
};


/**
 * Always returns `null`.
 * @type {function(...): null}
 */
goog.functions.NULL = function() {
  'use strict';
  return null;
};


/**
 * Always returns `undefined`.
 * @type {function(...): undefined}
 */
goog.functions.UNDEFINED = function() {
  return undefined;
};

/**
 * Always returns `undefined` (loosely-typed version).
 * @type {!Function}
 */
goog.functions.EMPTY = /** @type {?} */ (goog.functions.UNDEFINED);


/**
 * A simple function that returns the first argument of whatever is passed
 * into it.
 * @param {T=} opt_returnValue The single value that will be returned.
 * @param {...*} var_args Optional trailing arguments. These are ignored.
 * @return {T} The first argument passed in, or undefined if nothing was passed.
 * @template T
 */
goog.functions.identity = function(opt_returnValue, var_args) {
  'use strict';
  return opt_returnValue;
};


/**
 * Creates a function that always throws an error with the given message.
 * @param {string} message The error message.
 * @return {!Function} The error-throwing function.
 */
goog.functions.error = function(message) {
  'use strict';
  return function() {
    'use strict';
    throw new Error(message);
  };
};


/**
 * Creates a function that throws the given object.
 * @param {*} err An object to be thrown.
 * @return {!Function} The error-throwing function.
 */
goog.functions.fail = function(err) {
  'use strict';
  return function() {
    'use strict';
    throw err;
  };
};


/**
 * Given a function, create a function that keeps opt_numArgs arguments and
 * silently discards all additional arguments.
 * @param {Function} f The original function.
 * @param {number=} opt_numArgs The number of arguments to keep. Defaults to 0.
 * @return {!Function} A version of f that only keeps the first opt_numArgs
 *     arguments.
 */
goog.functions.lock = function(f, opt_numArgs) {
  'use strict';
  opt_numArgs = opt_numArgs || 0;
  return function() {
    'use strict';
    const self = /** @type {*} */ (this);
    return f.apply(self, Array.prototype.slice.call(arguments, 0, opt_numArgs));
  };
};


/**
 * Creates a function that returns its nth argument.
 * @param {number} n The position of the return argument.
 * @return {!Function} A new function.
 */
goog.functions.nth = function(n) {
  'use strict';
  return function() {
    'use strict';
    return arguments[n];
  };
};


/**
 * Like goog.partial(), except that arguments are added after arguments to the
 * returned function.
 *
 * Usage:
 * function f(arg1, arg2, arg3, arg4) { ... }
 * var g = goog.functions.partialRight(f, arg3, arg4);
 * g(arg1, arg2);
 *
 * @param {!Function} fn A function to partially apply.
 * @param {...*} var_args Additional arguments that are partially applied to fn
 *     at the end.
 * @return {!Function} A partially-applied form of the function goog.partial()
 *     was invoked as a method of.
 */
goog.functions.partialRight = function(fn, var_args) {
  'use strict';
  const rightArgs = Array.prototype.slice.call(arguments, 1);
  return function() {
    'use strict';
    // Even in strict mode, IE10/11 and Edge (non-Chromium) use global context
    // when free-calling functions. To catch cases where people were using this
    // erroneously, we explicitly change the context to undefined to match
    // strict mode specifications.
    let self = /** @type {*} */ (this);
    if (self === goog.global) {
      self = undefined;
    }
    const newArgs = Array.prototype.slice.call(arguments);
    newArgs.push.apply(newArgs, rightArgs);
    return fn.apply(self, newArgs);
  };
};


/**
 * Given a function, create a new function that swallows its return value
 * and replaces it with a new one.
 * @param {Function} f A function.
 * @param {T} retValue A new return value.
 * @return {function(...?):T} A new function.
 * @template T
 */
goog.functions.withReturnValue = function(f, retValue) {
  'use strict';
  return goog.functions.sequence(f, goog.functions.constant(retValue));
};


/**
 * Creates a function that returns whether its argument equals the given value.
 *
 * Example:
 * var key = goog.object.findKey(obj, goog.functions.equalTo('needle'));
 *
 * @param {*} value The value to compare to.
 * @param {boolean=} opt_useLooseComparison Whether to use a loose (==)
 *     comparison rather than a strict (===) one. Defaults to false.
 * @return {function(*):boolean} The new function.
 */
goog.functions.equalTo = function(value, opt_useLooseComparison) {
  'use strict';
  return function(other) {
    'use strict';
    return opt_useLooseComparison ? (value == other) : (value === other);
  };
};


/**
 * Creates the composition of the functions passed in.
 * For example, (goog.functions.compose(f, g))(a) is equivalent to f(g(a)).
 * @param {function(...?):T} fn The final function.
 * @param {...Function} var_args A list of functions.
 * @return {function(...?):T} The composition of all inputs.
 * @template T
 */
goog.functions.compose = function(fn, var_args) {
  'use strict';
  const functions = arguments;
  const length = functions.length;
  return function() {
    'use strict';
    const self = /** @type {*} */ (this);
    let result;
    if (length) {
      result = functions[length - 1].apply(self, arguments);
    }

    for (let i = length - 2; i >= 0; i--) {
      result = functions[i].call(self, result);
    }
    return result;
  };
};


/**
 * Creates a function that calls the functions passed in in sequence, and
 * returns the value of the last function. For example,
 * (goog.functions.sequence(f, g))(x) is equivalent to f(x),g(x).
 * @param {...Function} var_args A list of functions.
 * @return {!Function} A function that calls all inputs in sequence.
 */
goog.functions.sequence = function(var_args) {
  'use strict';
  const functions = arguments;
  const length = functions.length;
  return function() {
    'use strict';
    const self = /** @type {*} */ (this);
    let result;
    for (let i = 0; i < length; i++) {
      result = functions[i].apply(self, arguments);
    }
    return result;
  };
};


/**
 * Creates a function that returns true if each of its components evaluates
 * to true. The components are evaluated in order, and the evaluation will be
 * short-circuited as soon as a function returns false.
 * For example, (goog.functions.and(f, g))(x) is equivalent to f(x) && g(x).
 * @param {...Function} var_args A list of functions.
 * @return {function(...?):boolean} A function that ANDs its component
 *      functions.
 */
goog.functions.and = function(var_args) {
  'use strict';
  const functions = arguments;
  const length = functions.length;
  return function() {
    'use strict';
    const self = /** @type {*} */ (this);
    for (let i = 0; i < length; i++) {
      if (!functions[i].apply(self, arguments)) {
        return false;
      }
    }
    return true;
  };
};


/**
 * Creates a function that returns true if any of its components evaluates
 * to true. The components are evaluated in order, and the evaluation will be
 * short-circuited as soon as a function returns true.
 * For example, (goog.functions.or(f, g))(x) is equivalent to f(x) || g(x).
 * @param {...Function} var_args A list of functions.
 * @return {function(...?):boolean} A function that ORs its component
 *    functions.
 */
goog.functions.or = function(var_args) {
  'use strict';
  const functions = arguments;
  const length = functions.length;
  return function() {
    'use strict';
    const self = /** @type {*} */ (this);
    for (let i = 0; i < length; i++) {
      if (functions[i].apply(self, arguments)) {
        return true;
      }
    }
    return false;
  };
};


/**
 * Creates a function that returns the Boolean opposite of a provided function.
 * For example, (goog.functions.not(f))(x) is equivalent to !f(x).
 * @param {!Function} f The original function.
 * @return {function(...?):boolean} A function that delegates to f and returns
 * opposite.
 */
goog.functions.not = function(f) {
  'use strict';
  return function() {
    'use strict';
    const self = /** @type {*} */ (this);
    return !f.apply(self, arguments);
  };
};


/**
 * Generic factory function to construct an object given the constructor
 * and the arguments. Intended to be bound to create object factories.
 *
 * Example:
 *
 * var factory = goog.partial(goog.functions.create, Class);
 *
 * @param {function(new:T, ...)} constructor The constructor for the Object.
 * @param {...*} var_args The arguments to be passed to the constructor.
 * @return {T} A new instance of the class given in `constructor`.
 * @template T
 * @deprecated This function does not work with ES6 class constructors. Use
 *     arrow functions + spread args instead.
 */
goog.functions.create = function(constructor, var_args) {
  'use strict';
  /**
   * @constructor
   * @final
   */
  const temp = function() {};
  temp.prototype = constructor.prototype;

  // obj will have constructor's prototype in its chain and
  // 'obj instanceof constructor' will be true.
  const obj = new temp();

  // obj is initialized by constructor.
  // arguments is only array-like so lacks shift(), but can be used with
  // the Array prototype function.
  constructor.apply(obj, Array.prototype.slice.call(arguments, 1));
  return obj;
};


/**
 * @define {boolean} Whether the return value cache should be used.
 *    This should only be used to disable caches when testing.
 */
goog.functions.CACHE_RETURN_VALUE =
    goog.define('goog.functions.CACHE_RETURN_VALUE', true);


/**
 * Gives a wrapper function that caches the return value of a parameterless
 * function when first called.
 *
 * When called for the first time, the given function is called and its
 * return value is cached (thus this is only appropriate for idempotent
 * functions).  Subsequent calls will return the cached return value. This
 * allows the evaluation of expensive functions to be delayed until first used.
 *
 * To cache the return values of functions with parameters, see goog.memoize.
 *
 * @param {function():T} fn A function to lazily evaluate.
 * @return {function():T} A wrapped version the function.
 * @template T
 */
goog.functions.cacheReturnValue = function(fn) {
  'use strict';
  let called = false;
  let value;

  return function() {
    'use strict';
    if (!goog.functions.CACHE_RETURN_VALUE) {
      return fn();
    }

    if (!called) {
      value = fn();
      called = true;
    }

    return value;
  };
};


/**
 * Wraps a function to allow it to be called, at most, once. All
 * additional calls are no-ops.
 *
 * This is particularly useful for initialization functions
 * that should be called, at most, once.
 *
 * @param {function():*} f Function to call.
 * @return {function():undefined} Wrapped function.
 */
goog.functions.once = function(f) {
  'use strict';
  // Keep a reference to the function that we null out when we're done with
  // it -- that way, the function can be GC'd when we're done with it.
  let inner = f;
  return function() {
    'use strict';
    if (inner) {
      const tmp = inner;
      inner = null;
      tmp();
    }
  };
};


/**
 * Wraps a function to allow it to be called, at most, once per interval
 * (specified in milliseconds). If the wrapper function is called N times within
 * that interval, only the Nth call will go through.
 *
 * This is particularly useful for batching up repeated actions where the
 * last action should win. This can be used, for example, for refreshing an
 * autocomplete pop-up every so often rather than updating with every keystroke,
 * since the final text typed by the user is the one that should produce the
 * final autocomplete results. For more stateful debouncing with support for
 * pausing, resuming, and canceling debounced actions, use
 * `goog.async.Debouncer`.
 *
 * @param {function(this:SCOPE, ...?)} f Function to call.
 * @param {number} interval Interval over which to debounce. The function will
 *     only be called after the full interval has elapsed since the last call.
 * @param {SCOPE=} opt_scope Object in whose scope to call the function.
 * @return {function(...?): undefined} Wrapped function.
 * @template SCOPE
 */
goog.functions.debounce = function(f, interval, opt_scope) {
  'use strict';
  let timeout = 0;
  return /** @type {function(...?)} */ (function(var_args) {
    'use strict';
    goog.global.clearTimeout(timeout);
    const args = arguments;
    timeout = goog.global.setTimeout(function() {
      'use strict';
      f.apply(opt_scope, args);
    }, interval);
  });
};


/**
 * Wraps a function to allow it to be called, at most, once per interval
 * (specified in milliseconds). If the wrapper function is called N times in
 * that interval, both the 1st and the Nth calls will go through.
 *
 * This is particularly useful for limiting repeated user requests where the
 * the last action should win, but you also don't want to wait until the end of
 * the interval before sending a request out, as it leads to a perception of
 * slowness for the user.
 *
 * @param {function(this:SCOPE, ...?)} f Function to call.
 * @param {number} interval Interval over which to throttle. The function can
 *     only be called once per interval.
 * @param {SCOPE=} opt_scope Object in whose scope to call the function.
 * @return {function(...?): undefined} Wrapped function.
 * @template SCOPE
 */
goog.functions.throttle = function(f, interval, opt_scope) {
  'use strict';
  let timeout = 0;
  let shouldFire = false;
  let storedArgs = [];

  const handleTimeout = function() {
    'use strict';
    timeout = 0;
    if (shouldFire) {
      shouldFire = false;
      fire();
    }
  };

  const fire = function() {
    'use strict';
    timeout = goog.global.setTimeout(handleTimeout, interval);
    let args = storedArgs;
    storedArgs = [];  // Avoid a space leak by clearing stored arguments.
    f.apply(opt_scope, args);
  };

  return /** @type {function(...?)} */ (function(var_args) {
    'use strict';
    storedArgs = arguments;
    if (!timeout) {
      fire();
    } else {
      shouldFire = true;
    }
  });
};


/**
 * Wraps a function to allow it to be called, at most, once per interval
 * (specified in milliseconds). If the wrapper function is called N times within
 * that interval, only the 1st call will go through.
 *
 * This is particularly useful for limiting repeated user requests where the
 * first request is guaranteed to have all the data required to perform the
 * final action, so there's no need to wait until the end of the interval before
 * sending the request out.
 *
 * @param {function(this:SCOPE, ...?)} f Function to call.
 * @param {number} interval Interval over which to rate-limit. The function will
 *     only be called once per interval, and ignored for the remainer of the
 *     interval.
 * @param {SCOPE=} opt_scope Object in whose scope to call the function.
 * @return {function(...?): undefined} Wrapped function.
 * @template SCOPE
 */
goog.functions.rateLimit = function(f, interval, opt_scope) {
  'use strict';
  let timeout = 0;

  const handleTimeout = function() {
    'use strict';
    timeout = 0;
  };

  return /** @type {function(...?)} */ (function(var_args) {
    'use strict';
    if (!timeout) {
      timeout = goog.global.setTimeout(handleTimeout, interval);
      f.apply(opt_scope, arguments);
    }
  });
};

/**
 * Returns true if the specified value is a function.
 * @param {*} val Variable to test.
 * @return {boolean} Whether variable is a function.
 */
goog.functions.isFunction = (val) => {
  return typeof val === 'function';
};

//third_party/javascript/closure/dom/htmlelement.js
/**
 * @license
 * Copyright The Closure Library Authors.
 * SPDX-License-Identifier: Apache-2.0
 */

goog.provide('goog.dom.HtmlElement');



/**
 * This subclass of HTMLElement is used when only a HTMLElement is possible and
 * not any of its subclasses. Normally, a type can refer to an instance of
 * itself or an instance of any subtype. More concretely, if HTMLElement is used
 * then the compiler must assume that it might still be e.g. HTMLScriptElement.
 * With this, the type check knows that it couldn't be any special element.
 *
 * @constructor
 * @extends {HTMLElement}
 */
goog.dom.HtmlElement = function() {};

//third_party/javascript/closure/dom/tagname.js
/**
 * @license
 * Copyright The Closure Library Authors.
 * SPDX-License-Identifier: Apache-2.0
 */

/**
 * @fileoverview Defines the goog.dom.TagName class. Its constants enumerate
 * all HTML tag names specified in either the W3C HTML 4.01 index of elements
 * or the HTML5.1 specification.
 *
 * References:
 * https://www.w3.org/TR/html401/index/elements.html
 * https://www.w3.org/TR/html51/dom.html#elements
 */
goog.provide('goog.dom.TagName');

goog.require('goog.dom.HtmlElement');

/**
 * A tag name for an HTML element.
 *
 * This type is a lie. All instances are actually strings. Do not implement it.
 *
 * It exists because we need an object type to host the template type parameter,
 * and that's not possible with literal or enum types. It is a record type so
 * that runtime type checks don't try to validate the lie.
 *
 * @template T
 * @record
 */
goog.dom.TagName = class {
  /**
   * Cast a string into the tagname for the associated constructor.
   *
   * @template T
   * @param {string} name
   * @param {function(new:T, ...?)} type
   * @return {!goog.dom.TagName<T>}
   */
  static cast(name, type) {
    return /** @type {?} */ (name);
  }

  /** @suppress {unusedPrivateMembers} */
  constructor() {
    /** @private {null} */
    this.googDomTagName_doNotImplementThisTypeOrElse_;

    /** @private {T} */
    this.ensureTypeScriptRemembersTypeT_;
  }

  /**
   * Appease the compiler that instances are stringafiable for the
   * purpose of being a dictionary key.
   *
   * Never implemented; always backed by `String::toString`.
   *
   * @override
   * @return {string}
   */
  toString() {}
};



/** @const {!goog.dom.TagName<!HTMLAnchorElement>} */
goog.dom.TagName.A = /** @type {?} */ ('A');

/** @const {!goog.dom.TagName<!goog.dom.HtmlElement>} */
goog.dom.TagName.ABBR = /** @type {?} */ ('ABBR');

/** @const {!goog.dom.TagName<!goog.dom.HtmlElement>} */
goog.dom.TagName.ACRONYM = /** @type {?} */ ('ACRONYM');

/** @const {!goog.dom.TagName<!goog.dom.HtmlElement>} */
goog.dom.TagName.ADDRESS = /** @type {?} */ ('ADDRESS');

/** @const {!goog.dom.TagName<!HTMLAppletElement>} */
goog.dom.TagName.APPLET = /** @type {?} */ ('APPLET');

/** @const {!goog.dom.TagName<!HTMLAreaElement>} */
goog.dom.TagName.AREA = /** @type {?} */ ('AREA');

/** @const {!goog.dom.TagName<!goog.dom.HtmlElement>} */
goog.dom.TagName.ARTICLE = /** @type {?} */ ('ARTICLE');

/** @const {!goog.dom.TagName<!goog.dom.HtmlElement>} */
goog.dom.TagName.ASIDE = /** @type {?} */ ('ASIDE');

/** @const {!goog.dom.TagName<!HTMLAudioElement>} */
goog.dom.TagName.AUDIO = /** @type {?} */ ('AUDIO');

/** @const {!goog.dom.TagName<!goog.dom.HtmlElement>} */
goog.dom.TagName.B = /** @type {?} */ ('B');

/** @const {!goog.dom.TagName<!HTMLBaseElement>} */
goog.dom.TagName.BASE = /** @type {?} */ ('BASE');

/** @const {!goog.dom.TagName<!HTMLBaseFontElement>} */
goog.dom.TagName.BASEFONT = /** @type {?} */ ('BASEFONT');

/** @const {!goog.dom.TagName<!goog.dom.HtmlElement>} */
goog.dom.TagName.BDI = /** @type {?} */ ('BDI');

/** @const {!goog.dom.TagName<!goog.dom.HtmlElement>} */
goog.dom.TagName.BDO = /** @type {?} */ ('BDO');

/** @const {!goog.dom.TagName<!goog.dom.HtmlElement>} */
goog.dom.TagName.BIG = /** @type {?} */ ('BIG');

/** @const {!goog.dom.TagName<!HTMLQuoteElement>} */
goog.dom.TagName.BLOCKQUOTE = /** @type {?} */ ('BLOCKQUOTE');

/** @const {!goog.dom.TagName<!HTMLBodyElement>} */
goog.dom.TagName.BODY = /** @type {?} */ ('BODY');

/** @const {!goog.dom.TagName<!HTMLBRElement>} */
goog.dom.TagName.BR = /** @type {?} */ ('BR');

/** @const {!goog.dom.TagName<!HTMLButtonElement>} */
goog.dom.TagName.BUTTON = /** @type {?} */ ('BUTTON');

/** @const {!goog.dom.TagName<!HTMLCanvasElement>} */
goog.dom.TagName.CANVAS = /** @type {?} */ ('CANVAS');

/** @const {!goog.dom.TagName<!HTMLTableCaptionElement>} */
goog.dom.TagName.CAPTION = /** @type {?} */ ('CAPTION');

/** @const {!goog.dom.TagName<!goog.dom.HtmlElement>} */
goog.dom.TagName.CENTER = /** @type {?} */ ('CENTER');

/** @const {!goog.dom.TagName<!goog.dom.HtmlElement>} */
goog.dom.TagName.CITE = /** @type {?} */ ('CITE');

/** @const {!goog.dom.TagName<!goog.dom.HtmlElement>} */
goog.dom.TagName.CODE = /** @type {?} */ ('CODE');

/** @const {!goog.dom.TagName<!HTMLTableColElement>} */
goog.dom.TagName.COL = /** @type {?} */ ('COL');

/** @const {!goog.dom.TagName<!HTMLTableColElement>} */
goog.dom.TagName.COLGROUP = /** @type {?} */ ('COLGROUP');

/** @const {!goog.dom.TagName<!goog.dom.HtmlElement>} */
goog.dom.TagName.COMMAND = /** @type {?} */ ('COMMAND');

/** @const {!goog.dom.TagName<!goog.dom.HtmlElement>} */
goog.dom.TagName.DATA = /** @type {?} */ ('DATA');

/** @const {!goog.dom.TagName<!HTMLDataListElement>} */
goog.dom.TagName.DATALIST = /** @type {?} */ ('DATALIST');

/** @const {!goog.dom.TagName<!goog.dom.HtmlElement>} */
goog.dom.TagName.DD = /** @type {?} */ ('DD');

/** @const {!goog.dom.TagName<!HTMLModElement>} */
goog.dom.TagName.DEL = /** @type {?} */ ('DEL');

/** @const {!goog.dom.TagName<!HTMLDetailsElement>} */
goog.dom.TagName.DETAILS = /** @type {?} */ ('DETAILS');

/** @const {!goog.dom.TagName<!goog.dom.HtmlElement>} */
goog.dom.TagName.DFN = /** @type {?} */ ('DFN');

/** @const {!goog.dom.TagName<!HTMLDialogElement>} */
goog.dom.TagName.DIALOG = /** @type {?} */ ('DIALOG');

/** @const {!goog.dom.TagName<!HTMLDirectoryElement>} */
goog.dom.TagName.DIR = /** @type {?} */ ('DIR');

/** @const {!goog.dom.TagName<!HTMLDivElement>} */
goog.dom.TagName.DIV = /** @type {?} */ ('DIV');

/** @const {!goog.dom.TagName<!HTMLDListElement>} */
goog.dom.TagName.DL = /** @type {?} */ ('DL');

/** @const {!goog.dom.TagName<!goog.dom.HtmlElement>} */
goog.dom.TagName.DT = /** @type {?} */ ('DT');

/** @const {!goog.dom.TagName<!goog.dom.HtmlElement>} */
goog.dom.TagName.EM = /** @type {?} */ ('EM');

/** @const {!goog.dom.TagName<!HTMLEmbedElement>} */
goog.dom.TagName.EMBED = /** @type {?} */ ('EMBED');

/** @const {!goog.dom.TagName<!HTMLFieldSetElement>} */
goog.dom.TagName.FIELDSET = /** @type {?} */ ('FIELDSET');

/** @const {!goog.dom.TagName<!goog.dom.HtmlElement>} */
goog.dom.TagName.FIGCAPTION = /** @type {?} */ ('FIGCAPTION');

/** @const {!goog.dom.TagName<!goog.dom.HtmlElement>} */
goog.dom.TagName.FIGURE = /** @type {?} */ ('FIGURE');

/** @const {!goog.dom.TagName<!HTMLFontElement>} */
goog.dom.TagName.FONT = /** @type {?} */ ('FONT');

/** @const {!goog.dom.TagName<!goog.dom.HtmlElement>} */
goog.dom.TagName.FOOTER = /** @type {?} */ ('FOOTER');

/** @const {!goog.dom.TagName<!HTMLFormElement>} */
goog.dom.TagName.FORM = /** @type {?} */ ('FORM');

/** @const {!goog.dom.TagName<!HTMLFrameElement>} */
goog.dom.TagName.FRAME = /** @type {?} */ ('FRAME');

/** @const {!goog.dom.TagName<!HTMLFrameSetElement>} */
goog.dom.TagName.FRAMESET = /** @type {?} */ ('FRAMESET');

/** @const {!goog.dom.TagName<!HTMLHeadingElement>} */
goog.dom.TagName.H1 = /** @type {?} */ ('H1');

/** @const {!goog.dom.TagName<!HTMLHeadingElement>} */
goog.dom.TagName.H2 = /** @type {?} */ ('H2');

/** @const {!goog.dom.TagName<!HTMLHeadingElement>} */
goog.dom.TagName.H3 = /** @type {?} */ ('H3');

/** @const {!goog.dom.TagName<!HTMLHeadingElement>} */
goog.dom.TagName.H4 = /** @type {?} */ ('H4');

/** @const {!goog.dom.TagName<!HTMLHeadingElement>} */
goog.dom.TagName.H5 = /** @type {?} */ ('H5');

/** @const {!goog.dom.TagName<!HTMLHeadingElement>} */
goog.dom.TagName.H6 = /** @type {?} */ ('H6');

/** @const {!goog.dom.TagName<!HTMLHeadElement>} */
goog.dom.TagName.HEAD = /** @type {?} */ ('HEAD');

/** @const {!goog.dom.TagName<!goog.dom.HtmlElement>} */
goog.dom.TagName.HEADER = /** @type {?} */ ('HEADER');

/** @const {!goog.dom.TagName<!goog.dom.HtmlElement>} */
goog.dom.TagName.HGROUP = /** @type {?} */ ('HGROUP');

/** @const {!goog.dom.TagName<!HTMLHRElement>} */
goog.dom.TagName.HR = /** @type {?} */ ('HR');

/** @const {!goog.dom.TagName<!HTMLHtmlElement>} */
goog.dom.TagName.HTML = /** @type {?} */ ('HTML');

/** @const {!goog.dom.TagName<!goog.dom.HtmlElement>} */
goog.dom.TagName.I = /** @type {?} */ ('I');

/** @const {!goog.dom.TagName<!HTMLIFrameElement>} */
goog.dom.TagName.IFRAME = /** @type {?} */ ('IFRAME');

/** @const {!goog.dom.TagName<!HTMLImageElement>} */
goog.dom.TagName.IMG = /** @type {?} */ ('IMG');

/** @const {!goog.dom.TagName<!HTMLInputElement>} */
goog.dom.TagName.INPUT = /** @type {?} */ ('INPUT');

/** @const {!goog.dom.TagName<!HTMLModElement>} */
goog.dom.TagName.INS = /** @type {?} */ ('INS');

/** @const {!goog.dom.TagName<!HTMLIsIndexElement>} */
goog.dom.TagName.ISINDEX = /** @type {?} */ ('ISINDEX');

/** @const {!goog.dom.TagName<!goog.dom.HtmlElement>} */
goog.dom.TagName.KBD = /** @type {?} */ ('KBD');

// HTMLKeygenElement is deprecated.
/** @const {!goog.dom.TagName<!goog.dom.HtmlElement>} */
goog.dom.TagName.KEYGEN = /** @type {?} */ ('KEYGEN');

/** @const {!goog.dom.TagName<!HTMLLabelElement>} */
goog.dom.TagName.LABEL = /** @type {?} */ ('LABEL');

/** @const {!goog.dom.TagName<!HTMLLegendElement>} */
goog.dom.TagName.LEGEND = /** @type {?} */ ('LEGEND');

/** @const {!goog.dom.TagName<!HTMLLIElement>} */
goog.dom.TagName.LI = /** @type {?} */ ('LI');

/** @const {!goog.dom.TagName<!HTMLLinkElement>} */
goog.dom.TagName.LINK = /** @type {?} */ ('LINK');

/** @const {!goog.dom.TagName<!goog.dom.HtmlElement>} */
goog.dom.TagName.MAIN = /** @type {?} */ ('MAIN');

/** @const {!goog.dom.TagName<!HTMLMapElement>} */
goog.dom.TagName.MAP = /** @type {?} */ ('MAP');

/** @const {!goog.dom.TagName<!goog.dom.HtmlElement>} */
goog.dom.TagName.MARK = /** @type {?} */ ('MARK');

/** @const {!goog.dom.TagName<!goog.dom.HtmlElement>} */
goog.dom.TagName.MATH = /** @type {?} */ ('MATH');

/** @const {!goog.dom.TagName<!HTMLMenuElement>} */
goog.dom.TagName.MENU = /** @type {?} */ ('MENU');

/** @const {!goog.dom.TagName<!HTMLMenuItemElement>} */
goog.dom.TagName.MENUITEM = /** @type {?} */ ('MENUITEM');

/** @const {!goog.dom.TagName<!HTMLMetaElement>} */
goog.dom.TagName.META = /** @type {?} */ ('META');

/** @const {!goog.dom.TagName<!HTMLMeterElement>} */
goog.dom.TagName.METER = /** @type {?} */ ('METER');

/** @const {!goog.dom.TagName<!goog.dom.HtmlElement>} */
goog.dom.TagName.NAV = /** @type {?} */ ('NAV');

/** @const {!goog.dom.TagName<!goog.dom.HtmlElement>} */
goog.dom.TagName.NOFRAMES = /** @type {?} */ ('NOFRAMES');

/** @const {!goog.dom.TagName<!goog.dom.HtmlElement>} */
goog.dom.TagName.NOSCRIPT = /** @type {?} */ ('NOSCRIPT');

/** @const {!goog.dom.TagName<!HTMLObjectElement>} */
goog.dom.TagName.OBJECT = /** @type {?} */ ('OBJECT');

/** @const {!goog.dom.TagName<!HTMLOListElement>} */
goog.dom.TagName.OL = /** @type {?} */ ('OL');

/** @const {!goog.dom.TagName<!HTMLOptGroupElement>} */
goog.dom.TagName.OPTGROUP = /** @type {?} */ ('OPTGROUP');

/** @const {!goog.dom.TagName<!HTMLOptionElement>} */
goog.dom.TagName.OPTION = /** @type {?} */ ('OPTION');

/** @const {!goog.dom.TagName<!HTMLOutputElement>} */
goog.dom.TagName.OUTPUT = /** @type {?} */ ('OUTPUT');

/** @const {!goog.dom.TagName<!HTMLParagraphElement>} */
goog.dom.TagName.P = /** @type {?} */ ('P');

/** @const {!goog.dom.TagName<!HTMLParamElement>} */
goog.dom.TagName.PARAM = /** @type {?} */ ('PARAM');

/** @const {!goog.dom.TagName<!HTMLPictureElement>} */
goog.dom.TagName.PICTURE = /** @type {?} */ ('PICTURE');

/** @const {!goog.dom.TagName<!HTMLPreElement>} */
goog.dom.TagName.PRE = /** @type {?} */ ('PRE');

/** @const {!goog.dom.TagName<!HTMLProgressElement>} */
goog.dom.TagName.PROGRESS = /** @type {?} */ ('PROGRESS');

/** @const {!goog.dom.TagName<!HTMLQuoteElement>} */
goog.dom.TagName.Q = /** @type {?} */ ('Q');

/** @const {!goog.dom.TagName<!goog.dom.HtmlElement>} */
goog.dom.TagName.RP = /** @type {?} */ ('RP');

/** @const {!goog.dom.TagName<!goog.dom.HtmlElement>} */
goog.dom.TagName.RT = /** @type {?} */ ('RT');

/** @const {!goog.dom.TagName<!goog.dom.HtmlElement>} */
goog.dom.TagName.RTC = /** @type {?} */ ('RTC');

/** @const {!goog.dom.TagName<!goog.dom.HtmlElement>} */
goog.dom.TagName.RUBY = /** @type {?} */ ('RUBY');

/** @const {!goog.dom.TagName<!goog.dom.HtmlElement>} */
goog.dom.TagName.S = /** @type {?} */ ('S');

/** @const {!goog.dom.TagName<!goog.dom.HtmlElement>} */
goog.dom.TagName.SAMP = /** @type {?} */ ('SAMP');

/** @const {!goog.dom.TagName<!HTMLScriptElement>} */
goog.dom.TagName.SCRIPT = /** @type {?} */ ('SCRIPT');

/** @const {!goog.dom.TagName<!goog.dom.HtmlElement>} */
goog.dom.TagName.SECTION = /** @type {?} */ ('SECTION');

/** @const {!goog.dom.TagName<!HTMLSelectElement>} */
goog.dom.TagName.SELECT = /** @type {?} */ ('SELECT');

/** @const {!goog.dom.TagName<!goog.dom.HtmlElement>} */
goog.dom.TagName.SMALL = /** @type {?} */ ('SMALL');

/** @const {!goog.dom.TagName<!HTMLSourceElement>} */
goog.dom.TagName.SOURCE = /** @type {?} */ ('SOURCE');

/** @const {!goog.dom.TagName<!HTMLSpanElement>} */
goog.dom.TagName.SPAN = /** @type {?} */ ('SPAN');

/** @const {!goog.dom.TagName<!goog.dom.HtmlElement>} */
goog.dom.TagName.STRIKE = /** @type {?} */ ('STRIKE');

/** @const {!goog.dom.TagName<!goog.dom.HtmlElement>} */
goog.dom.TagName.STRONG = /** @type {?} */ ('STRONG');

/** @const {!goog.dom.TagName<!HTMLStyleElement>} */
goog.dom.TagName.STYLE = /** @type {?} */ ('STYLE');

/** @const {!goog.dom.TagName<!goog.dom.HtmlElement>} */
goog.dom.TagName.SUB = /** @type {?} */ ('SUB');

/** @const {!goog.dom.TagName<!goog.dom.HtmlElement>} */
goog.dom.TagName.SUMMARY = /** @type {?} */ ('SUMMARY');

/** @const {!goog.dom.TagName<!goog.dom.HtmlElement>} */
goog.dom.TagName.SUP = /** @type {?} */ ('SUP');

/** @const {!goog.dom.TagName<!goog.dom.HtmlElement>} */
goog.dom.TagName.SVG = /** @type {?} */ ('SVG');

/** @const {!goog.dom.TagName<!HTMLTableElement>} */
goog.dom.TagName.TABLE = /** @type {?} */ ('TABLE');

/** @const {!goog.dom.TagName<!HTMLTableSectionElement>} */
goog.dom.TagName.TBODY = /** @type {?} */ ('TBODY');

/** @const {!goog.dom.TagName<!HTMLTableCellElement>} */
goog.dom.TagName.TD = /** @type {?} */ ('TD');

/** @const {!goog.dom.TagName<!HTMLTemplateElement>} */
goog.dom.TagName.TEMPLATE = /** @type {?} */ ('TEMPLATE');

/** @const {!goog.dom.TagName<!HTMLTextAreaElement>} */
goog.dom.TagName.TEXTAREA = /** @type {?} */ ('TEXTAREA');

/** @const {!goog.dom.TagName<!HTMLTableSectionElement>} */
goog.dom.TagName.TFOOT = /** @type {?} */ ('TFOOT');

/** @const {!goog.dom.TagName<!HTMLTableCellElement>} */
goog.dom.TagName.TH = /** @type {?} */ ('TH');

/** @const {!goog.dom.TagName<!HTMLTableSectionElement>} */
goog.dom.TagName.THEAD = /** @type {?} */ ('THEAD');

/** @const {!goog.dom.TagName<!goog.dom.HtmlElement>} */
goog.dom.TagName.TIME = /** @type {?} */ ('TIME');

/** @const {!goog.dom.TagName<!HTMLTitleElement>} */
goog.dom.TagName.TITLE = /** @type {?} */ ('TITLE');

/** @const {!goog.dom.TagName<!HTMLTableRowElement>} */
goog.dom.TagName.TR = /** @type {?} */ ('TR');

/** @const {!goog.dom.TagName<!HTMLTrackElement>} */
goog.dom.TagName.TRACK = /** @type {?} */ ('TRACK');

/** @const {!goog.dom.TagName<!goog.dom.HtmlElement>} */
goog.dom.TagName.TT = /** @type {?} */ ('TT');

/** @const {!goog.dom.TagName<!goog.dom.HtmlElement>} */
goog.dom.TagName.U = /** @type {?} */ ('U');

/** @const {!goog.dom.TagName<!HTMLUListElement>} */
goog.dom.TagName.UL = /** @type {?} */ ('UL');

/** @const {!goog.dom.TagName<!goog.dom.HtmlElement>} */
goog.dom.TagName.VAR = /** @type {?} */ ('VAR');

/** @const {!goog.dom.TagName<!HTMLVideoElement>} */
goog.dom.TagName.VIDEO = /** @type {?} */ ('VIDEO');

/** @const {!goog.dom.TagName<!goog.dom.HtmlElement>} */
goog.dom.TagName.WBR = /** @type {?} */ ('WBR');

//third_party/javascript/closure/object/object.js
/**
 * @license
 * Copyright The Closure Library Authors.
 * SPDX-License-Identifier: Apache-2.0
 */

/**
 * @fileoverview Utilities for manipulating objects/maps/hashes.
 */

goog.provide('goog.object');


/**
 * Calls a function for each element in an object/map/hash.
 *
 * @param {Object<K,V>} obj The object over which to iterate.
 * @param {function(this:T,V,?,Object<K,V>):?} f The function to call
 *     for every element. This function takes 3 arguments (the value, the
 *     key and the object) and the return value is ignored.
 * @param {T=} opt_obj This is used as the 'this' object within f.
 * @template T,K,V
 */
goog.object.forEach = function(obj, f, opt_obj) {
  'use strict';
  for (const key in obj) {
    f.call(/** @type {?} */ (opt_obj), obj[key], key, obj);
  }
};


/**
 * Calls a function for each element in an object/map/hash. If that call returns
 * true, adds the element to a new object.
 *
 * @param {Object<K,V>} obj The object over which to iterate.
 * @param {function(this:T,V,?,Object<K,V>):boolean} f The function to call
 *     for every element. This
 *     function takes 3 arguments (the value, the key and the object)
 *     and should return a boolean. If the return value is true the
 *     element is added to the result object. If it is false the
 *     element is not included.
 * @param {T=} opt_obj This is used as the 'this' object within f.
 * @return {!Object<K,V>} a new object in which only elements that passed the
 *     test are present.
 * @template T,K,V
 */
goog.object.filter = function(obj, f, opt_obj) {
  'use strict';
  const res = {};
  for (const key in obj) {
    if (f.call(/** @type {?} */ (opt_obj), obj[key], key, obj)) {
      res[key] = obj[key];
    }
  }
  return res;
};


/**
 * For every element in an object/map/hash calls a function and inserts the
 * result into a new object.
 *
 * @param {Object<K,V>} obj The object over which to iterate.
 * @param {function(this:T,V,?,Object<K,V>):R} f The function to call
 *     for every element. This function
 *     takes 3 arguments (the value, the key and the object)
 *     and should return something. The result will be inserted
 *     into a new object.
 * @param {T=} opt_obj This is used as the 'this' object within f.
 * @return {!Object<K,R>} a new object with the results from f.
 * @template T,K,V,R
 */
goog.object.map = function(obj, f, opt_obj) {
  'use strict';
  const res = {};
  for (const key in obj) {
    res[key] = f.call(/** @type {?} */ (opt_obj), obj[key], key, obj);
  }
  return res;
};


/**
 * Calls a function for each element in an object/map/hash. If any
 * call returns true, returns true (without checking the rest). If
 * all calls return false, returns false.
 *
 * @param {Object<K,V>} obj The object to check.
 * @param {function(this:T,V,?,Object<K,V>):boolean} f The function to
 *     call for every element. This function
 *     takes 3 arguments (the value, the key and the object) and should
 *     return a boolean.
 * @param {T=} opt_obj This is used as the 'this' object within f.
 * @return {boolean} true if any element passes the test.
 * @template T,K,V
 */
goog.object.some = function(obj, f, opt_obj) {
  'use strict';
  for (const key in obj) {
    if (f.call(/** @type {?} */ (opt_obj), obj[key], key, obj)) {
      return true;
    }
  }
  return false;
};


/**
 * Calls a function for each element in an object/map/hash. If
 * all calls return true, returns true. If any call returns false, returns
 * false at this point and does not continue to check the remaining elements.
 *
 * @param {Object<K,V>} obj The object to check.
 * @param {?function(this:T,V,?,Object<K,V>):boolean} f The function to
 *     call for every element. This function
 *     takes 3 arguments (the value, the key and the object) and should
 *     return a boolean.
 * @param {T=} opt_obj This is used as the 'this' object within f.
 * @return {boolean} false if any element fails the test.
 * @template T,K,V
 */
goog.object.every = function(obj, f, opt_obj) {
  'use strict';
  for (const key in obj) {
    if (!f.call(/** @type {?} */ (opt_obj), obj[key], key, obj)) {
      return false;
    }
  }
  return true;
};


/**
 * Returns the number of key-value pairs in the object map.
 *
 * @param {Object} obj The object for which to get the number of key-value
 *     pairs.
 * @return {number} The number of key-value pairs in the object map.
 */
goog.object.getCount = function(obj) {
  'use strict';
  let rv = 0;
  for (const key in obj) {
    rv++;
  }
  return rv;
};


/**
 * Returns one key from the object map, if any exists.
 * For map literals the returned key will be the first one in most of the
 * browsers (a know exception is Konqueror).
 *
 * @param {Object} obj The object to pick a key from.
 * @return {string|undefined} The key or undefined if the object is empty.
 */
goog.object.getAnyKey = function(obj) {
  'use strict';
  for (const key in obj) {
    return key;
  }
};


/**
 * Returns one value from the object map, if any exists.
 * For map literals the returned value will be the first one in most of the
 * browsers (a know exception is Konqueror).
 *
 * @param {Object<K,V>} obj The object to pick a value from.
 * @return {V|undefined} The value or undefined if the object is empty.
 * @template K,V
 */
goog.object.getAnyValue = function(obj) {
  'use strict';
  for (const key in obj) {
    return obj[key];
  }
};


/**
 * Whether the object/hash/map contains the given object as a value.
 * An alias for goog.object.containsValue(obj, val).
 *
 * @param {Object<K,V>} obj The object in which to look for val.
 * @param {V} val The object for which to check.
 * @return {boolean} true if val is present.
 * @template K,V
 */
goog.object.contains = function(obj, val) {
  'use strict';
  return goog.object.containsValue(obj, val);
};


/**
 * Returns the values of the object/map/hash.
 *
 * @param {Object<K,V>} obj The object from which to get the values.
 * @return {!Array<V>} The values in the object/map/hash.
 * @template K,V
 */
goog.object.getValues = function(obj) {
  'use strict';
  const res = [];
  let i = 0;
  for (const key in obj) {
    res[i++] = obj[key];
  }
  return res;
};


/**
 * Returns the keys of the object/map/hash.
 *
 * @param {Object} obj The object from which to get the keys.
 * @return {!Array<string>} Array of property keys.
 */
goog.object.getKeys = function(obj) {
  'use strict';
  const res = [];
  let i = 0;
  for (const key in obj) {
    res[i++] = key;
  }
  return res;
};


/**
 * Get a value from an object multiple levels deep.  This is useful for
 * pulling values from deeply nested objects, such as JSON responses.
 * Example usage: getValueByKeys(jsonObj, 'foo', 'entries', 3)
 *
 * @param {!Object} obj An object to get the value from.  Can be array-like.
 * @param {...(string|number|!IArrayLike<number|string>)}
 *     var_args A number of keys
 *     (as strings, or numbers, for array-like objects).  Can also be
 *     specified as a single array of keys.
 * @return {*} The resulting value.  If, at any point, the value for a key
 *     in the current object is null or undefined, returns undefined.
 */
goog.object.getValueByKeys = function(obj, var_args) {
  'use strict';
  const isArrayLike = goog.isArrayLike(var_args);
  const keys = isArrayLike ?
      /** @type {!IArrayLike<number|string>} */ (var_args) :
      arguments;

  // Start with the 2nd parameter for the variable parameters syntax.
  for (let i = isArrayLike ? 0 : 1; i < keys.length; i++) {
    if (obj == null) return undefined;
    obj = obj[keys[i]];
  }

  return obj;
};


/**
 * Whether the object/map/hash contains the given key.
 *
 * @param {Object} obj The object in which to look for key.
 * @param {?} key The key for which to check.
 * @return {boolean} true If the map contains the key.
 */
goog.object.containsKey = function(obj, key) {
  'use strict';
  return obj !== null && key in obj;
};


/**
 * Whether the object/map/hash contains the given value. This is O(n).
 *
 * @param {Object<K,V>} obj The object in which to look for val.
 * @param {V} val The value for which to check.
 * @return {boolean} true If the map contains the value.
 * @template K,V
 */
goog.object.containsValue = function(obj, val) {
  'use strict';
  for (const key in obj) {
    if (obj[key] == val) {
      return true;
    }
  }
  return false;
};


/**
 * Searches an object for an element that satisfies the given condition and
 * returns its key.
 * @param {Object<K,V>} obj The object to search in.
 * @param {function(this:T,V,string,Object<K,V>):boolean} f The
 *      function to call for every element. Takes 3 arguments (the value,
 *     the key and the object) and should return a boolean.
 * @param {T=} opt_this An optional "this" context for the function.
 * @return {string|undefined} The key of an element for which the function
 *     returns true or undefined if no such element is found.
 * @template T,K,V
 */
goog.object.findKey = function(obj, f, opt_this) {
  'use strict';
  for (const key in obj) {
    if (f.call(/** @type {?} */ (opt_this), obj[key], key, obj)) {
      return key;
    }
  }
  return undefined;
};


/**
 * Searches an object for an element that satisfies the given condition and
 * returns its value.
 * @param {Object<K,V>} obj The object to search in.
 * @param {function(this:T,V,string,Object<K,V>):boolean} f The function
 *     to call for every element. Takes 3 arguments (the value, the key
 *     and the object) and should return a boolean.
 * @param {T=} opt_this An optional "this" context for the function.
 * @return {V} The value of an element for which the function returns true or
 *     undefined if no such element is found.
 * @template T,K,V
 */
goog.object.findValue = function(obj, f, opt_this) {
  'use strict';
  const key = goog.object.findKey(obj, f, opt_this);
  return key && obj[key];
};


/**
 * Whether the object/map/hash is empty.
 *
 * @param {Object} obj The object to test.
 * @return {boolean} true if obj is empty.
 */
goog.object.isEmpty = function(obj) {
  'use strict';
  for (const key in obj) {
    return false;
  }
  return true;
};


/**
 * Removes all key value pairs from the object/map/hash.
 *
 * @param {Object} obj The object to clear.
 */
goog.object.clear = function(obj) {
  'use strict';
  for (const i in obj) {
    delete obj[i];
  }
};


/**
 * Removes a key-value pair based on the key.
 *
 * @param {Object} obj The object from which to remove the key.
 * @param {?} key The key to remove.
 * @return {boolean} Whether an element was removed.
 */
goog.object.remove = function(obj, key) {
  'use strict';
  let rv;
  if (rv = key in /** @type {!Object} */ (obj)) {
    delete obj[key];
  }
  return rv;
};


/**
 * Adds a key-value pair to the object. Throws an exception if the key is
 * already in use. Use set if you want to change an existing pair.
 *
 * @param {Object<K,V>} obj The object to which to add the key-value pair.
 * @param {string} key The key to add.
 * @param {V} val The value to add.
 * @template K,V
 */
goog.object.add = function(obj, key, val) {
  'use strict';
  if (obj !== null && key in obj) {
    throw new Error('The object already contains the key "' + key + '"');
  }
  goog.object.set(obj, key, val);
};


/**
 * Returns the value for the given key.
 *
 * @param {Object<K,V>} obj The object from which to get the value.
 * @param {string} key The key for which to get the value.
 * @param {R=} opt_val The value to return if no item is found for the given
 *     key (default is undefined).
 * @return {V|R|undefined} The value for the given key.
 * @template K,V,R
 */
goog.object.get = function(obj, key, opt_val) {
  'use strict';
  if (obj !== null && key in obj) {
    return obj[key];
  }
  return opt_val;
};


/**
 * Adds a key-value pair to the object/map/hash.
 *
 * @param {Object<K,V>} obj The object to which to add the key-value pair.
 * @param {string} key The key to add.
 * @param {V} value The value to add.
 * @template K,V
 */
goog.object.set = function(obj, key, value) {
  'use strict';
  obj[key] = value;
};


/**
 * Adds a key-value pair to the object/map/hash if it doesn't exist yet.
 *
 * @param {Object<K,V>} obj The object to which to add the key-value pair.
 * @param {string} key The key to add.
 * @param {V} value The value to add if the key wasn't present.
 * @return {V} The value of the entry at the end of the function.
 * @template K,V
 */
goog.object.setIfUndefined = function(obj, key, value) {
  'use strict';
  return key in /** @type {!Object} */ (obj) ? obj[key] : (obj[key] = value);
};


/**
 * Sets a key and value to an object if the key is not set. The value will be
 * the return value of the given function. If the key already exists, the
 * object will not be changed and the function will not be called (the function
 * will be lazily evaluated -- only called if necessary).
 *
 * This function is particularly useful when used with an `Object` which is
 * acting as a cache.
 *
 * @param {!Object<K,V>} obj The object to which to add the key-value pair.
 * @param {string} key The key to add.
 * @param {function():V} f The value to add if the key wasn't present.
 * @return {V} The value of the entry at the end of the function.
 * @template K,V
 */
goog.object.setWithReturnValueIfNotSet = function(obj, key, f) {
  'use strict';
  if (key in obj) {
    return obj[key];
  }

  const val = f();
  obj[key] = val;
  return val;
};


/**
 * Compares two objects for equality using === on the values.
 *
 * @param {!Object<K,V>} a
 * @param {!Object<K,V>} b
 * @return {boolean}
 * @template K,V
 */
goog.object.equals = function(a, b) {
  'use strict';
  for (const k in a) {
    if (!(k in b) || a[k] !== b[k]) {
      return false;
    }
  }
  for (const k in b) {
    if (!(k in a)) {
      return false;
    }
  }
  return true;
};


/**
 * Returns a shallow clone of the object.
 *
 * @param {Object<K,V>} obj Object to clone.
 * @return {!Object<K,V>} Clone of the input object.
 * @template K,V
 */
goog.object.clone = function(obj) {
  'use strict';
  const res = {};
  for (const key in obj) {
    res[key] = obj[key];
  }
  return res;
};


/**
 * Clones a value. The input may be an Object, Array, or basic type. Objects and
 * arrays will be cloned recursively.
 *
 * WARNINGS:
 * <code>goog.object.unsafeClone</code> does not detect reference loops. Objects
 * that refer to themselves will cause infinite recursion.
 *
 * <code>goog.object.unsafeClone</code> is unaware of unique identifiers, and
 * copies UIDs created by <code>getUid</code> into cloned results.
 *
 * @param {T} obj The value to clone.
 * @return {T} A clone of the input value.
 * @template T
 */
goog.object.unsafeClone = function(obj) {
  'use strict';
  if (!obj || typeof obj !== 'object') return obj;
  if (typeof obj.clone === 'function') return obj.clone();
  const clone = Array.isArray(obj) ? [] :
      typeof ArrayBuffer === 'function' &&
          typeof ArrayBuffer.isView === 'function' && ArrayBuffer.isView(obj) &&
          !(obj instanceof DataView) ?
                                     new obj.constructor(obj.length) :
                                     {};
  for (const key in obj) {
    clone[key] = goog.object.unsafeClone(obj[key]);
  }
  return clone;
};


/**
 * Returns a new object in which all the keys and values are interchanged
 * (keys become values and values become keys). If multiple keys map to the
 * same value, the chosen transposed value is implementation-dependent.
 *
 * @param {Object} obj The object to transpose.
 * @return {!Object} The transposed object.
 */
goog.object.transpose = function(obj) {
  'use strict';
  const transposed = {};
  for (const key in obj) {
    transposed[obj[key]] = key;
  }
  return transposed;
};


/**
 * The names of the fields that are defined on Object.prototype.
 * @type {Array<string>}
 * @private
 */
goog.object.PROTOTYPE_FIELDS_ = [
  'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable',
  'toLocaleString', 'toString', 'valueOf'
];


/**
 * Extends an object with another object.
 * This operates 'in-place'; it does not create a new Object.
 *
 * Example:
 * var o = {};
 * goog.object.extend(o, {a: 0, b: 1});
 * o; // {a: 0, b: 1}
 * goog.object.extend(o, {b: 2, c: 3});
 * o; // {a: 0, b: 2, c: 3}
 *
 * @param {Object} target The object to modify. Existing properties will be
 *     overwritten if they are also present in one of the objects in
 *     `var_args`.
 * @param {...(Object|null|undefined)} var_args The objects from which values
 *     will be copied.
 * @deprecated Prefer Object.assign
 */
goog.object.extend = function(target, var_args) {
  'use strict';
  let key;
  let source;
  for (let i = 1; i < arguments.length; i++) {
    source = arguments[i];
    for (key in source) {
      target[key] = source[key];
    }

    // For IE the for-in-loop does not contain any properties that are not
    // enumerable on the prototype object (for example isPrototypeOf from
    // Object.prototype) and it will also not include 'replace' on objects that
    // extend String and change 'replace' (not that it is common for anyone to
    // extend anything except Object).

    for (let j = 0; j < goog.object.PROTOTYPE_FIELDS_.length; j++) {
      key = goog.object.PROTOTYPE_FIELDS_[j];
      if (Object.prototype.hasOwnProperty.call(source, key)) {
        target[key] = source[key];
      }
    }
  }
};


/**
 * Creates a new object built from the key-value pairs provided as arguments.
 * @param {...*} var_args If only one argument is provided and it is an array
 *     then this is used as the arguments, otherwise even arguments are used as
 *     the property names and odd arguments are used as the property values.
 * @return {!Object} The new object.
 * @throws {Error} If there are uneven number of arguments or there is only one
 *     non array argument.
 */
goog.object.create = function(var_args) {
  'use strict';
  const argLength = arguments.length;
  if (argLength == 1 && Array.isArray(arguments[0])) {
    return goog.object.create.apply(null, arguments[0]);
  }

  if (argLength % 2) {
    throw new Error('Uneven number of arguments');
  }

  const rv = {};
  for (let i = 0; i < argLength; i += 2) {
    rv[arguments[i]] = arguments[i + 1];
  }
  return rv;
};


/**
 * Creates a new object where the property names come from the arguments but
 * the value is always set to true
 * @param {...*} var_args If only one argument is provided and it is an array
 *     then this is used as the arguments, otherwise the arguments are used
 *     as the property names.
 * @return {!Object} The new object.
 */
goog.object.createSet = function(var_args) {
  'use strict';
  const argLength = arguments.length;
  if (argLength == 1 && Array.isArray(arguments[0])) {
    return goog.object.createSet.apply(null, arguments[0]);
  }

  const rv = {};
  for (let i = 0; i < argLength; i++) {
    rv[arguments[i]] = true;
  }
  return rv;
};


/**
 * Creates an immutable view of the underlying object, if the browser
 * supports immutable objects.
 *
 * In default mode, writes to this view will fail silently. In strict mode,
 * they will throw an error.
 *
 * @param {!Object<K,V>} obj An object.
 * @return {!Object<K,V>} An immutable view of that object, or the
 *     original object if this browser does not support immutables.
 * @template K,V
 */
goog.object.createImmutableView = function(obj) {
  'use strict';
  let result = obj;
  if (Object.isFrozen && !Object.isFrozen(obj)) {
    result = Object.create(obj);
    Object.freeze(result);
  }
  return result;
};


/**
 * @param {!Object} obj An object.
 * @return {boolean} Whether this is an immutable view of the object.
 */
goog.object.isImmutableView = function(obj) {
  'use strict';
  return !!Object.isFrozen && Object.isFrozen(obj);
};


/**
 * Get all properties names on a given Object regardless of enumerability.
 *
 * <p> If the browser does not support `Object.getOwnPropertyNames` nor
 * `Object.getPrototypeOf` then this is equivalent to using
 * `goog.object.getKeys`
 *
 * @param {?Object} obj The object to get the properties of.
 * @param {boolean=} opt_includeObjectPrototype Whether properties defined on
 *     `Object.prototype` should be included in the result.
 * @param {boolean=} opt_includeFunctionPrototype Whether properties defined on
 *     `Function.prototype` should be included in the result.
 * @return {!Array<string>}
 * @public
 */
goog.object.getAllPropertyNames = function(
    obj, opt_includeObjectPrototype, opt_includeFunctionPrototype) {
  'use strict';
  if (!obj) {
    return [];
  }

  // Naively use a for..in loop to get the property names if the browser doesn't
  // support any other APIs for getting it.
  if (!Object.getOwnPropertyNames || !Object.getPrototypeOf) {
    return goog.object.getKeys(obj);
  }

  const visitedSet = {};

  // Traverse the prototype chain and add all properties to the visited set.
  let proto = obj;
  while (proto &&
         (proto !== Object.prototype || !!opt_includeObjectPrototype) &&
         (proto !== Function.prototype || !!opt_includeFunctionPrototype)) {
    const names = Object.getOwnPropertyNames(proto);
    for (let i = 0; i < names.length; i++) {
      visitedSet[names[i]] = true;
    }
    proto = Object.getPrototypeOf(proto);
  }

  return goog.object.getKeys(visitedSet);
};


/**
 * Given a ES5 or ES6 class reference, return its super class / super
 * constructor.
 *
 * This should be used in rare cases where you need to walk up the inheritance
 * tree (this is generally a bad idea). But this work with ES5 and ES6 classes,
 * unlike relying on the superClass_ property.
 *
 * Note: To start walking up the hierarchy from an instance call this with its
 * `constructor` property; e.g. `getSuperClass(instance.constructor)`.
 *
 * @param {function(new: ?)} constructor
 * @return {?Object}
 */
goog.object.getSuperClass = function(constructor) {
  'use strict';
  var proto = Object.getPrototypeOf(constructor.prototype);
  return proto && proto.constructor;
};

//third_party/javascript/closure/dom/tags.js
/**
 * @license
 * Copyright The Closure Library Authors.
 * SPDX-License-Identifier: Apache-2.0
 */

/**
 * @fileoverview Utilities for HTML element tag names.
 */
goog.provide('goog.dom.tags');

goog.require('goog.object');


/**
 * The void elements specified by
 * http://www.w3.org/TR/html-markup/syntax.html#void-elements.
 * @const @private {!Object<string, boolean>}
 */
goog.dom.tags.VOID_TAGS_ = goog.object.createSet(
    'area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input',
    'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr');


/**
 * Checks whether the tag is void (with no contents allowed and no legal end
 * tag), for example 'br'.
 * @param {string} tagName The tag name in lower case.
 * @return {boolean}
 */
goog.dom.tags.isVoidTag = function(tagName) {
  'use strict';
  return goog.dom.tags.VOID_TAGS_[tagName] === true;
};

//third_party/javascript/closure/html/trustedtypes.js
/**
 * @license
 * Copyright The Closure Library Authors.
 * SPDX-License-Identifier: Apache-2.0
 */

/**
 * @fileoverview Policy to convert strings to Trusted Types. See
 * https://github.com/WICG/trusted-types for details.
 */

goog.provide('goog.html.trustedtypes');


/**
 * Cached result of goog.createTrustedTypesPolicy.
 * @type {?TrustedTypePolicy|undefined}
 * @private
 */
goog.html.trustedtypes.cachedPolicy_;


/**
 * Creates a (singleton) Trusted Type Policy for Safe HTML Types.
 * @return {?TrustedTypePolicy}
 * @package
 */
goog.html.trustedtypes.getPolicyPrivateDoNotAccessOrElse = function() {
  'use strict';
  if (!goog.TRUSTED_TYPES_POLICY_NAME) {
    // Binary not configured for Trusted Types.
    return null;
  }

  if (goog.html.trustedtypes.cachedPolicy_ === undefined) {
    goog.html.trustedtypes.cachedPolicy_ =
        goog.createTrustedTypesPolicy(goog.TRUSTED_TYPES_POLICY_NAME + '#html');
  }

  return goog.html.trustedtypes.cachedPolicy_;
};

//third_party/javascript/closure/string/typedstring.js
/**
 * @license
 * Copyright The Closure Library Authors.
 * SPDX-License-Identifier: Apache-2.0
 */

goog.provide('goog.string.TypedString');



/**
 * Wrapper for strings that conform to a data type or language.
 *
 * Implementations of this interface are wrappers for strings, and typically
 * associate a type contract with the wrapped string.  Concrete implementations
 * of this interface may choose to implement additional run-time type checking,
 * see for example `goog.html.SafeHtml`. If available, client code that
 * needs to ensure type membership of an object should use the type's function
 * to assert type membership, such as `goog.html.SafeHtml.unwrap`.
 * @interface
 */
goog.string.TypedString = function() {};


/**
 * Interface marker of the TypedString interface.
 *
 * This property can be used to determine at runtime whether or not an object
 * implements this interface.  All implementations of this interface set this
 * property to `true`.
 * @type {boolean}
 */
goog.string.TypedString.prototype.implementsGoogStringTypedString;


/**
 * Retrieves this wrapped string's value.
 * @return {string} The wrapped string's value.
 */
goog.string.TypedString.prototype.getTypedStringValue;

//third_party/javascript/closure/string/const.js
/**
 * @license
 * Copyright The Closure Library Authors.
 * SPDX-License-Identifier: Apache-2.0
 */

goog.provide('goog.string.Const');

goog.require('goog.asserts');
goog.require('goog.string.TypedString');



/**
 * Wrapper for compile-time-constant strings.
 *
 * Const is a wrapper for strings that can only be created from program
 * constants (i.e., string literals).  This property relies on a custom Closure
 * compiler check that `goog.string.Const.from` is only invoked on
 * compile-time-constant expressions.
 *
 * Const is useful in APIs whose correct and secure use requires that certain
 * arguments are not attacker controlled: Compile-time constants are inherently
 * under the control of the application and not under control of external
 * attackers, and hence are safe to use in such contexts.
 *
 * Instances of this type must be created via its factory method
 * `goog.string.Const.from` and not by invoking its constructor.  The
 * constructor intentionally takes no parameters and the type is immutable;
 * hence only a default instance corresponding to the empty string can be
 * obtained via constructor invocation.  Use goog.string.Const.EMPTY
 * instead of using this constructor to get an empty Const string.
 *
 * @see goog.string.Const#from
 * @constructor
 * @final
 * @struct
 * @implements {goog.string.TypedString}
 * @param {Object=} opt_token package-internal implementation detail.
 * @param {string=} opt_content package-internal implementation detail.
 */
goog.string.Const = function(opt_token, opt_content) {
  'use strict';
  /**
   * The wrapped value of this Const object.  The field has a purposely ugly
   * name to make (non-compiled) code that attempts to directly access this
   * field stand out.
   * @private {string}
   */
  this.stringConstValueWithSecurityContract__googStringSecurityPrivate_ =
      ((opt_token ===
        goog.string.Const.GOOG_STRING_CONSTRUCTOR_TOKEN_PRIVATE_) &&
       opt_content) ||
      '';

  /**
   * A type marker used to implement additional run-time type checking.
   * @see goog.string.Const#unwrap
   * @const {!Object}
   * @private
   */
  this.STRING_CONST_TYPE_MARKER__GOOG_STRING_SECURITY_PRIVATE_ =
      goog.string.Const.TYPE_MARKER_;
};


/**
 * @override
 * @const
 */
goog.string.Const.prototype.implementsGoogStringTypedString = true;


/**
 * Returns this Const's value as a string.
 *
 * IMPORTANT: In code where it is security-relevant that an object's type is
 * indeed `goog.string.Const`, use `goog.string.Const.unwrap`
 * instead of this method.
 *
 * @see goog.string.Const#unwrap
 * @override
 */
goog.string.Const.prototype.getTypedStringValue = function() {
  'use strict';
  return this.stringConstValueWithSecurityContract__googStringSecurityPrivate_;
};


if (goog.DEBUG) {
  /**
   * Returns a debug-string representation of this value.
   *
   * To obtain the actual string value wrapped inside an object of this type,
   * use `goog.string.Const.unwrap`.
   *
   * @see goog.string.Const#unwrap
   * @override
   */
  goog.string.Const.prototype.toString = function() {
    'use strict';
    return 'Const{' +
        this.stringConstValueWithSecurityContract__googStringSecurityPrivate_ +
        '}';
  };
}


/**
 * Performs a runtime check that the provided object is indeed an instance
 * of `goog.string.Const`, and returns its value.
 * @param {!goog.string.Const} stringConst The object to extract from.
 * @return {string} The Const object's contained string, unless the run-time
 *     type check fails. In that case, `unwrap` returns an innocuous
 *     string, or, if assertions are enabled, throws
 *     `goog.asserts.AssertionError`.
 */
goog.string.Const.unwrap = function(stringConst) {
  'use strict';
  // Perform additional run-time type-checking to ensure that stringConst is
  // indeed an instance of the expected type.  This provides some additional
  // protection against security bugs due to application code that disables type
  // checks.
  if (stringConst instanceof goog.string.Const &&
      stringConst.constructor === goog.string.Const &&
      stringConst.STRING_CONST_TYPE_MARKER__GOOG_STRING_SECURITY_PRIVATE_ ===
          goog.string.Const.TYPE_MARKER_) {
    return stringConst
        .stringConstValueWithSecurityContract__googStringSecurityPrivate_;
  } else {
    goog.asserts.fail(
        'expected object of type Const, got \'' + stringConst + '\'');
    return 'type_error:Const';
  }
};


/**
 * Creates a Const object from a compile-time constant string.
 *
 * It is illegal to invoke this function on an expression whose
 * compile-time-constant value cannot be determined by the Closure compiler.
 *
 * Correct invocations include,
 * <pre>
 *   var s = goog.string.Const.from('hello');
 *   var t = goog.string.Const.from('hello' + 'world');
 * </pre>
 *
 * In contrast, the following are illegal:
 * <pre>
 *   var s = goog.string.Const.from(getHello());
 *   var t = goog.string.Const.from('hello' + world);
 * </pre>
 *
 * @param {string} s A constant string from which to create a Const.
 * @return {!goog.string.Const} A Const object initialized to stringConst.
 */
goog.string.Const.from = function(s) {
  'use strict';
  return new goog.string.Const(
      goog.string.Const.GOOG_STRING_CONSTRUCTOR_TOKEN_PRIVATE_, s);
};

/**
 * Type marker for the Const type, used to implement additional run-time
 * type checking.
 * @const {!Object}
 * @private
 */
goog.string.Const.TYPE_MARKER_ = {};

/**
 * @type {!Object}
 * @private
 * @const
 */
goog.string.Const.GOOG_STRING_CONSTRUCTOR_TOKEN_PRIVATE_ = {};

/**
 * A Const instance wrapping the empty string.
 * @const {!goog.string.Const}
 */
goog.string.Const.EMPTY = goog.string.Const.from('');

//third_party/javascript/closure/html/safescript.js
goog.loadModule(function(exports) {'use strict';/**
 * @license
 * Copyright The Closure Library Authors.
 * SPDX-License-Identifier: Apache-2.0
 */

/**
 * @fileoverview The SafeScript type and its builders.
 *
 * TODO(xtof): Link to document stating type contract.
 */

goog.module('goog.html.SafeScript');
goog.module.declareLegacyNamespace();

const Const = goog.require('goog.string.Const');
const TypedString = goog.require('goog.string.TypedString');
const trustedtypes = goog.require('goog.html.trustedtypes');
const {fail} = goog.require('goog.asserts');

/**
 * Token used to ensure that object is created only from this file. No code
 * outside of this file can access this token.
 * @const {!Object}
 */
const CONSTRUCTOR_TOKEN_PRIVATE = {};

/**
 * A string-like object which represents JavaScript code and that carries the
 * security type contract that its value, as a string, will not cause execution
 * of unconstrained attacker controlled code (XSS) when evaluated as JavaScript
 * in a browser.
 *
 * Instances of this type must be created via the factory method
 * `SafeScript.fromConstant` and not by invoking its constructor. The
 * constructor intentionally takes an extra parameter that cannot be constructed
 * outside of this file and the type is immutable; hence only a default instance
 * corresponding to the empty string can be obtained via constructor invocation.
 *
 * A SafeScript's string representation can safely be interpolated as the
 * content of a script element within HTML. The SafeScript string should not be
 * escaped before interpolation.
 *
 * Note that the SafeScript might contain text that is attacker-controlled but
 * that text should have been interpolated with appropriate escaping,
 * sanitization and/or validation into the right location in the script, such
 * that it is highly constrained in its effect (for example, it had to match a
 * set of whitelisted words).
 *
 * A SafeScript can be constructed via security-reviewed unchecked
 * conversions. In this case producers of SafeScript must ensure themselves that
 * the SafeScript does not contain unsafe script. Note in particular that
 * `&lt;` is dangerous, even when inside JavaScript strings, and so should
 * always be forbidden or JavaScript escaped in user controlled input. For
 * example, if `&lt;/script&gt;&lt;script&gt;evil&lt;/script&gt;"` were
 * interpolated inside a JavaScript string, it would break out of the context
 * of the original script element and `evil` would execute. Also note
 * that within an HTML script (raw text) element, HTML character references,
 * such as "&lt;" are not allowed. See
 * http://www.w3.org/TR/html5/scripting-1.html#restrictions-for-contents-of-script-elements.
 * Creating SafeScript objects HAS SIDE-EFFECTS due to calling Trusted Types Web
 * API.
 *
 * @see SafeScript#fromConstant
 * @final
 * @implements {TypedString}
 */
class SafeScript {
  /**
   * @param {!TrustedScript|string} value
   * @param {!Object} token package-internal implementation detail.
   */
  constructor(value, token) {
    /**
     * The contained value of this SafeScript.  The field has a purposely ugly
     * name to make (non-compiled) code that attempts to directly access this
     * field stand out.
     * @private {!TrustedScript|string}
     */
    this.privateDoNotAccessOrElseSafeScriptWrappedValue_ =
        (token === CONSTRUCTOR_TOKEN_PRIVATE) ? value : '';

    /**
     * @override
     * @const
     */
    this.implementsGoogStringTypedString = true;
  }

  /**
   * Creates a SafeScript object from a compile-time constant string.
   *
   * @param {!Const} script A compile-time-constant string from which to create
   *     a SafeScript.
   * @return {!SafeScript} A SafeScript object initialized to `script`.
   */
  static fromConstant(script) {
    const scriptString = Const.unwrap(script);
    if (scriptString.length === 0) {
      return SafeScript.EMPTY;
    }
    return SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse(
        scriptString);
  }

  /**
   * Creates a SafeScript JSON representation from anything that could be passed
   * to JSON.stringify.
   * @param {*} val
   * @return {!SafeScript}
   */
  static fromJson(val) {
    return SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse(
        SafeScript.stringify_(val));
  }

  /**
   * Returns this SafeScript's value as a string.
   *
   * IMPORTANT: In code where it is security relevant that an object's type is
   * indeed `SafeScript`, use `SafeScript.unwrap` instead of
   * this method. If in doubt, assume that it's security relevant. In
   * particular, note that goog.html functions which return a goog.html type do
   * not guarantee the returned instance is of the right type. For example:
   *
   * <pre>
   * var fakeSafeHtml = new String('fake');
   * fakeSafeHtml.__proto__ = goog.html.SafeHtml.prototype;
   * var newSafeHtml = goog.html.SafeHtml.htmlEscape(fakeSafeHtml);
   * // newSafeHtml is just an alias for fakeSafeHtml, it's passed through by
   * // goog.html.SafeHtml.htmlEscape() as fakeSafeHtml
   * // instanceof goog.html.SafeHtml.
   * </pre>
   *
   * @see SafeScript#unwrap
   * @override
   */
  getTypedStringValue() {
    return this.privateDoNotAccessOrElseSafeScriptWrappedValue_.toString();
  }

  /**
   * Performs a runtime check that the provided object is indeed a
   * SafeScript object, and returns its value.
   *
   * @param {!SafeScript} safeScript The object to extract from.
   * @return {string} The safeScript object's contained string, unless
   *     the run-time type check fails. In that case, `unwrap` returns an
   *     innocuous string, or, if assertions are enabled, throws
   *     `asserts.AssertionError`.
   */
  static unwrap(safeScript) {
    return SafeScript.unwrapTrustedScript(safeScript).toString();
  }

  /**
   * Unwraps value as TrustedScript if supported or as a string if not.
   * @param {!SafeScript} safeScript
   * @return {!TrustedScript|string}
   * @see SafeScript.unwrap
   */
  static unwrapTrustedScript(safeScript) {
    // Perform additional Run-time type-checking to ensure that
    // safeScript is indeed an instance of the expected type.  This
    // provides some additional protection against security bugs due to
    // application code that disables type checks.
    // Specifically, the following checks are performed:
    // 1. The object is an instance of the expected type.
    // 2. The object is not an instance of a subclass.
    if (safeScript instanceof SafeScript &&
        safeScript.constructor === SafeScript) {
      return safeScript.privateDoNotAccessOrElseSafeScriptWrappedValue_;
    } else {
      fail(
          'expected object of type SafeScript, got \'' + safeScript +
          '\' of type ' + goog.typeOf(safeScript));
      return 'type_error:SafeScript';
    }
  }

  /**
   * Converts the given value to a embeddabel JSON string and returns it. The
   * resulting string can be embedded in HTML because the '<' character is
   * encoded.
   *
   * @param {*} val
   * @return {string}
   * @private
   */
  static stringify_(val) {
    const json = JSON.stringify(val);
    return json.replace(/</g, '\\x3c');
  }

  /**
   * Package-internal utility method to create SafeScript instances.
   *
   * @param {string} script The string to initialize the SafeScript object with.
   * @return {!SafeScript} The initialized SafeScript object.
   * @package
   */
  static createSafeScriptSecurityPrivateDoNotAccessOrElse(script) {
    const policy = trustedtypes.getPolicyPrivateDoNotAccessOrElse();
    const trustedScript = policy ? policy.createScript(script) : script;
    return new SafeScript(trustedScript, CONSTRUCTOR_TOKEN_PRIVATE);
  }
}

/**
 * Returns a string-representation of this value.
 *
 * To obtain the actual string value wrapped in a SafeScript, use
 * `SafeScript.unwrap`.
 *
 * @return {string}
 * @see SafeScript#unwrap
 * @override
 */
SafeScript.prototype.toString = function() {
  return this.privateDoNotAccessOrElseSafeScriptWrappedValue_.toString();
};


/**
 * A SafeScript instance corresponding to the empty string.
 * @const {!SafeScript}
 */
SafeScript.EMPTY = /** @type {!SafeScript} */ ({
  // NOTE: this compiles to nothing, but hides the possible side effect of
  // SafeScript creation (due to calling trustedTypes.createPolicy) from the
  // compiler so that the entire call can be removed if the result is not used.
  // MOE:begin_strip
  // TODO(b/155299094): Refactor after adding compiler support.
  // MOE:end_strip
  valueOf: function() {
    return SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse('');
  },
}.valueOf());


exports = SafeScript;

;return exports;});

//third_party/javascript/closure/fs/url.js
/**
 * @license
 * Copyright The Closure Library Authors.
 * SPDX-License-Identifier: Apache-2.0
 */

/**
 * @fileoverview Wrapper for URL and its createObjectUrl and revokeObjectUrl
 * methods that are part of the HTML5 File API.
 */

goog.provide('goog.fs.url');


/**
 * Creates a blob URL for a blob object.
 * Throws an error if the browser does not support Object Urls.
 *
 * @param {!File|!Blob|!MediaSource|!MediaStream} obj The object for which
 *   to create the URL.
 * @return {string} The URL for the object.
 */
goog.fs.url.createObjectUrl = function(obj) {
  'use strict';
  return goog.fs.url.getUrlObject_().createObjectURL(obj);
};


/**
 * Revokes a URL created by {@link goog.fs.url.createObjectUrl}.
 * Throws an error if the browser does not support Object Urls.
 *
 * @param {string} url The URL to revoke.
 */
goog.fs.url.revokeObjectUrl = function(url) {
  'use strict';
  goog.fs.url.getUrlObject_().revokeObjectURL(url);
};


/**
 * @record
 * @private
 */
goog.fs.url.UrlObject_ = function() {};

/**
 * @param {!File|!Blob|!MediaSource|!MediaStream} arg
 * @return {string}
 */
goog.fs.url.UrlObject_.prototype.createObjectURL = function(arg) {};

/**
 * @param {string} s
 */
goog.fs.url.UrlObject_.prototype.revokeObjectURL = function(s) {};


/**
 * Get the object that has the createObjectURL and revokeObjectURL functions for
 * this browser.
 *
 * @return {!goog.fs.url.UrlObject_} The object for this browser.
 * @private
 */
goog.fs.url.getUrlObject_ = function() {
  'use strict';
  const urlObject = goog.fs.url.findUrlObject_();
  if (urlObject != null) {
    return urlObject;
  } else {
    throw new Error('This browser doesn\'t seem to support blob URLs');
  }
};


/**
 * Finds the object that has the createObjectURL and revokeObjectURL functions
 * for this browser.
 *
 * @return {?goog.fs.url.UrlObject_} The object for this browser or null if the
 *     browser does not support Object Urls.
 * @private
 */
goog.fs.url.findUrlObject_ = function() {
  'use strict';
  // This is what the spec says to do
  // http://dev.w3.org/2006/webapi/FileAPI/#dfn-createObjectURL
  if (goog.global.URL !== undefined &&
      goog.global.URL.createObjectURL !== undefined) {
    return /** @type {!goog.fs.url.UrlObject_} */ (goog.global.URL);
    // This is what the spec used to say to do
  } else if (goog.global.createObjectURL !== undefined) {
    return /** @type {!goog.fs.url.UrlObject_} */ (goog.global);
  } else {
    return null;
  }
};


/**
 * Checks whether this browser supports Object Urls. If not, calls to
 * createObjectUrl and revokeObjectUrl will result in an error.
 *
 * @return {boolean} True if this browser supports Object Urls.
 */
goog.fs.url.browserSupportsObjectUrls = function() {
  'use strict';
  return goog.fs.url.findUrlObject_() != null;
};

//third_party/javascript/closure/fs/blob.js
/**
 * @license
 * Copyright The Closure Library Authors.
 * SPDX-License-Identifier: Apache-2.0
 */

/**
 * @fileoverview Wrappers for the HTML5 File API. These wrappers closely mirror
 * the underlying APIs, but use Closure-style events and Deferred return values.
 * Their existence also makes it possible to mock the FileSystem API for testing
 * in browsers that don't support it natively.
 *
 * When adding public functions to anything under this namespace, be sure to add
 * its mock counterpart to goog.testing.fs.
 */

goog.provide('goog.fs.blob');

goog.require('goog.array');

/**
 * Concatenates one or more values together and converts them to a Blob.
 *
 * @param {...(string|!Blob|!ArrayBuffer)} var_args The values that will make up
 *     the resulting blob.
 * @return {!Blob} The blob.
 */
goog.fs.blob.getBlob = function(var_args) {
  'use strict';
  var BlobBuilder = goog.global.BlobBuilder || goog.global.WebKitBlobBuilder;

  if (BlobBuilder !== undefined) {
    var bb = new BlobBuilder();
    for (var i = 0; i < arguments.length; i++) {
      bb.append(arguments[i]);
    }
    return bb.getBlob();
  } else {
    return goog.fs.blob.getBlobWithProperties(goog.array.toArray(arguments));
  }
};


/**
 * Creates a blob with the given properties.
 * See https://developer.mozilla.org/en-US/docs/Web/API/Blob for more details.
 *
 * @param {!Array<string|!Blob|!ArrayBuffer>} parts The values that will make up
 *     the resulting blob (subset supported by both BlobBuilder.append() and
 *     Blob constructor).
 * @param {string=} opt_type The MIME type of the Blob.
 * @param {string=} opt_endings Specifies how strings containing newlines are to
 *     be written out.
 * @return {!Blob} The blob.
 */
goog.fs.blob.getBlobWithProperties = function(parts, opt_type, opt_endings) {
  'use strict';
  var BlobBuilder = goog.global.BlobBuilder || goog.global.WebKitBlobBuilder;

  if (BlobBuilder !== undefined) {
    var bb = new BlobBuilder();
    for (var i = 0; i < parts.length; i++) {
      bb.append(parts[i], opt_endings);
    }
    return bb.getBlob(opt_type);
  } else if (goog.global.Blob !== undefined) {
    var properties = {};
    if (opt_type) {
      properties['type'] = opt_type;
    }
    if (opt_endings) {
      properties['endings'] = opt_endings;
    }
    return new Blob(parts, properties);
  } else {
    throw new Error('This browser doesn\'t seem to support creating Blobs');
  }
};

//third_party/javascript/closure/i18n/bidi.js
/**
 * @license
 * Copyright The Closure Library Authors.
 * SPDX-License-Identifier: Apache-2.0
 */

/**
 * @fileoverview Utility functions for supporting Bidi issues.
 */


/**
 * Namespace for bidi supporting functions.
 */
goog.provide('goog.i18n.bidi');
goog.provide('goog.i18n.bidi.Dir');
goog.provide('goog.i18n.bidi.DirectionalString');
goog.provide('goog.i18n.bidi.Format');


/**
 * @define {boolean} FORCE_RTL forces the {@link goog.i18n.bidi.IS_RTL} constant
 * to say that the current locale is a RTL locale.  This should only be used
 * if you want to override the default behavior for deciding whether the
 * current locale is RTL or not.
 *
 * {@see goog.i18n.bidi.IS_RTL}
 */
goog.i18n.bidi.FORCE_RTL = goog.define('goog.i18n.bidi.FORCE_RTL', false);


/**
 * Constant that defines whether or not the current locale is a RTL locale.
 * If {@link goog.i18n.bidi.FORCE_RTL} is not true, this constant will default
 * to check that {@link goog.LOCALE} is one of a few major RTL locales.
 *
 * <p>This is designed to be a maximally efficient compile-time constant. For
 * example, for the default goog.LOCALE, compiling
 * "if (goog.i18n.bidi.IS_RTL) alert('rtl') else {}" should produce no code. It
 * is this design consideration that limits the implementation to only
 * supporting a few major RTL locales, as opposed to the broader repertoire of
 * something like goog.i18n.bidi.isRtlLanguage.
 *
 * <p>Since this constant refers to the directionality of the locale, it is up
 * to the caller to determine if this constant should also be used for the
 * direction of the UI.
 *
 * {@see goog.LOCALE}
 *
 * @type {boolean}
 *
 * TODO(aharon): write a test that checks that this is a compile-time constant.
 */
// LINT.IfChange
goog.i18n.bidi.IS_RTL =
    goog.i18n.bidi.FORCE_RTL ||
    ((goog.LOCALE.substring(0, 2).toLowerCase() == 'ar' ||
      goog.LOCALE.substring(0, 2).toLowerCase() == 'fa' ||
      goog.LOCALE.substring(0, 2).toLowerCase() == 'he' ||
      goog.LOCALE.substring(0, 2).toLowerCase() == 'iw' ||
      goog.LOCALE.substring(0, 2).toLowerCase() == 'ps' ||
      goog.LOCALE.substring(0, 2).toLowerCase() == 'sd' ||
      goog.LOCALE.substring(0, 2).toLowerCase() == 'ug' ||
      goog.LOCALE.substring(0, 2).toLowerCase() == 'ur' ||
      goog.LOCALE.substring(0, 2).toLowerCase() == 'yi') &&
     (goog.LOCALE.length == 2 || goog.LOCALE.substring(2, 3) == '-' ||
      goog.LOCALE.substring(2, 3) == '_')) ||
    (  // Specific to CKB (Central Kurdish)
        goog.LOCALE.length >= 3 &&
        goog.LOCALE.substring(0, 3).toLowerCase() == 'ckb' &&
        (goog.LOCALE.length == 3 || goog.LOCALE.substring(3, 4) == '-' ||
         goog.LOCALE.substring(3, 4) == '_')) ||
    (  // 2 letter language codes with RTL scripts
        goog.LOCALE.length >= 7 &&
        ((goog.LOCALE.substring(2, 3) == '-' ||
          goog.LOCALE.substring(2, 3) == '_') &&
         (goog.LOCALE.substring(3, 7).toLowerCase() == 'adlm' ||
          goog.LOCALE.substring(3, 7).toLowerCase() == 'arab' ||
          goog.LOCALE.substring(3, 7).toLowerCase() == 'hebr' ||
          goog.LOCALE.substring(3, 7).toLowerCase() == 'nkoo' ||
          goog.LOCALE.substring(3, 7).toLowerCase() == 'rohg' ||
          goog.LOCALE.substring(3, 7).toLowerCase() == 'thaa'))) ||
    (  // 3 letter languages codes with RTL scripts
        goog.LOCALE.length >= 8 &&
        ((goog.LOCALE.substring(3, 4) == '-' ||
          goog.LOCALE.substring(3, 4) == '_') &&
         (goog.LOCALE.substring(4, 8).toLowerCase() == 'adlm' ||
          goog.LOCALE.substring(4, 8).toLowerCase() == 'arab' ||
          goog.LOCALE.substring(4, 8).toLowerCase() == 'hebr' ||
          goog.LOCALE.substring(4, 8).toLowerCase() == 'nkoo' ||
          goog.LOCALE.substring(4, 8).toLowerCase() == 'rohg' ||
          goog.LOCALE.substring(4, 8).toLowerCase() == 'thaa')));
//    closure/RtlLocalesTest.java)

// TODO(b/77919903): Add additional scripts and languages that are RTL,
// e.g., mende, samaritan, etc.


/**
 * Unicode formatting characters and directionality string constants.
 * @enum {string}
 */
goog.i18n.bidi.Format = {
  /** Unicode "Left-To-Right Embedding" (LRE) character. */
  LRE: '\u202A',
  /** Unicode "Right-To-Left Embedding" (RLE) character. */
  RLE: '\u202B',
  /** Unicode "Pop Directional Formatting" (PDF) character. */
  PDF: '\u202C',
  /** Unicode "Left-To-Right Mark" (LRM) character. */
  LRM: '\u200E',
  /** Unicode "Right-To-Left Mark" (RLM) character. */
  RLM: '\u200F'
};


/**
 * Directionality enum.
 * @enum {number}
 */
goog.i18n.bidi.Dir = {
  /**
   * Left-to-right.
   */
  LTR: 1,

  /**
   * Right-to-left.
   */
  RTL: -1,

  /**
   * Neither left-to-right nor right-to-left.
   */
  NEUTRAL: 0
};


/**
 * 'right' string constant.
 * @type {string}
 */
goog.i18n.bidi.RIGHT = 'right';


/**
 * 'left' string constant.
 * @type {string}
 */
goog.i18n.bidi.LEFT = 'left';


/**
 * 'left' if locale is RTL, 'right' if not.
 * @type {string}
 */
goog.i18n.bidi.I18N_RIGHT =
    goog.i18n.bidi.IS_RTL ? goog.i18n.bidi.LEFT : goog.i18n.bidi.RIGHT;


/**
 * 'right' if locale is RTL, 'left' if not.
 * @type {string}
 */
goog.i18n.bidi.I18N_LEFT =
    goog.i18n.bidi.IS_RTL ? goog.i18n.bidi.RIGHT : goog.i18n.bidi.LEFT;


/**
 * Convert a directionality given in various formats to a goog.i18n.bidi.Dir
 * constant. Useful for interaction with different standards of directionality
 * representation.
 *
 * @param {goog.i18n.bidi.Dir|number|boolean|null} givenDir Directionality given
 *     in one of the following formats:
 *     1. A goog.i18n.bidi.Dir constant.
 *     2. A number (positive = LTR, negative = RTL, 0 = neutral).
 *     3. A boolean (true = RTL, false = LTR).
 *     4. A null for unknown directionality.
 * @param {boolean=} opt_noNeutral Whether a givenDir of zero or
 *     goog.i18n.bidi.Dir.NEUTRAL should be treated as null, i.e. unknown, in
 *     order to preserve legacy behavior.
 * @return {?goog.i18n.bidi.Dir} A goog.i18n.bidi.Dir constant matching the
 *     given directionality. If given null, returns null (i.e. unknown).
 */
goog.i18n.bidi.toDir = function(givenDir, opt_noNeutral) {
  'use strict';
  if (typeof givenDir == 'number') {
    // This includes the non-null goog.i18n.bidi.Dir case.
    return givenDir > 0 ?
        goog.i18n.bidi.Dir.LTR :
        givenDir < 0 ? goog.i18n.bidi.Dir.RTL :
                       opt_noNeutral ? null : goog.i18n.bidi.Dir.NEUTRAL;
  } else if (givenDir == null) {
    return null;
  } else {
    // Must be typeof givenDir == 'boolean'.
    return givenDir ? goog.i18n.bidi.Dir.RTL : goog.i18n.bidi.Dir.LTR;
  }
};


/**
 * A practical pattern to identify strong LTR character in the BMP.
 * This pattern is not theoretically correct according to the Unicode
 * standard. It is simplified for performance and small code size.
 * It also partially supports LTR scripts beyond U+FFFF by including
 * UTF-16 high surrogate values corresponding to mostly L-class code
 * point ranges.
 * However, low surrogate values and private-use regions are not included
 * in this RegEx.
 * @type {string}
 * @private
 */
goog.i18n.bidi.ltrChars_ =
    'A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02B8\u0300-\u0590\u0900-\u1FFF' +
    '\u200E\u2C00-\uD801\uD804-\uD839\uD83C-\uDBFF' +
    '\uF900-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF';

/**
 * A practical pattern to identify strong RTL character. This pattern is not
 * theoretically correct according to the Unicode standard. It is simplified
 * for performance and small code size.
 * It also partially supports RTL scripts beyond U+FFFF by including
 * UTF-16 high surrogate values corresponding to mostly R- or AL-class
 * code point ranges.
 * However, low surrogate values and private-use regions are not included
 * in this RegEx.
 * @type {string}
 * @private
 */
goog.i18n.bidi.rtlChars_ =
    '\u0591-\u06EF\u06FA-\u08FF\u200F\uD802-\uD803\uD83A-\uD83B' +
    '\uFB1D-\uFDFF\uFE70-\uFEFC';

/**
 * Simplified regular expression for an HTML tag (opening or closing) or an HTML
 * escape. We might want to skip over such expressions when estimating the text
 * directionality.
 * @type {RegExp}
 * @private
 */
goog.i18n.bidi.htmlSkipReg_ = /<[^>]*>|&[^;]+;/g;


/**
 * Returns the input text with spaces instead of HTML tags or HTML escapes, if
 * opt_isStripNeeded is true. Else returns the input as is.
 * Useful for text directionality estimation.
 * Note: the function should not be used in other contexts; it is not 100%
 * correct, but rather a good-enough implementation for directionality
 * estimation purposes.
 * @param {string} str The given string.
 * @param {boolean=} opt_isStripNeeded Whether to perform the stripping.
 *     Default: false (to retain consistency with calling functions).
 * @return {string} The given string cleaned of HTML tags / escapes.
 * @private
 */
goog.i18n.bidi.stripHtmlIfNeeded_ = function(str, opt_isStripNeeded) {
  'use strict';
  return opt_isStripNeeded ? str.replace(goog.i18n.bidi.htmlSkipReg_, '') : str;
};


/**
 * Regular expression to check for RTL characters, BMP and high surrogate.
 * @type {RegExp}
 * @private
 */
goog.i18n.bidi.rtlCharReg_ = new RegExp('[' + goog.i18n.bidi.rtlChars_ + ']');


/**
 * Regular expression to check for LTR characters.
 * @type {RegExp}
 * @private
 */
goog.i18n.bidi.ltrCharReg_ = new RegExp('[' + goog.i18n.bidi.ltrChars_ + ']');


/**
 * Test whether the given string has any RTL characters in it.
 * @param {string} str The given string that need to be tested.
 * @param {boolean=} opt_isHtml Whether str is HTML / HTML-escaped.
 *     Default: false.
 * @return {boolean} Whether the string contains RTL characters.
 */
goog.i18n.bidi.hasAnyRtl = function(str, opt_isHtml) {
  'use strict';
  return goog.i18n.bidi.rtlCharReg_.test(
      goog.i18n.bidi.stripHtmlIfNeeded_(str, opt_isHtml));
};


/**
 * Test whether the given string has any RTL characters in it.
 * @param {string} str The given string that need to be tested.
 * @return {boolean} Whether the string contains RTL characters.
 * @deprecated Use hasAnyRtl.
 */
goog.i18n.bidi.hasRtlChar = goog.i18n.bidi.hasAnyRtl;


/**
 * Test whether the given string has any LTR characters in it.
 * @param {string} str The given string that need to be tested.
 * @param {boolean=} opt_isHtml Whether str is HTML / HTML-escaped.
 *     Default: false.
 * @return {boolean} Whether the string contains LTR characters.
 */
goog.i18n.bidi.hasAnyLtr = function(str, opt_isHtml) {
  'use strict';
  return goog.i18n.bidi.ltrCharReg_.test(
      goog.i18n.bidi.stripHtmlIfNeeded_(str, opt_isHtml));
};


/**
 * Regular expression pattern to check if the first character in the string
 * is LTR.
 * @type {RegExp}
 * @private
 */
goog.i18n.bidi.ltrRe_ = new RegExp('^[' + goog.i18n.bidi.ltrChars_ + ']');


/**
 * Regular expression pattern to check if the first character in the string
 * is RTL.
 * @type {RegExp}
 * @private
 */
goog.i18n.bidi.rtlRe_ = new RegExp('^[' + goog.i18n.bidi.rtlChars_ + ']');


/**
 * Check if the first character in the string is RTL or not.
 * @param {string} str The given string that need to be tested.
 * @return {boolean} Whether the first character in str is an RTL char.
 */
goog.i18n.bidi.isRtlChar = function(str) {
  'use strict';
  return goog.i18n.bidi.rtlRe_.test(str);
};


/**
 * Check if the first character in the string is LTR or not.
 * @param {string} str The given string that need to be tested.
 * @return {boolean} Whether the first character in str is an LTR char.
 */
goog.i18n.bidi.isLtrChar = function(str) {
  'use strict';
  return goog.i18n.bidi.ltrRe_.test(str);
};


/**
 * Check if the first character in the string is neutral or not.
 * @param {string} str The given string that need to be tested.
 * @return {boolean} Whether the first character in str is a neutral char.
 */
goog.i18n.bidi.isNeutralChar = function(str) {
  'use strict';
  return !goog.i18n.bidi.isLtrChar(str) && !goog.i18n.bidi.isRtlChar(str);
};


/**
 * Regular expressions to check if a piece of text is of LTR directionality
 * on first character with strong directionality.
 * @type {RegExp}
 * @private
 */
goog.i18n.bidi.ltrDirCheckRe_ = new RegExp(
    '^[^' + goog.i18n.bidi.rtlChars_ + ']*[' + goog.i18n.bidi.ltrChars_ + ']');


/**
 * Regular expressions to check if a piece of text is of RTL directionality
 * on first character with strong directionality.
 * @type {RegExp}
 * @private
 */
goog.i18n.bidi.rtlDirCheckRe_ = new RegExp(
    '^[^' + goog.i18n.bidi.ltrChars_ + ']*[' + goog.i18n.bidi.rtlChars_ + ']');


/**
 * Check whether the first strongly directional character (if any) is RTL.
 * @param {string} str String being checked.
 * @param {boolean=} opt_isHtml Whether str is HTML / HTML-escaped.
 *     Default: false.
 * @return {boolean} Whether RTL directionality is detected using the first
 *     strongly-directional character method.
 */
goog.i18n.bidi.startsWithRtl = function(str, opt_isHtml) {
  'use strict';
  return goog.i18n.bidi.rtlDirCheckRe_.test(
      goog.i18n.bidi.stripHtmlIfNeeded_(str, opt_isHtml));
};


/**
 * Check whether the first strongly directional character (if any) is RTL.
 * @param {string} str String being checked.
 * @param {boolean=} opt_isHtml Whether str is HTML / HTML-escaped.
 *     Default: false.
 * @return {boolean} Whether RTL directionality is detected using the first
 *     strongly-directional character method.
 * @deprecated Use startsWithRtl.
 */
goog.i18n.bidi.isRtlText = goog.i18n.bidi.startsWithRtl;


/**
 * Check whether the first strongly directional character (if any) is LTR.
 * @param {string} str String being checked.
 * @param {boolean=} opt_isHtml Whether str is HTML / HTML-escaped.
 *     Default: false.
 * @return {boolean} Whether LTR directionality is detected using the first
 *     strongly-directional character method.
 */
goog.i18n.bidi.startsWithLtr = function(str, opt_isHtml) {
  'use strict';
  return goog.i18n.bidi.ltrDirCheckRe_.test(
      goog.i18n.bidi.stripHtmlIfNeeded_(str, opt_isHtml));
};


/**
 * Check whether the first strongly directional character (if any) is LTR.
 * @param {string} str String being checked.
 * @param {boolean=} opt_isHtml Whether str is HTML / HTML-escaped.
 *     Default: false.
 * @return {boolean} Whether LTR directionality is detected using the first
 *     strongly-directional character method.
 * @deprecated Use startsWithLtr.
 */
goog.i18n.bidi.isLtrText = goog.i18n.bidi.startsWithLtr;


/**
 * Regular expression to check if a string looks like something that must
 * always be LTR even in RTL text, e.g. a URL. When estimating the
 * directionality of text containing these, we treat these as weakly LTR,
 * like numbers.
 * @type {RegExp}
 * @private
 */
goog.i18n.bidi.isRequiredLtrRe_ = /^http:\/\/.*/;


/**
 * Check whether the input string either contains no strongly directional
 * characters or looks like a url.
 * @param {string} str String being checked.
 * @param {boolean=} opt_isHtml Whether str is HTML / HTML-escaped.
 *     Default: false.
 * @return {boolean} Whether neutral directionality is detected.
 */
goog.i18n.bidi.isNeutralText = function(str, opt_isHtml) {
  'use strict';
  str = goog.i18n.bidi.stripHtmlIfNeeded_(str, opt_isHtml);
  return goog.i18n.bidi.isRequiredLtrRe_.test(str) ||
      !goog.i18n.bidi.hasAnyLtr(str) && !goog.i18n.bidi.hasAnyRtl(str);
};


/**
 * Regular expressions to check if the last strongly-directional character in a
 * piece of text is LTR.
 * @type {RegExp}
 * @private
 */
goog.i18n.bidi.ltrExitDirCheckRe_ = new RegExp(
    '[' + goog.i18n.bidi.ltrChars_ + ']' +
    '[^' + goog.i18n.bidi.rtlChars_ + ']*$');


/**
 * Regular expressions to check if the last strongly-directional character in a
 * piece of text is RTL.
 * @type {RegExp}
 * @private
 */
goog.i18n.bidi.rtlExitDirCheckRe_ = new RegExp(
    '[' + goog.i18n.bidi.rtlChars_ + ']' +
    '[^' + goog.i18n.bidi.ltrChars_ + ']*$');


/**
 * Check if the exit directionality a piece of text is LTR, i.e. if the last
 * strongly-directional character in the string is LTR.
 * @param {string} str String being checked.
 * @param {boolean=} opt_isHtml Whether str is HTML / HTML-escaped.
 *     Default: false.
 * @return {boolean} Whether LTR exit directionality was detected.
 */
goog.i18n.bidi.endsWithLtr = function(str, opt_isHtml) {
  'use strict';
  return goog.i18n.bidi.ltrExitDirCheckRe_.test(
      goog.i18n.bidi.stripHtmlIfNeeded_(str, opt_isHtml));
};


/**
 * Check if the exit directionality a piece of text is LTR, i.e. if the last
 * strongly-directional character in the string is LTR.
 * @param {string} str String being checked.
 * @param {boolean=} opt_isHtml Whether str is HTML / HTML-escaped.
 *     Default: false.
 * @return {boolean} Whether LTR exit directionality was detected.
 * @deprecated Use endsWithLtr.
 */
goog.i18n.bidi.isLtrExitText = goog.i18n.bidi.endsWithLtr;


/**
 * Check if the exit directionality a piece of text is RTL, i.e. if the last
 * strongly-directional character in the string is RTL.
 * @param {string} str String being checked.
 * @param {boolean=} opt_isHtml Whether str is HTML / HTML-escaped.
 *     Default: false.
 * @return {boolean} Whether RTL exit directionality was detected.
 */
goog.i18n.bidi.endsWithRtl = function(str, opt_isHtml) {
  'use strict';
  return goog.i18n.bidi.rtlExitDirCheckRe_.test(
      goog.i18n.bidi.stripHtmlIfNeeded_(str, opt_isHtml));
};


/**
 * Check if the exit directionality a piece of text is RTL, i.e. if the last
 * strongly-directional character in the string is RTL.
 * @param {string} str String being checked.
 * @param {boolean=} opt_isHtml Whether str is HTML / HTML-escaped.
 *     Default: false.
 * @return {boolean} Whether RTL exit directionality was detected.
 * @deprecated Use endsWithRtl.
 */
goog.i18n.bidi.isRtlExitText = goog.i18n.bidi.endsWithRtl;


/**
 * A regular expression for matching right-to-left language codes.
 * See {@link #isRtlLanguage} for the design.
 * Note that not all RTL scripts are included.
 * @type {!RegExp}
 * @private
 */
goog.i18n.bidi.rtlLocalesRe_ = new RegExp(
    '^(ar|ckb|dv|he|iw|fa|nqo|ps|sd|ug|ur|yi|' +
        '.*[-_](Adlm|Arab|Hebr|Nkoo|Rohg|Thaa))' +
        '(?!.*[-_](Latn|Cyrl)($|-|_))($|-|_)',
    'i');


/**
 * Check if a BCP 47 / III language code indicates an RTL language, i.e. either:
 * - a language code explicitly specifying one of the right-to-left scripts,
 *   e.g. "az-Arab", or<p>
 * - a language code specifying one of the languages normally written in a
 *   right-to-left script, e.g. "fa" (Farsi), except ones explicitly specifying
 *   Latin or Cyrillic script (which are the usual LTR alternatives).<p>
 * The list of right-to-left scripts appears in the 100-199 range in
 * http://www.unicode.org/iso15924/iso15924-num.html, of which Arabic and
 * Hebrew are by far the most widely used. We also recognize Thaana, and N'Ko,
 * which also have significant modern usage. Adlam and Rohingya
 * scripts are now included since they can be expected to be used in the
 * future. The rest (Syriac, Samaritan, Mandaic, etc.) seem to have extremely
 * limited or no modern usage and are not recognized to save on code size. The
 * languages usually written in a right-to-left script are taken as those with
 * Suppress-Script: Hebr|Arab|Thaa|Nkoo|Adlm|Rohg in
 * http://www.iana.org/assignments/language-subtag-registry,
 * as well as Central (or Sorani) Kurdish (ckb), Sindhi (sd) and Uyghur (ug).
 * Other subtags of the language code, e.g. regions like EG (Egypt), are
 * ignored.
 * @param {string} lang BCP 47 (a.k.a III) language code.
 * @return {boolean} Whether the language code is an RTL language.
 */
goog.i18n.bidi.isRtlLanguage = function(lang) {
  'use strict';
  return goog.i18n.bidi.rtlLocalesRe_.test(lang);
};


/**
 * Regular expression for bracket guard replacement in text.
 * @type {RegExp}
 * @private
 */
goog.i18n.bidi.bracketGuardTextRe_ =
    /(\(.*?\)+)|(\[.*?\]+)|(\{.*?\}+)|(<.*?>+)/g;


/**
 * Apply bracket guard using LRM and RLM. This is to address the problem of
 * messy bracket display frequently happens in RTL layout.
 * This function works for plain text, not for HTML. In HTML, the opening
 * bracket might be in a different context than the closing bracket (such as
 * an attribute value).
 * @param {string} s The string that need to be processed.
 * @param {boolean=} opt_isRtlContext specifies default direction (usually
 *     direction of the UI).
 * @return {string} The processed string, with all bracket guarded.
 */
goog.i18n.bidi.guardBracketInText = function(s, opt_isRtlContext) {
  'use strict';
  const useRtl = opt_isRtlContext === undefined ? goog.i18n.bidi.hasAnyRtl(s) :
                                                  opt_isRtlContext;
  const mark = useRtl ? goog.i18n.bidi.Format.RLM : goog.i18n.bidi.Format.LRM;
  return s.replace(goog.i18n.bidi.bracketGuardTextRe_, mark + '$&' + mark);
};


/**
 * Enforce the html snippet in RTL directionality regardless of overall context.
 * If the html piece was enclosed by tag, dir will be applied to existing
 * tag, otherwise a span tag will be added as wrapper. For this reason, if
 * html snippet starts with a tag, this tag must enclose the whole piece. If
 * the tag already has a dir specified, this new one will override existing
 * one in behavior (tested on FF and IE).
 * @param {string} html The string that need to be processed.
 * @return {string} The processed string, with directionality enforced to RTL.
 */
goog.i18n.bidi.enforceRtlInHtml = function(html) {
  'use strict';
  if (html.charAt(0) == '<') {
    return html.replace(/<\w+/, '$& dir=rtl');
  }
  // '\n' is important for FF so that it won't incorrectly merge span groups
  return '\n<span dir=rtl>' + html + '</span>';
};


/**
 * Enforce RTL on both end of the given text piece using unicode BiDi formatting
 * characters RLE and PDF.
 * @param {string} text The piece of text that need to be wrapped.
 * @return {string} The wrapped string after process.
 */
goog.i18n.bidi.enforceRtlInText = function(text) {
  'use strict';
  return goog.i18n.bidi.Format.RLE + text + goog.i18n.bidi.Format.PDF;
};


/**
 * Enforce the html snippet in RTL directionality regardless or overall context.
 * If the html piece was enclosed by tag, dir will be applied to existing
 * tag, otherwise a span tag will be added as wrapper. For this reason, if
 * html snippet starts with a tag, this tag must enclose the whole piece. If
 * the tag already has a dir specified, this new one will override existing
 * one in behavior (tested on FF and IE).
 * @param {string} html The string that need to be processed.
 * @return {string} The processed string, with directionality enforced to RTL.
 */
goog.i18n.bidi.enforceLtrInHtml = function(html) {
  'use strict';
  if (html.charAt(0) == '<') {
    return html.replace(/<\w+/, '$& dir=ltr');
  }
  // '\n' is important for FF so that it won't incorrectly merge span groups
  return '\n<span dir=ltr>' + html + '</span>';
};


/**
 * Enforce LTR on both end of the given text piece using unicode BiDi formatting
 * characters LRE and PDF.
 * @param {string} text The piece of text that need to be wrapped.
 * @return {string} The wrapped string after process.
 */
goog.i18n.bidi.enforceLtrInText = function(text) {
  'use strict';
  return goog.i18n.bidi.Format.LRE + text + goog.i18n.bidi.Format.PDF;
};


/**
 * Regular expression to find dimensions such as "padding: .3 0.4ex 5px 6;"
 * @type {RegExp}
 * @private
 */
goog.i18n.bidi.dimensionsRe_ =
    /:\s*([.\d][.\w]*)\s+([.\d][.\w]*)\s+([.\d][.\w]*)\s+([.\d][.\w]*)/g;


/**
 * Regular expression for left.
 * @type {RegExp}
 * @private
 */
goog.i18n.bidi.leftRe_ = /left/gi;


/**
 * Regular expression for right.
 * @type {RegExp}
 * @private
 */
goog.i18n.bidi.rightRe_ = /right/gi;


/**
 * Placeholder regular expression for swapping.
 * @type {RegExp}
 * @private
 */
goog.i18n.bidi.tempRe_ = /%%%%/g;


/**
 * Swap location parameters and 'left'/'right' in CSS specification. The
 * processed string will be suited for RTL layout. Though this function can
 * cover most cases, there are always exceptions. It is suggested to put
 * those exceptions in separate group of CSS string.
 * @param {string} cssStr CSS spefication string.
 * @return {string} Processed CSS specification string.
 */
goog.i18n.bidi.mirrorCSS = function(cssStr) {
  'use strict';
  return cssStr
      .
      // reverse dimensions
      replace(goog.i18n.bidi.dimensionsRe_, ':$1 $4 $3 $2')
      .replace(goog.i18n.bidi.leftRe_, '%%%%')
      .  // swap left and right
      replace(goog.i18n.bidi.rightRe_, goog.i18n.bidi.LEFT)
      .replace(goog.i18n.bidi.tempRe_, goog.i18n.bidi.RIGHT);
};


/**
 * Regular expression for hebrew double quote substitution, finding quote
 * directly after hebrew characters.
 * @type {RegExp}
 * @private
 */
goog.i18n.bidi.doubleQuoteSubstituteRe_ = /([\u0591-\u05f2])"/g;


/**
 * Regular expression for hebrew single quote substitution, finding quote
 * directly after hebrew characters.
 * @type {RegExp}
 * @private
 */
goog.i18n.bidi.singleQuoteSubstituteRe_ = /([\u0591-\u05f2])'/g;


/**
 * Replace the double and single quote directly after a Hebrew character with
 * GERESH and GERSHAYIM. In such case, most likely that's user intention.
 * @param {string} str String that need to be processed.
 * @return {string} Processed string with double/single quote replaced.
 */
goog.i18n.bidi.normalizeHebrewQuote = function(str) {
  'use strict';
  return str.replace(goog.i18n.bidi.doubleQuoteSubstituteRe_, '$1\u05f4')
      .replace(goog.i18n.bidi.singleQuoteSubstituteRe_, '$1\u05f3');
};


/**
 * Regular expression to split a string into "words" for directionality
 * estimation based on relative word counts.
 * @type {RegExp}
 * @private
 */
goog.i18n.bidi.wordSeparatorRe_ = /\s+/;


/**
 * Regular expression to check if a string contains any numerals. Used to
 * differentiate between completely neutral strings and those containing
 * numbers, which are weakly LTR.
 *
 * Native Arabic digits (\u0660 - \u0669) are not included because although they
 * do flow left-to-right inside a number, this is the case even if the  overall
 * directionality is RTL, and a mathematical expression using these digits is
 * supposed to flow right-to-left overall, including unary plus and minus
 * appearing to the right of a number, and this does depend on the overall
 * directionality being RTL. The digits used in Farsi (\u06F0 - \u06F9), on the
 * other hand, are included, since Farsi math (including unary plus and minus)
 * does flow left-to-right.
 * TODO: Consider other systems of digits, e.g., Adlam.
 *
 * @type {RegExp}
 * @private
 */
goog.i18n.bidi.hasNumeralsRe_ = /[\d\u06f0-\u06f9]/;


/**
 * This constant controls threshold of RTL directionality.
 * @type {number}
 * @private
 */
goog.i18n.bidi.rtlDetectionThreshold_ = 0.40;


/**
 * Estimates the directionality of a string based on relative word counts.
 * If the number of RTL words is above a certain percentage of the total number
 * of strongly directional words, returns RTL.
 * Otherwise, if any words are strongly or weakly LTR, returns LTR.
 * Otherwise, returns UNKNOWN, which is used to mean "neutral".
 * Numbers are counted as weakly LTR.
 * @param {string} str The string to be checked.
 * @param {boolean=} opt_isHtml Whether str is HTML / HTML-escaped.
 *     Default: false.
 * @return {goog.i18n.bidi.Dir} Estimated overall directionality of `str`.
 */
goog.i18n.bidi.estimateDirection = function(str, opt_isHtml) {
  'use strict';
  let rtlCount = 0;
  let totalCount = 0;
  let hasWeaklyLtr = false;
  const tokens = goog.i18n.bidi.stripHtmlIfNeeded_(str, opt_isHtml)
                     .split(goog.i18n.bidi.wordSeparatorRe_);
  for (let i = 0; i < tokens.length; i++) {
    const token = tokens[i];
    if (goog.i18n.bidi.startsWithRtl(token)) {
      rtlCount++;
      totalCount++;
    } else if (goog.i18n.bidi.isRequiredLtrRe_.test(token)) {
      hasWeaklyLtr = true;
    } else if (goog.i18n.bidi.hasAnyLtr(token)) {
      totalCount++;
    } else if (goog.i18n.bidi.hasNumeralsRe_.test(token)) {
      hasWeaklyLtr = true;
    }
  }

  return totalCount == 0 ?
      (hasWeaklyLtr ? goog.i18n.bidi.Dir.LTR : goog.i18n.bidi.Dir.NEUTRAL) :
      (rtlCount / totalCount > goog.i18n.bidi.rtlDetectionThreshold_ ?
           goog.i18n.bidi.Dir.RTL :
           goog.i18n.bidi.Dir.LTR);
};


/**
 * Check the directionality of a piece of text, return true if the piece of
 * text should be laid out in RTL direction.
 * @param {string} str The piece of text that need to be detected.
 * @param {boolean=} opt_isHtml Whether str is HTML / HTML-escaped.
 *     Default: false.
 * @return {boolean} Whether this piece of text should be laid out in RTL.
 */
goog.i18n.bidi.detectRtlDirectionality = function(str, opt_isHtml) {
  'use strict';
  return goog.i18n.bidi.estimateDirection(str, opt_isHtml) ==
      goog.i18n.bidi.Dir.RTL;
};


/**
 * Sets text input element's directionality and text alignment based on a
 * given directionality. Does nothing if the given directionality is unknown or
 * neutral.
 * @param {Element} element Input field element to set directionality to.
 * @param {goog.i18n.bidi.Dir|number|boolean|null} dir Desired directionality,
 *     given in one of the following formats:
 *     1. A goog.i18n.bidi.Dir constant.
 *     2. A number (positive = LRT, negative = RTL, 0 = neutral).
 *     3. A boolean (true = RTL, false = LTR).
 *     4. A null for unknown directionality.
 */
goog.i18n.bidi.setElementDirAndAlign = function(element, dir) {
  'use strict';
  if (element) {
    const htmlElement = /** @type {!HTMLElement} */ (element);
    dir = goog.i18n.bidi.toDir(dir);
    if (dir) {
      htmlElement.style.textAlign = dir == goog.i18n.bidi.Dir.RTL ?
          goog.i18n.bidi.RIGHT :
          goog.i18n.bidi.LEFT;
      htmlElement.dir = dir == goog.i18n.bidi.Dir.RTL ? 'rtl' : 'ltr';
    }
  }
};


/**
 * Sets element dir based on estimated directionality of the given text.
 * @param {!Element} element
 * @param {string} text
 */
goog.i18n.bidi.setElementDirByTextDirectionality = function(element, text) {
  'use strict';
  const htmlElement = /** @type {!HTMLElement} */ (element);
  switch (goog.i18n.bidi.estimateDirection(text)) {
    case (goog.i18n.bidi.Dir.LTR):
      if (htmlElement.dir !== 'ltr') {
        htmlElement.dir = 'ltr';
      }
      break;
    case (goog.i18n.bidi.Dir.RTL):
      if (htmlElement.dir !== 'rtl') {
        htmlElement.dir = 'rtl';
      }
      break;
    default:
      // Default for no direction, inherit from document.
      htmlElement.removeAttribute('dir');
  }
};



/**
 * Strings that have an (optional) known direction.
 *
 * Implementations of this interface are string-like objects that carry an
 * attached direction, if known.
 * @interface
 */
goog.i18n.bidi.DirectionalString = function() {};


/**
 * Interface marker of the DirectionalString interface.
 *
 * This property can be used to determine at runtime whether or not an object
 * implements this interface.  All implementations of this interface set this
 * property to `true`.
 * @type {boolean}
 */
goog.i18n.bidi.DirectionalString.prototype
    .implementsGoogI18nBidiDirectionalString;


/**
 * Retrieves this object's known direction (if any).
 * @return {?goog.i18n.bidi.Dir} The known direction. Null if unknown.
 */
goog.i18n.bidi.DirectionalString.prototype.getDirection;

//third_party/javascript/closure/html/trustedresourceurl.js
/**
 * @license
 * Copyright The Closure Library Authors.
 * SPDX-License-Identifier: Apache-2.0
 */

/**
 * @fileoverview The TrustedResourceUrl type and its builders.
 *
 * TODO(xtof): Link to document stating type contract.
 */

goog.provide('goog.html.TrustedResourceUrl');

goog.require('goog.asserts');
goog.require('goog.fs.blob');
goog.require('goog.fs.url');
goog.require('goog.html.SafeScript');
goog.require('goog.html.trustedtypes');
goog.require('goog.i18n.bidi.Dir');
goog.require('goog.i18n.bidi.DirectionalString');
goog.require('goog.string.Const');
goog.require('goog.string.TypedString');



/**
 * A URL which is under application control and from which script, CSS, and
 * other resources that represent executable code, can be fetched.
 *
 * Given that the URL can only be constructed from strings under application
 * control and is used to load resources, bugs resulting in a malformed URL
 * should not have a security impact and are likely to be easily detectable
 * during testing. Given the wide number of non-RFC compliant URLs in use,
 * stricter validation could prevent some applications from being able to use
 * this type.
 *
 * Instances of this type must be created via the factory method,
 * (`fromConstant`, `fromConstants`, `format` or `formatWithParams`), and not by
 * invoking its constructor. The constructor intentionally takes an extra
 * parameter that cannot be constructed outside of this file and the type is
 * immutable; hence only a default instance corresponding to the empty string
 * can be obtained via constructor invocation.
 *
 * Creating TrustedResourceUrl objects HAS SIDE-EFFECTS due to calling
 * Trusted Types Web API.
 *
 * @see goog.html.TrustedResourceUrl#fromConstant
 * @final
 * @struct
 * @implements {goog.i18n.bidi.DirectionalString}
 * @implements {goog.string.TypedString}
 */
goog.html.TrustedResourceUrl = class {
  /**
   * @param {!TrustedScriptURL|string} value
   * @param {!Object} token package-internal implementation detail.
   */
  constructor(value, token) {
    /**
     * The contained value of this TrustedResourceUrl.  The field has a
     * purposely ugly name to make (non-compiled) code that attempts to directly
     * access this field stand out.
     * @const
     * @private {!TrustedScriptURL|string}
     */
    this.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_ =
        (token === goog.html.TrustedResourceUrl.CONSTRUCTOR_TOKEN_PRIVATE_) ?
        value :
        '';
  }
};


/**
 * @override
 * @const
 */
goog.html.TrustedResourceUrl.prototype.implementsGoogStringTypedString = true;


/**
 * Returns this TrustedResourceUrl's value as a string.
 *
 * IMPORTANT: In code where it is security relevant that an object's type is
 * indeed `TrustedResourceUrl`, use
 * `goog.html.TrustedResourceUrl.unwrap` instead of this method. If in
 * doubt, assume that it's security relevant. In particular, note that
 * goog.html functions which return a goog.html type do not guarantee that
 * the returned instance is of the right type. For example:
 *
 * <pre>
 * var fakeSafeHtml = new String('fake');
 * fakeSafeHtml.__proto__ = goog.html.SafeHtml.prototype;
 * var newSafeHtml = goog.html.SafeHtml.htmlEscape(fakeSafeHtml);
 * // newSafeHtml is just an alias for fakeSafeHtml, it's passed through by
 * // goog.html.SafeHtml.htmlEscape() as fakeSafeHtml instanceof
 * // goog.html.SafeHtml.
 * </pre>
 *
 * @see goog.html.TrustedResourceUrl#unwrap
 * @override
 */
goog.html.TrustedResourceUrl.prototype.getTypedStringValue = function() {
  'use strict';
  return this.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_
      .toString();
};


/**
 * @override
 * @const
 */
goog.html.TrustedResourceUrl.prototype.implementsGoogI18nBidiDirectionalString =
    true;


/**
 * Returns this URLs directionality, which is always `LTR`.
 * @override
 */
goog.html.TrustedResourceUrl.prototype.getDirection = function() {
  'use strict';
  return goog.i18n.bidi.Dir.LTR;
};


/**
 * Creates a new TrustedResourceUrl with params added to URL. Both search and
 * hash params can be specified.
 *
 * @param {string|?Object<string, *>|undefined} searchParams Search parameters
 *     to add to URL. See goog.html.TrustedResourceUrl.stringifyParams_ for
 *     exact format definition.
 * @param {(string|?Object<string, *>)=} opt_hashParams Hash parameters to add
 *     to URL. See goog.html.TrustedResourceUrl.stringifyParams_ for exact
 *     format definition.
 * @return {!goog.html.TrustedResourceUrl} New TrustedResourceUrl with params.
 */
goog.html.TrustedResourceUrl.prototype.cloneWithParams = function(
    searchParams, opt_hashParams) {
  'use strict';
  var url = goog.html.TrustedResourceUrl.unwrap(this);
  var parts = goog.html.TrustedResourceUrl.URL_PARAM_PARSER_.exec(url);
  var urlBase = parts[1];
  var urlSearch = parts[2] || '';
  var urlHash = parts[3] || '';

  return goog.html.TrustedResourceUrl
      .createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(
          urlBase +
          goog.html.TrustedResourceUrl.stringifyParams_(
              '?', urlSearch, searchParams) +
          goog.html.TrustedResourceUrl.stringifyParams_(
              '#', urlHash, opt_hashParams));
};


/**
 * Returns a string-representation of this value.
 *
 * To obtain the actual string value wrapped in a TrustedResourceUrl, use
 * `goog.html.TrustedResourceUrl.unwrap`.
 *
 * @return {string}
 * @see goog.html.TrustedResourceUrl#unwrap
 * @override
 */
goog.html.TrustedResourceUrl.prototype.toString = function() {
  'use strict';
  return this.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_ + '';
};


/**
 * Performs a runtime check that the provided object is indeed a
 * TrustedResourceUrl object, and returns its value.
 *
 * @param {!goog.html.TrustedResourceUrl} trustedResourceUrl The object to
 *     extract from.
 * @return {string} The trustedResourceUrl object's contained string, unless
 *     the run-time type check fails. In that case, `unwrap` returns an
 *     innocuous string, or, if assertions are enabled, throws
 *     `goog.asserts.AssertionError`.
 */
goog.html.TrustedResourceUrl.unwrap = function(trustedResourceUrl) {
  'use strict';
  return goog.html.TrustedResourceUrl.unwrapTrustedScriptURL(trustedResourceUrl)
      .toString();
};


/**
 * Unwraps value as TrustedScriptURL if supported or as a string if not.
 * @param {!goog.html.TrustedResourceUrl} trustedResourceUrl
 * @return {!TrustedScriptURL|string}
 * @see goog.html.TrustedResourceUrl.unwrap
 */
goog.html.TrustedResourceUrl.unwrapTrustedScriptURL = function(
    trustedResourceUrl) {
  'use strict';
  // Perform additional Run-time type-checking to ensure that
  // trustedResourceUrl is indeed an instance of the expected type.  This
  // provides some additional protection against security bugs due to
  // application code that disables type checks.
  // Specifically, the following checks are performed:
  // 1. The object is an instance of the expected type.
  // 2. The object is not an instance of a subclass.
  if (trustedResourceUrl instanceof goog.html.TrustedResourceUrl &&
      trustedResourceUrl.constructor === goog.html.TrustedResourceUrl) {
    return trustedResourceUrl
        .privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_;
  } else {
    goog.asserts.fail('expected object of type TrustedResourceUrl, got \'' +
        trustedResourceUrl + '\' of type ' + goog.typeOf(trustedResourceUrl));
    return 'type_error:TrustedResourceUrl';
  }
};


/**
 * Creates a TrustedResourceUrl from a format string and arguments.
 *
 * The arguments for interpolation into the format string map labels to values.
 * Values of type `goog.string.Const` are interpolated without modifcation.
 * Values of other types are cast to string and encoded with
 * encodeURIComponent.
 *
 * `%{<label>}` markers are used in the format string to indicate locations
 * to be interpolated with the valued mapped to the given label. `<label>`
 * must contain only alphanumeric and `_` characters.
 *
 * The format string must match goog.html.TrustedResourceUrl.BASE_URL_.
 *
 * Example usage:
 *
 *    var url = goog.html.TrustedResourceUrl.format(goog.string.Const.from(
 *        'https://www.google.com/search?q=%{query}'), {'query': searchTerm});
 *
 *    var url = goog.html.TrustedResourceUrl.format(goog.string.Const.from(
 *        '//www.youtube.com/v/%{videoId}?hl=en&fs=1%{autoplay}'), {
 *        'videoId': videoId,
 *        'autoplay': opt_autoplay ?
 *            goog.string.Const.from('&autoplay=1') : goog.string.Const.EMPTY
 *    });
 *
 * While this function can be used to create a TrustedResourceUrl from only
 * constants, fromConstant() and fromConstants() are generally preferable for
 * that purpose.
 *
 * @param {!goog.string.Const} format The format string.
 * @param {!Object<string, (string|number|!goog.string.Const)>} args Mapping
 *     of labels to values to be interpolated into the format string.
 *     goog.string.Const values are interpolated without encoding.
 * @return {!goog.html.TrustedResourceUrl}
 * @throws {!Error} On an invalid format string or if a label used in the
 *     the format string is not present in args.
 */
goog.html.TrustedResourceUrl.format = function(format, args) {
  'use strict';
  var formatStr = goog.string.Const.unwrap(format);
  if (!goog.html.TrustedResourceUrl.BASE_URL_.test(formatStr)) {
    throw new Error('Invalid TrustedResourceUrl format: ' + formatStr);
  }
  var result = formatStr.replace(
      goog.html.TrustedResourceUrl.FORMAT_MARKER_, function(match, id) {
        'use strict';
        if (!Object.prototype.hasOwnProperty.call(args, id)) {
          throw new Error(
              'Found marker, "' + id + '", in format string, "' + formatStr +
              '", but no valid label mapping found ' +
              'in args: ' + JSON.stringify(args));
        }
        var arg = args[id];
        if (arg instanceof goog.string.Const) {
          return goog.string.Const.unwrap(arg);
        } else {
          return encodeURIComponent(String(arg));
        }
      });
  return goog.html.TrustedResourceUrl
      .createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(result);
};


/**
 * @private @const {!RegExp}
 */
goog.html.TrustedResourceUrl.FORMAT_MARKER_ = /%{(\w+)}/g;


/**
 * The URL must be absolute, scheme-relative or path-absolute. So it must
 * start with:
 * - https:// followed by allowed origin characters.
 * - // followed by allowed origin characters.
 * - Any absolute or relative path.
 *
 * Based on
 * https://url.spec.whatwg.org/commit-snapshots/56b74ce7cca8883eab62e9a12666e2fac665d03d/#url-parsing
 * an initial / which is not followed by another / or \ will end up in the "path
 * state" and from there it can only go to "fragment state" and "query state".
 *
 * We don't enforce a well-formed domain name. So '.' or '1.2' are valid.
 * That's ok because the origin comes from a compile-time constant.
 *
 * A regular expression is used instead of goog.uri for several reasons:
 * - Strictness. E.g. we don't want any userinfo component and we don't
 *   want '/./, nor \' in the first path component.
 * - Small trusted base. goog.uri is generic and might need to change,
 *   reasoning about all the ways it can parse a URL now and in the future
 *   is error-prone.
 * - Code size. We expect many calls to .format(), many of which might
 *   not be using goog.uri.
 * - Simplicity. Using goog.uri would likely not result in simpler nor shorter
 *   code.
 * @private @const {!RegExp}
 */
goog.html.TrustedResourceUrl.BASE_URL_ = new RegExp(
    '^((https:)?//[0-9a-z.:[\\]-]+/'  // Origin.
        + '|/[^/\\\\]'                // Absolute path.
        + '|[^:/\\\\%]+/'             // Relative path.
        + '|[^:/\\\\%]*[?#]'          // Query string or fragment.
        + '|about:blank#'             // about:blank with fragment.
        + ')',
    'i');

/**
 * RegExp for splitting a URL into the base, search field, and hash field.
 *
 * @private @const {!RegExp}
 */
goog.html.TrustedResourceUrl.URL_PARAM_PARSER_ =
    /^([^?#]*)(\?[^#]*)?(#[\s\S]*)?/;


/**
 * Formats the URL same as TrustedResourceUrl.format and then adds extra URL
 * parameters.
 *
 * Example usage:
 *
 *     // Creates '//www.youtube.com/v/abc?autoplay=1' for videoId='abc' and
 *     // opt_autoplay=1. Creates '//www.youtube.com/v/abc' for videoId='abc'
 *     // and opt_autoplay=undefined.
 *     var url = goog.html.TrustedResourceUrl.formatWithParams(
 *         goog.string.Const.from('//www.youtube.com/v/%{videoId}'),
 *         {'videoId': videoId},
 *         {'autoplay': opt_autoplay});
 *
 * @param {!goog.string.Const} format The format string.
 * @param {!Object<string, (string|number|!goog.string.Const)>} args Mapping
 *     of labels to values to be interpolated into the format string.
 *     goog.string.Const values are interpolated without encoding.
 * @param {string|?Object<string, *>|undefined} searchParams Parameters to add
 *     to URL. See goog.html.TrustedResourceUrl.stringifyParams_ for exact
 *     format definition.
 * @param {(string|?Object<string, *>)=} opt_hashParams Hash parameters to add
 *     to URL. See goog.html.TrustedResourceUrl.stringifyParams_ for exact
 *     format definition.
 * @return {!goog.html.TrustedResourceUrl}
 * @throws {!Error} On an invalid format string or if a label used in the
 *     the format string is not present in args.
 */
goog.html.TrustedResourceUrl.formatWithParams = function(
    format, args, searchParams, opt_hashParams) {
  'use strict';
  var url = goog.html.TrustedResourceUrl.format(format, args);
  return url.cloneWithParams(searchParams, opt_hashParams);
};


/**
 * Creates a TrustedResourceUrl object from a compile-time constant string.
 *
 * Compile-time constant strings are inherently program-controlled and hence
 * trusted.
 *
 * @param {!goog.string.Const} url A compile-time-constant string from which to
 *     create a TrustedResourceUrl.
 * @return {!goog.html.TrustedResourceUrl} A TrustedResourceUrl object
 *     initialized to `url`.
 */
goog.html.TrustedResourceUrl.fromConstant = function(url) {
  'use strict';
  return goog.html.TrustedResourceUrl
      .createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(
          goog.string.Const.unwrap(url));
};


/**
 * Creates a TrustedResourceUrl object from a compile-time constant strings.
 *
 * Compile-time constant strings are inherently program-controlled and hence
 * trusted.
 *
 * @param {!Array<!goog.string.Const>} parts Compile-time-constant strings from
 *     which to create a TrustedResourceUrl.
 * @return {!goog.html.TrustedResourceUrl} A TrustedResourceUrl object
 *     initialized to concatenation of `parts`.
 */
goog.html.TrustedResourceUrl.fromConstants = function(parts) {
  'use strict';
  var unwrapped = '';
  for (var i = 0; i < parts.length; i++) {
    unwrapped += goog.string.Const.unwrap(parts[i]);
  }
  return goog.html.TrustedResourceUrl
      .createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(unwrapped);
};

/**
 * Creates a TrustedResourceUrl object by generating a Blob from a SafeScript
 * object and then calling createObjectURL with that blob.
 *
 * SafeScript objects are trusted to contain executable JavaScript code.
 *
 * Caller must call goog.fs.url.revokeObjectUrl() on the unwrapped url to
 * release the underlying blob.
 *
 * Throws if browser doesn't support blob construction.
 *
 * @param {!goog.html.SafeScript} safeScript A script from which to create a
 *     TrustedResourceUrl.
 * @return {!goog.html.TrustedResourceUrl} A TrustedResourceUrl object
 *     initialized to a new blob URL.
 */
goog.html.TrustedResourceUrl.fromSafeScript = function(safeScript) {
  'use strict';
  var blob = goog.fs.blob.getBlobWithProperties(
      [goog.html.SafeScript.unwrap(safeScript)], 'text/javascript');
  var url = goog.fs.url.createObjectUrl(blob);
  return goog.html.TrustedResourceUrl
      .createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(url);
};


/**
 * Token used to ensure that object is created only from this file. No code
 * outside of this file can access this token.
 * @private {!Object}
 * @const
 */
goog.html.TrustedResourceUrl.CONSTRUCTOR_TOKEN_PRIVATE_ = {};


/**
 * Package-internal utility method to create TrustedResourceUrl instances.
 *
 * @param {string} url The string to initialize the TrustedResourceUrl object
 *     with.
 * @return {!goog.html.TrustedResourceUrl} The initialized TrustedResourceUrl
 *     object.
 * @package
 */
goog.html.TrustedResourceUrl
    .createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse = function(url) {
  'use strict';
  const policy = goog.html.trustedtypes.getPolicyPrivateDoNotAccessOrElse();
  var value = policy ? policy.createScriptURL(url) : url;
  return new goog.html.TrustedResourceUrl(
      value, goog.html.TrustedResourceUrl.CONSTRUCTOR_TOKEN_PRIVATE_);
};


/**
 * Stringifies the passed params to be used as either a search or hash field of
 * a URL.
 *
 * @param {string} prefix The prefix character for the given field ('?' or '#').
 * @param {string} currentString The existing field value (including the prefix
 *     character, if the field is present).
 * @param {string|?Object<string, *>|undefined} params The params to set or
 *     append to the field.
 * - If `undefined` or `null`, the field remains unchanged.
 * - If a string, then the string will be escaped and the field will be
 *   overwritten with that value.
 * - If an Object, that object is treated as a set of key-value pairs to be
 *   appended to the current field. Note that JavaScript doesn't guarantee the
 *   order of values in an object which might result in non-deterministic order
 *   of the parameters. However, browsers currently preserve the order. The
 *   rules for each entry:
 *   - If an array, it will be processed as if each entry were an additional
 *     parameter with exactly the same key, following the same logic below.
 *   - If `undefined` or `null`, it will be skipped.
 *   - Otherwise, it will be turned into a string, escaped, and appended.
 * @return {string}
 * @private
 */
goog.html.TrustedResourceUrl.stringifyParams_ = function(
    prefix, currentString, params) {
  'use strict';
  if (params == null) {
    // Do not modify the field.
    return currentString;
  }
  if (typeof params === 'string') {
    // Set field to the passed string.
    return params ? prefix + encodeURIComponent(params) : '';
  }
  // Add on parameters to field from key-value object.
  for (var key in params) {
    // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty#Using_hasOwnProperty_as_a_property_name
    if (Object.prototype.hasOwnProperty.call(params, key)) {
      var value = params[key];
      var outputValues = Array.isArray(value) ? value : [value];
      for (var i = 0; i < outputValues.length; i++) {
        var outputValue = outputValues[i];
        if (outputValue != null) {
          if (!currentString) {
            currentString = prefix;
          }
          currentString += (currentString.length > prefix.length ? '&' : '') +
              encodeURIComponent(key) + '=' +
              encodeURIComponent(String(outputValue));
        }
      }
    }
  }
  return currentString;
};

//third_party/javascript/closure/string/internal.js
/**
 * @license
 * Copyright The Closure Library Authors.
 * SPDX-License-Identifier: Apache-2.0
 */

/**
 * @fileoverview String functions called from Closure packages that couldn't
 * depend on each other. Outside Closure, use goog.string function which
 * delegate to these.
 */


goog.provide('goog.string.internal');


/**
 * Fast prefix-checker.
 * @param {string} str The string to check.
 * @param {string} prefix A string to look for at the start of `str`.
 * @return {boolean} True if `str` begins with `prefix`.
 * @see goog.string.startsWith
 */
goog.string.internal.startsWith = function(str, prefix) {
  'use strict';
  return str.lastIndexOf(prefix, 0) == 0;
};


/**
 * Fast suffix-checker.
 * @param {string} str The string to check.
 * @param {string} suffix A string to look for at the end of `str`.
 * @return {boolean} True if `str` ends with `suffix`.
 * @see goog.string.endsWith
 */
goog.string.internal.endsWith = function(str, suffix) {
  'use strict';
  const l = str.length - suffix.length;
  return l >= 0 && str.indexOf(suffix, l) == l;
};


/**
 * Case-insensitive prefix-checker.
 * @param {string} str The string to check.
 * @param {string} prefix  A string to look for at the end of `str`.
 * @return {boolean} True if `str` begins with `prefix` (ignoring
 *     case).
 * @see goog.string.caseInsensitiveStartsWith
 */
goog.string.internal.caseInsensitiveStartsWith = function(str, prefix) {
  'use strict';
  return goog.string.internal.caseInsensitiveCompare(
             prefix, str.substr(0, prefix.length)) == 0;
};


/**
 * Case-insensitive suffix-checker.
 * @param {string} str The string to check.
 * @param {string} suffix A string to look for at the end of `str`.
 * @return {boolean} True if `str` ends with `suffix` (ignoring
 *     case).
 * @see goog.string.caseInsensitiveEndsWith
 */
goog.string.internal.caseInsensitiveEndsWith = function(str, suffix) {
  'use strict';
  return (
      goog.string.internal.caseInsensitiveCompare(
          suffix, str.substr(str.length - suffix.length, suffix.length)) == 0);
};


/**
 * Case-insensitive equality checker.
 * @param {string} str1 First string to check.
 * @param {string} str2 Second string to check.
 * @return {boolean} True if `str1` and `str2` are the same string,
 *     ignoring case.
 * @see goog.string.caseInsensitiveEquals
 */
goog.string.internal.caseInsensitiveEquals = function(str1, str2) {
  'use strict';
  return str1.toLowerCase() == str2.toLowerCase();
};


/**
 * Checks if a string is empty or contains only whitespaces.
 * @param {string} str The string to check.
 * @return {boolean} Whether `str` is empty or whitespace only.
 * @see goog.string.isEmptyOrWhitespace
 */
goog.string.internal.isEmptyOrWhitespace = function(str) {
  'use strict';
  // testing length == 0 first is actually slower in all browsers (about the
  // same in Opera).
  // Since IE doesn't include non-breaking-space (0xa0) in their \s character
  // class (as required by section 7.2 of the ECMAScript spec), we explicitly
  // include it in the regexp to enforce consistent cross-browser behavior.
  return /^[\s\xa0]*$/.test(str);
};


/**
 * Trims white spaces to the left and right of a string.
 * @param {string} str The string to trim.
 * @return {string} A trimmed copy of `str`.
 */
goog.string.internal.trim =
    (goog.TRUSTED_SITE && String.prototype.trim) ? function(str) {
      'use strict';
      return str.trim();
    } : function(str) {
      'use strict';
      // Since IE doesn't include non-breaking-space (0xa0) in their \s
      // character class (as required by section 7.2 of the ECMAScript spec),
      // we explicitly include it in the regexp to enforce consistent
      // cross-browser behavior.
      // NOTE: We don't use String#replace because it might have side effects
      // causing this function to not compile to 0 bytes.
      return /^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(str)[1];
    };


/**
 * A string comparator that ignores case.
 * -1 = str1 less than str2
 *  0 = str1 equals str2
 *  1 = str1 greater than str2
 *
 * @param {string} str1 The string to compare.
 * @param {string} str2 The string to compare `str1` to.
 * @return {number} The comparator result, as described above.
 * @see goog.string.caseInsensitiveCompare
 */
goog.string.internal.caseInsensitiveCompare = function(str1, str2) {
  'use strict';
  const test1 = String(str1).toLowerCase();
  const test2 = String(str2).toLowerCase();

  if (test1 < test2) {
    return -1;
  } else if (test1 == test2) {
    return 0;
  } else {
    return 1;
  }
};


/**
 * Converts \n to <br>s or <br />s.
 * @param {string} str The string in which to convert newlines.
 * @param {boolean=} opt_xml Whether to use XML compatible tags.
 * @return {string} A copy of `str` with converted newlines.
 * @see goog.string.newLineToBr
 */
goog.string.internal.newLineToBr = function(str, opt_xml) {
  'use strict';
  return str.replace(/(\r\n|\r|\n)/g, opt_xml ? '<br />' : '<br>');
};


/**
 * Escapes double quote '"' and single quote '\'' characters in addition to
 * '&', '<', and '>' so that a string can be included in an HTML tag attribute
 * value within double or single quotes.
 * @param {string} str string to be escaped.
 * @param {boolean=} opt_isLikelyToContainHtmlChars
 * @return {string} An escaped copy of `str`.
 * @see goog.string.htmlEscape
 */
goog.string.internal.htmlEscape = function(
    str, opt_isLikelyToContainHtmlChars) {
  'use strict';
  if (opt_isLikelyToContainHtmlChars) {
    str = str.replace(goog.string.internal.AMP_RE_, '&amp;')
              .replace(goog.string.internal.LT_RE_, '&lt;')
              .replace(goog.string.internal.GT_RE_, '&gt;')
              .replace(goog.string.internal.QUOT_RE_, '&quot;')
              .replace(goog.string.internal.SINGLE_QUOTE_RE_, '&#39;')
              .replace(goog.string.internal.NULL_RE_, '&#0;');
    return str;

  } else {
    // quick test helps in the case when there are no chars to replace, in
    // worst case this makes barely a difference to the time taken
    if (!goog.string.internal.ALL_RE_.test(str)) return str;

    // str.indexOf is faster than regex.test in this case
    if (str.indexOf('&') != -1) {
      str = str.replace(goog.string.internal.AMP_RE_, '&amp;');
    }
    if (str.indexOf('<') != -1) {
      str = str.replace(goog.string.internal.LT_RE_, '&lt;');
    }
    if (str.indexOf('>') != -1) {
      str = str.replace(goog.string.internal.GT_RE_, '&gt;');
    }
    if (str.indexOf('"') != -1) {
      str = str.replace(goog.string.internal.QUOT_RE_, '&quot;');
    }
    if (str.indexOf('\'') != -1) {
      str = str.replace(goog.string.internal.SINGLE_QUOTE_RE_, '&#39;');
    }
    if (str.indexOf('\x00') != -1) {
      str = str.replace(goog.string.internal.NULL_RE_, '&#0;');
    }
    return str;
  }
};


/**
 * Regular expression that matches an ampersand, for use in escaping.
 * @const {!RegExp}
 * @private
 */
goog.string.internal.AMP_RE_ = /&/g;


/**
 * Regular expression that matches a less than sign, for use in escaping.
 * @const {!RegExp}
 * @private
 */
goog.string.internal.LT_RE_ = /</g;


/**
 * Regular expression that matches a greater than sign, for use in escaping.
 * @const {!RegExp}
 * @private
 */
goog.string.internal.GT_RE_ = />/g;


/**
 * Regular expression that matches a double quote, for use in escaping.
 * @const {!RegExp}
 * @private
 */
goog.string.internal.QUOT_RE_ = /"/g;


/**
 * Regular expression that matches a single quote, for use in escaping.
 * @const {!RegExp}
 * @private
 */
goog.string.internal.SINGLE_QUOTE_RE_ = /'/g;


/**
 * Regular expression that matches null character, for use in escaping.
 * @const {!RegExp}
 * @private
 */
goog.string.internal.NULL_RE_ = /\x00/g;


/**
 * Regular expression that matches any character that needs to be escaped.
 * @const {!RegExp}
 * @private
 */
goog.string.internal.ALL_RE_ = /[\x00&<>"']/;


/**
 * Do escaping of whitespace to preserve spatial formatting. We use character
 * entity #160 to make it safer for xml.
 * @param {string} str The string in which to escape whitespace.
 * @param {boolean=} opt_xml Whether to use XML compatible tags.
 * @return {string} An escaped copy of `str`.
 * @see goog.string.whitespaceEscape
 */
goog.string.internal.whitespaceEscape = function(str, opt_xml) {
  'use strict';
  // This doesn't use goog.string.preserveSpaces for backwards compatibility.
  return goog.string.internal.newLineToBr(
      str.replace(/  /g, ' &#160;'), opt_xml);
};


/**
 * Determines whether a string contains a substring.
 * @param {string} str The string to search.
 * @param {string} subString The substring to search for.
 * @return {boolean} Whether `str` contains `subString`.
 * @see goog.string.contains
 */
goog.string.internal.contains = function(str, subString) {
  'use strict';
  return str.indexOf(subString) != -1;
};


/**
 * Determines whether a string contains a substring, ignoring case.
 * @param {string} str The string to search.
 * @param {string} subString The substring to search for.
 * @return {boolean} Whether `str` contains `subString`.
 * @see goog.string.caseInsensitiveContains
 */
goog.string.internal.caseInsensitiveContains = function(str, subString) {
  'use strict';
  return goog.string.internal.contains(
      str.toLowerCase(), subString.toLowerCase());
};


/**
 * Compares two version numbers.
 *
 * @param {string|number} version1 Version of first item.
 * @param {string|number} version2 Version of second item.
 *
 * @return {number}  1 if `version1` is higher.
 *                   0 if arguments are equal.
 *                  -1 if `version2` is higher.
 * @see goog.string.compareVersions
 */
goog.string.internal.compareVersions = function(version1, version2) {
  'use strict';
  let order = 0;
  // Trim leading and trailing whitespace and split the versions into
  // subversions.
  const v1Subs = goog.string.internal.trim(String(version1)).split('.');
  const v2Subs = goog.string.internal.trim(String(version2)).split('.');
  const subCount = Math.max(v1Subs.length, v2Subs.length);

  // Iterate over the subversions, as long as they appear to be equivalent.
  for (let subIdx = 0; order == 0 && subIdx < subCount; subIdx++) {
    let v1Sub = v1Subs[subIdx] || '';
    let v2Sub = v2Subs[subIdx] || '';

    do {
      // Split the subversions into pairs of numbers and qualifiers (like 'b').
      // Two different RegExp objects are use to make it clear the code
      // is side-effect free
      const v1Comp = /(\d*)(\D*)(.*)/.exec(v1Sub) || ['', '', '', ''];
      const v2Comp = /(\d*)(\D*)(.*)/.exec(v2Sub) || ['', '', '', ''];
      // Break if there are no more matches.
      if (v1Comp[0].length == 0 && v2Comp[0].length == 0) {
        break;
      }

      // Parse the numeric part of the subversion. A missing number is
      // equivalent to 0.
      const v1CompNum = v1Comp[1].length == 0 ? 0 : parseInt(v1Comp[1], 10);
      const v2CompNum = v2Comp[1].length == 0 ? 0 : parseInt(v2Comp[1], 10);

      // Compare the subversion components. The number has the highest
      // precedence. Next, if the numbers are equal, a subversion without any
      // qualifier is always higher than a subversion with any qualifier. Next,
      // the qualifiers are compared as strings.
      order = goog.string.internal.compareElements_(v1CompNum, v2CompNum) ||
          goog.string.internal.compareElements_(
              v1Comp[2].length == 0, v2Comp[2].length == 0) ||
          goog.string.internal.compareElements_(v1Comp[2], v2Comp[2]);
      // Stop as soon as an inequality is discovered.

      v1Sub = v1Comp[3];
      v2Sub = v2Comp[3];
    } while (order == 0);
  }

  return order;
};


/**
 * Compares elements of a version number.
 *
 * @param {string|number|boolean} left An element from a version number.
 * @param {string|number|boolean} right An element from a version number.
 *
 * @return {number}  1 if `left` is higher.
 *                   0 if arguments are equal.
 *                  -1 if `right` is higher.
 * @private
 */
goog.string.internal.compareElements_ = function(left, right) {
  'use strict';
  if (left < right) {
    return -1;
  } else if (left > right) {
    return 1;
  }
  return 0;
};

//third_party/javascript/closure/html/safeurl.js
/**
 * @license
 * Copyright The Closure Library Authors.
 * SPDX-License-Identifier: Apache-2.0
 */

/**
 * @fileoverview The SafeUrl type and its builders.
 *
 * TODO(xtof): Link to document stating type contract.
 */

goog.provide('goog.html.SafeUrl');

goog.require('goog.asserts');
goog.require('goog.fs.url');
goog.require('goog.html.TrustedResourceUrl');
goog.require('goog.i18n.bidi.Dir');
goog.require('goog.i18n.bidi.DirectionalString');
goog.require('goog.string.Const');
goog.require('goog.string.TypedString');
goog.require('goog.string.internal');



/**
 * A string that is safe to use in URL context in DOM APIs and HTML documents.
 *
 * A SafeUrl is a string-like object that carries the security type contract
 * that its value as a string will not cause untrusted script execution
 * when evaluated as a hyperlink URL in a browser.
 *
 * Values of this type are guaranteed to be safe to use in URL/hyperlink
 * contexts, such as assignment to URL-valued DOM properties, in the sense that
 * the use will not result in a Cross-Site-Scripting vulnerability. Similarly,
 * SafeUrls can be interpolated into the URL context of an HTML template (e.g.,
 * inside a href attribute). However, appropriate HTML-escaping must still be
 * applied.
 *
 * Note that, as documented in `goog.html.SafeUrl.unwrap`, this type's
 * contract does not guarantee that instances are safe to interpolate into HTML
 * without appropriate escaping.
 *
 * Note also that this type's contract does not imply any guarantees regarding
 * the resource the URL refers to.  In particular, SafeUrls are <b>not</b>
 * safe to use in a context where the referred-to resource is interpreted as
 * trusted code, e.g., as the src of a script tag.
 *
 * Instances of this type must be created via the factory methods
 * (`goog.html.SafeUrl.fromConstant`, `goog.html.SafeUrl.sanitize`),
 * etc and not by invoking its constructor. The constructor intentionally takes
 * an extra parameter that cannot be constructed outside of this file and the
 * type is immutable; hence only a default instance corresponding to the empty
 * string can be obtained via constructor invocation.
 *
 * @see goog.html.SafeUrl#fromConstant
 * @see goog.html.SafeUrl#from
 * @see goog.html.SafeUrl#sanitize
 * @final
 * @struct
 * @implements {goog.i18n.bidi.DirectionalString}
 * @implements {goog.string.TypedString}
 */
goog.html.SafeUrl = class {
  /**
   * @param {string} value
   * @param {!Object} token package-internal implementation detail.
   */
  constructor(value, token) {
    /**
     * The contained value of this SafeUrl.  The field has a purposely ugly
     * name to make (non-compiled) code that attempts to directly access this
     * field stand out.
     * @private {string}
     */
    this.privateDoNotAccessOrElseSafeUrlWrappedValue_ =
        (token === goog.html.SafeUrl.CONSTRUCTOR_TOKEN_PRIVATE_) ? value : '';
  };
};


/**
 * The innocuous string generated by goog.html.SafeUrl.sanitize when passed
 * an unsafe URL.
 *
 * about:invalid is registered in
 * http://www.w3.org/TR/css3-values/#about-invalid.
 * http://tools.ietf.org/html/rfc6694#section-2.2.1 permits about URLs to
 * contain a fragment, which is not to be considered when determining if an
 * about URL is well-known.
 *
 * Using about:invalid seems preferable to using a fixed data URL, since
 * browsers might choose to not report CSP violations on it, as legitimate
 * CSS function calls to attr() can result in this URL being produced. It is
 * also a standard URL which matches exactly the semantics we need:
 * "The about:invalid URI references a non-existent document with a generic
 * error condition. It can be used when a URI is necessary, but the default
 * value shouldn't be resolveable as any type of document".
 *
 * @const {string}
 */
goog.html.SafeUrl.INNOCUOUS_STRING = 'about:invalid#zClosurez';


/**
 * @override
 * @const
 */
goog.html.SafeUrl.prototype.implementsGoogStringTypedString = true;


/**
 * Returns this SafeUrl's value as a string.
 *
 * IMPORTANT: In code where it is security relevant that an object's type is
 * indeed `SafeUrl`, use `goog.html.SafeUrl.unwrap` instead of this
 * method. If in doubt, assume that it's security relevant. In particular, note
 * that goog.html functions which return a goog.html type do not guarantee that
 * the returned instance is of the right type.
 *
 * IMPORTANT: The guarantees of the SafeUrl type contract only extend to the
 * behavior of browsers when interpreting URLs. Values of SafeUrl objects MUST
 * be appropriately escaped before embedding in a HTML document. Note that the
 * required escaping is context-sensitive (e.g. a different escaping is
 * required for embedding a URL in a style property within a style
 * attribute, as opposed to embedding in a href attribute).
 *
 * @see goog.html.SafeUrl#unwrap
 * @override
 */
goog.html.SafeUrl.prototype.getTypedStringValue = function() {
  'use strict';
  return this.privateDoNotAccessOrElseSafeUrlWrappedValue_.toString();
};


/**
 * @override
 * @const
 */
goog.html.SafeUrl.prototype.implementsGoogI18nBidiDirectionalString = true;


/**
 * Returns this URLs directionality, which is always `LTR`.
 * @override
 */
goog.html.SafeUrl.prototype.getDirection = function() {
  'use strict';
  return goog.i18n.bidi.Dir.LTR;
};


/**
 * Returns a string-representation of this value.
 *
 * To obtain the actual string value wrapped in a SafeUrl, use
 * `goog.html.SafeUrl.unwrap`.
 *
 * @return {string}
 * @see goog.html.SafeUrl#unwrap
 * @override
 */
goog.html.SafeUrl.prototype.toString = function() {
  'use strict';
  return this.privateDoNotAccessOrElseSafeUrlWrappedValue_.toString();
};



/**
 * Performs a runtime check that the provided object is indeed a SafeUrl
 * object, and returns its value.
 *
 * IMPORTANT: The guarantees of the SafeUrl type contract only extend to the
 * behavior of  browsers when interpreting URLs. Values of SafeUrl objects MUST
 * be appropriately escaped before embedding in a HTML document. Note that the
 * required escaping is context-sensitive (e.g. a different escaping is
 * required for embedding a URL in a style property within a style
 * attribute, as opposed to embedding in a href attribute).
 *
 * @param {!goog.html.SafeUrl} safeUrl The object to extract from.
 * @return {string} The SafeUrl object's contained string, unless the run-time
 *     type check fails. In that case, `unwrap` returns an innocuous
 *     string, or, if assertions are enabled, throws
 *     `goog.asserts.AssertionError`.
 */
goog.html.SafeUrl.unwrap = function(safeUrl) {
  'use strict';
  // Perform additional Run-time type-checking to ensure that safeUrl is indeed
  // an instance of the expected type.  This provides some additional protection
  // against security bugs due to application code that disables type checks.
  // Specifically, the following checks are performed:
  // 1. The object is an instance of the expected type.
  // 2. The object is not an instance of a subclass.
  if (safeUrl instanceof goog.html.SafeUrl &&
      safeUrl.constructor === goog.html.SafeUrl) {
    return safeUrl.privateDoNotAccessOrElseSafeUrlWrappedValue_;
  } else {
    goog.asserts.fail('expected object of type SafeUrl, got \'' +
        safeUrl + '\' of type ' + goog.typeOf(safeUrl));
    return 'type_error:SafeUrl';
  }
};


/**
 * Creates a SafeUrl object from a compile-time constant string.
 *
 * Compile-time constant strings are inherently program-controlled and hence
 * trusted.
 *
 * @param {!goog.string.Const} url A compile-time-constant string from which to
 *         create a SafeUrl.
 * @return {!goog.html.SafeUrl} A SafeUrl object initialized to `url`.
 */
goog.html.SafeUrl.fromConstant = function(url) {
  'use strict';
  return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(
      goog.string.Const.unwrap(url));
};


/**
 * A pattern that matches Blob or data types that can have SafeUrls created
 * from URL.createObjectURL(blob) or via a data: URI.
 *
 * This has some parameter support (most notably, we haven't implemented the
 * more complex parts like %-encoded characters or non-alphanumerical ones for
 * simplicity's sake). The specs are fairly complex, and they don't
 * always match Chrome's behavior: we settled on a subset where we're confident
 * all parties involved agree.
 *
 * The spec is available at https://mimesniff.spec.whatwg.org/ (and see
 * https://tools.ietf.org/html/rfc2397 for data: urls, which override some of
 * it).
 * @const
 * @private
 */
goog.html.SAFE_MIME_TYPE_PATTERN_ = new RegExp(
    // Note: Due to content-sniffing concerns, only add MIME types for
    // media formats.
    '^(?:audio/(?:3gpp2|3gpp|aac|L16|midi|mp3|mp4|mpeg|oga|ogg|opus|x-m4a|x-matroska|x-wav|wav|webm)|' +
        'font/\\w+|' +
        'image/(?:bmp|gif|jpeg|jpg|png|tiff|webp|x-icon)|' +
        'video/(?:mpeg|mp4|ogg|webm|quicktime|x-matroska))' +
        '(?:;\\w+=(?:\\w+|"[\\w;,= ]+"))*$',  // MIME type parameters
    'i');


/**
 * @param {string} mimeType The MIME type to check if safe.
 * @return {boolean} True if the MIME type is safe and creating a Blob via
 *   `SafeUrl.fromBlob()` with that type will not fail due to the type. False
 *   otherwise.
 */
goog.html.SafeUrl.isSafeMimeType = function(mimeType) {
  'use strict';
  return goog.html.SAFE_MIME_TYPE_PATTERN_.test(mimeType);
};


/**
 * Creates a SafeUrl wrapping a blob URL for the given `blob`.
 *
 * The blob URL is created with `URL.createObjectURL`. If the MIME type
 * for `blob` is not of a known safe audio, image or video MIME type,
 * then the SafeUrl will wrap {@link #INNOCUOUS_STRING}.
 *
 * Note: Call {@link revokeObjectUrl} on the URL after it's used
 * to prevent memory leaks.
 *
 * @see http://www.w3.org/TR/FileAPI/#url
 * @param {!Blob} blob
 * @return {!goog.html.SafeUrl} The blob URL, or an innocuous string wrapped
 *   as a SafeUrl.
 */
goog.html.SafeUrl.fromBlob = function(blob) {
  'use strict';
  var url = goog.html.SafeUrl.isSafeMimeType(blob.type) ?
      goog.fs.url.createObjectUrl(blob) :
      goog.html.SafeUrl.INNOCUOUS_STRING;
  return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(url);
};


/**
 * Revokes an object URL created for a safe URL created {@link fromBlob()}.
 * @param {!goog.html.SafeUrl} safeUrl SafeUrl wrapping a blob object.
 */
goog.html.SafeUrl.revokeObjectUrl = function(safeUrl) {
  'use strict';
  var url = safeUrl.getTypedStringValue();
  if (url !== goog.html.SafeUrl.INNOCUOUS_STRING) {
    goog.fs.url.revokeObjectUrl(url);
  }
};


/**
 * Creates a SafeUrl wrapping a blob URL created for a MediaSource.
 * @param {!MediaSource} mediaSource
 * @return {!goog.html.SafeUrl} The blob URL.
 */
goog.html.SafeUrl.fromMediaSource = function(mediaSource) {
  'use strict';
  goog.asserts.assert(
      'MediaSource' in goog.global, 'No support for MediaSource');
  const url = mediaSource instanceof MediaSource ?
      goog.fs.url.createObjectUrl(mediaSource) :
      goog.html.SafeUrl.INNOCUOUS_STRING;
  return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(url);
};


/**
 * Matches a base-64 data URL, with the first match group being the MIME type.
 * @const
 * @private
 */
goog.html.DATA_URL_PATTERN_ = /^data:(.*);base64,[a-z0-9+\/]+=*$/i;


/**
 * Attempts to create a SafeUrl wrapping a `data:` URL, after validating it
 * matches a known-safe media MIME type. If it doesn't match, return `null`.
 *
 * @param {string} dataUrl A valid base64 data URL with one of the whitelisted
 *     media MIME types.
 * @return {?goog.html.SafeUrl} A matching safe URL, or `null` if it does not
 *     pass.
 */
goog.html.SafeUrl.tryFromDataUrl = function(dataUrl) {
  'use strict';
  // For defensive purposes, in case users cast around the parameter type.
  dataUrl = String(dataUrl);
  // RFC4648 suggest to ignore CRLF in base64 encoding.
  // See https://tools.ietf.org/html/rfc4648.
  // Remove the CR (%0D) and LF (%0A) from the dataUrl.
  var filteredDataUrl = dataUrl.replace(/(%0A|%0D)/g, '');
  var match = filteredDataUrl.match(goog.html.DATA_URL_PATTERN_);
  // Note: The only risk of XSS here is if the `data:` URL results in a
  // same-origin document. In which case content-sniffing might cause the
  // browser to interpret the contents as html.
  // All modern browsers consider `data:` URL documents to have unique empty
  // origins. Only Firefox for versions prior to v57 behaves differently:
  // https://blog.mozilla.org/security/2017/10/04/treating-data-urls-unique-origins-firefox-57/
  // Older versions of IE don't understand `data:` urls, so it is not an issue.
  var valid = match && goog.html.SafeUrl.isSafeMimeType(match[1]);
  if (valid) {
    return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(
        filteredDataUrl);
  }
  return null;
};


/**
 * Creates a SafeUrl wrapping a `data:` URL, after validating it matches a
 * known-safe media MIME type. If it doesn't match, return
 * `goog.html.SafeUrl.INNOCUOUS_URL`.
 *
 * @param {string} dataUrl A valid base64 data URL with one of the whitelisted
 *     media MIME types.
 * @return {!goog.html.SafeUrl} A matching safe URL, or
 *     `goog.html.SafeUrl.INNOCUOUS_URL` if it does not pass.
 */
goog.html.SafeUrl.fromDataUrl = function(dataUrl) {
  'use strict';
  return goog.html.SafeUrl.tryFromDataUrl(dataUrl) ||
      goog.html.SafeUrl.INNOCUOUS_URL;
};


/**
 * Creates a SafeUrl wrapping a tel: URL.
 *
 * @param {string} telUrl A tel URL.
 * @return {!goog.html.SafeUrl} A matching safe URL, or {@link INNOCUOUS_STRING}
 *     wrapped as a SafeUrl if it does not pass.
 */
goog.html.SafeUrl.fromTelUrl = function(telUrl) {
  'use strict';
  // There's a risk that a tel: URL could immediately place a call once
  // clicked, without requiring user confirmation. For that reason it is
  // handled in this separate function.
  if (!goog.string.internal.caseInsensitiveStartsWith(telUrl, 'tel:')) {
    telUrl = goog.html.SafeUrl.INNOCUOUS_STRING;
  }
  return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(
      telUrl);
};


/**
 * Matches a sip/sips URL. We only allow urls that consist of an email address.
 * The characters '?' and '#' are not allowed in the local part of the email
 * address.
 * @const
 * @private
 */
goog.html.SIP_URL_PATTERN_ = new RegExp(
    '^sip[s]?:[+a-z0-9_.!$%&\'*\\/=^`{|}~-]+@([a-z0-9-]+\\.)+[a-z0-9]{2,63}$',
    'i');


/**
 * Creates a SafeUrl wrapping a sip: URL. We only allow urls that consist of an
 * email address. The characters '?' and '#' are not allowed in the local part
 * of the email address.
 *
 * @param {string} sipUrl A sip URL.
 * @return {!goog.html.SafeUrl} A matching safe URL, or {@link INNOCUOUS_STRING}
 *     wrapped as a SafeUrl if it does not pass.
 */
goog.html.SafeUrl.fromSipUrl = function(sipUrl) {
  'use strict';
  if (!goog.html.SIP_URL_PATTERN_.test(decodeURIComponent(sipUrl))) {
    sipUrl = goog.html.SafeUrl.INNOCUOUS_STRING;
  }
  return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(
      sipUrl);
};


/**
 * Creates a SafeUrl wrapping a fb-messenger://share URL.
 *
 * @param {string} facebookMessengerUrl A facebook messenger URL.
 * @return {!goog.html.SafeUrl} A matching safe URL, or {@link INNOCUOUS_STRING}
 *     wrapped as a SafeUrl if it does not pass.
 */
goog.html.SafeUrl.fromFacebookMessengerUrl = function(facebookMessengerUrl) {
  'use strict';
  if (!goog.string.internal.caseInsensitiveStartsWith(
          facebookMessengerUrl, 'fb-messenger://share')) {
    facebookMessengerUrl = goog.html.SafeUrl.INNOCUOUS_STRING;
  }
  return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(
      facebookMessengerUrl);
};

/**
 * Creates a SafeUrl wrapping a whatsapp://send URL.
 *
 * @param {string} whatsAppUrl A WhatsApp URL.
 * @return {!goog.html.SafeUrl} A matching safe URL, or {@link INNOCUOUS_STRING}
 *     wrapped as a SafeUrl if it does not pass.
 */
goog.html.SafeUrl.fromWhatsAppUrl = function(whatsAppUrl) {
  'use strict';
  if (!goog.string.internal.caseInsensitiveStartsWith(
          whatsAppUrl, 'whatsapp://send')) {
    whatsAppUrl = goog.html.SafeUrl.INNOCUOUS_STRING;
  }
  return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(
      whatsAppUrl);
};

/**
 * Creates a SafeUrl wrapping a sms: URL.
 *
 * @param {string} smsUrl A sms URL.
 * @return {!goog.html.SafeUrl} A matching safe URL, or {@link INNOCUOUS_STRING}
 *     wrapped as a SafeUrl if it does not pass.
 */
goog.html.SafeUrl.fromSmsUrl = function(smsUrl) {
  'use strict';
  if (!goog.string.internal.caseInsensitiveStartsWith(smsUrl, 'sms:') ||
      !goog.html.SafeUrl.isSmsUrlBodyValid_(smsUrl)) {
    smsUrl = goog.html.SafeUrl.INNOCUOUS_STRING;
  }
  return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(
      smsUrl);
};


/**
 * Validates SMS URL `body` parameter, which is optional and should appear at
 * most once and should be percent-encoded if present. Rejects many malformed
 * bodies, but may spuriously reject some URLs and does not reject all malformed
 * sms: URLs.
 *
 * @param {string} smsUrl A sms URL.
 * @return {boolean} Whether SMS URL has a valid `body` parameter if it exists.
 * @private
 */
goog.html.SafeUrl.isSmsUrlBodyValid_ = function(smsUrl) {
  'use strict';
  var hash = smsUrl.indexOf('#');
  if (hash > 0) {
    smsUrl = smsUrl.substring(0, hash);
  }
  var bodyParams = smsUrl.match(/[?&]body=/gi);
  // "body" param is optional
  if (!bodyParams) {
    return true;
  }
  // "body" MUST only appear once
  if (bodyParams.length > 1) {
    return false;
  }
  // Get the encoded `body` parameter value.
  var bodyValue = smsUrl.match(/[?&]body=([^&]*)/)[1];
  if (!bodyValue) {
    return true;
  }
  try {
    decodeURIComponent(bodyValue);
  } catch (error) {
    return false;
  }
  return /^(?:[a-z0-9\-_.~]|%[0-9a-f]{2})+$/i.test(bodyValue);
};


/**
 * Creates a SafeUrl wrapping a ssh: URL.
 *
 * @param {string} sshUrl A ssh URL.
 * @return {!goog.html.SafeUrl} A matching safe URL, or {@link INNOCUOUS_STRING}
 *     wrapped as a SafeUrl if it does not pass.
 */
goog.html.SafeUrl.fromSshUrl = function(sshUrl) {
  'use strict';
  if (!goog.string.internal.caseInsensitiveStartsWith(sshUrl, 'ssh://')) {
    sshUrl = goog.html.SafeUrl.INNOCUOUS_STRING;
  }
  return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(
      sshUrl);
};

/**
 * Sanitizes a Chrome extension URL to SafeUrl, given a compile-time-constant
 * extension identifier. Can also be restricted to chrome extensions.
 *
 * @param {string} url The url to sanitize. Should start with the extension
 *     scheme and the extension identifier.
 * @param {!goog.string.Const|!Array<!goog.string.Const>} extensionId The
 *     extension id to accept, as a compile-time constant or an array of those.
 *
 * @return {!goog.html.SafeUrl} Either `url` if it's deemed safe, or
 *     `INNOCUOUS_STRING` if it's not.
 */
goog.html.SafeUrl.sanitizeChromeExtensionUrl = function(url, extensionId) {
  'use strict';
  return goog.html.SafeUrl.sanitizeExtensionUrl_(
      /^chrome-extension:\/\/([^\/]+)\//, url, extensionId);
};

/**
 * Sanitizes a Firefox extension URL to SafeUrl, given a compile-time-constant
 * extension identifier. Can also be restricted to chrome extensions.
 *
 * @param {string} url The url to sanitize. Should start with the extension
 *     scheme and the extension identifier.
 * @param {!goog.string.Const|!Array<!goog.string.Const>} extensionId The
 *     extension id to accept, as a compile-time constant or an array of those.
 *
 * @return {!goog.html.SafeUrl} Either `url` if it's deemed safe, or
 *     `INNOCUOUS_STRING` if it's not.
 */
goog.html.SafeUrl.sanitizeFirefoxExtensionUrl = function(url, extensionId) {
  'use strict';
  return goog.html.SafeUrl.sanitizeExtensionUrl_(
      /^moz-extension:\/\/([^\/]+)\//, url, extensionId);
};

/**
 * Sanitizes a Edge extension URL to SafeUrl, given a compile-time-constant
 * extension identifier. Can also be restricted to chrome extensions.
 *
 * @param {string} url The url to sanitize. Should start with the extension
 *     scheme and the extension identifier.
 * @param {!goog.string.Const|!Array<!goog.string.Const>} extensionId The
 *     extension id to accept, as a compile-time constant or an array of those.
 *
 * @return {!goog.html.SafeUrl} Either `url` if it's deemed safe, or
 *     `INNOCUOUS_STRING` if it's not.
 */
goog.html.SafeUrl.sanitizeEdgeExtensionUrl = function(url, extensionId) {
  'use strict';
  return goog.html.SafeUrl.sanitizeExtensionUrl_(
      /^ms-browser-extension:\/\/([^\/]+)\//, url, extensionId);
};

/**
 * Private helper for converting extension URLs to SafeUrl, given the scheme for
 * that particular extension type. Use the sanitizeFirefoxExtensionUrl,
 * sanitizeChromeExtensionUrl or sanitizeEdgeExtensionUrl unless you're building
 * new helpers.
 *
 * @private
 * @param {!RegExp} scheme The scheme to accept as a RegExp extracting the
 *     extension identifier.
 * @param {string} url The url to sanitize. Should start with the extension
 *     scheme and the extension identifier.
 * @param {!goog.string.Const|!Array<!goog.string.Const>} extensionId The
 *     extension id to accept, as a compile-time constant or an array of those.
 *
 * @return {!goog.html.SafeUrl} Either `url` if it's deemed safe, or
 *     `INNOCUOUS_STRING` if it's not.
 */
goog.html.SafeUrl.sanitizeExtensionUrl_ = function(scheme, url, extensionId) {
  'use strict';
  var matches = scheme.exec(url);
  if (!matches) {
    url = goog.html.SafeUrl.INNOCUOUS_STRING;
  } else {
    var extractedExtensionId = matches[1];
    var acceptedExtensionIds;
    if (extensionId instanceof goog.string.Const) {
      acceptedExtensionIds = [goog.string.Const.unwrap(extensionId)];
    } else {
      acceptedExtensionIds = extensionId.map(function unwrap(x) {
        'use strict';
        return goog.string.Const.unwrap(x);
      });
    }
    if (acceptedExtensionIds.indexOf(extractedExtensionId) == -1) {
      url = goog.html.SafeUrl.INNOCUOUS_STRING;
    }
  }
  return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(url);
};


/**
 * Creates a SafeUrl from TrustedResourceUrl. This is safe because
 * TrustedResourceUrl is more tightly restricted than SafeUrl.
 *
 * @param {!goog.html.TrustedResourceUrl} trustedResourceUrl
 * @return {!goog.html.SafeUrl}
 */
goog.html.SafeUrl.fromTrustedResourceUrl = function(trustedResourceUrl) {
  'use strict';
  return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(
      goog.html.TrustedResourceUrl.unwrap(trustedResourceUrl));
};


/**
 * A pattern that recognizes a commonly useful subset of URLs that satisfy
 * the SafeUrl contract.
 *
 * This regular expression matches a subset of URLs that will not cause script
 * execution if used in URL context within a HTML document. Specifically, this
 * regular expression matches if (comment from here on and regex copied from
 * Soy's EscapingConventions):
 * (1) Either a protocol in a whitelist (http, https, mailto or ftp).
 * (2) or no protocol.  A protocol must be followed by a colon. The below
 *     allows that by allowing colons only after one of the characters [/?#].
 *     A colon after a hash (#) must be in the fragment.
 *     Otherwise, a colon after a (?) must be in a query.
 *     Otherwise, a colon after a single solidus (/) must be in a path.
 *     Otherwise, a colon after a double solidus (//) must be in the authority
 *     (before port).
 *
 * @private
 * @const {!RegExp}
 */
goog.html.SAFE_URL_PATTERN_ =
    /^(?:(?:https?|mailto|ftp):|[^:/?#]*(?:[/?#]|$))/i;

/**
 * Public version of goog.html.SAFE_URL_PATTERN_. Updating
 * goog.html.SAFE_URL_PATTERN_ doesn't seem to be backward compatible.
 * Namespace is also changed to goog.html.SafeUrl so it can be imported using
 * goog.require('goog.dom.SafeUrl').
 *
 * TODO(bangert): Remove SAFE_URL_PATTERN_
 * @const {!RegExp}
 */
goog.html.SafeUrl.SAFE_URL_PATTERN = goog.html.SAFE_URL_PATTERN_;

/**
 * Attempts to create a SafeUrl object from `url`. The input string is validated
 * to match a pattern of commonly used safe URLs. If validation fails, `null` is
 * returned.
 *
 * `url` may be a URL with the `http:`, `https:`, `mailto:`, `ftp:` or `data`
 * scheme, or a relative URL (i.e., a URL without a scheme; specifically, a
 * scheme-relative, absolute-path-relative, or path-relative URL).
 *
 * @see http://url.spec.whatwg.org/#concept-relative-url
 * @param {string|!goog.string.TypedString} url The URL to validate.
 * @return {?goog.html.SafeUrl} The validated URL, wrapped as a SafeUrl, or null
 *     if validation fails.
 */
goog.html.SafeUrl.trySanitize = function(url) {
  'use strict';
  if (url instanceof goog.html.SafeUrl) {
    return url;
  }
  if (typeof url == 'object' && url.implementsGoogStringTypedString) {
    url = /** @type {!goog.string.TypedString} */ (url).getTypedStringValue();
  } else {
    // For defensive purposes, in case users cast around the parameter type.
    url = String(url);
  }
  if (!goog.html.SAFE_URL_PATTERN_.test(url)) {
    return goog.html.SafeUrl.tryFromDataUrl(url);
  }
  return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(url);
};

/**
 * Creates a SafeUrl object from `url`. If `url` is a
 * `goog.html.SafeUrl` then it is simply returned. Otherwise the input string is
 * validated to match a pattern of commonly used safe URLs. If validation fails,
 * `goog.html.SafeUrl.INNOCUOUS_URL` is returned.
 *
 * `url` may be a URL with the `http:`, `https:`, `mailto:`, `ftp:` or `data`
 * scheme, or a relative URL (i.e., a URL without a scheme; specifically, a
 * scheme-relative, absolute-path-relative, or path-relative URL).
 *
 * @see http://url.spec.whatwg.org/#concept-relative-url
 * @param {string|!goog.string.TypedString} url The URL to validate.
 * @return {!goog.html.SafeUrl} The validated URL, wrapped as a SafeUrl.
 */
goog.html.SafeUrl.sanitize = function(url) {
  'use strict';
  return goog.html.SafeUrl.trySanitize(url) || goog.html.SafeUrl.INNOCUOUS_URL;
};

/**
 * Creates a SafeUrl object from `url`. If `url` is a
 * `goog.html.SafeUrl` then it is simply returned. Otherwise the input string is
 * validated to match a pattern of commonly used safe URLs.
 *
 * `url` may be a URL with the http, https, mailto or ftp scheme,
 * or a relative URL (i.e., a URL without a scheme; specifically, a
 * scheme-relative, absolute-path-relative, or path-relative URL).
 *
 * This function asserts (using goog.asserts) that the URL matches this pattern.
 * If it does not, in addition to failing the assert, an innocuous URL will be
 * returned.
 *
 * @see http://url.spec.whatwg.org/#concept-relative-url
 * @param {string|!goog.string.TypedString} url The URL to validate.
 * @param {boolean=} opt_allowDataUrl Whether to allow valid data: URLs.
 * @return {!goog.html.SafeUrl} The validated URL, wrapped as a SafeUrl.
 */
goog.html.SafeUrl.sanitizeAssertUnchanged = function(url, opt_allowDataUrl) {
  'use strict';
  if (url instanceof goog.html.SafeUrl) {
    return url;
  } else if (typeof url == 'object' && url.implementsGoogStringTypedString) {
    url = /** @type {!goog.string.TypedString} */ (url).getTypedStringValue();
  } else {
    url = String(url);
  }
  if (opt_allowDataUrl && /^data:/i.test(url)) {
    var safeUrl = goog.html.SafeUrl.fromDataUrl(url);
    if (safeUrl.getTypedStringValue() == url) {
      return safeUrl;
    }
  }
  if (!goog.asserts.assert(
          goog.html.SAFE_URL_PATTERN_.test(url),
          '%s does not match the safe URL pattern', url)) {
    url = goog.html.SafeUrl.INNOCUOUS_STRING;
  }
  return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(url);
};

/**
 * Token used to ensure that object is created only from this file. No code
 * outside of this file can access this token.
 * @private {!Object}
 * @const
 */
goog.html.SafeUrl.CONSTRUCTOR_TOKEN_PRIVATE_ = {};

/**
 * Package-internal utility method to create SafeUrl instances.
 *
 * @param {string} url The string to initialize the SafeUrl object with.
 * @return {!goog.html.SafeUrl} The initialized SafeUrl object.
 * @package
 */
goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse = function(
    url) {
  'use strict';
  return new goog.html.SafeUrl(
      url, goog.html.SafeUrl.CONSTRUCTOR_TOKEN_PRIVATE_);
};


/**
 * `INNOCUOUS_STRING` wrapped in a `SafeUrl`.
 * @const {!goog.html.SafeUrl}
 */
goog.html.SafeUrl.INNOCUOUS_URL =
    goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(
        goog.html.SafeUrl.INNOCUOUS_STRING);


/**
 * A SafeUrl corresponding to the special about:blank url.
 * @const {!goog.html.SafeUrl}
 */
goog.html.SafeUrl.ABOUT_BLANK =
    goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(
        'about:blank');

//third_party/javascript/closure/html/safestyle.js
/**
 * @license
 * Copyright The Closure Library Authors.
 * SPDX-License-Identifier: Apache-2.0
 */

/**
 * @fileoverview The SafeStyle type and its builders.
 *
 * TODO(xtof): Link to document stating type contract.
 */

goog.provide('goog.html.SafeStyle');

goog.require('goog.array');
goog.require('goog.asserts');
goog.require('goog.html.SafeUrl');
goog.require('goog.string.Const');
goog.require('goog.string.TypedString');
goog.require('goog.string.internal');



/**
 * A string-like object which represents a sequence of CSS declarations
 * (`propertyName1: propertyvalue1; propertyName2: propertyValue2; ...`)
 * and that carries the security type contract that its value, as a string,
 * will not cause untrusted script execution (XSS) when evaluated as CSS in a
 * browser.
 *
 * Instances of this type must be created via the factory methods
 * (`goog.html.SafeStyle.create` or `goog.html.SafeStyle.fromConstant`)
 * and not by invoking its constructor. The constructor intentionally takes an
 * extra parameter that cannot be constructed outside of this file and the type
 * is immutable; hence only a default instance corresponding to the empty string
 * can be obtained via constructor invocation.
 *
 * SafeStyle's string representation can safely be:
 * <ul>
 *   <li>Interpolated as the content of a *quoted* HTML style attribute.
 *       However, the SafeStyle string *must be HTML-attribute-escaped* before
 *       interpolation.
 *   <li>Interpolated as the content of a {}-wrapped block within a stylesheet.
 *       '<' characters in the SafeStyle string *must be CSS-escaped* before
 *       interpolation. The SafeStyle string is also guaranteed not to be able
 *       to introduce new properties or elide existing ones.
 *   <li>Interpolated as the content of a {}-wrapped block within an HTML
 *       &lt;style&gt; element. '<' characters in the SafeStyle string
 *       *must be CSS-escaped* before interpolation.
 *   <li>Assigned to the style property of a DOM node. The SafeStyle string
 *       should not be escaped before being assigned to the property.
 * </ul>
 *
 * A SafeStyle may never contain literal angle brackets. Otherwise, it could
 * be unsafe to place a SafeStyle into a &lt;style&gt; tag (where it can't
 * be HTML escaped). For example, if the SafeStyle containing
 * `font: 'foo &lt;style/&gt;&lt;script&gt;evil&lt;/script&gt;'` were
 * interpolated within a &lt;style&gt; tag, this would then break out of the
 * style context into HTML.
 *
 * A SafeStyle may contain literal single or double quotes, and as such the
 * entire style string must be escaped when used in a style attribute (if
 * this were not the case, the string could contain a matching quote that
 * would escape from the style attribute).
 *
 * Values of this type must be composable, i.e. for any two values
 * `style1` and `style2` of this type,
 * `goog.html.SafeStyle.unwrap(style1) +
 * goog.html.SafeStyle.unwrap(style2)` must itself be a value that satisfies
 * the SafeStyle type constraint. This requirement implies that for any value
 * `style` of this type, `goog.html.SafeStyle.unwrap(style)` must
 * not end in a "property value" or "property name" context. For example,
 * a value of `background:url("` or `font-` would not satisfy the
 * SafeStyle contract. This is because concatenating such strings with a
 * second value that itself does not contain unsafe CSS can result in an
 * overall string that does. For example, if `javascript:evil())"` is
 * appended to `background:url("}, the resulting string may result in
 * the execution of a malicious script.
 *
 * TODO(mlourenco): Consider whether we should implement UTF-8 interchange
 * validity checks and blacklisting of newlines (including Unicode ones) and
 * other whitespace characters (\t, \f). Document here if so and also update
 * SafeStyle.fromConstant().
 *
 * The following example values comply with this type's contract:
 * <ul>
 *   <li><pre>width: 1em;</pre>
 *   <li><pre>height:1em;</pre>
 *   <li><pre>width: 1em;height: 1em;</pre>
 *   <li><pre>background:url('http://url');</pre>
 * </ul>
 * In addition, the empty string is safe for use in a CSS attribute.
 *
 * The following example values do NOT comply with this type's contract:
 * <ul>
 *   <li><pre>background: red</pre> (missing a trailing semi-colon)
 *   <li><pre>background:</pre> (missing a value and a trailing semi-colon)
 *   <li><pre>1em</pre> (missing an attribute name, which provides context for
 *       the value)
 * </ul>
 *
 * @see goog.html.SafeStyle#create
 * @see goog.html.SafeStyle#fromConstant
 * @see http://www.w3.org/TR/css3-syntax/
 * @final
 * @struct
 * @implements {goog.string.TypedString}
 */
goog.html.SafeStyle = class {
  /**
   * @param {string} value
   * @param {!Object} token package-internal implementation detail.
   */
  constructor(value, token) {
    /**
     * The contained value of this SafeStyle.  The field has a purposely
     * ugly name to make (non-compiled) code that attempts to directly access
     * this field stand out.
     * @private {string}
     */
    this.privateDoNotAccessOrElseSafeStyleWrappedValue_ =
        (token === goog.html.SafeStyle.CONSTRUCTOR_TOKEN_PRIVATE_) ? value : '';
  }
};


/**
 * @override
 * @const
 */
goog.html.SafeStyle.prototype.implementsGoogStringTypedString = true;


/**
 * Creates a SafeStyle object from a compile-time constant string.
 *
 * `style` should be in the format
 * `name: value; [name: value; ...]` and must not have any < or >
 * characters in it. This is so that SafeStyle's contract is preserved,
 * allowing the SafeStyle to correctly be interpreted as a sequence of CSS
 * declarations and without affecting the syntactic structure of any
 * surrounding CSS and HTML.
 *
 * This method performs basic sanity checks on the format of `style`
 * but does not constrain the format of `name` and `value`, except
 * for disallowing tag characters.
 *
 * @param {!goog.string.Const} style A compile-time-constant string from which
 *     to create a SafeStyle.
 * @return {!goog.html.SafeStyle} A SafeStyle object initialized to
 *     `style`.
 */
goog.html.SafeStyle.fromConstant = function(style) {
  'use strict';
  var styleString = goog.string.Const.unwrap(style);
  if (styleString.length === 0) {
    return goog.html.SafeStyle.EMPTY;
  }
  goog.asserts.assert(
      goog.string.internal.endsWith(styleString, ';'),
      'Last character of style string is not \';\': ' + styleString);
  goog.asserts.assert(
      goog.string.internal.contains(styleString, ':'),
      'Style string must contain at least one \':\', to ' +
          'specify a "name: value" pair: ' + styleString);
  return goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(
      styleString);
};


/**
 * Returns this SafeStyle's value as a string.
 *
 * IMPORTANT: In code where it is security relevant that an object's type is
 * indeed `SafeStyle`, use `goog.html.SafeStyle.unwrap` instead of
 * this method. If in doubt, assume that it's security relevant. In particular,
 * note that goog.html functions which return a goog.html type do not guarantee
 * the returned instance is of the right type. For example:
 *
 * <pre>
 * var fakeSafeHtml = new String('fake');
 * fakeSafeHtml.__proto__ = goog.html.SafeHtml.prototype;
 * var newSafeHtml = goog.html.SafeHtml.htmlEscape(fakeSafeHtml);
 * // newSafeHtml is just an alias for fakeSafeHtml, it's passed through by
 * // goog.html.SafeHtml.htmlEscape() as fakeSafeHtml
 * // instanceof goog.html.SafeHtml.
 * </pre>
 *
 * @see goog.html.SafeStyle#unwrap
 * @override
 */
goog.html.SafeStyle.prototype.getTypedStringValue = function() {
  'use strict';
  return this.privateDoNotAccessOrElseSafeStyleWrappedValue_;
};


/**
 * Returns a string-representation of this value.
 *
 * To obtain the actual string value wrapped in a SafeStyle, use
 * `goog.html.SafeStyle.unwrap`.
 *
 * @return {string}
 * @see goog.html.SafeStyle#unwrap
 * @override
 */
goog.html.SafeStyle.prototype.toString = function() {
  'use strict';
  return this.privateDoNotAccessOrElseSafeStyleWrappedValue_.toString();
};


/**
 * Performs a runtime check that the provided object is indeed a
 * SafeStyle object, and returns its value.
 *
 * @param {!goog.html.SafeStyle} safeStyle The object to extract from.
 * @return {string} The safeStyle object's contained string, unless
 *     the run-time type check fails. In that case, `unwrap` returns an
 *     innocuous string, or, if assertions are enabled, throws
 *     `goog.asserts.AssertionError`.
 */
goog.html.SafeStyle.unwrap = function(safeStyle) {
  'use strict';
  // Perform additional Run-time type-checking to ensure that
  // safeStyle is indeed an instance of the expected type.  This
  // provides some additional protection against security bugs due to
  // application code that disables type checks.
  // Specifically, the following checks are performed:
  // 1. The object is an instance of the expected type.
  // 2. The object is not an instance of a subclass.
  if (safeStyle instanceof goog.html.SafeStyle &&
      safeStyle.constructor === goog.html.SafeStyle) {
    return safeStyle.privateDoNotAccessOrElseSafeStyleWrappedValue_;
  } else {
    goog.asserts.fail(
        'expected object of type SafeStyle, got \'' + safeStyle +
        '\' of type ' + goog.typeOf(safeStyle));
    return 'type_error:SafeStyle';
  }
};


/**
 * Token used to ensure that object is created only from this file. No code
 * outside of this file can access this token.
 * @private {!Object}
 * @const
 */
goog.html.SafeStyle.CONSTRUCTOR_TOKEN_PRIVATE_ = {};


/**
 * Package-internal utility method to create SafeStyle instances.
 *
 * @param {string} style The string to initialize the SafeStyle object with.
 * @return {!goog.html.SafeStyle} The initialized SafeStyle object.
 * @package
 */
goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse = function(
    style) {
  'use strict';
  return new goog.html.SafeStyle(
      style, goog.html.SafeStyle.CONSTRUCTOR_TOKEN_PRIVATE_);
};


/**
 * A SafeStyle instance corresponding to the empty string.
 * @const {!goog.html.SafeStyle}
 */
goog.html.SafeStyle.EMPTY =
    goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse('');


/**
 * The innocuous string generated by goog.html.SafeStyle.create when passed
 * an unsafe value.
 * @const {string}
 */
goog.html.SafeStyle.INNOCUOUS_STRING = 'zClosurez';


/**
 * A single property value.
 * @typedef {string|!goog.string.Const|!goog.html.SafeUrl}
 */
goog.html.SafeStyle.PropertyValue;


/**
 * Mapping of property names to their values.
 * We don't support numbers even though some values might be numbers (e.g.
 * line-height or 0 for any length). The reason is that most numeric values need
 * units (e.g. '1px') and allowing numbers could cause users forgetting about
 * them.
 * @typedef {!Object<string, ?goog.html.SafeStyle.PropertyValue|
 *     ?Array<!goog.html.SafeStyle.PropertyValue>>}
 */
goog.html.SafeStyle.PropertyMap;


/**
 * Creates a new SafeStyle object from the properties specified in the map.
 * @param {!goog.html.SafeStyle.PropertyMap} map Mapping of property names to
 *     their values, for example {'margin': '1px'}. Names must consist of
 *     [-_a-zA-Z0-9]. Values might be strings consisting of
 *     [-,.'"%_!# a-zA-Z0-9[\]], where ", ', and [] must be properly balanced.
 *     We also allow simple functions like rgb() and url() which sanitizes its
 *     contents. Other values must be wrapped in goog.string.Const. URLs might
 *     be passed as goog.html.SafeUrl which will be wrapped into url(""). We
 *     also support array whose elements are joined with ' '. Null value causes
 *     skipping the property.
 * @return {!goog.html.SafeStyle}
 * @throws {!Error} If invalid name is provided.
 * @throws {!goog.asserts.AssertionError} If invalid value is provided. With
 *     disabled assertions, invalid value is replaced by
 *     goog.html.SafeStyle.INNOCUOUS_STRING.
 */
goog.html.SafeStyle.create = function(map) {
  'use strict';
  var style = '';
  for (var name in map) {
    // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty#Using_hasOwnProperty_as_a_property_name
    if (Object.prototype.hasOwnProperty.call(map, name)) {
      if (!/^[-_a-zA-Z0-9]+$/.test(name)) {
        throw new Error('Name allows only [-_a-zA-Z0-9], got: ' + name);
      }
      var value = map[name];
      if (value == null) {
        continue;
      }
      if (Array.isArray(value)) {
        value =
            goog.array.map(value, goog.html.SafeStyle.sanitizePropertyValue_)
                .join(' ');
      } else {
        value = goog.html.SafeStyle.sanitizePropertyValue_(value);
      }
      style += name + ':' + value + ';';
    }
  }
  if (!style) {
    return goog.html.SafeStyle.EMPTY;
  }
  return goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(
      style);
};


/**
 * Checks and converts value to string.
 * @param {!goog.html.SafeStyle.PropertyValue} value
 * @return {string}
 * @private
 */
goog.html.SafeStyle.sanitizePropertyValue_ = function(value) {
  'use strict';
  if (value instanceof goog.html.SafeUrl) {
    var url = goog.html.SafeUrl.unwrap(value);
    return 'url("' + url.replace(/</g, '%3c').replace(/[\\"]/g, '\\$&') + '")';
  }
  var result = value instanceof goog.string.Const ?
      goog.string.Const.unwrap(value) :
      goog.html.SafeStyle.sanitizePropertyValueString_(String(value));
  // These characters can be used to change context and we don't want that even
  // with const values.
  if (/[{;}]/.test(result)) {
    throw new goog.asserts.AssertionError(
        'Value does not allow [{;}], got: %s.', [result]);
  }
  return result;
};


/**
 * Checks string value.
 * @param {string} value
 * @return {string}
 * @private
 */
goog.html.SafeStyle.sanitizePropertyValueString_ = function(value) {
  'use strict';
  // Some CSS property values permit nested functions. We allow one level of
  // nesting, and all nested functions must also be in the FUNCTIONS_RE_ list.
  var valueWithoutFunctions =
      value.replace(goog.html.SafeStyle.FUNCTIONS_RE_, '$1')
          .replace(goog.html.SafeStyle.FUNCTIONS_RE_, '$1')
          .replace(goog.html.SafeStyle.URL_RE_, 'url');
  if (!goog.html.SafeStyle.VALUE_RE_.test(valueWithoutFunctions)) {
    goog.asserts.fail(
        'String value allows only ' + goog.html.SafeStyle.VALUE_ALLOWED_CHARS_ +
        ' and simple functions, got: ' + value);
    return goog.html.SafeStyle.INNOCUOUS_STRING;
  } else if (goog.html.SafeStyle.COMMENT_RE_.test(value)) {
    goog.asserts.fail('String value disallows comments, got: ' + value);
    return goog.html.SafeStyle.INNOCUOUS_STRING;
  } else if (!goog.html.SafeStyle.hasBalancedQuotes_(value)) {
    goog.asserts.fail('String value requires balanced quotes, got: ' + value);
    return goog.html.SafeStyle.INNOCUOUS_STRING;
  } else if (!goog.html.SafeStyle.hasBalancedSquareBrackets_(value)) {
    goog.asserts.fail(
        'String value requires balanced square brackets and one' +
        ' identifier per pair of brackets, got: ' + value);
    return goog.html.SafeStyle.INNOCUOUS_STRING;
  }
  return goog.html.SafeStyle.sanitizeUrl_(value);
};


/**
 * Checks that quotes (" and ') are properly balanced inside a string. Assumes
 * that neither escape (\) nor any other character that could result in
 * breaking out of a string parsing context are allowed;
 * see http://www.w3.org/TR/css3-syntax/#string-token-diagram.
 * @param {string} value Untrusted CSS property value.
 * @return {boolean} True if property value is safe with respect to quote
 *     balancedness.
 * @private
 */
goog.html.SafeStyle.hasBalancedQuotes_ = function(value) {
  'use strict';
  var outsideSingle = true;
  var outsideDouble = true;
  for (var i = 0; i < value.length; i++) {
    var c = value.charAt(i);
    if (c == '\'' && outsideDouble) {
      outsideSingle = !outsideSingle;
    } else if (c == '"' && outsideSingle) {
      outsideDouble = !outsideDouble;
    }
  }
  return outsideSingle && outsideDouble;
};


/**
 * Checks that square brackets ([ and ]) are properly balanced inside a string,
 * and that the content in the square brackets is one ident-token;
 * see https://www.w3.org/TR/css-syntax-3/#ident-token-diagram.
 * For practicality, and in line with other restrictions posed on SafeStyle
 * strings, we restrict the character set allowable in the ident-token to
 * [-_a-zA-Z0-9].
 * @param {string} value Untrusted CSS property value.
 * @return {boolean} True if property value is safe with respect to square
 *     bracket balancedness.
 * @private
 */
goog.html.SafeStyle.hasBalancedSquareBrackets_ = function(value) {
  'use strict';
  var outside = true;
  var tokenRe = /^[-_a-zA-Z0-9]$/;
  for (var i = 0; i < value.length; i++) {
    var c = value.charAt(i);
    if (c == ']') {
      if (outside) return false;  // Unbalanced ].
      outside = true;
    } else if (c == '[') {
      if (!outside) return false;  // No nesting.
      outside = false;
    } else if (!outside && !tokenRe.test(c)) {
      return false;
    }
  }
  return outside;
};


/**
 * Characters allowed in goog.html.SafeStyle.VALUE_RE_.
 * @private {string}
 */
goog.html.SafeStyle.VALUE_ALLOWED_CHARS_ = '[-,."\'%_!# a-zA-Z0-9\\[\\]]';


/**
 * Regular expression for safe values.
 *
 * Quotes (" and ') are allowed, but a check must be done elsewhere to ensure
 * they're balanced.
 *
 * Square brackets ([ and ]) are allowed, but a check must be done elsewhere
 * to ensure they're balanced. The content inside a pair of square brackets must
 * be one alphanumeric identifier.
 *
 * ',' allows multiple values to be assigned to the same property
 * (e.g. background-attachment or font-family) and hence could allow
 * multiple values to get injected, but that should pose no risk of XSS.
 *
 * The expression checks only for XSS safety, not for CSS validity.
 * @const {!RegExp}
 * @private
 */
goog.html.SafeStyle.VALUE_RE_ =
    new RegExp('^' + goog.html.SafeStyle.VALUE_ALLOWED_CHARS_ + '+$');


/**
 * Regular expression for url(). We support URLs allowed by
 * https://www.w3.org/TR/css-syntax-3/#url-token-diagram without using escape
 * sequences. Use percent-encoding if you need to use special characters like
 * backslash.
 * @private @const {!RegExp}
 */
goog.html.SafeStyle.URL_RE_ = new RegExp(
    '\\b(url\\([ \t\n]*)(' +
        '\'[ -&(-\\[\\]-~]*\'' +  // Printable characters except ' and \.
        '|"[ !#-\\[\\]-~]*"' +    // Printable characters except " and \.
        '|[!#-&*-\\[\\]-~]*' +    // Printable characters except [ "'()\\].
        ')([ \t\n]*\\))',
    'g');

/**
 * Names of functions allowed in FUNCTIONS_RE_.
 * @private @const {!Array<string>}
 */
goog.html.SafeStyle.ALLOWED_FUNCTIONS_ = [
  'calc',
  'cubic-bezier',
  'fit-content',
  'hsl',
  'hsla',
  'linear-gradient',
  'matrix',
  'minmax',
  'repeat',
  'rgb',
  'rgba',
  '(rotate|scale|translate)(X|Y|Z|3d)?',
];


/**
 * Regular expression for simple functions.
 * @private @const {!RegExp}
 */
goog.html.SafeStyle.FUNCTIONS_RE_ = new RegExp(
    '\\b(' + goog.html.SafeStyle.ALLOWED_FUNCTIONS_.join('|') + ')' +
        '\\([-+*/0-9a-z.%\\[\\], ]+\\)',
    'g');


/**
 * Regular expression for comments. These are disallowed in CSS property values.
 * @private @const {!RegExp}
 */
goog.html.SafeStyle.COMMENT_RE_ = /\/\*/;


/**
 * Sanitize URLs inside url().
 *
 * NOTE: We could also consider using CSS.escape once that's available in the
 * browsers. However, loosely matching URL e.g. with url\(.*\) and then escaping
 * the contents would result in a slightly different language than CSS leading
 * to confusion of users. E.g. url(")") is valid in CSS but it would be invalid
 * as seen by our parser. On the other hand, url(\) is invalid in CSS but our
 * parser would be fine with it.
 *
 * @param {string} value Untrusted CSS property value.
 * @return {string}
 * @private
 */
goog.html.SafeStyle.sanitizeUrl_ = function(value) {
  'use strict';
  return value.replace(
      goog.html.SafeStyle.URL_RE_, function(match, before, url, after) {
        'use strict';
        var quote = '';
        url = url.replace(/^(['"])(.*)\1$/, function(match, start, inside) {
          'use strict';
          quote = start;
          return inside;
        });
        var sanitized = goog.html.SafeUrl.sanitize(url).getTypedStringValue();
        return before + quote + sanitized + quote + after;
      });
};


/**
 * Creates a new SafeStyle object by concatenating the values.
 * @param {...(!goog.html.SafeStyle|!Array<!goog.html.SafeStyle>)} var_args
 *     SafeStyles to concatenate.
 * @return {!goog.html.SafeStyle}
 */
goog.html.SafeStyle.concat = function(var_args) {
  'use strict';
  var style = '';

  /**
   * @param {!goog.html.SafeStyle|!Array<!goog.html.SafeStyle>} argument
   */
  var addArgument = function(argument) {
    'use strict';
    if (Array.isArray(argument)) {
      goog.array.forEach(argument, addArgument);
    } else {
      style += goog.html.SafeStyle.unwrap(argument);
    }
  };

  goog.array.forEach(arguments, addArgument);
  if (!style) {
    return goog.html.SafeStyle.EMPTY;
  }
  return goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(
      style);
};

//third_party/javascript/closure/html/safestylesheet.js
goog.loadModule(function(exports) {'use strict';/**
 * @license
 * Copyright The Closure Library Authors.
 * SPDX-License-Identifier: Apache-2.0
 */

/**
 * @fileoverview The SafeStyleSheet type and its builders.
 *
 * TODO(xtof): Link to document stating type contract.
 */

goog.module('goog.html.SafeStyleSheet');
goog.module.declareLegacyNamespace();

const Const = goog.require('goog.string.Const');
const SafeStyle = goog.require('goog.html.SafeStyle');
const TypedString = goog.require('goog.string.TypedString');
const googArray = goog.require('goog.array');
const googObject = goog.require('goog.object');
const {assert, fail} = goog.require('goog.asserts');
const {contains} = goog.require('goog.string.internal');

/**
 * Token used to ensure that object is created only from this file. No code
 * outside of this file can access this token.
 * @const {!Object}
 */
const CONSTRUCTOR_TOKEN_PRIVATE = {};

/**
 * A string-like object which represents a CSS style sheet and that carries the
 * security type contract that its value, as a string, will not cause untrusted
 * script execution (XSS) when evaluated as CSS in a browser.
 *
 * Instances of this type must be created via the factory method
 * `SafeStyleSheet.fromConstant` and not by invoking its constructor. The
 * constructor intentionally takes an extra parameter that cannot be constructed
 * outside of this file and the type is immutable; hence only a default instance
 * corresponding to the empty string can be obtained via constructor invocation.
 *
 * A SafeStyleSheet's string representation can safely be interpolated as the
 * content of a style element within HTML. The SafeStyleSheet string should
 * not be escaped before interpolation.
 *
 * Values of this type must be composable, i.e. for any two values
 * `styleSheet1` and `styleSheet2` of this type,
 * `SafeStyleSheet.unwrap(styleSheet1) + SafeStyleSheet.unwrap(styleSheet2)`
 * must itself be a value that satisfies the SafeStyleSheet type constraint.
 * This requirement implies that for any value `styleSheet` of this type,
 * `SafeStyleSheet.unwrap(styleSheet1)` must end in
 * "beginning of rule" context.
 *
 * A SafeStyleSheet can be constructed via security-reviewed unchecked
 * conversions. In this case producers of SafeStyleSheet must ensure themselves
 * that the SafeStyleSheet does not contain unsafe script. Note in particular
 * that `&lt;` is dangerous, even when inside CSS strings, and so should
 * always be forbidden or CSS-escaped in user controlled input. For example, if
 * `&lt;/style&gt;&lt;script&gt;evil&lt;/script&gt;"` were interpolated
 * inside a CSS string, it would break out of the context of the original
 * style element and `evil` would execute. Also note that within an HTML
 * style (raw text) element, HTML character references, such as
 * `&amp;lt;`, are not allowed. See
 * http://www.w3.org/TR/html5/scripting-1.html#restrictions-for-contents-of-script-elements
 * (similar considerations apply to the style element).
 *
 * @see SafeStyleSheet#fromConstant
 * @final
 * @implements {TypedString}
 */
class SafeStyleSheet {
  /**
   * @param {string} value
   * @param {!Object} token package-internal implementation detail.
   */
  constructor(value, token) {
    /**
     * The contained value of this SafeStyleSheet.  The field has a purposely
     * ugly name to make (non-compiled) code that attempts to directly access
     * this field stand out.
     * @private {string}
     */
    this.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_ =
        (token === CONSTRUCTOR_TOKEN_PRIVATE) ? value : '';

    /**
     * @override
     * @const
     */
    this.implementsGoogStringTypedString = true;
  }

  /**
   * Creates a style sheet consisting of one selector and one style definition.
   * Use {@link SafeStyleSheet.concat} to create longer style sheets.
   * This function doesn't support @import, @media and similar constructs.
   * @param {string} selector CSS selector, e.g. '#id' or 'tag .class, #id'. We
   *     support CSS3 selectors: https://w3.org/TR/css3-selectors/#selectors.
   * @param {!SafeStyle.PropertyMap|!SafeStyle} style Style
   *     definition associated with the selector.
   * @return {!SafeStyleSheet}
   * @throws {!Error} If invalid selector is provided.
   */
  static createRule(selector, style) {
    if (contains(selector, '<')) {
      throw new Error(`Selector does not allow '<', got: ${selector}`);
    }

    // Remove strings.
    const selectorToCheck =
        selector.replace(/('|")((?!\1)[^\r\n\f\\]|\\[\s\S])*\1/g, '');

    // Check characters allowed in CSS3 selectors.
    if (!/^[-_a-zA-Z0-9#.:* ,>+~[\]()=^$|]+$/.test(selectorToCheck)) {
      throw new Error(
          'Selector allows only [-_a-zA-Z0-9#.:* ,>+~[\\]()=^$|] and ' +
          'strings, got: ' + selector);
    }

    // Check balanced () and [].
    if (!SafeStyleSheet.hasBalancedBrackets_(selectorToCheck)) {
      throw new Error(
          '() and [] in selector must be balanced, got: ' + selector);
    }

    if (!(style instanceof SafeStyle)) {
      style = SafeStyle.create(style);
    }
    const styleSheet =
        `${selector}{` + SafeStyle.unwrap(style).replace(/</g, '\\3C ') + '}';
    return SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(
        styleSheet);
  }

  /**
   * Checks if a string has balanced () and [] brackets.
   * @param {string} s String to check.
   * @return {boolean}
   * @private
   */
  static hasBalancedBrackets_(s) {
    const brackets = {'(': ')', '[': ']'};
    const expectedBrackets = [];
    for (let i = 0; i < s.length; i++) {
      const ch = s[i];
      if (brackets[ch]) {
        expectedBrackets.push(brackets[ch]);
      } else if (googObject.contains(brackets, ch)) {
        if (expectedBrackets.pop() != ch) {
          return false;
        }
      }
    }
    return expectedBrackets.length == 0;
  }

  /**
   * Creates a new SafeStyleSheet object by concatenating values.
   * @param {...(!SafeStyleSheet|!Array<!SafeStyleSheet>)}
   *     var_args Values to concatenate.
   * @return {!SafeStyleSheet}
   */
  static concat(var_args) {
    let result = '';

    /**
     * @param {!SafeStyleSheet|!Array<!SafeStyleSheet>}
     *     argument
     */
    const addArgument = argument => {
      if (Array.isArray(argument)) {
        googArray.forEach(argument, addArgument);
      } else {
        result += SafeStyleSheet.unwrap(argument);
      }
    };

    googArray.forEach(arguments, addArgument);
    return SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(
        result);
  }

  /**
   * Creates a SafeStyleSheet object from a compile-time constant string.
   *
   * `styleSheet` must not have any &lt; characters in it, so that
   * the syntactic structure of the surrounding HTML is not affected.
   *
   * @param {!Const} styleSheet A compile-time-constant string from
   *     which to create a SafeStyleSheet.
   * @return {!SafeStyleSheet} A SafeStyleSheet object initialized to
   *     `styleSheet`.
   */
  static fromConstant(styleSheet) {
    const styleSheetString = Const.unwrap(styleSheet);
    if (styleSheetString.length === 0) {
      return SafeStyleSheet.EMPTY;
    }
    // > is a valid character in CSS selectors and there's no strict need to
    // block it if we already block <.
    assert(
        !contains(styleSheetString, '<'),
        `Forbidden '<' character in style sheet string: ${styleSheetString}`);
    return SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(
        styleSheetString);
  }

  /**
   * Returns this SafeStyleSheet's value as a string.
   *
   * IMPORTANT: In code where it is security relevant that an object's type is
   * indeed `SafeStyleSheet`, use `SafeStyleSheet.unwrap`
   * instead of this method. If in doubt, assume that it's security relevant. In
   * particular, note that goog.html functions which return a goog.html type do
   * not guarantee the returned instance is of the right type. For example:
   *
   * <pre>
   * var fakeSafeHtml = new String('fake');
   * fakeSafeHtml.__proto__ = goog.html.SafeHtml.prototype;
   * var newSafeHtml = goog.html.SafeHtml.htmlEscape(fakeSafeHtml);
   * // newSafeHtml is just an alias for fakeSafeHtml, it's passed through by
   * // goog.html.SafeHtml.htmlEscape() as fakeSafeHtml
   * // instanceof goog.html.SafeHtml.
   * </pre>
   *
   * @see SafeStyleSheet#unwrap
   * @override
   */
  getTypedStringValue() {
    return this.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_;
  }

  /**
   * Performs a runtime check that the provided object is indeed a
   * SafeStyleSheet object, and returns its value.
   *
   * @param {!SafeStyleSheet} safeStyleSheet The object to extract from.
   * @return {string} The safeStyleSheet object's contained string, unless
   *     the run-time type check fails. In that case, `unwrap` returns an
   *     innocuous string, or, if assertions are enabled, throws
   *     `asserts.AssertionError`.
   */
  static unwrap(safeStyleSheet) {
    // Perform additional Run-time type-checking to ensure that
    // safeStyleSheet is indeed an instance of the expected type.  This
    // provides some additional protection against security bugs due to
    // application code that disables type checks.
    // Specifically, the following checks are performed:
    // 1. The object is an instance of the expected type.
    // 2. The object is not an instance of a subclass.
    if (safeStyleSheet instanceof SafeStyleSheet &&
        safeStyleSheet.constructor === SafeStyleSheet) {
      return safeStyleSheet.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_;
    } else {
      fail(
          'expected object of type SafeStyleSheet, got \'' + safeStyleSheet +
          '\' of type ' + goog.typeOf(safeStyleSheet));
      return 'type_error:SafeStyleSheet';
    }
  }

  /**
   * Package-internal utility method to create SafeStyleSheet instances.
   *
   * @param {string} styleSheet The string to initialize the SafeStyleSheet
   *     object with.
   * @return {!SafeStyleSheet} The initialized SafeStyleSheet object.
   * @package
   */
  static createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(styleSheet) {
    return new SafeStyleSheet(styleSheet, CONSTRUCTOR_TOKEN_PRIVATE);
  }
}

/**
 * Returns a string-representation of this value.
 *
 * To obtain the actual string value wrapped in a SafeStyleSheet, use
 * `SafeStyleSheet.unwrap`.
 *
 * @return {string}
 * @see SafeStyleSheet#unwrap
 * @override
 */
SafeStyleSheet.prototype.toString = function() {
  return this.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_.toString();
};


/**
 * A SafeStyleSheet instance corresponding to the empty string.
 * @const {!SafeStyleSheet}
 */
SafeStyleSheet.EMPTY =
    SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse('');


exports = SafeStyleSheet;

;return exports;});

//third_party/javascript/closure/labs/useragent/util.js
/**
 * @license
 * Copyright The Closure Library Authors.
 * SPDX-License-Identifier: Apache-2.0
 */

/**
 * @fileoverview Utilities used by goog.labs.userAgent tools. These functions
 * should not be used outside of goog.labs.userAgent.*.
 *
 */

goog.provide('goog.labs.userAgent.util');

goog.require('goog.string.internal');


/**
 * Gets the native userAgent string from navigator if it exists.
 * If navigator or navigator.userAgent string is missing, returns an empty
 * string.
 * @return {string}
 * @private
 */
goog.labs.userAgent.util.getNativeUserAgentString_ = function() {
  'use strict';
  var navigator = goog.labs.userAgent.util.getNavigator_();
  if (navigator) {
    var userAgent = navigator.userAgent;
    if (userAgent) {
      return userAgent;
    }
  }
  return '';
};


/**
 * Getter for the native navigator.
 * This is a separate function so it can be stubbed out in testing.
 * @return {!Navigator}
 * @private
 */
goog.labs.userAgent.util.getNavigator_ = function() {
  'use strict';
  return goog.global.navigator;
};


/**
 * A possible override for applications which wish to not check
 * navigator.userAgent but use a specified value for detection instead.
 * @private {string}
 */
goog.labs.userAgent.util.userAgent_ =
    goog.labs.userAgent.util.getNativeUserAgentString_();


/**
 * Applications may override browser detection on the built in
 * navigator.userAgent object by setting this string. Set to null to use the
 * browser object instead.
 * @param {?string=} opt_userAgent The User-Agent override.
 */
goog.labs.userAgent.util.setUserAgent = function(opt_userAgent) {
  'use strict';
  goog.labs.userAgent.util.userAgent_ =
      opt_userAgent || goog.labs.userAgent.util.getNativeUserAgentString_();
};


/**
 * @return {string} The user agent string.
 */
goog.labs.userAgent.util.getUserAgent = function() {
  'use strict';
  return goog.labs.userAgent.util.userAgent_;
};


/**
 * @param {string} str
 * @return {boolean} Whether the user agent contains the given string.
 */
goog.labs.userAgent.util.matchUserAgent = function(str) {
  'use strict';
  var userAgent = goog.labs.userAgent.util.getUserAgent();
  return goog.string.internal.contains(userAgent, str);
};


/**
 * @param {string} str
 * @return {boolean} Whether the user agent contains the given string, ignoring
 *     case.
 */
goog.labs.userAgent.util.matchUserAgentIgnoreCase = function(str) {
  'use strict';
  var userAgent = goog.labs.userAgent.util.getUserAgent();
  return goog.string.internal.caseInsensitiveContains(userAgent, str);
};


/**
 * Parses the user agent into tuples for each section.
 * @param {string} userAgent
 * @return {!Array<!Array<string>>} Tuples of key, version, and the contents
 *     of the parenthetical.
 */
goog.labs.userAgent.util.extractVersionTuples = function(userAgent) {
  'use strict';
  // Matches each section of a user agent string.
  // Example UA:
  // Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us)
  // AppleWebKit/531.21.10 (KHTML, like Gecko) Mobile/7B405
  // This has three version tuples: Mozilla, AppleWebKit, and Mobile.

  var versionRegExp = new RegExp(
      // Key. Note that a key may have a space.
      // (i.e. 'Mobile Safari' in 'Mobile Safari/5.0')
      '(\\w[\\w ]+)' +

          '/' +                // slash
          '([^\\s]+)' +        // version (i.e. '5.0b')
          '\\s*' +             // whitespace
          '(?:\\((.*?)\\))?',  // parenthetical info. parentheses not matched.
      'g');

  var data = [];
  var match;

  // Iterate and collect the version tuples.  Each iteration will be the
  // next regex match.
  while (match = versionRegExp.exec(userAgent)) {
    data.push([
      match[1],  // key
      match[2],  // value
      // || undefined as this is not undefined in IE7 and IE8
      match[3] || undefined  // info
    ]);
  }

  return data;
};

//third_party/javascript/closure/labs/useragent/browser.js
/**
 * @license
 * Copyright The Closure Library Authors.
 * SPDX-License-Identifier: Apache-2.0
 */

/**
 * @fileoverview Closure user agent detection (Browser).
 * @see <a href="http://www.useragentstring.com/">User agent strings</a>
 * For more information on rendering engine, platform, or device see the other
 * sub-namespaces in goog.labs.userAgent, goog.labs.userAgent.platform,
 * goog.labs.userAgent.device respectively.)
 */

goog.provide('goog.labs.userAgent.browser');

goog.require('goog.array');
goog.require('goog.labs.userAgent.util');
goog.require('goog.object');
goog.require('goog.string.internal');


// TODO(nnaze): Refactor to remove excessive exclusion logic in matching
// functions.


/**
 * @return {boolean} Whether the user's browser is Opera.  Note: Chromium
 *     based Opera (Opera 15+) is detected as Chrome to avoid unnecessary
 *     special casing.
 * @private
 */
goog.labs.userAgent.browser.matchOpera_ = function() {
  'use strict';
  return goog.labs.userAgent.util.matchUserAgent('Opera');
};


/**
 * @return {boolean} Whether the user's browser is IE.
 * @private
 */
goog.labs.userAgent.browser.matchIE_ = function() {
  'use strict';
  return goog.labs.userAgent.util.matchUserAgent('Trident') ||
      goog.labs.userAgent.util.matchUserAgent('MSIE');
};


/**
 * @return {boolean} Whether the user's browser is Edge. This refers to EdgeHTML
 * based Edge.
 * @private
 */
goog.labs.userAgent.browser.matchEdgeHtml_ = function() {
  'use strict';
  return goog.labs.userAgent.util.matchUserAgent('Edge');
};


/**
 * @return {boolean} Whether the user's browser is Chromium based Edge.
 * @private
 */
goog.labs.userAgent.browser.matchEdgeChromium_ = function() {
  'use strict';
  return goog.labs.userAgent.util.matchUserAgent('Edg/');
};


/**
 * @return {boolean} Whether the user's browser is Chromium based Opera.
 * @private
 */
goog.labs.userAgent.browser.matchOperaChromium_ = function() {
  'use strict';
  return goog.labs.userAgent.util.matchUserAgent('OPR');
};


/**
 * @return {boolean} Whether the user's browser is Firefox.
 * @private
 */
goog.labs.userAgent.browser.matchFirefox_ = function() {
  'use strict';
  return goog.labs.userAgent.util.matchUserAgent('Firefox') ||
      goog.labs.userAgent.util.matchUserAgent('FxiOS');
};


/**
 * @return {boolean} Whether the user's browser is Safari.
 * @private
 */
goog.labs.userAgent.browser.matchSafari_ = function() {
  'use strict';
  return goog.labs.userAgent.util.matchUserAgent('Safari') &&
      !(goog.labs.userAgent.browser.matchChrome_() ||
        goog.labs.userAgent.browser.matchCoast_() ||
        goog.labs.userAgent.browser.matchOpera_() ||
        goog.labs.userAgent.browser.matchEdgeHtml_() ||
        goog.labs.userAgent.browser.matchEdgeChromium_() ||
        goog.labs.userAgent.browser.matchOperaChromium_() ||
        goog.labs.userAgent.browser.matchFirefox_() ||
        goog.labs.userAgent.browser.isSilk() ||
        goog.labs.userAgent.util.matchUserAgent('Android'));
};


/**
 * @return {boolean} Whether the user's browser is Coast (Opera's Webkit-based
 *     iOS browser).
 * @private
 */
goog.labs.userAgent.browser.matchCoast_ = function() {
  'use strict';
  return goog.labs.userAgent.util.matchUserAgent('Coast');
};


/**
 * @return {boolean} Whether the user's browser is iOS Webview.
 * @private
 */
goog.labs.userAgent.browser.matchIosWebview_ = function() {
  'use strict';
  // iOS Webview does not show up as Chrome or Safari. Also check for Opera's
  // WebKit-based iOS browser, Coast.
  return (goog.labs.userAgent.util.matchUserAgent('iPad') ||
          goog.labs.userAgent.util.matchUserAgent('iPhone')) &&
      !goog.labs.userAgent.browser.matchSafari_() &&
      !goog.labs.userAgent.browser.matchChrome_() &&
      !goog.labs.userAgent.browser.matchCoast_() &&
      !goog.labs.userAgent.browser.matchFirefox_() &&
      goog.labs.userAgent.util.matchUserAgent('AppleWebKit');
};


/**
 * @return {boolean} Whether the user's browser is any Chromium browser. This
 * returns true for Chrome, Opera 15+, and Edge Chromium.
 * @private
 */
goog.labs.userAgent.browser.matchChrome_ = function() {
  'use strict';
  return (goog.labs.userAgent.util.matchUserAgent('Chrome') ||
          goog.labs.userAgent.util.matchUserAgent('CriOS')) &&
      !goog.labs.userAgent.browser.matchEdgeHtml_();
};


/**
 * @return {boolean} Whether the user's browser is the Android browser.
 * @private
 */
goog.labs.userAgent.browser.matchAndroidBrowser_ = function() {
  'use strict';
  // Android can appear in the user agent string for Chrome on Android.
  // This is not the Android standalone browser if it does.
  return goog.labs.userAgent.util.matchUserAgent('Android') &&
      !(goog.labs.userAgent.browser.isChrome() ||
        goog.labs.userAgent.browser.isFirefox() ||
        goog.labs.userAgent.browser.isOpera() ||
        goog.labs.userAgent.browser.isSilk());
};


/**
 * @return {boolean} Whether the user's browser is Opera.
 */
goog.labs.userAgent.browser.isOpera = goog.labs.userAgent.browser.matchOpera_;


/**
 * @return {boolean} Whether the user's browser is IE.
 */
goog.labs.userAgent.browser.isIE = goog.labs.userAgent.browser.matchIE_;


/**
 * @return {boolean} Whether the user's browser is EdgeHTML based Edge.
 */
goog.labs.userAgent.browser.isEdge = goog.labs.userAgent.browser.matchEdgeHtml_;


/**
 * @return {boolean} Whether the user's browser is Chromium based Edge.
 */
goog.labs.userAgent.browser.isEdgeChromium =
    goog.labs.userAgent.browser.matchEdgeChromium_;

/**
 * @return {boolean} Whether the user's browser is Chromium based Opera.
 */
goog.labs.userAgent.browser.isOperaChromium =
    goog.labs.userAgent.browser.matchOperaChromium_;

/**
 * @return {boolean} Whether the user's browser is Firefox.
 */
goog.labs.userAgent.browser.isFirefox =
    goog.labs.userAgent.browser.matchFirefox_;


/**
 * @return {boolean} Whether the user's browser is Safari.
 */
goog.labs.userAgent.browser.isSafari = goog.labs.userAgent.browser.matchSafari_;


/**
 * @return {boolean} Whether the user's browser is Coast (Opera's Webkit-based
 *     iOS browser).
 */
goog.labs.userAgent.browser.isCoast = goog.labs.userAgent.browser.matchCoast_;


/**
 * @return {boolean} Whether the user's browser is iOS Webview.
 */
goog.labs.userAgent.browser.isIosWebview =
    goog.labs.userAgent.browser.matchIosWebview_;


/**
 * @return {boolean} Whether the user's browser is any Chromium based browser (
 * Chrome, Blink-based Opera (15+) and Edge Chromium).
 */
goog.labs.userAgent.browser.isChrome = goog.labs.userAgent.browser.matchChrome_;


/**
 * @return {boolean} Whether the user's browser is the Android browser.
 */
goog.labs.userAgent.browser.isAndroidBrowser =
    goog.labs.userAgent.browser.matchAndroidBrowser_;


/**
 * For more information, see:
 * http://docs.aws.amazon.com/silk/latest/developerguide/user-agent.html
 * @return {boolean} Whether the user's browser is Silk.
 */
goog.labs.userAgent.browser.isSilk = function() {
  'use strict';
  return goog.labs.userAgent.util.matchUserAgent('Silk');
};


/**
 * @return {string} The browser version or empty string if version cannot be
 *     determined. Note that for Internet Explorer, this returns the version of
 *     the browser, not the version of the rendering engine. (IE 8 in
 *     compatibility mode will return 8.0 rather than 7.0. To determine the
 *     rendering engine version, look at document.documentMode instead. See
 *     http://msdn.microsoft.com/en-us/library/cc196988(v=vs.85).aspx for more
 *     details.)
 */
goog.labs.userAgent.browser.getVersion = function() {
  'use strict';
  var userAgentString = goog.labs.userAgent.util.getUserAgent();
  // Special case IE since IE's version is inside the parenthesis and
  // without the '/'.
  if (goog.labs.userAgent.browser.isIE()) {
    return goog.labs.userAgent.browser.getIEVersion_(userAgentString);
  }

  var versionTuples =
      goog.labs.userAgent.util.extractVersionTuples(userAgentString);

  // Construct a map for easy lookup.
  var versionMap = {};
  goog.array.forEach(versionTuples, function(tuple) {
    'use strict';
    // Note that the tuple is of length three, but we only care about the
    // first two.
    var key = tuple[0];
    var value = tuple[1];
    versionMap[key] = value;
  });

  var versionMapHasKey = goog.partial(goog.object.containsKey, versionMap);

  // Gives the value with the first key it finds, otherwise empty string.
  function lookUpValueWithKeys(keys) {
    var key = goog.array.find(keys, versionMapHasKey);
    return versionMap[key] || '';
  }

  // Check Opera before Chrome since Opera 15+ has "Chrome" in the string.
  // See
  // http://my.opera.com/ODIN/blog/2013/07/15/opera-user-agent-strings-opera-15-and-beyond
  if (goog.labs.userAgent.browser.isOpera()) {
    // Opera 10 has Version/10.0 but Opera/9.8, so look for "Version" first.
    // Opera uses 'OPR' for more recent UAs.
    return lookUpValueWithKeys(['Version', 'Opera']);
  }

  // Check Edge before Chrome since it has Chrome in the string.
  if (goog.labs.userAgent.browser.isEdge()) {
    return lookUpValueWithKeys(['Edge']);
  }

  // Check Chromium Edge before Chrome since it has Chrome in the string.
  if (goog.labs.userAgent.browser.isEdgeChromium()) {
    return lookUpValueWithKeys(['Edg']);
  }

  if (goog.labs.userAgent.browser.isChrome()) {
    return lookUpValueWithKeys(['Chrome', 'CriOS', 'HeadlessChrome']);
  }

  // Usually products browser versions are in the third tuple after "Mozilla"
  // and the engine.
  var tuple = versionTuples[2];
  return tuple && tuple[1] || '';
};


/**
 * @param {string|number} version The version to check.
 * @return {boolean} Whether the browser version is higher or the same as the
 *     given version.
 */
goog.labs.userAgent.browser.isVersionOrHigher = function(version) {
  'use strict';
  return goog.string.internal.compareVersions(
             goog.labs.userAgent.browser.getVersion(), version) >= 0;
};


/**
 * Determines IE version. More information:
 * http://msdn.microsoft.com/en-us/library/ie/bg182625(v=vs.85).aspx#uaString
 * http://msdn.microsoft.com/en-us/library/hh869301(v=vs.85).aspx
 * http://blogs.msdn.com/b/ie/archive/2010/03/23/introducing-ie9-s-user-agent-string.aspx
 * http://blogs.msdn.com/b/ie/archive/2009/01/09/the-internet-explorer-8-user-agent-string-updated-edition.aspx
 *
 * @param {string} userAgent the User-Agent.
 * @return {string}
 * @private
 */
goog.labs.userAgent.browser.getIEVersion_ = function(userAgent) {
  'use strict';
  // IE11 may identify itself as MSIE 9.0 or MSIE 10.0 due to an IE 11 upgrade
  // bug. Example UA:
  // Mozilla/5.0 (MSIE 9.0; Windows NT 6.1; WOW64; Trident/7.0; rv:11.0)
  // like Gecko.
  // See http://www.whatismybrowser.com/developers/unknown-user-agent-fragments.
  var rv = /rv: *([\d\.]*)/.exec(userAgent);
  if (rv && rv[1]) {
    return rv[1];
  }

  var version = '';
  var msie = /MSIE +([\d\.]+)/.exec(userAgent);
  if (msie && msie[1]) {
    // IE in compatibility mode usually identifies itself as MSIE 7.0; in this
    // case, use the Trident version to determine the version of IE. For more
    // details, see the links above.
    var tridentVersion = /Trident\/(\d.\d)/.exec(userAgent);
    if (msie[1] == '7.0') {
      if (tridentVersion && tridentVersion[1]) {
        switch (tridentVersion[1]) {
          case '4.0':
            version = '8.0';
            break;
          case '5.0':
            version = '9.0';
            break;
          case '6.0':
            version = '10.0';
            break;
          case '7.0':
            version = '11.0';
            break;
        }
      } else {
        version = '7.0';
      }
    } else {
      version = msie[1];
    }
  }
  return version;
};

//third_party/javascript/closure/html/safehtml.js
/**
 * @license
 * Copyright The Closure Library Authors.
 * SPDX-License-Identifier: Apache-2.0
 */


/**
 * @fileoverview The SafeHtml type and its builders.
 *
 * TODO(xtof): Link to document stating type contract.
 */

goog.provide('goog.html.SafeHtml');

goog.require('goog.array');
goog.require('goog.asserts');
goog.require('goog.dom.TagName');
goog.require('goog.dom.tags');
goog.require('goog.html.SafeScript');
goog.require('goog.html.SafeStyle');
goog.require('goog.html.SafeStyleSheet');
goog.require('goog.html.SafeUrl');
goog.require('goog.html.TrustedResourceUrl');
goog.require('goog.html.trustedtypes');
goog.require('goog.i18n.bidi.Dir');
goog.require('goog.i18n.bidi.DirectionalString');
goog.require('goog.labs.userAgent.browser');
goog.require('goog.object');
goog.require('goog.string.Const');
goog.require('goog.string.TypedString');
goog.require('goog.string.internal');



/**
 * A string that is safe to use in HTML context in DOM APIs and HTML documents.
 *
 * A SafeHtml is a string-like object that carries the security type contract
 * that its value as a string will not cause untrusted script execution when
 * evaluated as HTML in a browser.
 *
 * Values of this type are guaranteed to be safe to use in HTML contexts,
 * such as, assignment to the innerHTML DOM property, or interpolation into
 * a HTML template in HTML PC_DATA context, in the sense that the use will not
 * result in a Cross-Site-Scripting vulnerability.
 *
 * Instances of this type must be created via the factory methods
 * (`goog.html.SafeHtml.create`, `goog.html.SafeHtml.htmlEscape`),
 * etc and not by invoking its constructor. The constructor intentionally takes
 * an extra parameter that cannot be constructed outside of this file and the
 * type is immutable; hence only a default instance corresponding to the empty
 * string can be obtained via constructor invocation.
 *
 * Creating SafeHtml objects HAS SIDE-EFFECTS due to calling Trusted Types Web
 * API.
 *
 * Note that there is no `goog.html.SafeHtml.fromConstant`. The reason is that
 * the following code would create an unsafe HTML:
 *
 * ```
 * goog.html.SafeHtml.concat(
 *     goog.html.SafeHtml.fromConstant(goog.string.Const.from('<script>')),
 *     goog.html.SafeHtml.htmlEscape(userInput),
 *     goog.html.SafeHtml.fromConstant(goog.string.Const.from('<\/script>')));
 * ```
 *
 * There's `goog.dom.constHtmlToNode` to create a node from constant strings
 * only.
 *
 * @see goog.html.SafeHtml.create
 * @see goog.html.SafeHtml.htmlEscape
 * @final
 * @struct
 * @implements {goog.i18n.bidi.DirectionalString}
 * @implements {goog.string.TypedString}
 */
goog.html.SafeHtml = class {
  /**
   * @param {!TrustedHTML|string} value
   * @param {?goog.i18n.bidi.Dir} dir
   * @param {!Object} token package-internal implementation detail.
   */
  constructor(value, dir, token) {
    /**
     * The contained value of this SafeHtml.  The field has a purposely ugly
     * name to make (non-compiled) code that attempts to directly access this
     * field stand out.
     * @private {!TrustedHTML|string}
     */
    this.privateDoNotAccessOrElseSafeHtmlWrappedValue_ =
        (token === goog.html.SafeHtml.CONSTRUCTOR_TOKEN_PRIVATE_) ? value : '';

    /**
     * This SafeHtml's directionality, or null if unknown.
     * @private {?goog.i18n.bidi.Dir}
     */
    this.dir_ = dir;
  }
};


/**
 * @define {boolean} Whether to strip out error messages or to leave them in.
 */
goog.html.SafeHtml.ENABLE_ERROR_MESSAGES =
    goog.define('goog.html.SafeHtml.ENABLE_ERROR_MESSAGES', goog.DEBUG);


/**
 * Whether the `style` attribute is supported. Set to false to avoid the byte
 * weight of `goog.html.SafeStyle` where unneeded. An error will be thrown if
 * the `style` attribute is used.
 * @define {boolean}
 */
goog.html.SafeHtml.SUPPORT_STYLE_ATTRIBUTE =
    goog.define('goog.html.SafeHtml.SUPPORT_STYLE_ATTRIBUTE', true);


/**
 * @override
 * @const
 */
goog.html.SafeHtml.prototype.implementsGoogI18nBidiDirectionalString = true;


/** @override */
goog.html.SafeHtml.prototype.getDirection = function() {
  'use strict';
  return this.dir_;
};


/**
 * @override
 * @const
 */
goog.html.SafeHtml.prototype.implementsGoogStringTypedString = true;


/**
 * Returns this SafeHtml's value as string.
 *
 * IMPORTANT: In code where it is security relevant that an object's type is
 * indeed `SafeHtml`, use `goog.html.SafeHtml.unwrap` instead of
 * this method. If in doubt, assume that it's security relevant. In particular,
 * note that goog.html functions which return a goog.html type do not guarantee
 * that the returned instance is of the right type. For example:
 *
 * <pre>
 * var fakeSafeHtml = new String('fake');
 * fakeSafeHtml.__proto__ = goog.html.SafeHtml.prototype;
 * var newSafeHtml = goog.html.SafeHtml.htmlEscape(fakeSafeHtml);
 * // newSafeHtml is just an alias for fakeSafeHtml, it's passed through by
 * // goog.html.SafeHtml.htmlEscape() as fakeSafeHtml
 * // instanceof goog.html.SafeHtml.
 * </pre>
 *
 * @see goog.html.SafeHtml.unwrap
 * @override
 */
goog.html.SafeHtml.prototype.getTypedStringValue = function() {
  'use strict';
  return this.privateDoNotAccessOrElseSafeHtmlWrappedValue_.toString();
};


/**
 * Returns a string-representation of this value.
 *
 * To obtain the actual string value wrapped in a SafeHtml, use
 * `goog.html.SafeHtml.unwrap`.
 *
 * @return {string}
 * @see goog.html.SafeHtml.unwrap
 * @override
 */
goog.html.SafeHtml.prototype.toString = function() {
  'use strict';
  return this.privateDoNotAccessOrElseSafeHtmlWrappedValue_.toString();
};


/**
 * Performs a runtime check that the provided object is indeed a SafeHtml
 * object, and returns its value.
 * @param {!goog.html.SafeHtml} safeHtml The object to extract from.
 * @return {string} The SafeHtml object's contained string, unless the run-time
 *     type check fails. In that case, `unwrap` returns an innocuous
 *     string, or, if assertions are enabled, throws
 *     `goog.asserts.AssertionError`.
 */
goog.html.SafeHtml.unwrap = function(safeHtml) {
  'use strict';
  return goog.html.SafeHtml.unwrapTrustedHTML(safeHtml).toString();
};


/**
 * Unwraps value as TrustedHTML if supported or as a string if not.
 * @param {!goog.html.SafeHtml} safeHtml
 * @return {!TrustedHTML|string}
 * @see goog.html.SafeHtml.unwrap
 */
goog.html.SafeHtml.unwrapTrustedHTML = function(safeHtml) {
  'use strict';
  // Perform additional run-time type-checking to ensure that safeHtml is indeed
  // an instance of the expected type.  This provides some additional protection
  // against security bugs due to application code that disables type checks.
  // Specifically, the following checks are performed:
  // 1. The object is an instance of the expected type.
  // 2. The object is not an instance of a subclass.
  if (safeHtml instanceof goog.html.SafeHtml &&
      safeHtml.constructor === goog.html.SafeHtml) {
    return safeHtml.privateDoNotAccessOrElseSafeHtmlWrappedValue_;
  } else {
    goog.asserts.fail(
        'expected object of type SafeHtml, got \'' + safeHtml + '\' of type ' +
        goog.typeOf(safeHtml));
    return 'type_error:SafeHtml';
  }
};


/**
 * Shorthand for union of types that can sensibly be converted to strings
 * or might already be SafeHtml (as SafeHtml is a goog.string.TypedString).
 * @private
 * @typedef {string|number|boolean|!goog.string.TypedString|
 *           !goog.i18n.bidi.DirectionalString}
 */
goog.html.SafeHtml.TextOrHtml_;


/**
 * Returns HTML-escaped text as a SafeHtml object.
 *
 * If text is of a type that implements
 * `goog.i18n.bidi.DirectionalString`, the directionality of the new
 * `SafeHtml` object is set to `text`'s directionality, if known.
 * Otherwise, the directionality of the resulting SafeHtml is unknown (i.e.,
 * `null`).
 *
 * @param {!goog.html.SafeHtml.TextOrHtml_} textOrHtml The text to escape. If
 *     the parameter is of type SafeHtml it is returned directly (no escaping
 *     is done).
 * @return {!goog.html.SafeHtml} The escaped text, wrapped as a SafeHtml.
 */
goog.html.SafeHtml.htmlEscape = function(textOrHtml) {
  'use strict';
  if (textOrHtml instanceof goog.html.SafeHtml) {
    return textOrHtml;
  }
  var textIsObject = typeof textOrHtml == 'object';
  var dir = null;
  if (textIsObject && textOrHtml.implementsGoogI18nBidiDirectionalString) {
    dir = /** @type {!goog.i18n.bidi.DirectionalString} */ (textOrHtml)
              .getDirection();
  }
  var textAsString;
  if (textIsObject && textOrHtml.implementsGoogStringTypedString) {
    textAsString = /** @type {!goog.string.TypedString} */ (textOrHtml)
                       .getTypedStringValue();
  } else {
    textAsString = String(textOrHtml);
  }
  return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(
      goog.string.internal.htmlEscape(textAsString), dir);
};


/**
 * Returns HTML-escaped text as a SafeHtml object, with newlines changed to
 * &lt;br&gt;.
 * @param {!goog.html.SafeHtml.TextOrHtml_} textOrHtml The text to escape. If
 *     the parameter is of type SafeHtml it is returned directly (no escaping
 *     is done).
 * @return {!goog.html.SafeHtml} The escaped text, wrapped as a SafeHtml.
 */
goog.html.SafeHtml.htmlEscapePreservingNewlines = function(textOrHtml) {
  'use strict';
  if (textOrHtml instanceof goog.html.SafeHtml) {
    return textOrHtml;
  }
  var html = goog.html.SafeHtml.htmlEscape(textOrHtml);
  return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(
      goog.string.internal.newLineToBr(goog.html.SafeHtml.unwrap(html)),
      html.getDirection());
};


/**
 * Returns HTML-escaped text as a SafeHtml object, with newlines changed to
 * &lt;br&gt; and escaping whitespace to preserve spatial formatting. Character
 * entity #160 is used to make it safer for XML.
 * @param {!goog.html.SafeHtml.TextOrHtml_} textOrHtml The text to escape. If
 *     the parameter is of type SafeHtml it is returned directly (no escaping
 *     is done).
 * @return {!goog.html.SafeHtml} The escaped text, wrapped as a SafeHtml.
 */
goog.html.SafeHtml.htmlEscapePreservingNewlinesAndSpaces = function(
    textOrHtml) {
  'use strict';
  if (textOrHtml instanceof goog.html.SafeHtml) {
    return textOrHtml;
  }
  var html = goog.html.SafeHtml.htmlEscape(textOrHtml);
  return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(
      goog.string.internal.whitespaceEscape(goog.html.SafeHtml.unwrap(html)),
      html.getDirection());
};


/**
 * Coerces an arbitrary object into a SafeHtml object.
 *
 * If `textOrHtml` is already of type `goog.html.SafeHtml`, the same
 * object is returned. Otherwise, `textOrHtml` is coerced to string, and
 * HTML-escaped. If `textOrHtml` is of a type that implements
 * `goog.i18n.bidi.DirectionalString`, its directionality, if known, is
 * preserved.
 *
 * @param {!goog.html.SafeHtml.TextOrHtml_} textOrHtml The text or SafeHtml to
 *     coerce.
 * @return {!goog.html.SafeHtml} The resulting SafeHtml object.
 * @deprecated Use goog.html.SafeHtml.htmlEscape.
 */
goog.html.SafeHtml.from = goog.html.SafeHtml.htmlEscape;


/**
 * Converts an arbitrary string into an HTML comment by HTML-escaping the
 * contents and embedding the result between HTML comment markers.
 *
 * Escaping is needed because Internet Explorer supports conditional comments
 * and so may render HTML markup within comments.
 *
 * @param {string} text
 * @return {!goog.html.SafeHtml}
 */
goog.html.SafeHtml.comment = function(text) {
  'use strict';
  return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(
      '<!--' + goog.string.internal.htmlEscape(text) + '-->', null);
};


/**
 * @const
 * @private
 */
goog.html.SafeHtml.VALID_NAMES_IN_TAG_ = /^[a-zA-Z0-9-]+$/;


/**
 * Set of attributes containing URL as defined at
 * http://www.w3.org/TR/html5/index.html#attributes-1.
 * @private @const {!Object<string,boolean>}
 */
goog.html.SafeHtml.URL_ATTRIBUTES_ = goog.object.createSet(
    'action', 'cite', 'data', 'formaction', 'href', 'manifest', 'poster',
    'src');


/**
 * Tags which are unsupported via create(). They might be supported via a
 * tag-specific create method. These are tags which might require a
 * TrustedResourceUrl in one of their attributes or a restricted type for
 * their content.
 * @private @const {!Object<string,boolean>}
 */
goog.html.SafeHtml.NOT_ALLOWED_TAG_NAMES_ = goog.object.createSet(
    goog.dom.TagName.APPLET, goog.dom.TagName.BASE, goog.dom.TagName.EMBED,
    goog.dom.TagName.IFRAME, goog.dom.TagName.LINK, goog.dom.TagName.MATH,
    goog.dom.TagName.META, goog.dom.TagName.OBJECT, goog.dom.TagName.SCRIPT,
    goog.dom.TagName.STYLE, goog.dom.TagName.SVG, goog.dom.TagName.TEMPLATE);


/**
 * @typedef {string|number|!goog.string.TypedString|
 *     !goog.html.SafeStyle.PropertyMap|undefined|null}
 */
goog.html.SafeHtml.AttributeValue;


/**
 * Creates a SafeHtml content consisting of a tag with optional attributes and
 * optional content.
 *
 * For convenience tag names and attribute names are accepted as regular
 * strings, instead of goog.string.Const. Nevertheless, you should not pass
 * user-controlled values to these parameters. Note that these parameters are
 * syntactically validated at runtime, and invalid values will result in
 * an exception.
 *
 * Example usage:
 *
 * goog.html.SafeHtml.create('br');
 * goog.html.SafeHtml.create('div', {'class': 'a'});
 * goog.html.SafeHtml.create('p', {}, 'a');
 * goog.html.SafeHtml.create('p', {}, goog.html.SafeHtml.create('br'));
 *
 * goog.html.SafeHtml.create('span', {
 *   'style': {'margin': '0'}
 * });
 *
 * To guarantee SafeHtml's type contract is upheld there are restrictions on
 * attribute values and tag names.
 *
 * - For attributes which contain script code (on*), a goog.string.Const is
 *   required.
 * - For attributes which contain style (style), a goog.html.SafeStyle or a
 *   goog.html.SafeStyle.PropertyMap is required.
 * - For attributes which are interpreted as URLs (e.g. src, href) a
 *   goog.html.SafeUrl, goog.string.Const or string is required. If a string
 *   is passed, it will be sanitized with SafeUrl.sanitize().
 * - For tags which can load code or set security relevant page metadata,
 *   more specific goog.html.SafeHtml.create*() functions must be used. Tags
 *   which are not supported by this function are applet, base, embed, iframe,
 *   link, math, meta, object, script, style, svg, and template.
 *
 * @param {!goog.dom.TagName|string} tagName The name of the tag. Only tag names
 *     consisting of [a-zA-Z0-9-] are allowed. Tag names documented above are
 *     disallowed.
 * @param {?Object<string, ?goog.html.SafeHtml.AttributeValue>=} opt_attributes
 *     Mapping from attribute names to their values. Only attribute names
 *     consisting of [a-zA-Z0-9-] are allowed. Value of null or undefined causes
 *     the attribute to be omitted.
 * @param {!goog.html.SafeHtml.TextOrHtml_|
 *     !Array<!goog.html.SafeHtml.TextOrHtml_>=} opt_content Content to
 *     HTML-escape and put inside the tag. This must be empty for void tags
 *     like <br>. Array elements are concatenated.
 * @return {!goog.html.SafeHtml} The SafeHtml content with the tag.
 * @throws {!Error} If invalid tag name, attribute name, or attribute value is
 *     provided.
 * @throws {!goog.asserts.AssertionError} If content for void tag is provided.
 */
goog.html.SafeHtml.create = function(tagName, opt_attributes, opt_content) {
  'use strict';
  goog.html.SafeHtml.verifyTagName(String(tagName));
  return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse(
      String(tagName), opt_attributes, opt_content);
};


/**
 * Verifies if the tag name is valid and if it doesn't change the context.
 * E.g. STRONG is fine but SCRIPT throws because it changes context. See
 * goog.html.SafeHtml.create for an explanation of allowed tags.
 * @param {string} tagName
 * @throws {!Error} If invalid tag name is provided.
 * @package
 */
goog.html.SafeHtml.verifyTagName = function(tagName) {
  'use strict';
  if (!goog.html.SafeHtml.VALID_NAMES_IN_TAG_.test(tagName)) {
    throw new Error(
        goog.html.SafeHtml.ENABLE_ERROR_MESSAGES ?
            'Invalid tag name <' + tagName + '>.' :
            '');
  }
  if (tagName.toUpperCase() in goog.html.SafeHtml.NOT_ALLOWED_TAG_NAMES_) {
    throw new Error(
        goog.html.SafeHtml.ENABLE_ERROR_MESSAGES ?

            'Tag name <' + tagName + '> is not allowed for SafeHtml.' :
            '');
  }
};


/**
 * Creates a SafeHtml representing an iframe tag.
 *
 * This by default restricts the iframe as much as possible by setting the
 * sandbox attribute to the empty string. If the iframe requires less
 * restrictions, set the sandbox attribute as tight as possible, but do not rely
 * on the sandbox as a security feature because it is not supported by older
 * browsers. If a sandbox is essential to security (e.g. for third-party
 * frames), use createSandboxIframe which checks for browser support.
 *
 * @see https://developer.mozilla.org/en/docs/Web/HTML/Element/iframe#attr-sandbox
 *
 * @param {?goog.html.TrustedResourceUrl=} opt_src The value of the src
 *     attribute. If null or undefined src will not be set.
 * @param {?goog.html.SafeHtml=} opt_srcdoc The value of the srcdoc attribute.
 *     If null or undefined srcdoc will not be set.
 * @param {?Object<string, ?goog.html.SafeHtml.AttributeValue>=} opt_attributes
 *     Mapping from attribute names to their values. Only attribute names
 *     consisting of [a-zA-Z0-9-] are allowed. Value of null or undefined causes
 *     the attribute to be omitted.
 * @param {!goog.html.SafeHtml.TextOrHtml_|
 *     !Array<!goog.html.SafeHtml.TextOrHtml_>=} opt_content Content to
 *     HTML-escape and put inside the tag. Array elements are concatenated.
 * @return {!goog.html.SafeHtml} The SafeHtml content with the tag.
 * @throws {!Error} If invalid tag name, attribute name, or attribute value is
 *     provided. If opt_attributes contains the src or srcdoc attributes.
 */
goog.html.SafeHtml.createIframe = function(
    opt_src, opt_srcdoc, opt_attributes, opt_content) {
  'use strict';
  if (opt_src) {
    // Check whether this is really TrustedResourceUrl.
    goog.html.TrustedResourceUrl.unwrap(opt_src);
  }

  var fixedAttributes = {};
  fixedAttributes['src'] = opt_src || null;
  fixedAttributes['srcdoc'] =
      opt_srcdoc && goog.html.SafeHtml.unwrap(opt_srcdoc);
  var defaultAttributes = {'sandbox': ''};
  var attributes = goog.html.SafeHtml.combineAttributes(
      fixedAttributes, defaultAttributes, opt_attributes);
  return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse(
      'iframe', attributes, opt_content);
};


/**
 * Creates a SafeHtml representing a sandboxed iframe tag.
 *
 * The sandbox attribute is enforced in its most restrictive mode, an empty
 * string. Consequently, the security requirements for the src and srcdoc
 * attributes are relaxed compared to SafeHtml.createIframe. This function
 * will throw on browsers that do not support the sandbox attribute, as
 * determined by SafeHtml.canUseSandboxIframe.
 *
 * The SafeHtml returned by this function can trigger downloads with no
 * user interaction on Chrome (though only a few, further attempts are blocked).
 * Firefox and IE will block all downloads from the sandbox.
 *
 * @see https://developer.mozilla.org/en/docs/Web/HTML/Element/iframe#attr-sandbox
 * @see https://lists.w3.org/Archives/Public/public-whatwg-archive/2013Feb/0112.html
 *
 * @param {string|!goog.html.SafeUrl=} opt_src The value of the src
 *     attribute. If null or undefined src will not be set.
 * @param {string=} opt_srcdoc The value of the srcdoc attribute.
 *     If null or undefined srcdoc will not be set. Will not be sanitized.
 * @param {!Object<string, ?goog.html.SafeHtml.AttributeValue>=} opt_attributes
 *     Mapping from attribute names to their values. Only attribute names
 *     consisting of [a-zA-Z0-9-] are allowed. Value of null or undefined causes
 *     the attribute to be omitted.
 * @param {!goog.html.SafeHtml.TextOrHtml_|
 *     !Array<!goog.html.SafeHtml.TextOrHtml_>=} opt_content Content to
 *     HTML-escape and put inside the tag. Array elements are concatenated.
 * @return {!goog.html.SafeHtml} The SafeHtml content with the tag.
 * @throws {!Error} If invalid tag name, attribute name, or attribute value is
 *     provided. If opt_attributes contains the src, srcdoc or sandbox
 *     attributes. If browser does not support the sandbox attribute on iframe.
 */
goog.html.SafeHtml.createSandboxIframe = function(
    opt_src, opt_srcdoc, opt_attributes, opt_content) {
  'use strict';
  if (!goog.html.SafeHtml.canUseSandboxIframe()) {
    throw new Error(
        goog.html.SafeHtml.ENABLE_ERROR_MESSAGES ?
            'The browser does not support sandboxed iframes.' :
            '');
  }

  var fixedAttributes = {};
  if (opt_src) {
    // Note that sanitize is a no-op on SafeUrl.
    fixedAttributes['src'] =
        goog.html.SafeUrl.unwrap(goog.html.SafeUrl.sanitize(opt_src));
  } else {
    fixedAttributes['src'] = null;
  }
  fixedAttributes['srcdoc'] = opt_srcdoc || null;
  fixedAttributes['sandbox'] = '';
  var attributes =
      goog.html.SafeHtml.combineAttributes(fixedAttributes, {}, opt_attributes);
  return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse(
      'iframe', attributes, opt_content);
};


/**
 * Checks if the user agent supports sandboxed iframes.
 * @return {boolean}
 */
goog.html.SafeHtml.canUseSandboxIframe = function() {
  'use strict';
  return goog.global['HTMLIFrameElement'] &&
      ('sandbox' in goog.global['HTMLIFrameElement'].prototype);
};


/**
 * Creates a SafeHtml representing a script tag with the src attribute.
 * @param {!goog.html.TrustedResourceUrl} src The value of the src
 * attribute.
 * @param {?Object<string, ?goog.html.SafeHtml.AttributeValue>=}
 * opt_attributes
 *     Mapping from attribute names to their values. Only attribute names
 *     consisting of [a-zA-Z0-9-] are allowed. Value of null or undefined
 *     causes the attribute to be omitted.
 * @return {!goog.html.SafeHtml} The SafeHtml content with the tag.
 * @throws {!Error} If invalid attribute name or value is provided. If
 *     opt_attributes contains the src attribute.
 */
goog.html.SafeHtml.createScriptSrc = function(src, opt_attributes) {
  'use strict';
  // TODO(mlourenco): The charset attribute should probably be blocked. If
  // its value is attacker controlled, the script contains attacker controlled
  // sub-strings (even if properly escaped) and the server does not set charset
  // then XSS is likely possible.
  // https://html.spec.whatwg.org/multipage/scripting.html#dom-script-charset

  // Check whether this is really TrustedResourceUrl.
  goog.html.TrustedResourceUrl.unwrap(src);

  var fixedAttributes = {'src': src};
  var defaultAttributes = {};
  var attributes = goog.html.SafeHtml.combineAttributes(
      fixedAttributes, defaultAttributes, opt_attributes);
  return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse(
      'script', attributes);
};


/**
 * Creates a SafeHtml representing a script tag. Does not allow the language,
 * src, text or type attributes to be set.
 * @param {!goog.html.SafeScript|!Array<!goog.html.SafeScript>}
 *     script Content to put inside the tag. Array elements are
 *     concatenated.
 * @param {?Object<string, ?goog.html.SafeHtml.AttributeValue>=} opt_attributes
 *     Mapping from attribute names to their values. Only attribute names
 *     consisting of [a-zA-Z0-9-] are allowed. Value of null or undefined causes
 *     the attribute to be omitted.
 * @return {!goog.html.SafeHtml} The SafeHtml content with the tag.
 * @throws {!Error} If invalid attribute name or attribute value is provided. If
 *     opt_attributes contains the language, src, text or type attribute.
 */
goog.html.SafeHtml.createScript = function(script, opt_attributes) {
  'use strict';
  for (var attr in opt_attributes) {
    // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty#Using_hasOwnProperty_as_a_property_name
    if (Object.prototype.hasOwnProperty.call(opt_attributes, attr)) {
      var attrLower = attr.toLowerCase();
      if (attrLower == 'language' || attrLower == 'src' ||
          attrLower == 'text' || attrLower == 'type') {
        throw new Error(
            goog.html.SafeHtml.ENABLE_ERROR_MESSAGES ?
                'Cannot set "' + attrLower + '" attribute' :
                '');
      }
    }
  }

  var content = '';
  script = goog.array.concat(script);
  for (var i = 0; i < script.length; i++) {
    content += goog.html.SafeScript.unwrap(script[i]);
  }
  // Convert to SafeHtml so that it's not HTML-escaped. This is safe because
  // as part of its contract, SafeScript should have no dangerous '<'.
  var htmlContent =
      goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(
          content, goog.i18n.bidi.Dir.NEUTRAL);
  return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse(
      'script', opt_attributes, htmlContent);
};


/**
 * Creates a SafeHtml representing a style tag. The type attribute is set
 * to "text/css".
 * @param {!goog.html.SafeStyleSheet|!Array<!goog.html.SafeStyleSheet>}
 *     styleSheet Content to put inside the tag. Array elements are
 *     concatenated.
 * @param {?Object<string, ?goog.html.SafeHtml.AttributeValue>=} opt_attributes
 *     Mapping from attribute names to their values. Only attribute names
 *     consisting of [a-zA-Z0-9-] are allowed. Value of null or undefined causes
 *     the attribute to be omitted.
 * @return {!goog.html.SafeHtml} The SafeHtml content with the tag.
 * @throws {!Error} If invalid attribute name or attribute value is provided. If
 *     opt_attributes contains the type attribute.
 */
goog.html.SafeHtml.createStyle = function(styleSheet, opt_attributes) {
  'use strict';
  var fixedAttributes = {'type': 'text/css'};
  var defaultAttributes = {};
  var attributes = goog.html.SafeHtml.combineAttributes(
      fixedAttributes, defaultAttributes, opt_attributes);

  var content = '';
  styleSheet = goog.array.concat(styleSheet);
  for (var i = 0; i < styleSheet.length; i++) {
    content += goog.html.SafeStyleSheet.unwrap(styleSheet[i]);
  }
  // Convert to SafeHtml so that it's not HTML-escaped. This is safe because
  // as part of its contract, SafeStyleSheet should have no dangerous '<'.
  var htmlContent =
      goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(
          content, goog.i18n.bidi.Dir.NEUTRAL);
  return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse(
      'style', attributes, htmlContent);
};


/**
 * Creates a SafeHtml representing a meta refresh tag.
 * @param {!goog.html.SafeUrl|string} url Where to redirect. If a string is
 *     passed, it will be sanitized with SafeUrl.sanitize().
 * @param {number=} opt_secs Number of seconds until the page should be
 *     reloaded. Will be set to 0 if unspecified.
 * @return {!goog.html.SafeHtml} The SafeHtml content with the tag.
 */
goog.html.SafeHtml.createMetaRefresh = function(url, opt_secs) {
  'use strict';
  // Note that sanitize is a no-op on SafeUrl.
  var unwrappedUrl = goog.html.SafeUrl.unwrap(goog.html.SafeUrl.sanitize(url));

  if (goog.labs.userAgent.browser.isIE() ||
      goog.labs.userAgent.browser.isEdge()) {
    // IE/EDGE can't parse the content attribute if the url contains a
    // semicolon. We can fix this by adding quotes around the url, but then we
    // can't parse quotes in the URL correctly. Also, it seems that IE/EDGE
    // did not unescape semicolons in these URLs at some point in the past. We
    // take a best-effort approach.
    //
    // If the URL has semicolons (which may happen in some cases, see
    // http://www.w3.org/TR/1999/REC-html401-19991224/appendix/notes.html#h-B.2
    // for instance), wrap it in single quotes to protect the semicolons.
    // If the URL has semicolons and single quotes, url-encode the single quotes
    // as well.
    //
    // This is imperfect. Notice that both ' and ; are reserved characters in
    // URIs, so this could do the wrong thing, but at least it will do the wrong
    // thing in only rare cases.
    if (goog.string.internal.contains(unwrappedUrl, ';')) {
      unwrappedUrl = '\'' + unwrappedUrl.replace(/'/g, '%27') + '\'';
    }
  }
  var attributes = {
    'http-equiv': 'refresh',
    'content': (opt_secs || 0) + '; url=' + unwrappedUrl
  };

  // This function will handle the HTML escaping for attributes.
  return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse(
      'meta', attributes);
};


/**
 * @param {string} tagName The tag name.
 * @param {string} name The attribute name.
 * @param {!goog.html.SafeHtml.AttributeValue} value The attribute value.
 * @return {string} A "name=value" string.
 * @throws {!Error} If attribute value is unsafe for the given tag and
 *     attribute.
 * @private
 */
goog.html.SafeHtml.getAttrNameAndValue_ = function(tagName, name, value) {
  'use strict';
  // If it's goog.string.Const, allow any valid attribute name.
  if (value instanceof goog.string.Const) {
    value = goog.string.Const.unwrap(value);
  } else if (name.toLowerCase() == 'style') {
    if (goog.html.SafeHtml.SUPPORT_STYLE_ATTRIBUTE) {
      value = goog.html.SafeHtml.getStyleValue_(value);
    } else {
      throw new Error(
          goog.html.SafeHtml.ENABLE_ERROR_MESSAGES ?
              'Attribute "style" not supported.' :
              '');
    }
  } else if (/^on/i.test(name)) {
    // TODO(jakubvrana): Disallow more attributes with a special meaning.
    throw new Error(
        goog.html.SafeHtml.ENABLE_ERROR_MESSAGES ? 'Attribute "' + name +
                '" requires goog.string.Const value, "' + value + '" given.' :
                                                   '');
    // URL attributes handled differently according to tag.
  } else if (name.toLowerCase() in goog.html.SafeHtml.URL_ATTRIBUTES_) {
    if (value instanceof goog.html.TrustedResourceUrl) {
      value = goog.html.TrustedResourceUrl.unwrap(value);
    } else if (value instanceof goog.html.SafeUrl) {
      value = goog.html.SafeUrl.unwrap(value);
    } else if (typeof value === 'string') {
      value = goog.html.SafeUrl.sanitize(value).getTypedStringValue();
    } else {
      throw new Error(
          goog.html.SafeHtml.ENABLE_ERROR_MESSAGES ?
              'Attribute "' + name + '" on tag "' + tagName +
                  '" requires goog.html.SafeUrl, goog.string.Const, or' +
                  ' string, value "' + value + '" given.' :
              '');
    }
  }

  // Accept SafeUrl, TrustedResourceUrl, etc. for attributes which only require
  // HTML-escaping.
  if (value.implementsGoogStringTypedString) {
    // Ok to call getTypedStringValue() since there's no reliance on the type
    // contract for security here.
    value =
        /** @type {!goog.string.TypedString} */ (value).getTypedStringValue();
  }

  goog.asserts.assert(
      typeof value === 'string' || typeof value === 'number',
      'String or number value expected, got ' + (typeof value) +
          ' with value: ' + value);
  return name + '="' + goog.string.internal.htmlEscape(String(value)) + '"';
};


/**
 * Gets value allowed in "style" attribute.
 * @param {!goog.html.SafeHtml.AttributeValue} value It could be SafeStyle or a
 *     map which will be passed to goog.html.SafeStyle.create.
 * @return {string} Unwrapped value.
 * @throws {!Error} If string value is given.
 * @private
 */
goog.html.SafeHtml.getStyleValue_ = function(value) {
  'use strict';
  if (!goog.isObject(value)) {
    throw new Error(
        goog.html.SafeHtml.ENABLE_ERROR_MESSAGES ?
            'The "style" attribute requires goog.html.SafeStyle or map ' +
                'of style properties, ' + (typeof value) + ' given: ' + value :
            '');
  }
  if (!(value instanceof goog.html.SafeStyle)) {
    // Process the property bag into a style object.
    value = goog.html.SafeStyle.create(value);
  }
  return goog.html.SafeStyle.unwrap(value);
};


/**
 * Creates a SafeHtml content with known directionality consisting of a tag with
 * optional attributes and optional content.
 * @param {!goog.i18n.bidi.Dir} dir Directionality.
 * @param {string} tagName
 * @param {?Object<string, ?goog.html.SafeHtml.AttributeValue>=} opt_attributes
 * @param {!goog.html.SafeHtml.TextOrHtml_|
 *     !Array<!goog.html.SafeHtml.TextOrHtml_>=} opt_content
 * @return {!goog.html.SafeHtml} The SafeHtml content with the tag.
 */
goog.html.SafeHtml.createWithDir = function(
    dir, tagName, opt_attributes, opt_content) {
  'use strict';
  var html = goog.html.SafeHtml.create(tagName, opt_attributes, opt_content);
  html.dir_ = dir;
  return html;
};


/**
 * Creates a new SafeHtml object by joining the parts with separator.
 * @param {!goog.html.SafeHtml.TextOrHtml_} separator
 * @param {!Array<!goog.html.SafeHtml.TextOrHtml_|
 *     !Array<!goog.html.SafeHtml.TextOrHtml_>>} parts Parts to join. If a part
 *     contains an array then each member of this array is also joined with the
 *     separator.
 * @return {!goog.html.SafeHtml}
 */
goog.html.SafeHtml.join = function(separator, parts) {
  'use strict';
  var separatorHtml = goog.html.SafeHtml.htmlEscape(separator);
  var dir = separatorHtml.getDirection();
  var content = [];

  /**
   * @param {!goog.html.SafeHtml.TextOrHtml_|
   *     !Array<!goog.html.SafeHtml.TextOrHtml_>} argument
   */
  var addArgument = function(argument) {
    'use strict';
    if (Array.isArray(argument)) {
      goog.array.forEach(argument, addArgument);
    } else {
      var html = goog.html.SafeHtml.htmlEscape(argument);
      content.push(goog.html.SafeHtml.unwrap(html));
      var htmlDir = html.getDirection();
      if (dir == goog.i18n.bidi.Dir.NEUTRAL) {
        dir = htmlDir;
      } else if (htmlDir != goog.i18n.bidi.Dir.NEUTRAL && dir != htmlDir) {
        dir = null;
      }
    }
  };

  goog.array.forEach(parts, addArgument);
  return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(
      content.join(goog.html.SafeHtml.unwrap(separatorHtml)), dir);
};


/**
 * Creates a new SafeHtml object by concatenating values.
 * @param {...(!goog.html.SafeHtml.TextOrHtml_|
 *     !Array<!goog.html.SafeHtml.TextOrHtml_>)} var_args Values to concatenate.
 * @return {!goog.html.SafeHtml}
 */
goog.html.SafeHtml.concat = function(var_args) {
  'use strict';
  return goog.html.SafeHtml.join(
      goog.html.SafeHtml.EMPTY, Array.prototype.slice.call(arguments));
};


/**
 * Creates a new SafeHtml object with known directionality by concatenating the
 * values.
 * @param {!goog.i18n.bidi.Dir} dir Directionality.
 * @param {...(!goog.html.SafeHtml.TextOrHtml_|
 *     !Array<!goog.html.SafeHtml.TextOrHtml_>)} var_args Elements of array
 *     arguments would be processed recursively.
 * @return {!goog.html.SafeHtml}
 */
goog.html.SafeHtml.concatWithDir = function(dir, var_args) {
  'use strict';
  var html = goog.html.SafeHtml.concat(goog.array.slice(arguments, 1));
  html.dir_ = dir;
  return html;
};


/**
 * Token used to ensure that object is created only from this file. No code
 * outside of this file can access this token.
 * @private {!Object}
 * @const
 */
goog.html.SafeHtml.CONSTRUCTOR_TOKEN_PRIVATE_ = {};


/**
 * Package-internal utility method to create SafeHtml instances.
 *
 * @param {string} html The string to initialize the SafeHtml object with.
 * @param {?goog.i18n.bidi.Dir} dir The directionality of the SafeHtml to be
 *     constructed, or null if unknown.
 * @return {!goog.html.SafeHtml} The initialized SafeHtml object.
 * @package
 */
goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse = function(
    html, dir) {
  'use strict';
  const policy = goog.html.trustedtypes.getPolicyPrivateDoNotAccessOrElse();
  const trustedHtml = policy ? policy.createHTML(html) : html;
  return new goog.html.SafeHtml(
      trustedHtml, dir, goog.html.SafeHtml.CONSTRUCTOR_TOKEN_PRIVATE_);
};


/**
 * Like create() but does not restrict which tags can be constructed.
 *
 * @param {string} tagName Tag name. Set or validated by caller.
 * @param {?Object<string, ?goog.html.SafeHtml.AttributeValue>=} opt_attributes
 * @param {(!goog.html.SafeHtml.TextOrHtml_|
 *     !Array<!goog.html.SafeHtml.TextOrHtml_>)=} opt_content
 * @return {!goog.html.SafeHtml}
 * @throws {!Error} If invalid or unsafe attribute name or value is provided.
 * @throws {!goog.asserts.AssertionError} If content for void tag is provided.
 * @package
 */
goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse = function(
    tagName, opt_attributes, opt_content) {
  'use strict';
  var dir = null;
  var result = '<' + tagName;
  result += goog.html.SafeHtml.stringifyAttributes(tagName, opt_attributes);

  var content = opt_content;
  if (content == null) {
    content = [];
  } else if (!Array.isArray(content)) {
    content = [content];
  }

  if (goog.dom.tags.isVoidTag(tagName.toLowerCase())) {
    goog.asserts.assert(
        !content.length, 'Void tag <' + tagName + '> does not allow content.');
    result += '>';
  } else {
    var html = goog.html.SafeHtml.concat(content);
    result += '>' + goog.html.SafeHtml.unwrap(html) + '</' + tagName + '>';
    dir = html.getDirection();
  }

  var dirAttribute = opt_attributes && opt_attributes['dir'];
  if (dirAttribute) {
    if (/^(ltr|rtl|auto)$/i.test(dirAttribute)) {
      // If the tag has the "dir" attribute specified then its direction is
      // neutral because it can be safely used in any context.
      dir = goog.i18n.bidi.Dir.NEUTRAL;
    } else {
      dir = null;
    }
  }

  return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(
      result, dir);
};


/**
 * Creates a string with attributes to insert after tagName.
 * @param {string} tagName
 * @param {?Object<string, ?goog.html.SafeHtml.AttributeValue>=} opt_attributes
 * @return {string} Returns an empty string if there are no attributes, returns
 *     a string starting with a space otherwise.
 * @throws {!Error} If attribute value is unsafe for the given tag and
 *     attribute.
 * @package
 */
goog.html.SafeHtml.stringifyAttributes = function(tagName, opt_attributes) {
  'use strict';
  var result = '';
  if (opt_attributes) {
    for (var name in opt_attributes) {
      // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty#Using_hasOwnProperty_as_a_property_name
      if (Object.prototype.hasOwnProperty.call(opt_attributes, name)) {
        if (!goog.html.SafeHtml.VALID_NAMES_IN_TAG_.test(name)) {
          throw new Error(
              goog.html.SafeHtml.ENABLE_ERROR_MESSAGES ?
                  'Invalid attribute name "' + name + '".' :
                  '');
        }
        var value = opt_attributes[name];
        if (value == null) {
          continue;
        }
        result +=
            ' ' + goog.html.SafeHtml.getAttrNameAndValue_(tagName, name, value);
      }
    }
  }
  return result;
};


/**
 * @param {!Object<string, ?goog.html.SafeHtml.AttributeValue>} fixedAttributes
 * @param {!Object<string, string>} defaultAttributes
 * @param {?Object<string, ?goog.html.SafeHtml.AttributeValue>=} opt_attributes
 *     Optional attributes passed to create*().
 * @return {!Object<string, ?goog.html.SafeHtml.AttributeValue>}
 * @throws {!Error} If opt_attributes contains an attribute with the same name
 *     as an attribute in fixedAttributes.
 * @package
 */
goog.html.SafeHtml.combineAttributes = function(
    fixedAttributes, defaultAttributes, opt_attributes) {
  'use strict';
  var combinedAttributes = {};
  var name;

  for (name in fixedAttributes) {
    // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty#Using_hasOwnProperty_as_a_property_name
    if (Object.prototype.hasOwnProperty.call(fixedAttributes, name)) {
      goog.asserts.assert(name.toLowerCase() == name, 'Must be lower case');
      combinedAttributes[name] = fixedAttributes[name];
    }
  }
  for (name in defaultAttributes) {
    if (Object.prototype.hasOwnProperty.call(defaultAttributes, name)) {
      goog.asserts.assert(name.toLowerCase() == name, 'Must be lower case');
      combinedAttributes[name] = defaultAttributes[name];
    }
  }

  if (opt_attributes) {
    for (name in opt_attributes) {
      if (Object.prototype.hasOwnProperty.call(opt_attributes, name)) {
        var nameLower = name.toLowerCase();
        if (nameLower in fixedAttributes) {
          throw new Error(
              goog.html.SafeHtml.ENABLE_ERROR_MESSAGES ?
                  'Cannot override "' + nameLower + '" attribute, got "' +
                      name + '" with value "' + opt_attributes[name] + '"' :
                  '');
        }
        if (nameLower in defaultAttributes) {
          delete combinedAttributes[nameLower];
        }
        combinedAttributes[name] = opt_attributes[name];
      }
    }
  }

  return combinedAttributes;
};


/**
 * A SafeHtml instance corresponding to the HTML doctype: "<!DOCTYPE html>".
 * @const {!goog.html.SafeHtml}
 */
goog.html.SafeHtml.DOCTYPE_HTML = /** @type {!goog.html.SafeHtml} */ ({
  // NOTE: this compiles to nothing, but hides the possible side effect of
  // SafeHtml creation (due to calling trustedTypes.createPolicy) from the
  // compiler so that the entire call can be removed if the result is not used.
  // MOE:begin_strip
  // TODO(b/155299094): Refactor after adding compiler support.
  // MOE:end_strip
  valueOf: function() {
    'use strict';
    return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(
        '<!DOCTYPE html>', goog.i18n.bidi.Dir.NEUTRAL);
  },
}.valueOf());

/**
 * A SafeHtml instance corresponding to the empty string.
 * @const {!goog.html.SafeHtml}
 */
goog.html.SafeHtml.EMPTY = new goog.html.SafeHtml(
    (goog.global.trustedTypes && goog.global.trustedTypes.emptyHTML) || '',
    goog.i18n.bidi.Dir.NEUTRAL, goog.html.SafeHtml.CONSTRUCTOR_TOKEN_PRIVATE_);

/**
 * A SafeHtml instance corresponding to the <br> tag.
 * @const {!goog.html.SafeHtml}
 */
goog.html.SafeHtml.BR = /** @type {!goog.html.SafeHtml} */ ({
  // NOTE: this compiles to nothing, but hides the possible side effect of
  // SafeHtml creation (due to calling trustedTypes.createPolicy) from the
  // compiler so that the entire call can be removed if the result is not used.
  // MOE:begin_strip
  // TODO(b/155299094): Refactor after adding compiler support.
  // MOE:end_strip
  valueOf: function() {
    'use strict';
    return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(
        '<br>', goog.i18n.bidi.Dir.NEUTRAL);
  },
}.valueOf());

//third_party/javascript/closure/html/uncheckedconversions.js
/**
 * @license
 * Copyright The Closure Library Authors.
 * SPDX-License-Identifier: Apache-2.0
 */

/**
 * @fileoverview Unchecked conversions to create values of goog.html types from
 * plain strings.  Use of these functions could potentially result in instances
 * of goog.html types that violate their type contracts, and hence result in
 * security vulnerabilties.
 *
 * Therefore, all uses of the methods herein must be carefully security
 * reviewed.  Avoid use of the methods in this file whenever possible; instead
 * prefer to create instances of goog.html types using inherently safe builders
 * or template systems.
 *
 * MOE:begin_intracomment_strip
 * See http://go/safehtml-unchecked for guidelines on using these functions.
 * MOE:end_intracomment_strip
 *
 * MOE:begin_intracomment_strip
 * MAINTAINERS: Use of these functions is detected with a Tricorder analyzer.
 * If adding functions here also add them to analyzer's list at
 * j/c/g/devtools/staticanalysis/pipeline/analyzers/shared/SafeHtmlAnalyzers.java.
 * MOE:end_intracomment_strip
 */


goog.provide('goog.html.uncheckedconversions');

goog.require('goog.asserts');
goog.require('goog.html.SafeHtml');
goog.require('goog.html.SafeScript');
goog.require('goog.html.SafeStyle');
goog.require('goog.html.SafeStyleSheet');
goog.require('goog.html.SafeUrl');
goog.require('goog.html.TrustedResourceUrl');
goog.require('goog.string.Const');
goog.require('goog.string.internal');
goog.requireType('goog.i18n.bidi.Dir');


/**
 * Performs an "unchecked conversion" to SafeHtml from a plain string that is
 * known to satisfy the SafeHtml type contract.
 *
 * IMPORTANT: Uses of this method must be carefully security-reviewed to ensure
 * that the value of `html` satisfies the SafeHtml type contract in all
 * possible program states.
 *
 * MOE:begin_intracomment_strip
 * See http://go/safehtml-unchecked for guidelines on using these functions.
 * MOE:end_intracomment_strip
 *
 * @param {!goog.string.Const} justification A constant string explaining why
 *     this use of this method is safe. May include a security review ticket
 *     number.
 * @param {string} html A string that is claimed to adhere to the SafeHtml
 *     contract.
 * @param {?goog.i18n.bidi.Dir=} opt_dir The optional directionality of the
 *     SafeHtml to be constructed. A null or undefined value signifies an
 *     unknown directionality.
 * @return {!goog.html.SafeHtml} The value of html, wrapped in a SafeHtml
 *     object.
 */
goog.html.uncheckedconversions.safeHtmlFromStringKnownToSatisfyTypeContract =
    function(justification, html, opt_dir) {
  'use strict';
  // unwrap() called inside an assert so that justification can be optimized
  // away in production code.
  goog.asserts.assertString(
      goog.string.Const.unwrap(justification), 'must provide justification');
  goog.asserts.assert(
      !goog.string.internal.isEmptyOrWhitespace(
          goog.string.Const.unwrap(justification)),
      'must provide non-empty justification');
  return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(
      html, opt_dir || null);
};


/**
 * Performs an "unchecked conversion" to SafeScript from a plain string that is
 * known to satisfy the SafeScript type contract.
 *
 * IMPORTANT: Uses of this method must be carefully security-reviewed to ensure
 * that the value of `script` satisfies the SafeScript type contract in
 * all possible program states.
 *
 * MOE:begin_intracomment_strip
 * See http://go/safehtml-unchecked for guidelines on using these functions.
 * MOE:end_intracomment_strip
 *
 * @param {!goog.string.Const} justification A constant string explaining why
 *     this use of this method is safe. May include a security review ticket
 *     number.
 * @param {string} script The string to wrap as a SafeScript.
 * @return {!goog.html.SafeScript} The value of `script`, wrapped in a
 *     SafeScript object.
 */
goog.html.uncheckedconversions.safeScriptFromStringKnownToSatisfyTypeContract =
    function(justification, script) {
  'use strict';
  // unwrap() called inside an assert so that justification can be optimized
  // away in production code.
  goog.asserts.assertString(
      goog.string.Const.unwrap(justification), 'must provide justification');
  goog.asserts.assert(
      !goog.string.internal.isEmptyOrWhitespace(
          goog.string.Const.unwrap(justification)),
      'must provide non-empty justification');
  return goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse(
      script);
};


/**
 * Performs an "unchecked conversion" to SafeStyle from a plain string that is
 * known to satisfy the SafeStyle type contract.
 *
 * IMPORTANT: Uses of this method must be carefully security-reviewed to ensure
 * that the value of `style` satisfies the SafeStyle type contract in all
 * possible program states.
 *
 * MOE:begin_intracomment_strip
 * See http://go/safehtml-unchecked for guidelines on using these functions.
 * MOE:end_intracomment_strip
 *
 * @param {!goog.string.Const} justification A constant string explaining why
 *     this use of this method is safe. May include a security review ticket
 *     number.
 * @param {string} style The string to wrap as a SafeStyle.
 * @return {!goog.html.SafeStyle} The value of `style`, wrapped in a
 *     SafeStyle object.
 */
goog.html.uncheckedconversions.safeStyleFromStringKnownToSatisfyTypeContract =
    function(justification, style) {
  'use strict';
  // unwrap() called inside an assert so that justification can be optimized
  // away in production code.
  goog.asserts.assertString(
      goog.string.Const.unwrap(justification), 'must provide justification');
  goog.asserts.assert(
      !goog.string.internal.isEmptyOrWhitespace(
          goog.string.Const.unwrap(justification)),
      'must provide non-empty justification');
  return goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(
      style);
};


/**
 * Performs an "unchecked conversion" to SafeStyleSheet from a plain string
 * that is known to satisfy the SafeStyleSheet type contract.
 *
 * IMPORTANT: Uses of this method must be carefully security-reviewed to ensure
 * that the value of `styleSheet` satisfies the SafeStyleSheet type
 * contract in all possible program states.
 *
 * MOE:begin_intracomment_strip
 * See http://go/safehtml-unchecked for guidelines on using these functions.
 * MOE:end_intracomment_strip
 *
 * @param {!goog.string.Const} justification A constant string explaining why
 *     this use of this method is safe. May include a security review ticket
 *     number.
 * @param {string} styleSheet The string to wrap as a SafeStyleSheet.
 * @return {!goog.html.SafeStyleSheet} The value of `styleSheet`, wrapped
 *     in a SafeStyleSheet object.
 */
goog.html.uncheckedconversions
    .safeStyleSheetFromStringKnownToSatisfyTypeContract = function(
    justification, styleSheet) {
  'use strict';
  // unwrap() called inside an assert so that justification can be optimized
  // away in production code.
  goog.asserts.assertString(
      goog.string.Const.unwrap(justification), 'must provide justification');
  goog.asserts.assert(
      !goog.string.internal.isEmptyOrWhitespace(
          goog.string.Const.unwrap(justification)),
      'must provide non-empty justification');
  return goog.html.SafeStyleSheet
      .createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(styleSheet);
};


/**
 * Performs an "unchecked conversion" to SafeUrl from a plain string that is
 * known to satisfy the SafeUrl type contract.
 *
 * IMPORTANT: Uses of this method must be carefully security-reviewed to ensure
 * that the value of `url` satisfies the SafeUrl type contract in all
 * possible program states.
 *
 * MOE:begin_intracomment_strip
 * See http://go/safehtml-unchecked for guidelines on using these functions.
 * MOE:end_intracomment_strip
 *
 * @param {!goog.string.Const} justification A constant string explaining why
 *     this use of this method is safe. May include a security review ticket
 *     number.
 * @param {string} url The string to wrap as a SafeUrl.
 * @return {!goog.html.SafeUrl} The value of `url`, wrapped in a SafeUrl
 *     object.
 */
goog.html.uncheckedconversions.safeUrlFromStringKnownToSatisfyTypeContract =
    function(justification, url) {
  'use strict';
  // unwrap() called inside an assert so that justification can be optimized
  // away in production code.
  goog.asserts.assertString(
      goog.string.Const.unwrap(justification), 'must provide justification');
  goog.asserts.assert(
      !goog.string.internal.isEmptyOrWhitespace(
          goog.string.Const.unwrap(justification)),
      'must provide non-empty justification');
  return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(url);
};


/**
 * Performs an "unchecked conversion" to TrustedResourceUrl from a plain string
 * that is known to satisfy the TrustedResourceUrl type contract.
 *
 * IMPORTANT: Uses of this method must be carefully security-reviewed to ensure
 * that the value of `url` satisfies the TrustedResourceUrl type contract
 * in all possible program states.
 *
 * MOE:begin_intracomment_strip
 * See http://go/safehtml-unchecked for guidelines on using these functions.
 * MOE:end_intracomment_strip
 *
 * @param {!goog.string.Const} justification A constant string explaining why
 *     this use of this method is safe. May include a security review ticket
 *     number.
 * @param {string} url The string to wrap as a TrustedResourceUrl.
 * @return {!goog.html.TrustedResourceUrl} The value of `url`, wrapped in
 *     a TrustedResourceUrl object.
 */
goog.html.uncheckedconversions
    .trustedResourceUrlFromStringKnownToSatisfyTypeContract = function(
    justification, url) {
  'use strict';
  // unwrap() called inside an assert so that justification can be optimized
  // away in production code.
  goog.asserts.assertString(
      goog.string.Const.unwrap(justification), 'must provide justification');
  goog.asserts.assert(
      !goog.string.internal.isEmptyOrWhitespace(
          goog.string.Const.unwrap(justification)),
      'must provide non-empty justification');
  return goog.html.TrustedResourceUrl
      .createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(url);
};

//third_party/javascript/closure/dom/safe.js
/**
 * @license
 * Copyright The Closure Library Authors.
 * SPDX-License-Identifier: Apache-2.0
 */

/**
 * @fileoverview Type-safe wrappers for unsafe DOM APIs.
 *
 * This file provides type-safe wrappers for DOM APIs that can result in
 * cross-site scripting (XSS) vulnerabilities, if the API is supplied with
 * untrusted (attacker-controlled) input.  Instead of plain strings, the type
 * safe wrappers consume values of types from the goog.html package whose
 * contract promises that values are safe to use in the corresponding context.
 *
 * Hence, a program that exclusively uses the wrappers in this file (i.e., whose
 * only reference to security-sensitive raw DOM APIs are in this file) is
 * guaranteed to be free of XSS due to incorrect use of such DOM APIs (modulo
 * correctness of code that produces values of the respective goog.html types,
 * and absent code that violates type safety).
 *
 * For example, assigning to an element's .innerHTML property a string that is
 * derived (even partially) from untrusted input typically results in an XSS
 * vulnerability. The type-safe wrapper goog.dom.safe.setInnerHtml consumes a
 * value of type goog.html.SafeHtml, whose contract states that using its values
 * in a HTML context will not result in XSS. Hence a program that is free of
 * direct assignments to any element's innerHTML property (with the exception of
 * the assignment to .innerHTML in this file) is guaranteed to be free of XSS
 * due to assignment of untrusted strings to the innerHTML property.
 */

goog.provide('goog.dom.safe');
goog.provide('goog.dom.safe.InsertAdjacentHtmlPosition');

goog.require('goog.asserts');
goog.require('goog.dom.asserts');
goog.require('goog.functions');
goog.require('goog.html.SafeHtml');
goog.require('goog.html.SafeScript');
goog.require('goog.html.SafeStyle');
goog.require('goog.html.SafeUrl');
goog.require('goog.html.TrustedResourceUrl');
goog.require('goog.html.uncheckedconversions');
goog.require('goog.string.Const');
goog.require('goog.string.internal');


/** @enum {string} */
goog.dom.safe.InsertAdjacentHtmlPosition = {
  AFTERBEGIN: 'afterbegin',
  AFTEREND: 'afterend',
  BEFOREBEGIN: 'beforebegin',
  BEFOREEND: 'beforeend'
};


/**
 * Inserts known-safe HTML into a Node, at the specified position.
 * @param {!Node} node The node on which to call insertAdjacentHTML.
 * @param {!goog.dom.safe.InsertAdjacentHtmlPosition} position Position where
 *     to insert the HTML.
 * @param {!goog.html.SafeHtml} html The known-safe HTML to insert.
 */
goog.dom.safe.insertAdjacentHtml = function(node, position, html) {
  'use strict';
  node.insertAdjacentHTML(position, goog.html.SafeHtml.unwrapTrustedHTML(html));
};


/**
 * Tags not allowed in goog.dom.safe.setInnerHtml.
 * @private @const {!Object<string, boolean>}
 */
goog.dom.safe.SET_INNER_HTML_DISALLOWED_TAGS_ = {
  'MATH': true,
  'SCRIPT': true,
  'STYLE': true,
  'SVG': true,
  'TEMPLATE': true
};


/**
 * Whether assigning to innerHTML results in a non-spec-compliant clean-up. Used
 * to define goog.dom.safe.unsafeSetInnerHtmlDoNotUseOrElse.
 *
 * <p>As mentioned in https://stackoverflow.com/questions/28741528, re-rendering
 * an element in IE by setting innerHTML causes IE to recursively disconnect all
 * parent/children connections that were in the previous contents of the
 * element. Unfortunately, this can unexpectedly result in confusing cases where
 * a function is run (typically asynchronously) on element that has since
 * disconnected from the DOM but assumes the presence of its children. A simple
 * workaround is to remove all children first. Testing on IE11 via
 * https://jsperf.com/innerhtml-vs-removechild/239, removeChild seems to be
 * ~10x faster than innerHTML='' for a large number of children (perhaps due
 * to the latter's recursive behavior), implying that this workaround would
 * not hurt performance and might actually improve it.
 * @return {boolean}
 * @private
 */
goog.dom.safe.isInnerHtmlCleanupRecursive_ =
    goog.functions.cacheReturnValue(function() {
      'use strict';
      // `document` missing in some test frameworks.
      if (goog.DEBUG && typeof document === 'undefined') {
        return false;
      }
      // Create 3 nested <div>s without using innerHTML.
      // We're not chaining the appendChilds in one call,  as this breaks
      // in a DocumentFragment.
      var div = document.createElement('div');
      var childDiv = document.createElement('div');
      childDiv.appendChild(document.createElement('div'));
      div.appendChild(childDiv);
      // `firstChild` is null in Google Js Test.
      if (goog.DEBUG && !div.firstChild) {
        return false;
      }
      var innerChild = div.firstChild.firstChild;
      div.innerHTML =
          goog.html.SafeHtml.unwrapTrustedHTML(goog.html.SafeHtml.EMPTY);
      return !innerChild.parentElement;
    });


/**
 * Assigns HTML to an element's innerHTML property. Helper to use only here and
 * in soy.js.
 * @param {?Element|?ShadowRoot} elem The element whose innerHTML is to be
 *     assigned to.
 * @param {!goog.html.SafeHtml} html
 */
goog.dom.safe.unsafeSetInnerHtmlDoNotUseOrElse = function(elem, html) {
  'use strict';
  // See comment above goog.dom.safe.isInnerHtmlCleanupRecursive_.
  if (goog.dom.safe.isInnerHtmlCleanupRecursive_()) {
    while (elem.lastChild) {
      elem.removeChild(elem.lastChild);
    }
  }
  elem.innerHTML = goog.html.SafeHtml.unwrapTrustedHTML(html);
};


/**
 * Assigns known-safe HTML to an element's innerHTML property.
 * @param {!Element|!ShadowRoot} elem The element whose innerHTML is to be
 *     assigned to.
 * @param {!goog.html.SafeHtml} html The known-safe HTML to assign.
 * @throws {Error} If called with one of these tags: math, script, style, svg,
 *     template.
 */
goog.dom.safe.setInnerHtml = function(elem, html) {
  'use strict';
  if (goog.asserts.ENABLE_ASSERTS && elem.tagName) {
    var tagName = elem.tagName.toUpperCase();
    if (goog.dom.safe.SET_INNER_HTML_DISALLOWED_TAGS_[tagName]) {
      throw new Error(
          'goog.dom.safe.setInnerHtml cannot be used to set content of ' +
          elem.tagName + '.');
    }
  }

  goog.dom.safe.unsafeSetInnerHtmlDoNotUseOrElse(elem, html);
};


/**
 * Assigns constant HTML to an element's innerHTML property.
 * @param {!Element} element The element whose innerHTML is to be assigned to.
 * @param {!goog.string.Const} constHtml The known-safe HTML to assign.
 * @throws {!Error} If called with one of these tags: math, script, style, svg,
 *     template.
 */
goog.dom.safe.setInnerHtmlFromConstant = function(element, constHtml) {
  'use strict';
  goog.dom.safe.setInnerHtml(
      element,
      goog.html.uncheckedconversions
          .safeHtmlFromStringKnownToSatisfyTypeContract(
              goog.string.Const.from('Constant HTML to be immediatelly used.'),
              goog.string.Const.unwrap(constHtml)));
};


/**
 * Assigns known-safe HTML to an element's outerHTML property.
 * @param {!Element} elem The element whose outerHTML is to be assigned to.
 * @param {!goog.html.SafeHtml} html The known-safe HTML to assign.
 */
goog.dom.safe.setOuterHtml = function(elem, html) {
  'use strict';
  elem.outerHTML = goog.html.SafeHtml.unwrapTrustedHTML(html);
};


/**
 * Safely assigns a URL a form element's action property.
 *
 * If url is of type goog.html.SafeUrl, its value is unwrapped and assigned to
 * form's action property.  If url is of type string however, it is first
 * sanitized using goog.html.SafeUrl.sanitize.
 *
 * Example usage:
 *   goog.dom.safe.setFormElementAction(formEl, url);
 * which is a safe alternative to
 *   formEl.action = url;
 * The latter can result in XSS vulnerabilities if url is a
 * user-/attacker-controlled value.
 *
 * @param {!Element} form The form element whose action property
 *     is to be assigned to.
 * @param {string|!goog.html.SafeUrl} url The URL to assign.
 * @see goog.html.SafeUrl#sanitize
 */
goog.dom.safe.setFormElementAction = function(form, url) {
  'use strict';
  /** @type {!goog.html.SafeUrl} */
  var safeUrl;
  if (url instanceof goog.html.SafeUrl) {
    safeUrl = url;
  } else {
    safeUrl = goog.html.SafeUrl.sanitizeAssertUnchanged(url);
  }
  goog.dom.asserts.assertIsHTMLFormElement(form).action =
      goog.html.SafeUrl.unwrap(safeUrl);
};

/**
 * Safely assigns a URL to a button element's formaction property.
 *
 * If url is of type goog.html.SafeUrl, its value is unwrapped and assigned to
 * button's formaction property.  If url is of type string however, it is first
 * sanitized using goog.html.SafeUrl.sanitize.
 *
 * Example usage:
 *   goog.dom.safe.setButtonFormAction(buttonEl, url);
 * which is a safe alternative to
 *   buttonEl.action = url;
 * The latter can result in XSS vulnerabilities if url is a
 * user-/attacker-controlled value.
 *
 * @param {!Element} button The button element whose action property
 *     is to be assigned to.
 * @param {string|!goog.html.SafeUrl} url The URL to assign.
 * @see goog.html.SafeUrl#sanitize
 */
goog.dom.safe.setButtonFormAction = function(button, url) {
  'use strict';
  /** @type {!goog.html.SafeUrl} */
  var safeUrl;
  if (url instanceof goog.html.SafeUrl) {
    safeUrl = url;
  } else {
    safeUrl = goog.html.SafeUrl.sanitizeAssertUnchanged(url);
  }
  goog.dom.asserts.assertIsHTMLButtonElement(button).formAction =
      goog.html.SafeUrl.unwrap(safeUrl);
};
/**
 * Safely assigns a URL to an input element's formaction property.
 *
 * If url is of type goog.html.SafeUrl, its value is unwrapped and assigned to
 * input's formaction property.  If url is of type string however, it is first
 * sanitized using goog.html.SafeUrl.sanitize.
 *
 * Example usage:
 *   goog.dom.safe.setInputFormAction(inputEl, url);
 * which is a safe alternative to
 *   inputEl.action = url;
 * The latter can result in XSS vulnerabilities if url is a
 * user-/attacker-controlled value.
 *
 * @param {!Element} input The input element whose action property
 *     is to be assigned to.
 * @param {string|!goog.html.SafeUrl} url The URL to assign.
 * @see goog.html.SafeUrl#sanitize
 */
goog.dom.safe.setInputFormAction = function(input, url) {
  'use strict';
  /** @type {!goog.html.SafeUrl} */
  var safeUrl;
  if (url instanceof goog.html.SafeUrl) {
    safeUrl = url;
  } else {
    safeUrl = goog.html.SafeUrl.sanitizeAssertUnchanged(url);
  }
  goog.dom.asserts.assertIsHTMLInputElement(input).formAction =
      goog.html.SafeUrl.unwrap(safeUrl);
};

/**
 * Sets the given element's style property to the contents of the provided
 * SafeStyle object.
 * @param {!Element} elem
 * @param {!goog.html.SafeStyle} style
 */
goog.dom.safe.setStyle = function(elem, style) {
  'use strict';
  elem.style.cssText = goog.html.SafeStyle.unwrap(style);
};


/**
 * Writes known-safe HTML to a document.
 * @param {!Document} doc The document to be written to.
 * @param {!goog.html.SafeHtml} html The known-safe HTML to assign.
 */
goog.dom.safe.documentWrite = function(doc, html) {
  'use strict';
  doc.write(goog.html.SafeHtml.unwrapTrustedHTML(html));
};


/**
 * Safely assigns a URL to an anchor element's href property.
 *
 * If url is of type goog.html.SafeUrl, its value is unwrapped and assigned to
 * anchor's href property.  If url is of type string however, it is first
 * sanitized using goog.html.SafeUrl.sanitize.
 *
 * Example usage:
 *   goog.dom.safe.setAnchorHref(anchorEl, url);
 * which is a safe alternative to
 *   anchorEl.href = url;
 * The latter can result in XSS vulnerabilities if url is a
 * user-/attacker-controlled value.
 *
 * @param {!HTMLAnchorElement} anchor The anchor element whose href property
 *     is to be assigned to.
 * @param {string|!goog.html.SafeUrl} url The URL to assign.
 * @see goog.html.SafeUrl#sanitize
 */
goog.dom.safe.setAnchorHref = function(anchor, url) {
  'use strict';
  goog.dom.asserts.assertIsHTMLAnchorElement(anchor);
  /** @type {!goog.html.SafeUrl} */
  var safeUrl;
  if (url instanceof goog.html.SafeUrl) {
    safeUrl = url;
  } else {
    safeUrl = goog.html.SafeUrl.sanitizeAssertUnchanged(url);
  }
  anchor.href = goog.html.SafeUrl.unwrap(safeUrl);
};


/**
 * Safely assigns a URL to an image element's src property.
 *
 * If url is of type goog.html.SafeUrl, its value is unwrapped and assigned to
 * image's src property.  If url is of type string however, it is first
 * sanitized using goog.html.SafeUrl.sanitize.
 *
 * @param {!HTMLImageElement} imageElement The image element whose src property
 *     is to be assigned to.
 * @param {string|!goog.html.SafeUrl} url The URL to assign.
 * @see goog.html.SafeUrl#sanitize
 */
goog.dom.safe.setImageSrc = function(imageElement, url) {
  'use strict';
  goog.dom.asserts.assertIsHTMLImageElement(imageElement);
  /** @type {!goog.html.SafeUrl} */
  var safeUrl;
  if (url instanceof goog.html.SafeUrl) {
    safeUrl = url;
  } else {
    var allowDataUrl = /^data:image\//i.test(url);
    safeUrl = goog.html.SafeUrl.sanitizeAssertUnchanged(url, allowDataUrl);
  }
  imageElement.src = goog.html.SafeUrl.unwrap(safeUrl);
};

/**
 * Safely assigns a URL to a audio element's src property.
 *
 * If url is of type goog.html.SafeUrl, its value is unwrapped and assigned to
 * audio's src property.  If url is of type string however, it is first
 * sanitized using goog.html.SafeUrl.sanitize.
 *
 * @param {!HTMLAudioElement} audioElement The audio element whose src property
 *     is to be assigned to.
 * @param {string|!goog.html.SafeUrl} url The URL to assign.
 * @see goog.html.SafeUrl#sanitize
 */
goog.dom.safe.setAudioSrc = function(audioElement, url) {
  'use strict';
  goog.dom.asserts.assertIsHTMLAudioElement(audioElement);
  /** @type {!goog.html.SafeUrl} */
  var safeUrl;
  if (url instanceof goog.html.SafeUrl) {
    safeUrl = url;
  } else {
    var allowDataUrl = /^data:audio\//i.test(url);
    safeUrl = goog.html.SafeUrl.sanitizeAssertUnchanged(url, allowDataUrl);
  }
  audioElement.src = goog.html.SafeUrl.unwrap(safeUrl);
};

/**
 * Safely assigns a URL to a video element's src property.
 *
 * If url is of type goog.html.SafeUrl, its value is unwrapped and assigned to
 * video's src property.  If url is of type string however, it is first
 * sanitized using goog.html.SafeUrl.sanitize.
 *
 * @param {!HTMLVideoElement} videoElement The video element whose src property
 *     is to be assigned to.
 * @param {string|!goog.html.SafeUrl} url The URL to assign.
 * @see goog.html.SafeUrl#sanitize
 */
goog.dom.safe.setVideoSrc = function(videoElement, url) {
  'use strict';
  goog.dom.asserts.assertIsHTMLVideoElement(videoElement);
  /** @type {!goog.html.SafeUrl} */
  var safeUrl;
  if (url instanceof goog.html.SafeUrl) {
    safeUrl = url;
  } else {
    var allowDataUrl = /^data:video\//i.test(url);
    safeUrl = goog.html.SafeUrl.sanitizeAssertUnchanged(url, allowDataUrl);
  }
  videoElement.src = goog.html.SafeUrl.unwrap(safeUrl);
};

/**
 * Safely assigns a URL to an embed element's src property.
 *
 * Example usage:
 *   goog.dom.safe.setEmbedSrc(embedEl, url);
 * which is a safe alternative to
 *   embedEl.src = url;
 * The latter can result in loading untrusted code unless it is ensured that
 * the URL refers to a trustworthy resource.
 *
 * @param {!HTMLEmbedElement} embed The embed element whose src property
 *     is to be assigned to.
 * @param {!goog.html.TrustedResourceUrl} url The URL to assign.
 */
goog.dom.safe.setEmbedSrc = function(embed, url) {
  'use strict';
  goog.dom.asserts.assertIsHTMLEmbedElement(embed);
  embed.src = goog.html.TrustedResourceUrl.unwrapTrustedScriptURL(url);
};


/**
 * Safely assigns a URL to a frame element's src property.
 *
 * Example usage:
 *   goog.dom.safe.setFrameSrc(frameEl, url);
 * which is a safe alternative to
 *   frameEl.src = url;
 * The latter can result in loading untrusted code unless it is ensured that
 * the URL refers to a trustworthy resource.
 *
 * @param {!HTMLFrameElement} frame The frame element whose src property
 *     is to be assigned to.
 * @param {!goog.html.TrustedResourceUrl} url The URL to assign.
 */
goog.dom.safe.setFrameSrc = function(frame, url) {
  'use strict';
  goog.dom.asserts.assertIsHTMLFrameElement(frame);
  frame.src = goog.html.TrustedResourceUrl.unwrap(url);
};


/**
 * Safely assigns a URL to an iframe element's src property.
 *
 * Example usage:
 *   goog.dom.safe.setIframeSrc(iframeEl, url);
 * which is a safe alternative to
 *   iframeEl.src = url;
 * The latter can result in loading untrusted code unless it is ensured that
 * the URL refers to a trustworthy resource.
 *
 * @param {!HTMLIFrameElement} iframe The iframe element whose src property
 *     is to be assigned to.
 * @param {!goog.html.TrustedResourceUrl} url The URL to assign.
 */
goog.dom.safe.setIframeSrc = function(iframe, url) {
  'use strict';
  goog.dom.asserts.assertIsHTMLIFrameElement(iframe);
  iframe.src = goog.html.TrustedResourceUrl.unwrap(url);
};


/**
 * Safely assigns HTML to an iframe element's srcdoc property.
 *
 * Example usage:
 *   goog.dom.safe.setIframeSrcdoc(iframeEl, safeHtml);
 * which is a safe alternative to
 *   iframeEl.srcdoc = html;
 * The latter can result in loading untrusted code.
 *
 * @param {!HTMLIFrameElement} iframe The iframe element whose srcdoc property
 *     is to be assigned to.
 * @param {!goog.html.SafeHtml} html The HTML to assign.
 */
goog.dom.safe.setIframeSrcdoc = function(iframe, html) {
  'use strict';
  goog.dom.asserts.assertIsHTMLIFrameElement(iframe);
  iframe.srcdoc = goog.html.SafeHtml.unwrapTrustedHTML(html);
};


/**
 * Safely sets a link element's href and rel properties. Whether or not
 * the URL assigned to href has to be a goog.html.TrustedResourceUrl
 * depends on the value of the rel property. If rel contains "stylesheet"
 * then a TrustedResourceUrl is required.
 *
 * Example usage:
 *   goog.dom.safe.setLinkHrefAndRel(linkEl, url, 'stylesheet');
 * which is a safe alternative to
 *   linkEl.rel = 'stylesheet';
 *   linkEl.href = url;
 * The latter can result in loading untrusted code unless it is ensured that
 * the URL refers to a trustworthy resource.
 *
 * @param {!HTMLLinkElement} link The link element whose href property
 *     is to be assigned to.
 * @param {string|!goog.html.SafeUrl|!goog.html.TrustedResourceUrl} url The URL
 *     to assign to the href property. Must be a TrustedResourceUrl if the
 *     value assigned to rel contains "stylesheet". A string value is
 *     sanitized with goog.html.SafeUrl.sanitize.
 * @param {string} rel The value to assign to the rel property.
 * @throws {Error} if rel contains "stylesheet" and url is not a
 *     TrustedResourceUrl
 * @see goog.html.SafeUrl#sanitize
 */
goog.dom.safe.setLinkHrefAndRel = function(link, url, rel) {
  'use strict';
  goog.dom.asserts.assertIsHTMLLinkElement(link);
  link.rel = rel;
  if (goog.string.internal.caseInsensitiveContains(rel, 'stylesheet')) {
    goog.asserts.assert(
        url instanceof goog.html.TrustedResourceUrl,
        'URL must be TrustedResourceUrl because "rel" contains "stylesheet"');
    link.href = goog.html.TrustedResourceUrl.unwrap(url);
  } else if (url instanceof goog.html.TrustedResourceUrl) {
    link.href = goog.html.TrustedResourceUrl.unwrap(url);
  } else if (url instanceof goog.html.SafeUrl) {
    link.href = goog.html.SafeUrl.unwrap(url);
  } else {  // string
    // SafeUrl.sanitize must return legitimate SafeUrl when passed a string.
    link.href = goog.html.SafeUrl.unwrap(
        goog.html.SafeUrl.sanitizeAssertUnchanged(url));
  }
};


/**
 * Safely assigns a URL to an object element's data property.
 *
 * Example usage:
 *   goog.dom.safe.setObjectData(objectEl, url);
 * which is a safe alternative to
 *   objectEl.data = url;
 * The latter can result in loading untrusted code unless setit is ensured that
 * the URL refers to a trustworthy resource.
 *
 * @param {!HTMLObjectElement} object The object element whose data property
 *     is to be assigned to.
 * @param {!goog.html.TrustedResourceUrl} url The URL to assign.
 */
goog.dom.safe.setObjectData = function(object, url) {
  'use strict';
  goog.dom.asserts.assertIsHTMLObjectElement(object);
  object.data = goog.html.TrustedResourceUrl.unwrapTrustedScriptURL(url);
};


/**
 * Safely assigns a URL to a script element's src property.
 *
 * Example usage:
 *   goog.dom.safe.setScriptSrc(scriptEl, url);
 * which is a safe alternative to
 *   scriptEl.src = url;
 * The latter can result in loading untrusted code unless it is ensured that
 * the URL refers to a trustworthy resource.
 *
 * @param {!HTMLScriptElement} script The script element whose src property
 *     is to be assigned to.
 * @param {!goog.html.TrustedResourceUrl} url The URL to assign.
 */
goog.dom.safe.setScriptSrc = function(script, url) {
  'use strict';
  goog.dom.asserts.assertIsHTMLScriptElement(script);
  script.src = goog.html.TrustedResourceUrl.unwrapTrustedScriptURL(url);
  goog.dom.safe.setNonceForScriptElement_(script);
};


/**
 * Safely assigns a value to a script element's content.
 *
 * Example usage:
 *   goog.dom.safe.setScriptContent(scriptEl, content);
 * which is a safe alternative to
 *   scriptEl.text = content;
 * The latter can result in executing untrusted code unless it is ensured that
 * the code is loaded from a trustworthy resource.
 *
 * @param {!HTMLScriptElement} script The script element whose content is being
 *     set.
 * @param {!goog.html.SafeScript} content The content to assign.
 */
goog.dom.safe.setScriptContent = function(script, content) {
  'use strict';
  goog.dom.asserts.assertIsHTMLScriptElement(script);
  script.textContent = goog.html.SafeScript.unwrapTrustedScript(content);
  goog.dom.safe.setNonceForScriptElement_(script);
};


/**
 * Set nonce-based CSPs to dynamically created scripts.
 * @param {!HTMLScriptElement} script The script element whose nonce value
 *     is to be calculated
 * @private
 */
goog.dom.safe.setNonceForScriptElement_ = function(script) {
  'use strict';
  var win = script.ownerDocument && script.ownerDocument.defaultView;
  var nonce = goog.getScriptNonce(win);
  if (nonce) {
    script.setAttribute('nonce', nonce);
  }
};


/**
 * Safely assigns a URL to a Location object's href property.
 *
 * If url is of type goog.html.SafeUrl, its value is unwrapped and assigned to
 * loc's href property.  If url is of type string however, it is first sanitized
 * using goog.html.SafeUrl.sanitize.
 *
 * Example usage:
 *   goog.dom.safe.setLocationHref(document.location, redirectUrl);
 * which is a safe alternative to
 *   document.location.href = redirectUrl;
 * The latter can result in XSS vulnerabilities if redirectUrl is a
 * user-/attacker-controlled value.
 *
 * @param {!Location} loc The Location object whose href property is to be
 *     assigned to.
 * @param {string|!goog.html.SafeUrl} url The URL to assign.
 * @see goog.html.SafeUrl#sanitize
 * MOE:begin_intracomment_strip
 * @deprecated Use
 *     google3.javascript.typescript.safevalues.safedom.safedom.location.setHref
 *     instead.
 * MOE:end_intracomment_strip

 */
goog.dom.safe.setLocationHref = function(loc, url) {
  'use strict';
  goog.dom.asserts.assertIsLocation(loc);
  /** @type {!goog.html.SafeUrl} */
  var safeUrl;
  if (url instanceof goog.html.SafeUrl) {
    safeUrl = url;
  } else {
    safeUrl = goog.html.SafeUrl.sanitizeAssertUnchanged(url);
  }
  loc.href = goog.html.SafeUrl.unwrap(safeUrl);
};

/**
 * Safely assigns the URL of a Location object.
 *
 * If url is of type goog.html.SafeUrl, its value is unwrapped and
 * passed to Location#assign. If url is of type string however, it is
 * first sanitized using goog.html.SafeUrl.sanitize.
 *
 * Example usage:
 *   goog.dom.safe.assignLocation(document.location, newUrl);
 * which is a safe alternative to
 *   document.location.assign(newUrl);
 * The latter can result in XSS vulnerabilities if newUrl is a
 * user-/attacker-controlled value.
 *
 * This has the same behaviour as setLocationHref, however some test
 * mock Location.assign instead of a property assignment.
 *
 * @param {!Location} loc The Location object which is to be assigned.
 * @param {string|!goog.html.SafeUrl} url The URL to assign.
 * @see goog.html.SafeUrl#sanitize
 * MOE:begin_intracomment_strip
 * @deprecated Use
 *     google3.javascript.typescript.safevalues.safedom.safedom.location.assign
 *     instead.
 * MOE:end_intracomment_strip
 */
goog.dom.safe.assignLocation = function(loc, url) {
  'use strict';
  goog.dom.asserts.assertIsLocation(loc);
  /** @type {!goog.html.SafeUrl} */
  var safeUrl;
  if (url instanceof goog.html.SafeUrl) {
    safeUrl = url;
  } else {
    safeUrl = goog.html.SafeUrl.sanitizeAssertUnchanged(url);
  }
  loc.assign(goog.html.SafeUrl.unwrap(safeUrl));
};


/**
 * Safely replaces the URL of a Location object.
 *
 * If url is of type goog.html.SafeUrl, its value is unwrapped and
 * passed to Location#replace. If url is of type string however, it is
 * first sanitized using goog.html.SafeUrl.sanitize.
 *
 * Example usage:
 *   goog.dom.safe.replaceLocation(document.location, newUrl);
 * which is a safe alternative to
 *   document.location.replace(newUrl);
 * The latter can result in XSS vulnerabilities if newUrl is a
 * user-/attacker-controlled value.
 *
 * @param {!Location} loc The Location object which is to be replaced.
 * @param {string|!goog.html.SafeUrl} url The URL to assign.
 * @see goog.html.SafeUrl#sanitize
 * MOE:begin_intracomment_strip
 * @deprecated Use
 *     google3.javascript.typescript.safevalues.safedom.safedom.location.replace
 *     instead.
 * MOE:end_intracomment_strip
 */
goog.dom.safe.replaceLocation = function(loc, url) {
  'use strict';
  /** @type {!goog.html.SafeUrl} */
  var safeUrl;
  if (url instanceof goog.html.SafeUrl) {
    safeUrl = url;
  } else {
    safeUrl = goog.html.SafeUrl.sanitizeAssertUnchanged(url);
  }
  loc.replace(goog.html.SafeUrl.unwrap(safeUrl));
};


/**
 * Safely opens a URL in a new window (via window.open).
 *
 * If url is of type goog.html.SafeUrl, its value is unwrapped and passed in to
 * window.open.  If url is of type string however, it is first sanitized
 * using goog.html.SafeUrl.sanitize.
 *
 * Note that this function does not prevent leakages via the referer that is
 * sent by window.open. It is advised to only use this to open 1st party URLs.
 *
 * Example usage:
 *   goog.dom.safe.openInWindow(url);
 * which is a safe alternative to
 *   window.open(url);
 * The latter can result in XSS vulnerabilities if url is a
 * user-/attacker-controlled value.
 *
 * @param {string|!goog.html.SafeUrl} url The URL to open.
 * @param {Window=} opt_openerWin Window of which to call the .open() method.
 *     Defaults to the global window.
 * @param {!goog.string.Const|string=} opt_name Name of the window to open in.
 *     Can be _top, etc as allowed by window.open(). This accepts string for
 *     legacy reasons. Pass goog.string.Const if possible.
 * @param {string=} opt_specs Comma-separated list of specifications, same as
 *     in window.open().
 * @param {boolean=} opt_replace Whether to replace the current entry in browser
 *     history, same as in window.open().
 * @return {Window} Window the url was opened in.
 */
goog.dom.safe.openInWindow = function(
    url, opt_openerWin, opt_name, opt_specs, opt_replace) {
  'use strict';
  /** @type {!goog.html.SafeUrl} */
  var safeUrl;
  if (url instanceof goog.html.SafeUrl) {
    safeUrl = url;
  } else {
    safeUrl = goog.html.SafeUrl.sanitizeAssertUnchanged(url);
  }
  var win = opt_openerWin || goog.global;
  // If opt_name is undefined, simply passing that in to open() causes IE to
  // reuse the current window instead of opening a new one. Thus we pass '' in
  // instead, which according to spec opens a new window. See
  // https://html.spec.whatwg.org/multipage/browsers.html#dom-open .
  var name = opt_name instanceof goog.string.Const ?
      goog.string.Const.unwrap(opt_name) :
      opt_name || '';
  // Do not pass opt_specs and opt_replace to window.open unless they were
  // provided by the caller. IE11 will use it as a signal to open a new window
  // rather than a new tab (even if they're undefined).
  if (opt_specs !== undefined || opt_replace !== undefined) {
    return win.open(
        goog.html.SafeUrl.unwrap(safeUrl), name, opt_specs, opt_replace);
  } else {
    return win.open(goog.html.SafeUrl.unwrap(safeUrl), name);
  }
};


/**
 * Parses the HTML as 'text/html'.
 * @param {!DOMParser} parser
 * @param {!goog.html.SafeHtml} html The HTML to be parsed.
 * @return {!Document}
 */
goog.dom.safe.parseFromStringHtml = function(parser, html) {
  'use strict';
  return goog.dom.safe.parseFromString(parser, html, 'text/html');
};


/**
 * Parses the string.
 * @param {!DOMParser} parser
 * @param {!goog.html.SafeHtml} content Note: We don't have a special type for
 *     XML or SVG supported by this function so we use SafeHtml.
 * @param {string} type
 * @return {!Document}
 */
goog.dom.safe.parseFromString = function(parser, content, type) {
  'use strict';
  return parser.parseFromString(
      goog.html.SafeHtml.unwrapTrustedHTML(content), type);
};


/**
 * Safely creates an HTMLImageElement from a Blob.
 *
 * Example usage:
 *     goog.dom.safe.createImageFromBlob(blob);
 * which is a safe alternative to
 *     image.src = createObjectUrl(blob)
 * The latter can result in executing malicious same-origin scripts from a bad
 * Blob.
 * @param {!Blob} blob The blob to create the image from.
 * @return {!HTMLImageElement} The image element created from the blob.
 * @throws {!Error} If called with a Blob with a MIME type other than image/.*.
 */
goog.dom.safe.createImageFromBlob = function(blob) {
  'use strict';
  // Any image/* MIME type is accepted as safe.
  if (!/^image\/.*/g.test(blob.type)) {
    throw new Error(
        'goog.dom.safe.createImageFromBlob only accepts MIME type image/.*.');
  }
  var objectUrl = goog.global.URL.createObjectURL(blob);
  var image = new goog.global.Image();
  image.onload = function() {
    'use strict';
    goog.global.URL.revokeObjectURL(objectUrl);
  };
  goog.dom.safe.setImageSrc(
      image,
      goog.html.uncheckedconversions
          .safeUrlFromStringKnownToSatisfyTypeContract(
              goog.string.Const.from('Image blob URL.'), objectUrl));
  return image;
};

/**
 * Creates a DocumentFragment by parsing html in the context of a Range.
 * @param {!Range} range The Range object starting from the context node to
 * create a fragment in.
 * @param {!goog.html.SafeHtml} html HTML to create a fragment from.
 * @return {?DocumentFragment}
 */
goog.dom.safe.createContextualFragment = function(range, html) {
  'use strict';
  return range.createContextualFragment(
      goog.html.SafeHtml.unwrapTrustedHTML(html));
};

/**
 * Returns CSP style nonce, if set for any <style> or <link rel="stylesheet">
 * tag.
 * @param {?Window=} opt_window The window context used to retrieve the nonce.
 *     Defaults to global context.
 * @return {string} CSP nonce or empty string if no nonce is present.
 */
goog.dom.safe.getStyleNonce = function(opt_window) {
  if (opt_window && opt_window != goog.global) {
    return goog.dom.safe.getNonce_(opt_window.document, 'style');
  }
  if (goog.dom.safe.cspStyleNonce_ === null) {
    goog.dom.safe.cspStyleNonce_ =
        goog.dom.safe.getNonce_(goog.global.document, 'style');
  }
  return goog.dom.safe.cspStyleNonce_;
};

/** @private {?string} */
goog.dom.safe.cspStyleNonce_ = null;

/**
 * According to the CSP3 spec a nonce must be a valid base64 string.
 * @see https://www.w3.org/TR/CSP3/#grammardef-base64-value
 * @private @const
 */
goog.dom.safe.NONCE_PATTERN_ = /^[\w+/_-]+[=]{0,2}$/;

/**
 * Returns CSP nonce, if set for any tag of given type.
 * @param {!Document} doc
 * @param {string} tag 'script' or 'style'. For 'style', if no <style> tag with
 *     nonce is found, <link rel="stylesheet"> is used.
 * @return {string} CSP nonce or empty string if no nonce is present.
 * @private
 */
goog.dom.safe.getNonce_ = function(doc, tag) {
  if (!doc.querySelector) {
    return '';
  }
  let el = doc.querySelector(tag + '[nonce]');
  if (!el && tag == 'style') {
    // Try to get style nonce from <link rel="stylesheet">.
    el = doc.querySelector('link[rel="stylesheet"][nonce]');
  }
  if (el) {
    // Try to get the nonce from the IDL property first, because browsers that
    // implement additional nonce protection features (currently only Chrome) to
    // prevent nonce stealing via CSS do not expose the nonce via attributes.
    // See https://github.com/whatwg/html/issues/2369
    const nonce = el['nonce'] || el.getAttribute('nonce');
    if (nonce && goog.dom.safe.NONCE_PATTERN_.test(nonce)) {
      return nonce;
    }
  }
  return '';
};

//third_party/javascript/closure/string/string.js
/**
 * @license
 * Copyright The Closure Library Authors.
 * SPDX-License-Identifier: Apache-2.0
 */

/**
 * @fileoverview Utilities for string manipulation.
 */


/**
 * Namespace for string utilities
 */
goog.provide('goog.string');
goog.provide('goog.string.Unicode');

goog.require('goog.dom.safe');
goog.require('goog.html.uncheckedconversions');
goog.require('goog.string.Const');
goog.require('goog.string.internal');


/**
 * @define {boolean} Enables HTML escaping of lowercase letter "e" which helps
 * with detection of double-escaping as this letter is frequently used.
 */
goog.string.DETECT_DOUBLE_ESCAPING =
    goog.define('goog.string.DETECT_DOUBLE_ESCAPING', false);


/**
 * @define {boolean} Whether to force non-dom html unescaping.
 */
goog.string.FORCE_NON_DOM_HTML_UNESCAPING =
    goog.define('goog.string.FORCE_NON_DOM_HTML_UNESCAPING', false);


/**
 * Common Unicode string characters.
 * @enum {string}
 */
goog.string.Unicode = {
  NBSP: '\xa0'
};


/**
 * Fast prefix-checker.
 * @param {string} str The string to check.
 * @param {string} prefix A string to look for at the start of `str`.
 * @return {boolean} True if `str` begins with `prefix`.
 */
goog.string.startsWith = goog.string.internal.startsWith;


/**
 * Fast suffix-checker.
 * @param {string} str The string to check.
 * @param {string} suffix A string to look for at the end of `str`.
 * @return {boolean} True if `str` ends with `suffix`.
 */
goog.string.endsWith = goog.string.internal.endsWith;


/**
 * Case-insensitive prefix-checker.
 * @param {string} str The string to check.
 * @param {string} prefix  A string to look for at the end of `str`.
 * @return {boolean} True if `str` begins with `prefix` (ignoring
 *     case).
 */
goog.string.caseInsensitiveStartsWith =
    goog.string.internal.caseInsensitiveStartsWith;


/**
 * Case-insensitive suffix-checker.
 * @param {string} str The string to check.
 * @param {string} suffix A string to look for at the end of `str`.
 * @return {boolean} True if `str` ends with `suffix` (ignoring
 *     case).
 */
goog.string.caseInsensitiveEndsWith =
    goog.string.internal.caseInsensitiveEndsWith;


/**
 * Case-insensitive equality checker.
 * @param {string} str1 First string to check.
 * @param {string} str2 Second string to check.
 * @return {boolean} True if `str1` and `str2` are the same string,
 *     ignoring case.
 */
goog.string.caseInsensitiveEquals = goog.string.internal.caseInsensitiveEquals;


/**
 * Does simple python-style string substitution.
 * subs("foo%s hot%s", "bar", "dog") becomes "foobar hotdog".
 * @param {string} str The string containing the pattern.
 * @param {...*} var_args The items to substitute into the pattern.
 * @return {string} A copy of `str` in which each occurrence of
 *     {@code %s} has been replaced an argument from `var_args`.
 */
goog.string.subs = function(str, var_args) {
  'use strict';
  const splitParts = str.split('%s');
  let returnString = '';

  const subsArguments = Array.prototype.slice.call(arguments, 1);
  while (subsArguments.length &&
         // Replace up to the last split part. We are inserting in the
         // positions between split parts.
         splitParts.length > 1) {
    returnString += splitParts.shift() + subsArguments.shift();
  }

  return returnString + splitParts.join('%s');  // Join unused '%s'
};


/**
 * Converts multiple whitespace chars (spaces, non-breaking-spaces, new lines
 * and tabs) to a single space, and strips leading and trailing whitespace.
 * @param {string} str Input string.
 * @return {string} A copy of `str` with collapsed whitespace.
 */
goog.string.collapseWhitespace = function(str) {
  'use strict';
  // Since IE doesn't include non-breaking-space (0xa0) in their \s character
  // class (as required by section 7.2 of the ECMAScript spec), we explicitly
  // include it in the regexp to enforce consistent cross-browser behavior.
  return str.replace(/[\s\xa0]+/g, ' ').replace(/^\s+|\s+$/g, '');
};


/**
 * Checks if a string is empty or contains only whitespaces.
 * @param {string} str The string to check.
 * @return {boolean} Whether `str` is empty or whitespace only.
 */
goog.string.isEmptyOrWhitespace = goog.string.internal.isEmptyOrWhitespace;


/**
 * Checks if a string is empty.
 * @param {string} str The string to check.
 * @return {boolean} Whether `str` is empty.
 */
goog.string.isEmptyString = function(str) {
  'use strict';
  return str.length == 0;
};


/**
 * Checks if a string is empty or contains only whitespaces.
 *
 * @param {string} str The string to check.
 * @return {boolean} Whether `str` is empty or whitespace only.
 * @deprecated Use goog.string.isEmptyOrWhitespace instead.
 */
goog.string.isEmpty = goog.string.isEmptyOrWhitespace;


/**
 * Checks if a string is null, undefined, empty or contains only whitespaces.
 * @param {*} str The string to check.
 * @return {boolean} Whether `str` is null, undefined, empty, or
 *     whitespace only.
 * @deprecated Use goog.string.isEmptyOrWhitespace(goog.string.makeSafe(str))
 *     instead.
 */
goog.string.isEmptyOrWhitespaceSafe = function(str) {
  'use strict';
  return goog.string.isEmptyOrWhitespace(goog.string.makeSafe(str));
};


/**
 * Checks if a string is null, undefined, empty or contains only whitespaces.
 *
 * @param {*} str The string to check.
 * @return {boolean} Whether `str` is null, undefined, empty, or
 *     whitespace only.
 * @deprecated Use goog.string.isEmptyOrWhitespace instead.
 */
goog.string.isEmptySafe = goog.string.isEmptyOrWhitespaceSafe;


/**
 * Checks if a string is all breaking whitespace.
 * @param {string} str The string to check.
 * @return {boolean} Whether the string is all breaking whitespace.
 */
goog.string.isBreakingWhitespace = function(str) {
  'use strict';
  return !/[^\t\n\r ]/.test(str);
};


/**
 * Checks if a string contains all letters.
 * @param {string} str string to check.
 * @return {boolean} True if `str` consists entirely of letters.
 */
goog.string.isAlpha = function(str) {
  'use strict';
  return !/[^a-zA-Z]/.test(str);
};


/**
 * Checks if a string contains only numbers.
 * @param {*} str string to check. If not a string, it will be
 *     casted to one.
 * @return {boolean} True if `str` is numeric.
 */
goog.string.isNumeric = function(str) {
  'use strict';
  return !/[^0-9]/.test(str);
};


/**
 * Checks if a string contains only numbers or letters.
 * @param {string} str string to check.
 * @return {boolean} True if `str` is alphanumeric.
 */
goog.string.isAlphaNumeric = function(str) {
  'use strict';
  return !/[^a-zA-Z0-9]/.test(str);
};


/**
 * Checks if a character is a space character.
 * @param {string} ch Character to check.
 * @return {boolean} True if `ch` is a space.
 */
goog.string.isSpace = function(ch) {
  'use strict';
  return ch == ' ';
};


/**
 * Checks if a character is a valid unicode character.
 * @param {string} ch Character to check.
 * @return {boolean} True if `ch` is a valid unicode character.
 */
goog.string.isUnicodeChar = function(ch) {
  'use strict';
  return ch.length == 1 && ch >= ' ' && ch <= '~' ||
      ch >= '\u0080' && ch <= '\uFFFD';
};


/**
 * Takes a string and replaces newlines with a space. Multiple lines are
 * replaced with a single space.
 * @param {string} str The string from which to strip newlines.
 * @return {string} A copy of `str` stripped of newlines.
 */
goog.string.stripNewlines = function(str) {
  'use strict';
  return str.replace(/(\r\n|\r|\n)+/g, ' ');
};


/**
 * Replaces Windows and Mac new lines with unix style: \r or \r\n with \n.
 * @param {string} str The string to in which to canonicalize newlines.
 * @return {string} `str` A copy of {@code} with canonicalized newlines.
 */
goog.string.canonicalizeNewlines = function(str) {
  'use strict';
  return str.replace(/(\r\n|\r|\n)/g, '\n');
};


/**
 * Normalizes whitespace in a string, replacing all whitespace chars with
 * a space.
 * @param {string} str The string in which to normalize whitespace.
 * @return {string} A copy of `str` with all whitespace normalized.
 */
goog.string.normalizeWhitespace = function(str) {
  'use strict';
  return str.replace(/\xa0|\s/g, ' ');
};


/**
 * Normalizes spaces in a string, replacing all consecutive spaces and tabs
 * with a single space. Replaces non-breaking space with a space.
 * @param {string} str The string in which to normalize spaces.
 * @return {string} A copy of `str` with all consecutive spaces and tabs
 *    replaced with a single space.
 */
goog.string.normalizeSpaces = function(str) {
  'use strict';
  return str.replace(/\xa0|[ \t]+/g, ' ');
};


/**
 * Removes the breaking spaces from the left and right of the string and
 * collapses the sequences of breaking spaces in the middle into single spaces.
 * The original and the result strings render the same way in HTML.
 * @param {string} str A string in which to collapse spaces.
 * @return {string} Copy of the string with normalized breaking spaces.
 */
goog.string.collapseBreakingSpaces = function(str) {
  'use strict';
  return str.replace(/[\t\r\n ]+/g, ' ')
      .replace(/^[\t\r\n ]+|[\t\r\n ]+$/g, '');
};


/**
 * Trims white spaces to the left and right of a string.
 * @param {string} str The string to trim.
 * @return {string} A trimmed copy of `str`.
 */
goog.string.trim = goog.string.internal.trim;


/**
 * Trims whitespaces at the left end of a string.
 * @param {string} str The string to left trim.
 * @return {string} A trimmed copy of `str`.
 */
goog.string.trimLeft = function(str) {
  'use strict';
  // Since IE doesn't include non-breaking-space (0xa0) in their \s character
  // class (as required by section 7.2 of the ECMAScript spec), we explicitly
  // include it in the regexp to enforce consistent cross-browser behavior.
  return str.replace(/^[\s\xa0]+/, '');
};


/**
 * Trims whitespaces at the right end of a string.
 * @param {string} str The string to right trim.
 * @return {string} A trimmed copy of `str`.
 */
goog.string.trimRight = function(str) {
  'use strict';
  // Since IE doesn't include non-breaking-space (0xa0) in their \s character
  // class (as required by section 7.2 of the ECMAScript spec), we explicitly
  // include it in the regexp to enforce consistent cross-browser behavior.
  return str.replace(/[\s\xa0]+$/, '');
};


/**
 * A string comparator that ignores case.
 * -1 = str1 less than str2
 *  0 = str1 equals str2
 *  1 = str1 greater than str2
 *
 * @param {string} str1 The string to compare.
 * @param {string} str2 The string to compare `str1` to.
 * @return {number} The comparator result, as described above.
 */
goog.string.caseInsensitiveCompare =
    goog.string.internal.caseInsensitiveCompare;


/**
 * Compares two strings interpreting their numeric substrings as numbers.
 *
 * @param {string} str1 First string.
 * @param {string} str2 Second string.
 * @param {!RegExp} tokenizerRegExp Splits a string into substrings of
 *     non-negative integers, non-numeric characters and optionally fractional
 *     numbers starting with a decimal point.
 * @return {number} Negative if str1 < str2, 0 is str1 == str2, positive if
 *     str1 > str2.
 * @private
 */
goog.string.numberAwareCompare_ = function(str1, str2, tokenizerRegExp) {
  'use strict';
  if (str1 == str2) {
    return 0;
  }
  if (!str1) {
    return -1;
  }
  if (!str2) {
    return 1;
  }

  // Using match to split the entire string ahead of time turns out to be faster
  // for most inputs than using RegExp.exec or iterating over each character.
  const tokens1 = str1.toLowerCase().match(tokenizerRegExp);
  const tokens2 = str2.toLowerCase().match(tokenizerRegExp);

  const count = Math.min(tokens1.length, tokens2.length);

  for (let i = 0; i < count; i++) {
    const a = tokens1[i];
    const b = tokens2[i];

    // Compare pairs of tokens, returning if one token sorts before the other.
    if (a != b) {
      // Only if both tokens are integers is a special comparison required.
      // Decimal numbers are sorted as strings (e.g., '.09' < '.1').
      const num1 = parseInt(a, 10);
      if (!isNaN(num1)) {
        const num2 = parseInt(b, 10);
        if (!isNaN(num2) && num1 - num2) {
          return num1 - num2;
        }
      }
      return a < b ? -1 : 1;
    }
  }

  // If one string is a substring of the other, the shorter string sorts first.
  if (tokens1.length != tokens2.length) {
    return tokens1.length - tokens2.length;
  }

  // The two strings must be equivalent except for case (perfect equality is
  // tested at the head of the function.) Revert to default ASCII string
  // comparison to stabilize the sort.
  return str1 < str2 ? -1 : 1;
};


/**
 * String comparison function that handles non-negative integer numbers in a
 * way humans might expect. Using this function, the string 'File 2.jpg' sorts
 * before 'File 10.jpg', and 'Version 1.9' before 'Version 1.10'. The comparison
 * is mostly case-insensitive, though strings that are identical except for case
 * are sorted with the upper-case strings before lower-case.
 *
 * This comparison function is up to 50x slower than either the default or the
 * case-insensitive compare. It should not be used in time-critical code, but
 * should be fast enough to sort several hundred short strings (like filenames)
 * with a reasonable delay.
 *
 * @param {string} str1 The string to compare in a numerically sensitive way.
 * @param {string} str2 The string to compare `str1` to.
 * @return {number} less than 0 if str1 < str2, 0 if str1 == str2, greater than
 *     0 if str1 > str2.
 */
goog.string.intAwareCompare = function(str1, str2) {
  'use strict';
  return goog.string.numberAwareCompare_(str1, str2, /\d+|\D+/g);
};


/**
 * String comparison function that handles non-negative integer and fractional
 * numbers in a way humans might expect. Using this function, the string
 * 'File 2.jpg' sorts before 'File 10.jpg', and '3.14' before '3.2'. Equivalent
 * to {@link goog.string.intAwareCompare} apart from the way how it interprets
 * dots.
 *
 * @param {string} str1 The string to compare in a numerically sensitive way.
 * @param {string} str2 The string to compare `str1` to.
 * @return {number} less than 0 if str1 < str2, 0 if str1 == str2, greater than
 *     0 if str1 > str2.
 */
goog.string.floatAwareCompare = function(str1, str2) {
  'use strict';
  return goog.string.numberAwareCompare_(str1, str2, /\d+|\.\d+|\D+/g);
};


/**
 * Alias for {@link goog.string.floatAwareCompare}.
 *
 * @param {string} str1
 * @param {string} str2
 * @return {number}
 */
goog.string.numerateCompare = goog.string.floatAwareCompare;


/**
 * URL-encodes a string
 * @param {*} str The string to url-encode.
 * @return {string} An encoded copy of `str` that is safe for urls.
 *     Note that '#', ':', and other characters used to delimit portions
 *     of URLs *will* be encoded.
 */
goog.string.urlEncode = function(str) {
  'use strict';
  return encodeURIComponent(String(str));
};


/**
 * URL-decodes the string. We need to specially handle '+'s because
 * the javascript library doesn't convert them to spaces.
 * @param {string} str The string to url decode.
 * @return {string} The decoded `str`.
 */
goog.string.urlDecode = function(str) {
  'use strict';
  return decodeURIComponent(str.replace(/\+/g, ' '));
};


/**
 * Converts \n to <br>s or <br />s.
 * @param {string} str The string in which to convert newlines.
 * @param {boolean=} opt_xml Whether to use XML compatible tags.
 * @return {string} A copy of `str` with converted newlines.
 */
goog.string.newLineToBr = goog.string.internal.newLineToBr;


/**
 * Escapes double quote '"' and single quote '\'' characters in addition to
 * '&', '<', and '>' so that a string can be included in an HTML tag attribute
 * value within double or single quotes.
 *
 * It should be noted that > doesn't need to be escaped for the HTML or XML to
 * be valid, but it has been decided to escape it for consistency with other
 * implementations.
 *
 * With goog.string.DETECT_DOUBLE_ESCAPING, this function escapes also the
 * lowercase letter "e".
 *
 * NOTE(pupius):
 * HtmlEscape is often called during the generation of large blocks of HTML.
 * Using statics for the regular expressions and strings is an optimization
 * that can more than half the amount of time IE spends in this function for
 * large apps, since strings and regexes both contribute to GC allocations.
 *
 * Testing for the presence of a character before escaping increases the number
 * of function calls, but actually provides a speed increase for the average
 * case -- since the average case often doesn't require the escaping of all 4
 * characters and indexOf() is much cheaper than replace().
 * The worst case does suffer slightly from the additional calls, therefore the
 * opt_isLikelyToContainHtmlChars option has been included for situations
 * where all 4 HTML entities are very likely to be present and need escaping.
 *
 * Some benchmarks (times tended to fluctuate +-0.05ms):
 *                                     FireFox                     IE6
 * (no chars / average (mix of cases) / all 4 chars)
 * no checks                     0.13 / 0.22 / 0.22         0.23 / 0.53 / 0.80
 * indexOf                       0.08 / 0.17 / 0.26         0.22 / 0.54 / 0.84
 * indexOf + re test             0.07 / 0.17 / 0.28         0.19 / 0.50 / 0.85
 *
 * An additional advantage of checking if replace actually needs to be called
 * is a reduction in the number of object allocations, so as the size of the
 * application grows the difference between the various methods would increase.
 *
 * @param {string} str string to be escaped.
 * @param {boolean=} opt_isLikelyToContainHtmlChars Don't perform a check to see
 *     if the character needs replacing - use this option if you expect each of
 *     the characters to appear often. Leave false if you expect few html
 *     characters to occur in your strings, such as if you are escaping HTML.
 * @return {string} An escaped copy of `str`.
 */
goog.string.htmlEscape = function(str, opt_isLikelyToContainHtmlChars) {
  'use strict';
  str = goog.string.internal.htmlEscape(str, opt_isLikelyToContainHtmlChars);
  if (goog.string.DETECT_DOUBLE_ESCAPING) {
    str = str.replace(goog.string.E_RE_, '&#101;');
  }
  return str;
};


/**
 * Regular expression that matches a lowercase letter "e", for use in escaping.
 * @const {!RegExp}
 * @private
 */
goog.string.E_RE_ = /e/g;


/**
 * Unescapes an HTML string.
 *
 * @param {string} str The string to unescape.
 * @return {string} An unescaped copy of `str`.
 */
goog.string.unescapeEntities = function(str) {
  'use strict';
  if (goog.string.contains(str, '&')) {
    // We are careful not to use a DOM if we do not have one or we explicitly
    // requested non-DOM html unescaping.
    if (!goog.string.FORCE_NON_DOM_HTML_UNESCAPING &&
        'document' in goog.global) {
      return goog.string.unescapeEntitiesUsingDom_(str);
    } else {
      // Fall back on pure XML entities
      return goog.string.unescapePureXmlEntities_(str);
    }
  }
  return str;
};


/**
 * Unescapes a HTML string using the provided document.
 *
 * @param {string} str The string to unescape.
 * @param {!Document} document A document to use in escaping the string.
 * @return {string} An unescaped copy of `str`.
 */
goog.string.unescapeEntitiesWithDocument = function(str, document) {
  'use strict';
  if (goog.string.contains(str, '&')) {
    return goog.string.unescapeEntitiesUsingDom_(str, document);
  }
  return str;
};


/**
 * Unescapes an HTML string using a DOM to resolve non-XML, non-numeric
 * entities. This function is XSS-safe and whitespace-preserving.
 * @private
 * @param {string} str The string to unescape.
 * @param {Document=} opt_document An optional document to use for creating
 *     elements. If this is not specified then the default window.document
 *     will be used.
 * @return {string} The unescaped `str` string.
 */
goog.string.unescapeEntitiesUsingDom_ = function(str, opt_document) {
  'use strict';
  /** @type {!Object<string, string>} */
  const seen = {'&amp;': '&', '&lt;': '<', '&gt;': '>', '&quot;': '"'};
  /** @type {!Element} */
  let div;
  if (opt_document) {
    div = opt_document.createElement('div');
  } else {
    div = goog.global.document.createElement('div');
  }
  // Match as many valid entity characters as possible. If the actual entity
  // happens to be shorter, it will still work as innerHTML will return the
  // trailing characters unchanged. Since the entity characters do not include
  // open angle bracket, there is no chance of XSS from the innerHTML use.
  // Since no whitespace is passed to innerHTML, whitespace is preserved.
  return str.replace(goog.string.HTML_ENTITY_PATTERN_, function(s, entity) {
    'use strict';
    // Check for cached entity.
    let value = seen[s];
    if (value) {
      return value;
    }
    // Check for numeric entity.
    if (entity.charAt(0) == '#') {
      // Prefix with 0 so that hex entities (e.g. &#x10) parse as hex numbers.
      const n = Number('0' + entity.substr(1));
      if (!isNaN(n)) {
        value = String.fromCharCode(n);
      }
    }
    // Fall back to innerHTML otherwise.
    if (!value) {
      // Append a non-entity character to avoid a bug in Webkit that parses
      // an invalid entity at the end of innerHTML text as the empty string.
      goog.dom.safe.setInnerHtml(
          div,
          goog.html.uncheckedconversions
              .safeHtmlFromStringKnownToSatisfyTypeContract(
                  goog.string.Const.from('Single HTML entity.'), s + ' '));
      // Then remove the trailing character from the result.
      value = div.firstChild.nodeValue.slice(0, -1);
    }
    // Cache and return.
    return seen[s] = value;
  });
};


/**
 * Unescapes XML entities.
 * @private
 * @param {string} str The string to unescape.
 * @return {string} An unescaped copy of `str`.
 */
goog.string.unescapePureXmlEntities_ = function(str) {
  'use strict';
  return str.replace(/&([^;]+);/g, function(s, entity) {
    'use strict';
    switch (entity) {
      case 'amp':
        return '&';
      case 'lt':
        return '<';
      case 'gt':
        return '>';
      case 'quot':
        return '"';
      default:
        if (entity.charAt(0) == '#') {
          // Prefix with 0 so that hex entities (e.g. &#x10) parse as hex.
          const n = Number('0' + entity.substr(1));
          if (!isNaN(n)) {
            return String.fromCharCode(n);
          }
        }
        // For invalid entities we just return the entity
        return s;
    }
  });
};


/**
 * Regular expression that matches an HTML entity.
 * See also HTML5: Tokenization / Tokenizing character references.
 * @private
 * @type {!RegExp}
 */
goog.string.HTML_ENTITY_PATTERN_ = /&([^;\s<&]+);?/g;


/**
 * Do escaping of whitespace to preserve spatial formatting. We use character
 * entity #160 to make it safer for xml.
 * @param {string} str The string in which to escape whitespace.
 * @param {boolean=} opt_xml Whether to use XML compatible tags.
 * @return {string} An escaped copy of `str`.
 */
goog.string.whitespaceEscape = function(str, opt_xml) {
  'use strict';
  // This doesn't use goog.string.preserveSpaces for backwards compatibility.
  return goog.string.newLineToBr(str.replace(/  /g, ' &#160;'), opt_xml);
};


/**
 * Preserve spaces that would be otherwise collapsed in HTML by replacing them
 * with non-breaking space Unicode characters.
 * @param {string} str The string in which to preserve whitespace.
 * @return {string} A copy of `str` with preserved whitespace.
 */
goog.string.preserveSpaces = function(str) {
  'use strict';
  return str.replace(/(^|[\n ]) /g, '$1' + goog.string.Unicode.NBSP);
};


/**
 * Strip quote characters around a string.  The second argument is a string of
 * characters to treat as quotes.  This can be a single character or a string of
 * multiple character and in that case each of those are treated as possible
 * quote characters. For example:
 *
 * <pre>
 * goog.string.stripQuotes('"abc"', '"`') --> 'abc'
 * goog.string.stripQuotes('`abc`', '"`') --> 'abc'
 * </pre>
 *
 * @param {string} str The string to strip.
 * @param {string} quoteChars The quote characters to strip.
 * @return {string} A copy of `str` without the quotes.
 */
goog.string.stripQuotes = function(str, quoteChars) {
  'use strict';
  const length = quoteChars.length;
  for (let i = 0; i < length; i++) {
    const quoteChar = length == 1 ? quoteChars : quoteChars.charAt(i);
    if (str.charAt(0) == quoteChar && str.charAt(str.length - 1) == quoteChar) {
      return str.substring(1, str.length - 1);
    }
  }
  return str;
};


/**
 * Truncates a string to a certain length and adds '...' if necessary.  The
 * length also accounts for the ellipsis, so a maximum length of 10 and a string
 * 'Hello World!' produces 'Hello W...'.
 * @param {string} str The string to truncate.
 * @param {number} chars Max number of characters.
 * @param {boolean=} opt_protectEscapedCharacters Whether to protect escaped
 *     characters from being cut off in the middle.
 * @return {string} The truncated `str` string.
 */
goog.string.truncate = function(str, chars, opt_protectEscapedCharacters) {
  'use strict';
  if (opt_protectEscapedCharacters) {
    str = goog.string.unescapeEntities(str);
  }

  if (str.length > chars) {
    str = str.substring(0, chars - 3) + '...';
  }

  if (opt_protectEscapedCharacters) {
    str = goog.string.htmlEscape(str);
  }

  return str;
};


/**
 * Truncate a string in the middle, adding "..." if necessary,
 * and favoring the beginning of the string.
 * @param {string} str The string to truncate the middle of.
 * @param {number} chars Max number of characters.
 * @param {boolean=} opt_protectEscapedCharacters Whether to protect escaped
 *     characters from being cutoff in the middle.
 * @param {number=} opt_trailingChars Optional number of trailing characters to
 *     leave at the end of the string, instead of truncating as close to the
 *     middle as possible.
 * @return {string} A truncated copy of `str`.
 */
goog.string.truncateMiddle = function(
    str, chars, opt_protectEscapedCharacters, opt_trailingChars) {
  'use strict';
  if (opt_protectEscapedCharacters) {
    str = goog.string.unescapeEntities(str);
  }

  if (opt_trailingChars && str.length > chars) {
    if (opt_trailingChars > chars) {
      opt_trailingChars = chars;
    }
    const endPoint = str.length - opt_trailingChars;
    const startPoint = chars - opt_trailingChars;
    str = str.substring(0, startPoint) + '...' + str.substring(endPoint);
  } else if (str.length > chars) {
    // Favor the beginning of the string:
    let half = Math.floor(chars / 2);
    const endPos = str.length - half;
    half += chars % 2;
    str = str.substring(0, half) + '...' + str.substring(endPos);
  }

  if (opt_protectEscapedCharacters) {
    str = goog.string.htmlEscape(str);
  }

  return str;
};


/**
 * Special chars that need to be escaped for goog.string.quote.
 * @private {!Object<string, string>}
 */
goog.string.specialEscapeChars_ = {
  '\0': '\\0',
  '\b': '\\b',
  '\f': '\\f',
  '\n': '\\n',
  '\r': '\\r',
  '\t': '\\t',
  '\x0B': '\\x0B',  // '\v' is not supported in JScript
  '"': '\\"',
  '\\': '\\\\',
  // To support the use case of embedding quoted strings inside of script
  // tags, we have to make sure HTML comments and opening/closing script tags do
  // not appear in the resulting string. The specific strings that must be
  // escaped are documented at:
  // https://html.spec.whatwg.org/multipage/scripting.html#restrictions-for-contents-of-script-elements
  '<': '\\u003C'  // NOTE: JSON.parse crashes on '\\x3c'.
};


/**
 * Character mappings used internally for goog.string.escapeChar.
 * @private {!Object<string, string>}
 */
goog.string.jsEscapeCache_ = {
  '\'': '\\\''
};


/**
 * Encloses a string in double quotes and escapes characters so that the
 * string is a valid JS string. The resulting string is safe to embed in
 * `<script>` tags as "<" is escaped.
 * @param {string} s The string to quote.
 * @return {string} A copy of `s` surrounded by double quotes.
 */
goog.string.quote = function(s) {
  'use strict';
  s = String(s);
  const sb = ['"'];
  for (let i = 0; i < s.length; i++) {
    const ch = s.charAt(i);
    const cc = ch.charCodeAt(0);
    sb[i + 1] = goog.string.specialEscapeChars_[ch] ||
        ((cc > 31 && cc < 127) ? ch : goog.string.escapeChar(ch));
  }
  sb.push('"');
  return sb.join('');
};


/**
 * Takes a string and returns the escaped string for that input string.
 * @param {string} str The string to escape.
 * @return {string} An escaped string representing `str`.
 */
goog.string.escapeString = function(str) {
  'use strict';
  const sb = [];
  for (let i = 0; i < str.length; i++) {
    sb[i] = goog.string.escapeChar(str.charAt(i));
  }
  return sb.join('');
};


/**
 * Takes a character and returns the escaped string for that character. For
 * example escapeChar(String.fromCharCode(15)) -> "\\x0E".
 * @param {string} c The character to escape.
 * @return {string} An escaped string representing `c`.
 */
goog.string.escapeChar = function(c) {
  'use strict';
  if (c in goog.string.jsEscapeCache_) {
    return goog.string.jsEscapeCache_[c];
  }

  if (c in goog.string.specialEscapeChars_) {
    return goog.string.jsEscapeCache_[c] = goog.string.specialEscapeChars_[c];
  }

  let rv = c;
  const cc = c.charCodeAt(0);
  if (cc > 31 && cc < 127) {
    rv = c;
  } else {
    // tab is 9 but handled above
    if (cc < 256) {
      rv = '\\x';
      if (cc < 16 || cc > 256) {
        rv += '0';
      }
    } else {
      rv = '\\u';
      if (cc < 4096) {  // \u1000
        rv += '0';
      }
    }
    rv += cc.toString(16).toUpperCase();
  }

  return goog.string.jsEscapeCache_[c] = rv;
};


/**
 * Determines whether a string contains a substring.
 * @param {string} str The string to search.
 * @param {string} subString The substring to search for.
 * @return {boolean} Whether `str` contains `subString`.
 */
goog.string.contains = goog.string.internal.contains;


/**
 * Determines whether a string contains a substring, ignoring case.
 * @param {string} str The string to search.
 * @param {string} subString The substring to search for.
 * @return {boolean} Whether `str` contains `subString`.
 */
goog.string.caseInsensitiveContains =
    goog.string.internal.caseInsensitiveContains;


/**
 * Returns the non-overlapping occurrences of ss in s.
 * If either s or ss evalutes to false, then returns zero.
 * @param {string} s The string to look in.
 * @param {string} ss The string to look for.
 * @return {number} Number of occurrences of ss in s.
 */
goog.string.countOf = function(s, ss) {
  'use strict';
  return s && ss ? s.split(ss).length - 1 : 0;
};


/**
 * Removes a substring of a specified length at a specific
 * index in a string.
 * @param {string} s The base string from which to remove.
 * @param {number} index The index at which to remove the substring.
 * @param {number} stringLength The length of the substring to remove.
 * @return {string} A copy of `s` with the substring removed or the full
 *     string if nothing is removed or the input is invalid.
 */
goog.string.removeAt = function(s, index, stringLength) {
  'use strict';
  let resultStr = s;
  // If the index is greater or equal to 0 then remove substring
  if (index >= 0 && index < s.length && stringLength > 0) {
    resultStr = s.substr(0, index) +
        s.substr(index + stringLength, s.length - index - stringLength);
  }
  return resultStr;
};


/**
 * Removes the first occurrence of a substring from a string.
 * @param {string} str The base string from which to remove.
 * @param {string} substr The string to remove.
 * @return {string} A copy of `str` with `substr` removed or the
 *     full string if nothing is removed.
 */
goog.string.remove = function(str, substr) {
  'use strict';
  return str.replace(substr, '');
};


/**
 *  Removes all occurrences of a substring from a string.
 *  @param {string} s The base string from which to remove.
 *  @param {string} ss The string to remove.
 *  @return {string} A copy of `s` with `ss` removed or the full
 *      string if nothing is removed.
 */
goog.string.removeAll = function(s, ss) {
  'use strict';
  const re = new RegExp(goog.string.regExpEscape(ss), 'g');
  return s.replace(re, '');
};


/**
 *  Replaces all occurrences of a substring of a string with a new substring.
 *  @param {string} s The base string from which to remove.
 *  @param {string} ss The string to replace.
 *  @param {string} replacement The replacement string.
 *  @return {string} A copy of `s` with `ss` replaced by
 *      `replacement` or the original string if nothing is replaced.
 */
goog.string.replaceAll = function(s, ss, replacement) {
  'use strict';
  const re = new RegExp(goog.string.regExpEscape(ss), 'g');
  return s.replace(re, replacement.replace(/\$/g, '$$$$'));
};


/**
 * Escapes characters in the string that are not safe to use in a RegExp.
 * @param {*} s The string to escape. If not a string, it will be casted
 *     to one.
 * @return {string} A RegExp safe, escaped copy of `s`.
 */
goog.string.regExpEscape = function(s) {
  'use strict';
  return String(s)
      .replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g, '\\$1')
      .replace(/\x08/g, '\\x08');
};


/**
 * Repeats a string n times.
 * @param {string} string The string to repeat.
 * @param {number} length The number of times to repeat.
 * @return {string} A string containing `length` repetitions of
 *     `string`.
 */
goog.string.repeat = (String.prototype.repeat) ? function(string, length) {
  'use strict';
  // The native method is over 100 times faster than the alternative.
  return string.repeat(length);
} : function(string, length) {
  'use strict';
  return new Array(length + 1).join(string);
};


/**
 * Pads number to given length and optionally rounds it to a given precision.
 * For example:
 * <pre>padNumber(1.25, 2, 3) -> '01.250'
 * padNumber(1.25, 2) -> '01.25'
 * padNumber(1.25, 2, 1) -> '01.3'
 * padNumber(1.25, 0) -> '1.25'</pre>
 *
 * @param {number} num The number to pad.
 * @param {number} length The desired length.
 * @param {number=} opt_precision The desired precision.
 * @return {string} `num` as a string with the given options.
 */
goog.string.padNumber = function(num, length, opt_precision) {
  'use strict';
  const s =
      (opt_precision !== undefined) ? num.toFixed(opt_precision) : String(num);
  let index = s.indexOf('.');
  if (index == -1) {
    index = s.length;
  }
  return goog.string.repeat('0', Math.max(0, length - index)) + s;
};


/**
 * Returns a string representation of the given object, with
 * null and undefined being returned as the empty string.
 *
 * @param {*} obj The object to convert.
 * @return {string} A string representation of the `obj`.
 */
goog.string.makeSafe = function(obj) {
  'use strict';
  return obj == null ? '' : String(obj);
};


/**
 * Concatenates string expressions. This is useful
 * since some browsers are very inefficient when it comes to using plus to
 * concat strings. Be careful when using null and undefined here since
 * these will not be included in the result. If you need to represent these
 * be sure to cast the argument to a String first.
 * For example:
 * <pre>buildString('a', 'b', 'c', 'd') -> 'abcd'
 * buildString(null, undefined) -> ''
 * </pre>
 * @param {...*} var_args A list of strings to concatenate. If not a string,
 *     it will be casted to one.
 * @return {string} The concatenation of `var_args`.
 */
goog.string.buildString = function(var_args) {
  'use strict';
  return Array.prototype.join.call(arguments, '');
};


/**
 * Returns a string with at least 64-bits of randomness.
 *
 * Doesn't trust JavaScript's random function entirely. Uses a combination of
 * random and current timestamp, and then encodes the string in base-36 to
 * make it shorter.
 *
 * @return {string} A random string, e.g. sn1s7vb4gcic.
 */
goog.string.getRandomString = function() {
  'use strict';
  const x = 2147483648;
  return Math.floor(Math.random() * x).toString(36) +
      Math.abs(Math.floor(Math.random() * x) ^ goog.now()).toString(36);
};


/**
 * Compares two version numbers.
 *
 * @param {string|number} version1 Version of first item.
 * @param {string|number} version2 Version of second item.
 *
 * @return {number}  1 if `version1` is higher.
 *                   0 if arguments are equal.
 *                  -1 if `version2` is higher.
 */
goog.string.compareVersions = goog.string.internal.compareVersions;


/**
 * String hash function similar to java.lang.String.hashCode().
 * The hash code for a string is computed as
 * s[0] * 31 ^ (n - 1) + s[1] * 31 ^ (n - 2) + ... + s[n - 1],
 * where s[i] is the ith character of the string and n is the length of
 * the string. We mod the result to make it between 0 (inclusive) and 2^32
 * (exclusive).
 * @param {string} str A string.
 * @return {number} Hash value for `str`, between 0 (inclusive) and 2^32
 *  (exclusive). The empty string returns 0.
 */
goog.string.hashCode = function(str) {
  'use strict';
  let result = 0;
  for (let i = 0; i < str.length; ++i) {
    // Normalize to 4 byte range, 0 ... 2^32.
    result = (31 * result + str.charCodeAt(i)) >>> 0;
  }
  return result;
};


/**
 * The most recent unique ID. |0 is equivalent to Math.floor in this case.
 * @type {number}
 * @private
 */
goog.string.uniqueStringCounter_ = Math.random() * 0x80000000 | 0;


/**
 * Generates and returns a string which is unique in the current document.
 * This is useful, for example, to create unique IDs for DOM elements.
 * @return {string} A unique id.
 */
goog.string.createUniqueString = function() {
  'use strict';
  return 'goog_' + goog.string.uniqueStringCounter_++;
};


/**
 * Converts the supplied string to a number, which may be Infinity or NaN.
 * This function strips whitespace: (toNumber(' 123') === 123)
 * This function accepts scientific notation: (toNumber('1e1') === 10)
 *
 * This is better than JavaScript's built-in conversions because, sadly:
 *     (Number(' ') === 0) and (parseFloat('123a') === 123)
 *
 * @param {string} str The string to convert.
 * @return {number} The number the supplied string represents, or NaN.
 */
goog.string.toNumber = function(str) {
  'use strict';
  const num = Number(str);
  if (num == 0 && goog.string.isEmptyOrWhitespace(str)) {
    return NaN;
  }
  return num;
};


/**
 * Returns whether the given string is lower camel case (e.g. "isFooBar").
 *
 * Note that this assumes the string is entirely letters.
 * @see http://en.wikipedia.org/wiki/CamelCase#Variations_and_synonyms
 *
 * @param {string} str String to test.
 * @return {boolean} Whether the string is lower camel case.
 */
goog.string.isLowerCamelCase = function(str) {
  'use strict';
  return /^[a-z]+([A-Z][a-z]*)*$/.test(str);
};


/**
 * Returns whether the given string is upper camel case (e.g. "FooBarBaz").
 *
 * Note that this assumes the string is entirely letters.
 * @see http://en.wikipedia.org/wiki/CamelCase#Variations_and_synonyms
 *
 * @param {string} str String to test.
 * @return {boolean} Whether the string is upper camel case.
 */
goog.string.isUpperCamelCase = function(str) {
  'use strict';
  return /^([A-Z][a-z]*)+$/.test(str);
};


/**
 * Converts a string from selector-case to camelCase (e.g. from
 * "multi-part-string" to "multiPartString"), useful for converting
 * CSS selectors and HTML dataset keys to their equivalent JS properties.
 * @param {string} str The string in selector-case form.
 * @return {string} The string in camelCase form.
 */
goog.string.toCamelCase = function(str) {
  'use strict';
  return String(str).replace(/\-([a-z])/g, function(all, match) {
    'use strict';
    return match.toUpperCase();
  });
};


/**
 * Converts a string from camelCase to selector-case (e.g. from
 * "multiPartString" to "multi-part-string"), useful for converting JS
 * style and dataset properties to equivalent CSS selectors and HTML keys.
 * @param {string} str The string in camelCase form.
 * @return {string} The string in selector-case form.
 */
goog.string.toSelectorCase = function(str) {
  'use strict';
  return String(str).replace(/([A-Z])/g, '-$1').toLowerCase();
};


/**
 * Converts a string into TitleCase. First character of the string is always
 * capitalized in addition to the first letter of every subsequent word.
 * Words are delimited by one or more whitespaces by default. Custom delimiters
 * can optionally be specified to replace the default, which doesn't preserve
 * whitespace delimiters and instead must be explicitly included if needed.
 *
 * Default delimiter => " ":
 *    goog.string.toTitleCase('oneTwoThree')    => 'OneTwoThree'
 *    goog.string.toTitleCase('one two three')  => 'One Two Three'
 *    goog.string.toTitleCase('  one   two   ') => '  One   Two   '
 *    goog.string.toTitleCase('one_two_three')  => 'One_two_three'
 *    goog.string.toTitleCase('one-two-three')  => 'One-two-three'
 *
 * Custom delimiter => "_-.":
 *    goog.string.toTitleCase('oneTwoThree', '_-.')       => 'OneTwoThree'
 *    goog.string.toTitleCase('one two three', '_-.')     => 'One two three'
 *    goog.string.toTitleCase('  one   two   ', '_-.')    => '  one   two   '
 *    goog.string.toTitleCase('one_two_three', '_-.')     => 'One_Two_Three'
 *    goog.string.toTitleCase('one-two-three', '_-.')     => 'One-Two-Three'
 *    goog.string.toTitleCase('one...two...three', '_-.') => 'One...Two...Three'
 *    goog.string.toTitleCase('one. two. three', '_-.')   => 'One. two. three'
 *    goog.string.toTitleCase('one-two.three', '_-.')     => 'One-Two.Three'
 *
 * @param {string} str String value in camelCase form.
 * @param {string=} opt_delimiters Custom delimiter character set used to
 *      distinguish words in the string value. Each character represents a
 *      single delimiter. When provided, default whitespace delimiter is
 *      overridden and must be explicitly included if needed.
 * @return {string} String value in TitleCase form.
 */
goog.string.toTitleCase = function(str, opt_delimiters) {
  'use strict';
  let delimiters = (typeof opt_delimiters === 'string') ?
      goog.string.regExpEscape(opt_delimiters) :
      '\\s';

  // For IE8, we need to prevent using an empty character set. Otherwise,
  // incorrect matching will occur.
  delimiters = delimiters ? '|[' + delimiters + ']+' : '';

  const regexp = new RegExp('(^' + delimiters + ')([a-z])', 'g');
  return str.replace(regexp, function(all, p1, p2) {
    'use strict';
    return p1 + p2.toUpperCase();
  });
};


/**
 * Capitalizes a string, i.e. converts the first letter to uppercase
 * and all other letters to lowercase, e.g.:
 *
 * goog.string.capitalize('one')     => 'One'
 * goog.string.capitalize('ONE')     => 'One'
 * goog.string.capitalize('one two') => 'One two'
 *
 * Note that this function does not trim initial whitespace.
 *
 * @param {string} str String value to capitalize.
 * @return {string} String value with first letter in uppercase.
 */
goog.string.capitalize = function(str) {
  'use strict';
  return String(str.charAt(0)).toUpperCase() +
      String(str.substr(1)).toLowerCase();
};


/**
 * Parse a string in decimal or hexidecimal ('0xFFFF') form.
 *
 * To parse a particular radix, please use parseInt(string, radix) directly. See
 * https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/parseInt
 *
 * This is a wrapper for the built-in parseInt function that will only parse
 * numbers as base 10 or base 16.  Some JS implementations assume strings
 * starting with "0" are intended to be octal. ES3 allowed but discouraged
 * this behavior. ES5 forbids it.  This function emulates the ES5 behavior.
 *
 * For more information, see Mozilla JS Reference: http://goo.gl/8RiFj
 *
 * @param {string|number|null|undefined} value The value to be parsed.
 * @return {number} The number, parsed. If the string failed to parse, this
 *     will be NaN.
 */
goog.string.parseInt = function(value) {
  'use strict';
  // Force finite numbers to strings.
  if (isFinite(value)) {
    value = String(value);
  }

  if (typeof value === 'string') {
    // If the string starts with '0x' or '-0x', parse as hex.
    return /^\s*-?0x/i.test(value) ? parseInt(value, 16) : parseInt(value, 10);
  }

  return NaN;
};


/**
 * Splits a string on a separator a limited number of times.
 *
 * This implementation is more similar to Python or Java, where the limit
 * parameter specifies the maximum number of splits rather than truncating
 * the number of results.
 *
 * See http://docs.python.org/2/library/stdtypes.html#str.split
 * See JavaDoc: http://goo.gl/F2AsY
 * See Mozilla reference: http://goo.gl/dZdZs
 *
 * @param {string} str String to split.
 * @param {string} separator The separator.
 * @param {number} limit The limit to the number of splits. The resulting array
 *     will have a maximum length of limit+1.  Negative numbers are the same
 *     as zero.
 * @return {!Array<string>} The string, split.
 */
goog.string.splitLimit = function(str, separator, limit) {
  'use strict';
  const parts = str.split(separator);
  const returnVal = [];

  // Only continue doing this while we haven't hit the limit and we have
  // parts left.
  while (limit > 0 && parts.length) {
    returnVal.push(parts.shift());
    limit--;
  }

  // If there are remaining parts, append them to the end.
  if (parts.length) {
    returnVal.push(parts.join(separator));
  }

  return returnVal;
};


/**
 * Finds the characters to the right of the last instance of any separator
 *
 * This function is similar to goog.string.path.baseName, except it can take a
 * list of characters to split the string on. It will return the rightmost
 * grouping of characters to the right of any separator as a left-to-right
 * oriented string.
 *
 * @see goog.string.path.baseName
 * @param {string} str The string
 * @param {string|!Array<string>} separators A list of separator characters
 * @return {string} The last part of the string with respect to the separators
 */
goog.string.lastComponent = function(str, separators) {
  'use strict';
  if (!separators) {
    return str;
  } else if (typeof separators == 'string') {
    separators = [separators];
  }

  let lastSeparatorIndex = -1;
  for (let i = 0; i < separators.length; i++) {
    if (separators[i] == '') {
      continue;
    }
    const currentSeparatorIndex = str.lastIndexOf(separators[i]);
    if (currentSeparatorIndex > lastSeparatorIndex) {
      lastSeparatorIndex = currentSeparatorIndex;
    }
  }
  if (lastSeparatorIndex == -1) {
    return str;
  }
  return str.slice(lastSeparatorIndex + 1);
};


/**
 * Computes the Levenshtein edit distance between two strings.
 * @param {string} a
 * @param {string} b
 * @return {number} The edit distance between the two strings.
 */
goog.string.editDistance = function(a, b) {
  'use strict';
  const v0 = [];
  const v1 = [];

  if (a == b) {
    return 0;
  }

  if (!a.length || !b.length) {
    return Math.max(a.length, b.length);
  }

  for (let i = 0; i < b.length + 1; i++) {
    v0[i] = i;
  }

  for (let i = 0; i < a.length; i++) {
    v1[0] = i + 1;

    for (let j = 0; j < b.length; j++) {
      const cost = Number(a[i] != b[j]);
      // Cost for the substring is the minimum of adding one character, removing
      // one character, or a swap.
      v1[j + 1] = Math.min(v1[j] + 1, v0[j + 1] + 1, v0[j] + cost);
    }

    for (let j = 0; j < v0.length; j++) {
      v0[j] = v1[j];
    }
  }

  return v1[b.length];
};

//javascript/apps/jspb/binary/utils.js
goog.loadModule(function(exports) {'use strict';/**
 * @fileoverview This file contains helper code used by BinaryReader
 * and BinaryWriter.
 *
 * @author aappleby@google.com (Austin Appleby)
 */

goog.module('jspb.utils');
goog.module.declareLegacyNamespace();

const BinaryConstants = goog.require('jspb.BinaryConstants');
const ByteSource = goog.require('jspb.ByteSource');
const crypt = goog.require('goog.crypt');
const gstring = goog.require('goog.string');
const {assert, fail} = goog.require('goog.asserts');

/**
 * Javascript can't natively handle 64-bit data types, so to manipulate them we
 * have to split them into two 32-bit halves and do the math manually.
 *
 * Instead of instantiating and passing small structures around to do this, we
 * instead just use two global temporary values. This one stores the low 32
 * bits of a split value - for example, if the original value was a 64-bit
 * integer, this temporary value will contain the low 32 bits of that integer.
 * If the original value was a double, this temporary value will contain the
 * low 32 bits of the binary representation of that double, etcetera.
 * @type {number}
 */
let split64Low = 0;


/**
 * And correspondingly, this temporary variable will contain the high 32 bits
 * of whatever value was split.
 * @type {number}
 */
let split64High = 0;


/**
 * Splits an unsigned Javascript integer into two 32-bit halves and stores it
 * in the temp values above.
 * @param {number} value The number to split.
 */
function splitUint64(value) {
  // Extract low 32 bits and high 32 bits as unsigned integers.
  var lowBits = value >>> 0;
  var highBits =
      Math.floor((value - lowBits) / BinaryConstants.TWO_TO_32) >>> 0;

  split64Low = lowBits;
  split64High = highBits;
}


/**
 * Splits a signed Javascript integer into two 32-bit halves and stores it in
 * the temp values above.
 * @param {number} value The number to split.
 */
function splitInt64(value) {
  // Convert to sign-magnitude representation.
  var sign = (value < 0);
  value = Math.abs(value);

  // Extract low 32 bits and high 32 bits as unsigned integers.
  var lowBits = value >>> 0;
  var highBits = Math.floor((value - lowBits) / BinaryConstants.TWO_TO_32);
  highBits = highBits >>> 0;

  // Perform two's complement conversion if the sign bit was set.
  if (sign) {
    highBits = ~highBits >>> 0;
    lowBits = ~lowBits >>> 0;
    lowBits += 1;
    if (lowBits > 0xFFFFFFFF) {
      lowBits = 0;
      highBits++;
      if (highBits > 0xFFFFFFFF) highBits = 0;
    }
  }

  split64Low = lowBits;
  split64High = highBits;
}


/**
 * Convers a signed Javascript integer into zigzag format, splits it into two
 * 32-bit halves, and stores it in the temp values above.
 * @param {number} value The number to split.
 */
function splitZigzag64(value) {
  // Convert to sign-magnitude and scale by 2 before we split the value.
  var sign = (value < 0);
  value = Math.abs(value) * 2;

  splitUint64(value);
  var lowBits = split64Low;
  var highBits = split64High;

  // If the value is negative, subtract 1 from the split representation so we
  // don't lose the sign bit due to precision issues.
  if (sign) {
    if (lowBits == 0) {
      if (highBits == 0) {
        lowBits = 0xFFFFFFFF;
        highBits = 0xFFFFFFFF;
      } else {
        highBits--;
        lowBits = 0xFFFFFFFF;
      }
    } else {
      lowBits--;
    }
  }

  split64Low = lowBits;
  split64High = highBits;
}


/**
 * Converts a floating-point number into 32-bit IEEE representation and stores
 * it in the temp values above.
 * @param {number} value
 */
function splitFloat32(value) {
  var sign = (value < 0) ? 1 : 0;
  value = sign ? -value : value;
  var exp;
  var mant;

  // Handle zeros.
  if (value === 0) {
    if ((1 / value) > 0) {
      // Positive zero.
      split64High = 0;
      split64Low = 0x00000000;
    } else {
      // Negative zero.
      split64High = 0;
      split64Low = 0x80000000;
    }
    return;
  }

  // Handle nans.
  if (isNaN(value)) {
    split64High = 0;
    split64Low = 0x7FFFFFFF;
    return;
  }

  // Handle infinities.
  if (value > BinaryConstants.FLOAT32_MAX) {
    split64High = 0;
    split64Low = ((sign << 31) | (0x7F800000)) >>> 0;
    return;
  }

  // Handle denormals.
  if (value < BinaryConstants.FLOAT32_MIN) {
    // Number is a denormal.
    mant = Math.round(value / Math.pow(2, -149));
    split64High = 0;
    split64Low = ((sign << 31) | mant) >>> 0;
    return;
  }

  exp = Math.floor(Math.log(value) / Math.LN2);
  mant = value * Math.pow(2, -exp);
  mant = Math.round(mant * BinaryConstants.TWO_TO_23) & 0x7FFFFF;

  split64High = 0;
  split64Low = ((sign << 31) | ((exp + 127) << 23) | mant) >>> 0;
}


/**
 * Converts a floating-point number into 64-bit IEEE representation and stores
 * it in the temp values above.
 * @param {number} value
 */
function splitFloat64(value) {
  var sign = (value < 0) ? 1 : 0;
  value = sign ? -value : value;

  // Handle zeros.
  if (value === 0) {
    if ((1 / value) > 0) {
      // Positive zero.
      split64High = 0x00000000;
      split64Low = 0x00000000;
    } else {
      // Negative zero.
      split64High = 0x80000000;
      split64Low = 0x00000000;
    }
    return;
  }

  // Handle nans.
  if (isNaN(value)) {
    split64High = 0x7FFFFFFF;
    split64Low = 0xFFFFFFFF;
    return;
  }

  // Handle infinities.
  if (value > BinaryConstants.FLOAT64_MAX) {
    split64High = ((sign << 31) | (0x7FF00000)) >>> 0;
    split64Low = 0;
    return;
  }

  // Handle denormals.
  if (value < BinaryConstants.FLOAT64_MIN) {
    // Number is a denormal.
    var mant = value / Math.pow(2, -1074);
    var mantHigh = (mant / BinaryConstants.TWO_TO_32);
    split64High = ((sign << 31) | mantHigh) >>> 0;
    split64Low = (mant >>> 0);
    return;
  }

  // Compute the least significant exponent needed to represent the magnitude of
  // the value by repeadly dividing/multiplying by 2 until the magnitude
  // crosses 2. While tempting to use log math to find the exponent, at the
  // bounadaries of precision, the result can be off by one.
  var maxDoubleExponent = 1023;
  var minDoubleExponent = -1022;
  var x = value;
  var exp = 0;
  if (x >= 2) {
    while (x >= 2 && exp < maxDoubleExponent) {
      exp++;
      x = x / 2;
    }
  } else {
    while (x < 1 && exp > minDoubleExponent) {
      x = x * 2;
      exp--;
    }
  }
  var mant = value * Math.pow(2, -exp);

  var mantHigh = (mant * BinaryConstants.TWO_TO_20) & 0xFFFFF;
  var mantLow = (mant * BinaryConstants.TWO_TO_52) >>> 0;

  split64High = ((sign << 31) | ((exp + 1023) << 20) | mantHigh) >>> 0;
  split64Low = mantLow;
}


/**
 * Converts an 8-character hash string into two 32-bit numbers and stores them
 * in the temp values above.
 * @param {string} hash
 */
function splitHash64(hash) {
  var a = hash.charCodeAt(0);
  var b = hash.charCodeAt(1);
  var c = hash.charCodeAt(2);
  var d = hash.charCodeAt(3);
  var e = hash.charCodeAt(4);
  var f = hash.charCodeAt(5);
  var g = hash.charCodeAt(6);
  var h = hash.charCodeAt(7);

  split64Low = (a + (b << 8) + (c << 16) + (d << 24)) >>> 0;
  split64High = (e + (f << 8) + (g << 16) + (h << 24)) >>> 0;
}


/**
 * Joins two 32-bit values into a 64-bit unsigned integer. Precision will be
 * lost if the result is greater than 2^52.
 * @param {number} bitsLow
 * @param {number} bitsHigh
 * @return {number}
 */
function joinUint64(bitsLow, bitsHigh) {
  return bitsHigh * BinaryConstants.TWO_TO_32 + (bitsLow >>> 0);
}


/**
 * Joins two 32-bit values into a 64-bit signed integer. Precision will be lost
 * if the result is greater than 2^52.
 * @param {number} bitsLow
 * @param {number} bitsHigh
 * @return {number}
 */
function joinInt64(bitsLow, bitsHigh) {
  // If the high bit is set, do a manual two's complement conversion.
  var sign = (bitsHigh & 0x80000000);
  if (sign) {
    bitsLow = (~bitsLow + 1) >>> 0;
    bitsHigh = ~bitsHigh >>> 0;
    if (bitsLow == 0) {
      bitsHigh = (bitsHigh + 1) >>> 0;
    }
  }

  var result = joinUint64(bitsLow, bitsHigh);
  return sign ? -result : result;
}

/**
 * Converts split 64-bit values from standard two's complement encoding to
 * zig-zag encoding. Invokes the provided function to produce final result.
 *
 * @param {number} bitsLow
 * @param {number} bitsHigh
 * @param {function(number, number): T} convert Conversion function to produce
 *     the result value, takes parameters (lowBits, highBits).
 * @return {T}
 * @template T
 */
function toZigzag64(bitsLow, bitsHigh, convert) {
  // See
  // https://engdoc.corp.google.com/eng/howto/protocolbuffers/developerguide/encoding.shtml?cl=head#types
  // 64-bit math is: (n << 1) ^ (n >> 63)
  //
  // To do this in 32 bits, we can get a 32-bit sign-flipping mask from the
  // high word.
  // Then we can operate on each word individually, with the addition of the
  // "carry" to get the most significant bit from the low word into the high
  // word.
  var signFlipMask = bitsHigh >> 31;
  bitsHigh = (bitsHigh << 1 | bitsLow >>> 31) ^ signFlipMask;
  bitsLow = (bitsLow << 1) ^ signFlipMask;
  return convert(bitsLow, bitsHigh);
}


/**
 * Joins two 32-bit values into a 64-bit unsigned integer and applies zigzag
 * decoding. Precision will be lost if the result is greater than 2^52.
 * @param {number} bitsLow
 * @param {number} bitsHigh
 * @return {number}
 */
function joinZigzag64(bitsLow, bitsHigh) {
  return fromZigzag64(bitsLow, bitsHigh, joinInt64);
}


/**
 * Converts split 64-bit values from zigzag encoding to standard two's
 * complement encoding. Invokes the provided function to produce final result.
 *
 * @param {number} bitsLow
 * @param {number} bitsHigh
 * @param {function(number, number): T} convert Conversion function to produce
 *     the result value, takes parameters (lowBits, highBits).
 * @return {T}
 * @template T
 */
function fromZigzag64(bitsLow, bitsHigh, convert) {
  // 64 bit math is:
  //   signmask = (zigzag & 1) ? -1 : 0;
  //   twosComplement = (zigzag >> 1) ^ signmask;
  //
  // To work with 32 bit, we can operate on both but "carry" the lowest bit
  // from the high word by shifting it up 31 bits to be the most significant bit
  // of the low word.
  var signFlipMask = -(bitsLow & 1);
  bitsLow = ((bitsLow >>> 1) | (bitsHigh << 31)) ^ signFlipMask;
  bitsHigh = (bitsHigh >>> 1) ^ signFlipMask;
  return convert(bitsLow, bitsHigh);
}


/**
 * Joins two 32-bit values into a 32-bit IEEE floating point number and
 * converts it back into a Javascript number.
 * @param {number} bitsLow The low 32 bits of the binary number;
 * @param {number} bitsHigh The high 32 bits of the binary number.
 * @return {number}
 */
function joinFloat32(bitsLow, bitsHigh) {
  var sign = ((bitsLow >> 31) * 2 + 1);
  var exp = (bitsLow >>> 23) & 0xFF;
  var mant = bitsLow & 0x7FFFFF;

  if (exp == 0xFF) {
    if (mant) {
      return NaN;
    } else {
      return sign * Infinity;
    }
  }

  if (exp == 0) {
    // Denormal.
    return sign * Math.pow(2, -149) * mant;
  } else {
    return sign * Math.pow(2, exp - 150) *
           (mant + Math.pow(2, 23));
  }
}


/**
 * Joins two 32-bit values into a 64-bit IEEE floating point number and
 * converts it back into a Javascript number.
 * @param {number} bitsLow The low 32 bits of the binary number;
 * @param {number} bitsHigh The high 32 bits of the binary number.
 * @return {number}
 */
function joinFloat64(bitsLow, bitsHigh) {
  var sign = ((bitsHigh >> 31) * 2 + 1);
  var exp = (bitsHigh >>> 20) & 0x7FF;
  var mant = BinaryConstants.TWO_TO_32 * (bitsHigh & 0xFFFFF) + bitsLow;

  if (exp == 0x7FF) {
    if (mant) {
      return NaN;
    } else {
      return sign * Infinity;
    }
  }

  if (exp == 0) {
    // Denormal.
    return sign * Math.pow(2, -1074) * mant;
  } else {
    return sign * Math.pow(2, exp - 1075) * (mant + BinaryConstants.TWO_TO_52);
  }
}


/**
 * Joins two 32-bit values into an 8-character hash string.
 * @param {number} bitsLow
 * @param {number} bitsHigh
 * @return {string}
 */
function joinHash64(bitsLow, bitsHigh) {
  var a = (bitsLow >>> 0) & 0xFF;
  var b = (bitsLow >>> 8) & 0xFF;
  var c = (bitsLow >>> 16) & 0xFF;
  var d = (bitsLow >>> 24) & 0xFF;
  var e = (bitsHigh >>> 0) & 0xFF;
  var f = (bitsHigh >>> 8) & 0xFF;
  var g = (bitsHigh >>> 16) & 0xFF;
  var h = (bitsHigh >>> 24) & 0xFF;

  return String.fromCharCode(a, b, c, d, e, f, g, h);
}

/**
 * Individual digits for number->string conversion.
 * @const {!Array<string>}
 */
let DIGITS = [
  '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'
];

/** @const {number} '0' */
const ZERO_CHAR_CODE = 48;

/** @const {number} 'a' */
const A_CHAR_CODE = 97;

/**
 * Losslessly converts a 64-bit unsigned integer in 32:32 split representation
 * into a decimal string.
 * @param {number} bitsLow The low 32 bits of the binary number;
 * @param {number} bitsHigh The high 32 bits of the binary number.
 * @return {string} The binary number represented as a string.
 */
function joinUnsignedDecimalString(bitsLow, bitsHigh) {
  // Skip the expensive conversion if the number is small enough to use the
  // built-in conversions.
  if (bitsHigh <= 0x1FFFFF) {
    return '' + (BinaryConstants.TWO_TO_32 * bitsHigh + bitsLow);
  }

  // What this code is doing is essentially converting the input number from
  // base-2 to base-1e7, which allows us to represent the 64-bit range with
  // only 3 (very large) digits. Those digits are then trivial to convert to
  // a base-10 string.

  // The magic numbers used here are -
  // 2^24 = 16777216 = (1,6777216) in base-1e7.
  // 2^48 = 281474976710656 = (2,8147497,6710656) in base-1e7.

  // Split 32:32 representation into 16:24:24 representation so our
  // intermediate digits don't overflow.
  var low = bitsLow & 0xFFFFFF;
  var mid = (((bitsLow >>> 24) | (bitsHigh << 8)) >>> 0) & 0xFFFFFF;
  var high = (bitsHigh >> 16) & 0xFFFF;

  // Assemble our three base-1e7 digits, ignoring carries. The maximum
  // value in a digit at this step is representable as a 48-bit integer, which
  // can be stored in a 64-bit floating point number.
  var digitA = low + (mid * 6777216) + (high * 6710656);
  var digitB = mid + (high * 8147497);
  var digitC = (high * 2);

  // Apply carries from A to B and from B to C.
  var base = 10000000;
  if (digitA >= base) {
    digitB += Math.floor(digitA / base);
    digitA %= base;
  }

  if (digitB >= base) {
    digitC += Math.floor(digitB / base);
    digitB %= base;
  }

  // Convert base-1e7 digits to base-10, with optional leading zeroes.
  function decimalFrom1e7(digit1e7, needLeadingZeros) {
    var partial = digit1e7 ? String(digit1e7) : '';
    if (needLeadingZeros) {
      return '0000000'.slice(partial.length) + partial;
    }
    return partial;
  }

  return decimalFrom1e7(digitC, /*needLeadingZeros=*/ 0) +
      decimalFrom1e7(digitB, /*needLeadingZeros=*/ digitC) +
      // If the final 1e7 digit didn't need leading zeros, we would have
      // returned via the trivial code path at the top.
      decimalFrom1e7(digitA, /*needLeadingZeros=*/ 1);
}


/**
 * Losslessly converts a 64-bit signed integer in 32:32 split representation
 * into a decimal string.
 * @param {number} bitsLow The low 32 bits of the binary number;
 * @param {number} bitsHigh The high 32 bits of the binary number.
 * @return {string} The binary number represented as a string.
 */
function joinSignedDecimalString(bitsLow, bitsHigh) {
  // If we're treating the input as a signed value and the high bit is set, do
  // a manual two's complement conversion before the decimal conversion.
  var negative = (bitsHigh & 0x80000000);
  if (negative) {
    bitsLow = (~bitsLow + 1) >>> 0;
    var carry = (bitsLow == 0) ? 1 : 0;
    bitsHigh = (~bitsHigh + carry) >>> 0;
  }

  var result = joinUnsignedDecimalString(bitsLow, bitsHigh);
  return negative ? '-' + result : result;
}


/**
 * Convert an 8-character hash string representing either a signed or unsigned
 * 64-bit integer into its decimal representation without losing accuracy.
 * @param {string} hash The hash string to convert.
 * @param {boolean} signed True if we should treat the hash string as encoding
 *     a signed integer.
 * @return {string}
 */
function hash64ToDecimalString(hash, signed) {
  splitHash64(hash);
  var bitsLow = split64Low;
  var bitsHigh = split64High;
  return signed ? joinSignedDecimalString(bitsLow, bitsHigh) :
                  joinUnsignedDecimalString(bitsLow, bitsHigh);
}


/**
 * Converts an array of 8-character hash strings into their decimal
 * representations.
 * @param {!Array<string>} hashes The array of hash strings to convert.
 * @param {boolean} signed True if we should treat the hash string as encoding
 *     a signed integer.
 * @return {!Array<string>}
 */
function hash64ArrayToDecimalStrings(hashes, signed) {
  var result = new Array(hashes.length);
  for (var i = 0; i < hashes.length; i++) {
    result[i] = hash64ToDecimalString(hashes[i], signed);
  }
  return result;
}


/**
 * Converts a signed or unsigned decimal string into its hash string
 * representation.
 * @param {string} dec
 * @return {string}
 */
function decimalStringToHash64(dec) {
  assert(dec.length > 0);

  // Check for minus sign.
  var minus = false;
  if (dec[0] === '-') {
    minus = true;
    dec = dec.slice(1);
  }

  // Store result as a byte array.
  var resultBytes = [0, 0, 0, 0, 0, 0, 0, 0];

  // Set result to m*result + c.
  function muladd(m, c) {
    for (var i = 0; i < 8 && (m !== 1 || c > 0); i++) {
      var r = m * resultBytes[i] + c;
      resultBytes[i] = r & 0xFF;
      c = r >>> 8;
    }
  }

  // Negate the result bits.
  function neg() {
    for (var i = 0; i < 8; i++) {
      resultBytes[i] = (~resultBytes[i]) & 0xFF;
    }
  }

  // For each decimal digit, set result to 10*result + digit.
  for (var i = 0; i < dec.length; i++) {
    muladd(10, dec.charCodeAt(i) - ZERO_CHAR_CODE);
  }

  // If there's a minus sign, convert into two's complement.
  if (minus) {
    neg();
    muladd(1, 1);
  }

  return crypt.byteArrayToString(resultBytes);
}


/**
 * Converts a signed or unsigned decimal string into two 32-bit halves, and
 * stores them in the temp variables listed above.
 * @param {string} value The decimal string to convert.
 */
function splitDecimalString(value) {
  splitHash64(decimalStringToHash64(value));
}

/**
 * @param {number} nibble A 4-bit integer.
 * @return {string}
 * @private
 */
function toHexDigit_(nibble) {
  return String.fromCharCode(
      nibble < 10 ? ZERO_CHAR_CODE + nibble : A_CHAR_CODE - 10 + nibble);
}

/**
 * @param {number} hexCharCode
 * @return {number}
 * @private
 */
function fromHexCharCode_(hexCharCode) {
  if (hexCharCode >= A_CHAR_CODE) {
    return hexCharCode - A_CHAR_CODE + 10;
  }
  return hexCharCode - ZERO_CHAR_CODE;
}

/**
 * Converts an 8-character hash string into its hexadecimal representation.
 * @param {string} hash
 * @return {string}
 */
function hash64ToHexString(hash) {
  var temp = new Array(18);
  temp[0] = '0';
  temp[1] = 'x';

  for (var i = 0; i < 8; i++) {
    var c = hash.charCodeAt(7 - i);
    temp[i * 2 + 2] = toHexDigit_(c >> 4);
    temp[i * 2 + 3] = toHexDigit_(c & 0xF);
  }

  var result = temp.join('');
  return result;
}


/**
 * Converts a '0x<16 digits>' hex string into its hash string representation.
 * @param {string} hex
 * @return {string}
 */
function hexStringToHash64(hex) {
  hex = hex.toLowerCase();
  assert(hex.length == 18);
  assert(hex[0] == '0');
  assert(hex[1] == 'x');

  var result = '';
  for (var i = 0; i < 8; i++) {
    var hi = fromHexCharCode_(hex.charCodeAt(i * 2 + 2));
    var lo = fromHexCharCode_(hex.charCodeAt(i * 2 + 3));
    result = String.fromCharCode(hi * 16 + lo) + result;
  }

  return result;
}


/**
 * Convert an 8-character hash string representing either a signed or unsigned
 * 64-bit integer into a Javascript number. Will lose accuracy if the result is
 * larger than 2^52.
 * @param {string} hash The hash string to convert.
 * @param {boolean} signed True if the has should be interpreted as a signed
 *     number.
 * @return {number}
 */
function hash64ToNumber(hash, signed) {
  splitHash64(hash);
  var bitsLow = split64Low;
  var bitsHigh = split64High;
  return signed ? joinInt64(bitsLow, bitsHigh) : joinUint64(bitsLow, bitsHigh);
}


/**
 * Convert a Javascript number into an 8-character hash string. Will lose
 * precision if the value is non-integral or greater than 2^64.
 * @param {number} value The integer to convert.
 * @return {string}
 */
function numberToHash64(value) {
  splitInt64(value);
  return joinHash64(split64Low, split64High);
}


/**
 * Counts the number of contiguous varints in a buffer.
 * @param {!Uint8Array} buffer The buffer to scan.
 * @param {number} start The starting point in the buffer to scan.
 * @param {number} end The end point in the buffer to scan.
 * @return {number} The number of varints in the buffer.
 */
function countVarints(buffer, start, end) {
  // Count how many high bits of each byte were set in the buffer.
  var count = 0;
  for (var i = start; i < end; i++) {
    count += buffer[i] >> 7;
  }

  // The number of varints in the buffer equals the size of the buffer minus
  // the number of non-terminal bytes in the buffer (those with the high bit
  // set).
  return (end - start) - count;
}


/**
 * Counts the number of contiguous varint fields with the given field number in
 * the buffer.
 * @param {!Uint8Array} buffer The buffer to scan.
 * @param {number} start The starting point in the buffer to scan.
 * @param {number} end The end point in the buffer to scan.
 * @param {number} field The field number to count.
 * @return {number} The number of matching fields in the buffer.
 */
function countVarintFields(buffer, start, end, field) {
  var count = 0;
  var cursor = start;
  var tag = field * 8 + BinaryConstants.WireType.VARINT;

  if (tag < 128) {
    // Single-byte field tag, we can use a slightly quicker count.
    while (cursor < end) {
      // Skip the field tag, or exit if we find a non-matching tag.
      if (buffer[cursor++] != tag) return count;

      // Field tag matches, we've found a valid field.
      count++;

      // Skip the varint.
      while (1) {
        var x = buffer[cursor++];
        if ((x & 0x80) == 0) break;
      }
    }
  } else {
    while (cursor < end) {
      // Skip the field tag, or exit if we find a non-matching tag.
      var temp = tag;
      while (temp > 128) {
        if (buffer[cursor] != ((temp & 0x7F) | 0x80)) return count;
        cursor++;
        temp >>= 7;
      }
      if (buffer[cursor++] != temp) return count;

      // Field tag matches, we've found a valid field.
      count++;

      // Skip the varint.
      while (1) {
        var x = buffer[cursor++];
        if ((x & 0x80) == 0) break;
      }
    }
  }
  return count;
}


/**
 * Counts the number of contiguous fixed32 fields with the given tag in the
 * buffer.
 * @param {!Uint8Array} buffer The buffer to scan.
 * @param {number} start The starting point in the buffer to scan.
 * @param {number} end The end point in the buffer to scan.
 * @param {number} tag The tag value to count.
 * @param {number} stride The number of bytes to skip per field.
 * @return {number} The number of fields with a matching tag in the buffer.
 * @private
 */
function countFixedFields_(buffer, start, end, tag, stride) {
  var count = 0;
  var cursor = start;

  if (tag < 128) {
    // Single-byte field tag, we can use a slightly quicker count.
    while (cursor < end) {
      // Skip the field tag, or exit if we find a non-matching tag.
      if (buffer[cursor++] != tag) return count;

      // Field tag matches, we've found a valid field.
      count++;

      // Skip the value.
      cursor += stride;
    }
  } else {
    while (cursor < end) {
      // Skip the field tag, or exit if we find a non-matching tag.
      var temp = tag;
      while (temp > 128) {
        if (buffer[cursor++] != ((temp & 0x7F) | 0x80)) return count;
        temp >>= 7;
      }
      if (buffer[cursor++] != temp) return count;

      // Field tag matches, we've found a valid field.
      count++;

      // Skip the value.
      cursor += stride;
    }
  }
  return count;
}


/**
 * Counts the number of contiguous fixed32 fields with the given field number
 * in the buffer.
 * @param {!Uint8Array} buffer The buffer to scan.
 * @param {number} start The starting point in the buffer to scan.
 * @param {number} end The end point in the buffer to scan.
 * @param {number} field The field number to count.
 * @return {number} The number of matching fields in the buffer.
 */
function countFixed32Fields(buffer, start, end, field) {
  var tag = field * 8 + BinaryConstants.WireType.FIXED32;
  return countFixedFields_(buffer, start, end, tag, 4);
}


/**
 * Counts the number of contiguous fixed64 fields with the given field number
 * in the buffer.
 * @param {!Uint8Array} buffer The buffer to scan.
 * @param {number} start The starting point in the buffer to scan.
 * @param {number} end The end point in the buffer to scan.
 * @param {number} field The field number to count
 * @return {number} The number of matching fields in the buffer.
 */
function countFixed64Fields(buffer, start, end, field) {
  var tag = field * 8 + BinaryConstants.WireType.FIXED64;
  return countFixedFields_(buffer, start, end, tag, 8);
}


/**
 * Counts the number of contiguous delimited fields with the given field number
 * in the buffer.
 * @param {!Uint8Array} buffer The buffer to scan.
 * @param {number} start The starting point in the buffer to scan.
 * @param {number} end The end point in the buffer to scan.
 * @param {number} field The field number to count.
 * @return {number} The number of matching fields in the buffer.
 */
function countDelimitedFields(buffer, start, end, field) {
  var count = 0;
  var cursor = start;
  var tag = field * 8 + BinaryConstants.WireType.DELIMITED;

  while (cursor < end) {
    // Skip the field tag, or exit if we find a non-matching tag.
    var temp = tag;
    while (temp > 128) {
      if (buffer[cursor++] != ((temp & 0x7F) | 0x80)) return count;
      temp >>= 7;
    }
    if (buffer[cursor++] != temp) return count;

    // Field tag matches, we've found a valid field.
    count++;

    // Decode the length prefix.
    var length = 0;
    var shift = 1;
    while (1) {
      temp = buffer[cursor++];
      length += (temp & 0x7f) * shift;
      shift *= 128;
      if ((temp & 0x80) == 0) break;
    }

    // Advance the cursor past the blob.
    cursor += length;
  }
  return count;
}


/**
 * String-ify bytes for text format. Should be optimized away in non-debug.
 * The returned string uses \xXX escapes for all values and is itself quoted.
 * [1, 31] serializes to '"\x01\x1f"'.
 * @param {?ByteSource} byteSource The bytes to serialize.
 * @return {string} Stringified bytes for text format.
 */
function debugBytesToTextFormat(byteSource) {
  var s = '"';
  if (byteSource) {
    var bytes = byteSourceToUint8Array(byteSource);
    for (var i = 0; i < bytes.length; i++) {
      s += '\\x';
      if (bytes[i] < 16) s += '0';
      s += bytes[i].toString(16);
    }
  }
  return s + '"';
}


/**
 * String-ify a scalar for text format. Should be optimized away in non-debug.
 * @param {string|number|boolean} scalar The scalar to stringify.
 * @return {string} Stringified scalar for text format.
 */
function debugScalarToTextFormat(scalar) {
  if (typeof scalar === 'string') {
    return gstring.quote(scalar);
  } else {
    return scalar.toString();
  }
}


/**
 * Utility function: convert a string with codepoints 0--255 inclusive to a
 * Uint8Array. If any codepoints greater than 255 exist in the string, throws an
 * exception.
 * @param {string} str
 * @return {!Uint8Array}
 */
function stringToByteArray(str) {
  var arr = new Uint8Array(str.length);
  for (var i = 0; i < str.length; i++) {
    var codepoint = str.charCodeAt(i);
    if (codepoint > 255) {
      throw new Error('Conversion error: string contains codepoint ' +
                      'outside of byte range');
    }
    arr[i] = codepoint;
  }
  return arr;
}


/**
 * Converts any type defined in ByteSource into a Uint8Array.
 * @param {!ByteSource} data
 * @return {!Uint8Array}
 * @suppress {invalidCasts}
 */
function byteSourceToUint8Array(data) {
  // Comparing a property is much faster than the instanceof test below, so
  // prefer this.
  if (data.constructor === Uint8Array) {
    return /** @type {!Uint8Array} */(data);
  }

  if (data.constructor === ArrayBuffer) {
    data = /** @type {!ArrayBuffer} */(data);
    return /** @type {!Uint8Array} */(new Uint8Array(data));
  }

  if (data.constructor === Array) {
    data = /** @type {!Array<number>} */(data);
    return /** @type {!Uint8Array} */(new Uint8Array(data));
  }

  if (data.constructor === String) {
    data = /** @type {string} */(data);
    return crypt.base64.decodeStringToUint8Array(data);
  }

  if (data instanceof Uint8Array) {
    // Support types like nodejs Buffer (a subclass of Uint8Array).
    data = /** @type {!Uint8Array} */ (data);
    // Make a shallow copy to ensure jspb code only ever deals with Uint8Array
    // exactly to ensure monomorphism.
    return /** @type {!Uint8Array} */ (
        new Uint8Array(data.buffer, data.byteOffset, data.byteLength));
  }

  fail('Type not convertible to Uint8Array.');
  return /** @type {!Uint8Array} */(new Uint8Array(0));
}

/** @return {number} */
function getSplit64Low() {
  return split64Low;
}
/** @return {number} */
function getSplit64High() {
  return split64High;
}

exports = {
  byteSourceToUint8Array,
  countDelimitedFields,
  countFixed32Fields,
  countFixed64Fields,
  countVarintFields,
  countVarints,
  debugBytesToTextFormat,
  debugScalarToTextFormat,
  decimalStringToHash64,
  DIGITS,
  fromZigzag64,
  hash64ArrayToDecimalStrings,
  hash64ToDecimalString,
  hash64ToHexString,
  hash64ToNumber,
  hexStringToHash64,
  joinFloat64,
  joinFloat32,
  joinHash64,
  joinInt64,
  joinSignedDecimalString,
  joinUint64,
  joinUnsignedDecimalString,
  joinZigzag64,
  numberToHash64,
  splitDecimalString,
  splitHash64,
  splitFloat64,
  splitFloat32,
  splitZigzag64,
  splitInt64,
  splitUint64,
  getSplit64Low,
  getSplit64High,
  stringToByteArray,
  toZigzag64,
};

;return exports;});

//javascript/apps/jspb/binary/decoder.js
goog.loadModule(function(exports) {'use strict';/**
 * @fileoverview This file contains utilities for decoding primitive values
 * (signed and unsigned integers, varints, booleans, enums, hashes, strings,
 * and raw bytes) embedded in Uint8Arrays into their corresponding Javascript
 * types.
 *
 * Major caveat - Javascript is unable to accurately represent integers larger
 * than 2^53 due to its use of a double-precision floating point format or all
 * numbers. If you need to guarantee that 64-bit values survive with all bits
 * intact, you _must_ read them using one of the split methods, which return
 * who numbers.
 *
 * @author aappleby@google.com (Austin Appleby)
 */

goog.module('jspb.BinaryDecoder');
goog.module.declareLegacyNamespace();

const ByteSource = goog.require('jspb.ByteSource');
const asserts = goog.require('goog.asserts');
const crypt = goog.require('goog.crypt');
const utils = goog.require('jspb.utils');


class BinaryDecoder {
  /**
   * BinaryDecoder implements the decoders for all the wire types specified in
   * https://developers.google.com/protocol-buffers/docs/encoding.
   *
   * @param {?ByteSource=} bytes The bytes we're reading from.
   * @param {number=} start The optional offset to start reading at.
   * @param {number=} length The optional length of the block to read -
   *     we'll throw an assertion if we go off the end of the block.
   */
  constructor(bytes, start, length) {
    /**
     * Typed byte-wise view of the source buffer.
     * @private {?Uint8Array}
     */
    this.bytes_ = null;

    /**
     * Start point of the block to read.
     * @private {number}
     */
    this.start_ = 0;

    /**
     * End point of the block to read.
     * @private {number}
     */
    this.end_ = 0;

    /**
     * Current read location in bytes_.
     * @private {number}
     */
    this.cursor_ = 0;

    /**
     * Set to true if this decoder encountered an error due to corrupt data.
     * @private {boolean}
     */
    this.error_ = false;

    if (bytes) {
      this.setBlock(bytes, start, length);
    }
  }

  /**
   * Pops an instance off the instance cache, or creates one if the cache is
   * empty.
   * @param {?ByteSource=} bytes The bytes we're reading from.
   * @param {number=} start The optional offset to start reading at.
   * @param {number=} length The optional length of the block to read -
   *     we'll throw an assertion if we go off the end of the block.
   * @return {!BinaryDecoder}
   */
  static alloc(bytes, start, length) {
    if (BinaryDecoder.instanceCache_.length) {
      var newDecoder = BinaryDecoder.instanceCache_.pop();
      if (bytes) {
        newDecoder.setBlock(bytes, start, length);
      }
      return newDecoder;
    } else {
      return new BinaryDecoder(bytes, start, length);
    }
  }

  /**
   * Puts this instance back in the instance cache.
   */
  free() {
    this.clear();
    if (BinaryDecoder.instanceCache_.length < 100) {
      BinaryDecoder.instanceCache_.push(this);
    }
  }

  /**
   * Makes a copy of this decoder.
   * @return {!BinaryDecoder}
   */
  clone() {
    return BinaryDecoder.alloc(
        this.bytes_, this.start_, this.end_ - this.start_);
  }

  /**
   * Clears the decoder.
   */
  clear() {
    this.bytes_ = null;
    this.start_ = 0;
    this.end_ = 0;
    this.cursor_ = 0;
    this.error_ = false;
  }

  /**
   * Returns the raw buffer.
   * @return {?Uint8Array} The raw buffer.
   */
  getBuffer() {
    return this.bytes_;
  }

  /**
   * Changes the block of bytes we're decoding.
   * @param {!ByteSource} data The bytes we're reading from.
   * @param {number=} start The optional offset to start reading at.
   * @param {number=} length The optional length of the block to read -
   *     we'll throw an assertion if we go off the end of the block.
   */
  setBlock(data, start, length) {
    this.bytes_ = utils.byteSourceToUint8Array(data);
    this.start_ = (start !== undefined) ? start : 0;
    this.end_ =
        (length !== undefined) ? this.start_ + length : this.bytes_.length;
    this.cursor_ = this.start_;
  }

  /**
   * @return {number}
   */
  getEnd() {
    return this.end_;
  }


  /**
   * @param {number} end
   */
  setEnd(end) {
    this.end_ = end;
  }

  /**
   * Moves the read cursor back to the start of the block.
   */
  reset() {
    this.cursor_ = this.start_;
  }


  /**
   * Returns the internal read cursor.
   * @return {number} The internal read cursor.
   */
  getCursor() {
    return this.cursor_;
  }

  /**
   * Returns the internal read cursor.
   * @param {number} cursor The new cursor.
   */
  setCursor(cursor) {
    this.cursor_ = cursor;
  }


  /**
   * Advances the stream cursor by the given number of bytes.
   * @param {number} count The number of bytes to advance by.
   */
  advance(count) {
    this.cursor_ += count;
    asserts.assert(this.cursor_ <= this.end_);
  }

  /**
   * Returns true if this decoder is at the end of the block.
   * @return {boolean}
   */
  atEnd() {
    return this.cursor_ == this.end_;
  }


  /**
   * Returns true if this decoder is at the end of the block.
   * @return {boolean}
   */
  pastEnd() {
    return this.cursor_ > this.end_;
  }

  /**
   * Returns true if this decoder encountered an error due to corrupt data.
   * @return {boolean}
   */
  getError() {
    return this.error_ || (this.cursor_ < 0) || (this.cursor_ > this.end_);
  }

  /**
   * Reads an unsigned varint from the binary stream and invokes the conversion
   * function with the value in two signed 32 bit integers to produce the
   * result. Since this does not convert the value to a number, no precision is
   * lost.
   *
   * It's possible for an unsigned varint to be incorrectly encoded - more than
   * 64 bits' worth of data could be present. If this happens, this method will
   * throw an error.
   *
   * Decoding varints requires doing some funny base-128 math - for more
   * details on the format, see
   * https://developers.google.com/protocol-buffers/docs/encoding
   *
   * @param {function(number, number): T} convert Conversion function to produce
   *     the result value, takes parameters (lowBits, highBits).
   * @return {T}
   * @template T
   */
  readSplitVarint64(convert) {
    var temp = 128;
    var lowBits = 0;
    var highBits = 0;

    // Read the first four bytes of the varint, stopping at the terminator if we
    // see it.
    for (var i = 0; i < 4 && temp >= 128; i++) {
      temp = this.bytes_[this.cursor_++];
      lowBits |= (temp & 0x7F) << (i * 7);
    }

    if (temp >= 128) {
      // Read the fifth byte, which straddles the low and high dwords.
      temp = this.bytes_[this.cursor_++];
      lowBits |= (temp & 0x7F) << 28;
      highBits |= (temp & 0x7F) >> 4;
    }

    if (temp >= 128) {
      // Read the sixth through tenth byte.
      for (var i = 0; i < 5 && temp >= 128; i++) {
        temp = this.bytes_[this.cursor_++];
        highBits |= (temp & 0x7F) << (i * 7 + 3);
      }
    }

    if (temp < 128) {
      return convert(lowBits >>> 0, highBits >>> 0);
    }

    // If we did not see the terminator, the encoding was invalid.
    asserts.fail('Failed to read varint, encoding is invalid.');
    this.error_ = true;
  }

  /**
   * Reads a signed zigzag encoded varint from the binary stream and invokes
   * the conversion function with the value in two signed 32 bit integers to
   * produce the result. Since this does not convert the value to a number, no
   * precision is lost.
   *
   * It's possible for an unsigned varint to be incorrectly encoded - more than
   * 64 bits' worth of data could be present. If this happens, this method will
   * throw an error.
   *
   * Zigzag encoding is a modification of varint encoding that reduces the
   * storage overhead for small negative integers - for more details on the
   * format, see https://developers.google.com/protocol-buffers/docs/encoding
   *
   * @param {function(number, number): T} convert Conversion function to produce
   *     the result value, takes parameters (lowBits, highBits).
   * @return {T}
   * @template T
   */
  readSplitZigzagVarint64(convert) {
    return this.readSplitVarint64(
        (low, high) => utils.fromZigzag64(low, high, convert));
  }

  /**
   * Reads a 64-bit fixed-width value from the stream and invokes the conversion
   * function with the value in two signed 32 bit integers to produce the
   * result. Since this does not convert the value to a number, no precision is
   * lost.
   *
   * @param {function(number, number): T} convert Conversion function to produce
   *     the result value, takes parameters (lowBits, highBits).
   * @return {T}
   * @template T
   */
  readSplitFixed64(convert) {
    var bytes = this.bytes_;
    var cursor = this.cursor_;
    this.cursor_ += 8;
    var lowBits = 0;
    var highBits = 0;
    for (var i = cursor + 7; i >= cursor; i--) {
      lowBits = (lowBits << 8) | bytes[i];
      highBits = (highBits << 8) | bytes[i + 4];
    }
    return convert(lowBits, highBits);
  }

  /**
   * Skips over a varint in the block without decoding it.
   */
  skipVarint() {
    while (this.bytes_[this.cursor_] & 0x80) {
      this.cursor_++;
    }
    this.cursor_++;
  }


  /**
   * Skips backwards over a varint in the block - to do this correctly, we have
   * to know the value we're skipping backwards over or things are ambiguous.
   * @param {number} value The varint value to unskip.
   */
  unskipVarint(value) {
    while (value > 128) {
      this.cursor_--;
      value = value >>> 7;
    }
    this.cursor_--;
  }

  /**
   * Reads a 32-bit varint from the binary stream. Due to a quirk of the
   * encoding format and Javascript's handling of bitwise math, this actually
   * works correctly for both signed and unsigned 32-bit varints.
   *
   * This function is called vastly more frequently than any other in
   * BinaryDecoder, so it has been unrolled and tweaked for performance.
   *
   * If there are more than 32 bits of data in the varint, it _must_ be due to
   * sign-extension. If we're in debug mode and the high 32 bits don't match the
   * expected sign extension, this method will throw an error.
   *
   * Decoding varints requires doing some funny base-128 math - for more
   * details on the format, see
   * https://developers.google.com/protocol-buffers/docs/encoding
   *
   * @return {number} The decoded unsigned 32-bit varint.
   */
  readUnsignedVarint32() {
    var temp;
    var bytes = this.bytes_;

    temp = bytes[this.cursor_ + 0];
    var x = (temp & 0x7F);
    if (temp < 128) {
      this.cursor_ += 1;
      asserts.assert(this.cursor_ <= this.end_);
      return x;
    }

    temp = bytes[this.cursor_ + 1];
    x |= (temp & 0x7F) << 7;
    if (temp < 128) {
      this.cursor_ += 2;
      asserts.assert(this.cursor_ <= this.end_);
      return x;
    }

    temp = bytes[this.cursor_ + 2];
    x |= (temp & 0x7F) << 14;
    if (temp < 128) {
      this.cursor_ += 3;
      asserts.assert(this.cursor_ <= this.end_);
      return x;
    }

    temp = bytes[this.cursor_ + 3];
    x |= (temp & 0x7F) << 21;
    if (temp < 128) {
      this.cursor_ += 4;
      asserts.assert(this.cursor_ <= this.end_);
      return x;
    }

    temp = bytes[this.cursor_ + 4];
    x |= (temp & 0x0F) << 28;
    if (temp < 128) {
      // We're reading the high bits of an unsigned varint. The byte we just
      // read also contains bits 33 through 35, which we're going to discard.
      this.cursor_ += 5;
      asserts.assert(this.cursor_ <= this.end_);
      return x >>> 0;
    }

    // If we get here, we need to truncate coming bytes. However we need to make
    // sure cursor place is correct.
    this.cursor_ += 5;
    if (bytes[this.cursor_++] >= 128 && bytes[this.cursor_++] >= 128 &&
        bytes[this.cursor_++] >= 128 && bytes[this.cursor_++] >= 128 &&
        bytes[this.cursor_++] >= 128) {
      // If we get here, the varint is too long.
      asserts.assert(false);
    }

    asserts.assert(this.cursor_ <= this.end_);
    return x;
  }

  /**
   * The readUnsignedVarint32 above deals with signed 32-bit varints correctly,
   * so this is just an alias.
   *
   * @return {number} The decoded signed 32-bit varint.
   */
  readSignedVarint32() {
    return this.readUnsignedVarint32();
  }



  /**
   * Reads a 32-bit unsigned variant and returns its value as a string.
   *
   * @return {string} The decoded unsigned 32-bit varint as a string.
   */
  readUnsignedVarint32String() {
    // 32-bit integers fit in JavaScript numbers without loss of precision, so
    // string variants of 32-bit varint readers can simply delegate then convert
    // to string.
    var value = this.readUnsignedVarint32();
    return value.toString();
  }


  /**
   * Reads a 32-bit signed variant and returns its value as a string.
   *
   * @return {string} The decoded signed 32-bit varint as a string.
   */
  readSignedVarint32String() {
    // 32-bit integers fit in JavaScript numbers without loss of precision, so
    // string variants of 32-bit varint readers can simply delegate then convert
    // to string.
    var value = this.readSignedVarint32();
    return value.toString();
  }


  /**
   * Reads a signed, zigzag-encoded 32-bit varint from the binary stream.
   *
   * Zigzag encoding is a modification of varint encoding that reduces the
   * storage overhead for small negative integers - for more details on the
   * format, see https://developers.google.com/protocol-buffers/docs/encoding
   *
   * @return {number} The decoded signed, zigzag-encoded 32-bit varint.
   */
  readZigzagVarint32() {
    var result = this.readUnsignedVarint32();
    return (result >>> 1) ^ -(result & 1);
  }


  /**
   * Reads an unsigned 64-bit varint from the binary stream. Note that since
   * Javascript represents all numbers as double-precision floats, there will be
   * precision lost if the absolute value of the varint is larger than 2^53.
   *
   * @return {number} The decoded unsigned varint. Precision will be lost if the
   *     integer exceeds 2^53.
   */
  readUnsignedVarint64() {
    return this.readSplitVarint64(utils.joinUint64);
  }


  /**
   * Reads an unsigned 64-bit varint from the binary stream and returns the
   * value as a decimal string.
   *
   * @return {string} The decoded unsigned varint as a decimal string.
   */
  readUnsignedVarint64String() {
    return this.readSplitVarint64(utils.joinUnsignedDecimalString);
  }


  /**
   * Reads a signed 64-bit varint from the binary stream. Note that since
   * Javascript represents all numbers as double-precision floats, there will be
   * precision lost if the absolute value of the varint is larger than 2^53.
   *
   * @return {number} The decoded signed varint. Precision will be lost if the
   *     integer exceeds 2^53.
   */
  readSignedVarint64() {
    return this.readSplitVarint64(utils.joinInt64);
  }


  /**
   * Reads an signed 64-bit varint from the binary stream and returns the value
   * as a decimal string.
   *
   * @return {string} The decoded signed varint as a decimal string.
   */
  readSignedVarint64String() {
    return this.readSplitVarint64(utils.joinSignedDecimalString);
  }


  /**
   * Reads a signed, zigzag-encoded 64-bit varint from the binary stream. Note
   * that since Javascript represents all numbers as double-precision floats,
   * there will be precision lost if the absolute value of the varint is larger
   * than 2^53.
   *
   * Zigzag encoding is a modification of varint encoding that reduces the
   * storage overhead for small negative integers - for more details on the
   * format, see https://developers.google.com/protocol-buffers/docs/encoding
   *
   * @return {number} The decoded zigzag varint. Precision will be lost if the
   *     integer exceeds 2^53.
   */
  readZigzagVarint64() {
    return this.readSplitVarint64(utils.joinZigzag64);
  }


  /**
   * Reads a signed, zigzag-encoded 64-bit varint from the binary stream and
   * returns its value as a string.
   *
   * Zigzag encoding is a modification of varint encoding that reduces the
   * storage overhead for small negative integers - for more details on the
   * format, see https://developers.google.com/protocol-buffers/docs/encoding
   *
   * @return {string} The decoded signed, zigzag-encoded 64-bit varint as a
   * string.
   */
  readZigzagVarint64String() {
    return this.readSplitZigzagVarint64(utils.joinSignedDecimalString);
  }


  /**
   * Reads a raw unsigned 8-bit integer from the binary stream.
   *
   * @return {number} The unsigned 8-bit integer read from the binary stream.
   */
  readUint8() {
    var a = this.bytes_[this.cursor_ + 0];
    this.cursor_ += 1;
    asserts.assert(this.cursor_ <= this.end_);
    return a;
  }


  /**
   * Reads a raw unsigned 16-bit integer from the binary stream.
   *
   * @return {number} The unsigned 16-bit integer read from the binary stream.
   */
  readUint16() {
    var a = this.bytes_[this.cursor_ + 0];
    var b = this.bytes_[this.cursor_ + 1];
    this.cursor_ += 2;
    asserts.assert(this.cursor_ <= this.end_);
    return (a << 0) | (b << 8);
  }


  /**
   * Reads a raw unsigned 32-bit integer from the binary stream.
   *
   * @return {number} The unsigned 32-bit integer read from the binary stream.
   */
  readUint32() {
    var a = this.bytes_[this.cursor_ + 0];
    var b = this.bytes_[this.cursor_ + 1];
    var c = this.bytes_[this.cursor_ + 2];
    var d = this.bytes_[this.cursor_ + 3];
    this.cursor_ += 4;
    asserts.assert(this.cursor_ <= this.end_);
    return ((a << 0) | (b << 8) | (c << 16) | (d << 24)) >>> 0;
  }


  /**
   * Reads a raw unsigned 64-bit integer from the binary stream. Note that since
   * Javascript represents all numbers as double-precision floats, there will be
   * precision lost if the absolute value of the integer is larger than 2^53.
   *
   * @return {number} The unsigned 64-bit integer read from the binary stream.
   *     Precision will be lost if the integer exceeds 2^53.
   */
  readUint64() {
    var bitsLow = this.readUint32();
    var bitsHigh = this.readUint32();
    return utils.joinUint64(bitsLow, bitsHigh);
  }


  /**
   * Reads a raw unsigned 64-bit integer from the binary stream. Note that since
   * Javascript represents all numbers as double-precision floats, there will be
   * precision lost if the absolute value of the integer is larger than 2^53.
   *
   * @return {string} The unsigned 64-bit integer read from the binary stream.
   */
  readUint64String() {
    var bitsLow = this.readUint32();
    var bitsHigh = this.readUint32();
    return utils.joinUnsignedDecimalString(bitsLow, bitsHigh);
  }


  /**
   * Reads a raw signed 8-bit integer from the binary stream.
   *
   * @return {number} The signed 8-bit integer read from the binary stream.
   */
  readInt8() {
    var a = this.bytes_[this.cursor_ + 0];
    this.cursor_ += 1;
    asserts.assert(this.cursor_ <= this.end_);
    return (a << 24) >> 24;
  }


  /**
   * Reads a raw signed 16-bit integer from the binary stream.
   *
   * @return {number} The signed 16-bit integer read from the binary stream.
   */
  readInt16() {
    var a = this.bytes_[this.cursor_ + 0];
    var b = this.bytes_[this.cursor_ + 1];
    this.cursor_ += 2;
    asserts.assert(this.cursor_ <= this.end_);
    return (((a << 0) | (b << 8)) << 16) >> 16;
  }


  /**
   * Reads a raw signed 32-bit integer from the binary stream.
   *
   * @return {number} The signed 32-bit integer read from the binary stream.
   */
  readInt32() {
    var a = this.bytes_[this.cursor_ + 0];
    var b = this.bytes_[this.cursor_ + 1];
    var c = this.bytes_[this.cursor_ + 2];
    var d = this.bytes_[this.cursor_ + 3];
    this.cursor_ += 4;
    asserts.assert(this.cursor_ <= this.end_);
    return (a << 0) | (b << 8) | (c << 16) | (d << 24);
  }


  /**
   * Reads a raw signed 64-bit integer from the binary stream. Note that since
   * Javascript represents all numbers as double-precision floats, there will be
   * precision lost if the absolute vlaue of the integer is larger than 2^53.
   *
   * @return {number} The signed 64-bit integer read from the binary stream.
   *     Precision will be lost if the integer exceeds 2^53.
   */
  readInt64() {
    var bitsLow = this.readUint32();
    var bitsHigh = this.readUint32();
    return utils.joinInt64(bitsLow, bitsHigh);
  }


  /**
   * Reads a raw signed 64-bit integer from the binary stream and returns it as
   * a string.
   *
   * @return {string} The signed 64-bit integer read from the binary stream.
   *     Precision will be lost if the integer exceeds 2^53.
   */
  readInt64String() {
    var bitsLow = this.readUint32();
    var bitsHigh = this.readUint32();
    return utils.joinSignedDecimalString(bitsLow, bitsHigh);
  }


  /**
   * Reads a 32-bit floating-point number from the binary stream, using the
   * temporary buffer to realign the data.
   *
   * @return {number} The float read from the binary stream.
   */
  readFloat() {
    var bitsLow = this.readUint32();
    var bitsHigh = 0;
    return utils.joinFloat32(bitsLow, bitsHigh);
  }


  /**
   * Reads a 64-bit floating-point number from the binary stream, using the
   * temporary buffer to realign the data.
   *
   * @return {number} The double read from the binary stream.
   */
  readDouble() {
    var bitsLow = this.readUint32();
    var bitsHigh = this.readUint32();
    return utils.joinFloat64(bitsLow, bitsHigh);
  }


  /**
   * Reads a boolean value from the binary stream.
   * @return {boolean} The boolean read from the binary stream.
   */
  readBool() {
    return !!this.bytes_[this.cursor_++];
  }


  /**
   * Reads an enum value from the binary stream, which are always encoded as
   * signed varints.
   * @return {number} The enum value read from the binary stream.
   */
  readEnum() {
    return this.readSignedVarint32();
  }


  /**
   * Reads and parses a UTF-8 encoded unicode string from the stream.
   * The code is inspired by maps.vectortown.parse.StreamedDataViewReader.
   * Supports codepoints from U+0000 up to U+10FFFF.
   * (http://en.wikipedia.org/wiki/UTF-8).
   * @param {number} length The length of the string to read.
   * @return {string} The decoded string.
   */
  readString(length) {
    var bytes = this.bytes_;
    var cursor = this.cursor_;
    var end = cursor + length;
    var codeUnits = [];

    var result = '';
    while (cursor < end) {
      var c = bytes[cursor++];
      if (c < 128) {  // Regular 7-bit ASCII.
        codeUnits.push(c);
      } else if (c < 192) {
        // UTF-8 continuation mark. We are out of sync. This
        // might happen if we attempted to read a character
        // with more than four bytes.
        continue;
      } else if (c < 224) {  // UTF-8 with two bytes.
        var c2 = bytes[cursor++];
        codeUnits.push(((c & 31) << 6) | (c2 & 63));
      } else if (c < 240) {  // UTF-8 with three bytes.
        var c2 = bytes[cursor++];
        var c3 = bytes[cursor++];
        codeUnits.push(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
      } else if (c < 248) {  // UTF-8 with 4 bytes.
        var c2 = bytes[cursor++];
        var c3 = bytes[cursor++];
        var c4 = bytes[cursor++];
        // Characters written on 4 bytes have 21 bits for a codepoint.
        // We can't fit that on 16bit characters, so we use surrogates.
        var codepoint =
            ((c & 7) << 18) | ((c2 & 63) << 12) | ((c3 & 63) << 6) | (c4 & 63);
        // Surrogates formula from wikipedia.
        // 1. Subtract 0x10000 from codepoint
        codepoint -= 0x10000;
        // 2. Split this into the high 10-bit value and the low 10-bit value
        // 3. Add 0xD800 to the high value to form the high surrogate
        // 4. Add 0xDC00 to the low value to form the low surrogate:
        var low = (codepoint & 1023) + 0xDC00;
        var high = ((codepoint >> 10) & 1023) + 0xD800;
        codeUnits.push(high, low);
      }

      // Avoid exceeding the maximum stack size when calling `apply`.
      if (codeUnits.length >= 8192) {
        result += String.fromCharCode.apply(null, codeUnits);
        codeUnits.length = 0;
      }
    }
    result += crypt.byteArrayToString(codeUnits);
    this.cursor_ = cursor;
    return result;
  }


  /**
   * Reads and parses a UTF-8 encoded unicode string (with length prefix) from
   * the stream.
   * @return {string} The decoded string.
   */
  readStringWithLength() {
    var length = this.readUnsignedVarint32();
    return this.readString(length);
  }


  /**
   * Reads a block of raw bytes from the binary stream.
   *
   * @param {number} length The number of bytes to read.
   * @return {!Uint8Array} The decoded block of bytes, or an empty block if the
   *     length was invalid.
   */
  readBytes(length) {
    if (length < 0 || this.cursor_ + length > this.bytes_.length) {
      this.error_ = true;
      asserts.fail('Invalid byte length!');
      return new Uint8Array(0);
    }

    var result = this.bytes_.subarray(this.cursor_, this.cursor_ + length);

    this.cursor_ += length;
    asserts.assert(this.cursor_ <= this.end_);
    return result;
  }

  /**
   * Visible for testing.
   * @package
   */
  static resetInstanceCache() {
    BinaryDecoder.instanceCache_ = [];
  }

  /**
   * Visible for testing.
   * @return {!Array<!BinaryDecoder>}
   * @package
   */
  static getInstanceCache() {
    return BinaryDecoder.instanceCache_;
  }
}


/**
 * Global pool of BinaryDecoder instances.
 * @private {!Array<!jspb.BinaryDecoder>}
 */
BinaryDecoder.instanceCache_ = [];

exports = BinaryDecoder;

;return exports;});

//javascript/apps/jspb/binary/encoder.js
goog.loadModule(function(exports) {'use strict';/**
 * @fileoverview BinaryEncode defines methods for encoding Javascript values
 * into arrays of bytes compatible with the Protocol Buffer wire format.
 *
 * @author aappleby@google.com (Austin Appleby)
 */

goog.module('jspb.BinaryEncoder');
goog.module.declareLegacyNamespace();

const BinaryConstants = goog.require('jspb.BinaryConstants');
const asserts = goog.require('goog.asserts');
const utils = goog.require('jspb.utils');

/**
 * BinaryEncoder implements encoders for all the wire types specified in
 * https://developers.google.com/protocol-buffers/docs/encoding.
 */
const BinaryEncoder = class {
  constructor() {
    /** @private {!Array<number>} */
    this.buffer_ = [];
  }

  /**
   * @return {number}
   */
  length() {
    return this.buffer_.length;
  }

  /**
   * @return {!Array<number>}
   */
  end() {
    var buffer = this.buffer_;
    this.buffer_ = [];
    return buffer;
  }

  /**
   * Encodes a 64-bit integer in 32:32 split representation into its wire-format
   * varint representation and stores it in the buffer.
   * @param {number} lowBits The low 32 bits of the int.
   * @param {number} highBits The high 32 bits of the int.
   */
  writeSplitVarint64(lowBits, highBits) {
    asserts.assert(lowBits == Math.floor(lowBits));
    asserts.assert(highBits == Math.floor(highBits));
    asserts.assert((lowBits >= 0) && (lowBits < BinaryConstants.TWO_TO_32));
    asserts.assert((highBits >= 0) && (highBits < BinaryConstants.TWO_TO_32));

    // Break the binary representation into chunks of 7 bits, set the 8th bit
    // in each chunk if it's not the final chunk, and append to the result.
    while (highBits > 0 || lowBits > 127) {
      this.buffer_.push((lowBits & 0x7f) | 0x80);
      lowBits = ((lowBits >>> 7) | (highBits << 25)) >>> 0;
      highBits = highBits >>> 7;
    }
    this.buffer_.push(lowBits);
  }

  /**
   * Encodes a 64-bit integer in 32:32 split representation into its wire-format
   * fixed representation and stores it in the buffer.
   * @param {number} lowBits The low 32 bits of the int.
   * @param {number} highBits The high 32 bits of the int.
   */
  writeSplitFixed64(lowBits, highBits) {
    asserts.assert(lowBits == Math.floor(lowBits));
    asserts.assert(highBits == Math.floor(highBits));
    asserts.assert((lowBits >= 0) && (lowBits < BinaryConstants.TWO_TO_32));
    asserts.assert((highBits >= 0) && (highBits < BinaryConstants.TWO_TO_32));
    this.writeUint32(lowBits);
    this.writeUint32(highBits);
  }

  /**
   * Encodes a 64-bit integer in 32:32 split representation into its wire-format
   * a zigzag varint representation and stores it in the buffer.
   * @param {number} lowBits The low 32 bits of the int.
   * @param {number} highBits The high 32 bits of the int.
   */
  writeSplitZigzagVarint64(lowBits, highBits) {
    var self = this;
    utils.toZigzag64(lowBits, highBits, function(lo, hi) {
      self.writeSplitVarint64(lo >>> 0, hi >>> 0);
    });
  }

  /**
   * Encodes a 32-bit unsigned integer into its wire-format varint
   * representation and stores it in the buffer.
   * @param {number} value The integer to convert.
   */
  writeUnsignedVarint32(value) {
    asserts.assert(value == Math.floor(value));
    asserts.assert((value >= 0) && (value < BinaryConstants.TWO_TO_32));

    while (value > 127) {
      this.buffer_.push((value & 0x7f) | 0x80);
      value = value >>> 7;
    }

    this.buffer_.push(value);
  }

  /**
   * Encodes a 32-bit signed integer into its wire-format varint representation
   * and stores it in the buffer.
   * @param {number} value The integer to convert.
   */
  writeSignedVarint32(value) {
    asserts.assert(value == Math.floor(value));
    asserts.assert(
        (value >= -BinaryConstants.TWO_TO_31) &&
        (value < BinaryConstants.TWO_TO_31));

    // Use the unsigned version if the value is not negative.
    if (value >= 0) {
      this.writeUnsignedVarint32(value);
      return;
    }

    // Write nine bytes with a _signed_ right shift so we preserve the sign bit.
    for (var i = 0; i < 9; i++) {
      this.buffer_.push((value & 0x7f) | 0x80);
      value = value >> 7;
    }

    // The above loop writes out 63 bits, so the last byte is always the sign
    // bit which is always set for negative numbers.
    this.buffer_.push(1);
  }

  /**
   * Encodes a 64-bit unsigned integer into its wire-format varint
   * representation and stores it in the buffer. Integers that are not
   * representable in 64 bits will be truncated.
   * @param {number} value The integer to convert.
   */
  writeUnsignedVarint64(value) {
    asserts.assert(value == Math.floor(value));
    asserts.assert((value >= 0) && (value < BinaryConstants.TWO_TO_64));
    utils.splitInt64(value);
    this.writeSplitVarint64(utils.getSplit64Low(), utils.getSplit64High());
  }

  /**
   * Encodes a 64-bit signed integer into its wire-format varint representation
   * and stores it in the buffer. Integers that are not representable in 64 bits
   * will be truncated.
   * @param {number} value The integer to convert.
   */
  writeSignedVarint64(value) {
    asserts.assert(value == Math.floor(value));
    asserts.assert(
        (value >= -BinaryConstants.TWO_TO_63) &&
        (value < BinaryConstants.TWO_TO_63));
    utils.splitInt64(value);
    this.writeSplitVarint64(utils.getSplit64Low(), utils.getSplit64High());
  }

  /**
   * Encodes a JavaScript integer into its wire-format, zigzag-encoded varint
   * representation and stores it in the buffer.
   * @param {number} value The integer to convert.
   */
  writeZigzagVarint32(value) {
    asserts.assert(value == Math.floor(value));
    asserts.assert(
        (value >= -BinaryConstants.TWO_TO_31) &&
        (value < BinaryConstants.TWO_TO_31));
    this.writeUnsignedVarint32(((value << 1) ^ (value >> 31)) >>> 0);
  }

  /**
   * Encodes a JavaScript integer into its wire-format, zigzag-encoded varint
   * representation and stores it in the buffer. Integers not representable in
   * 64 bits will be truncated.
   * @param {number} value The integer to convert.
   */
  writeZigzagVarint64(value) {
    asserts.assert(value == Math.floor(value));
    asserts.assert(
        (value >= -BinaryConstants.TWO_TO_63) &&
        (value < BinaryConstants.TWO_TO_63));
    utils.splitZigzag64(value);
    this.writeSplitVarint64(utils.getSplit64Low(), utils.getSplit64High());
  }

  /**
   * Encodes a JavaScript decimal string into its wire-format, zigzag-encoded
   * varint representation and stores it in the buffer. Integers not
   * representable in 64 bits will be truncated.
   * @param {string} value The integer to convert.
   */
  writeZigzagVarint64String(value) {
    var self = this;
    utils.splitDecimalString(value);
    utils.toZigzag64(
        utils.getSplit64Low(), utils.getSplit64High(), function(lo, hi) {
          self.writeSplitVarint64(lo >>> 0, hi >>> 0);
        });
  }

  /**
   * Writes an 8-bit unsigned integer to the buffer. Numbers outside the range
   * [0,2^8) will be truncated.
   * @param {number} value The value to write.
   */
  writeUint8(value) {
    asserts.assert(value == Math.floor(value));
    asserts.assert((value >= 0) && (value < 256));
    this.buffer_.push((value >>> 0) & 0xFF);
  }

  /**
   * Writes a 16-bit unsigned integer to the buffer. Numbers outside the
   * range [0,2^16) will be truncated.
   * @param {number} value The value to write.
   */
  writeUint16(value) {
    asserts.assert(value == Math.floor(value));
    asserts.assert((value >= 0) && (value < 65536));
    this.buffer_.push((value >>> 0) & 0xFF);
    this.buffer_.push((value >>> 8) & 0xFF);
  }

  /**
   * Writes a 32-bit unsigned integer to the buffer. Numbers outside the
   * range [0,2^32) will be truncated.
   * @param {number} value The value to write.
   */
  writeUint32(value) {
    asserts.assert(value == Math.floor(value));
    asserts.assert((value >= 0) && (value < BinaryConstants.TWO_TO_32));
    this.buffer_.push((value >>> 0) & 0xFF);
    this.buffer_.push((value >>> 8) & 0xFF);
    this.buffer_.push((value >>> 16) & 0xFF);
    this.buffer_.push((value >>> 24) & 0xFF);
  }

  /**
   * Writes a 64-bit unsigned integer to the buffer. Numbers outside the
   * range [0,2^64) will be truncated.
   * @param {number} value The value to write.
   */
  writeUint64(value) {
    asserts.assert(value == Math.floor(value));
    asserts.assert((value >= 0) && (value < BinaryConstants.TWO_TO_64));
    utils.splitUint64(value);
    this.writeUint32(utils.getSplit64Low());
    this.writeUint32(utils.getSplit64High());
  }

  /**
   * Writes an 8-bit integer to the buffer. Numbers outside the range
   * [-2^7,2^7) will be truncated.
   * @param {number} value The value to write.
   */
  writeInt8(value) {
    asserts.assert(value == Math.floor(value));
    asserts.assert((value >= -128) && (value < 128));
    this.buffer_.push((value >>> 0) & 0xFF);
  }

  /**
   * Writes a 16-bit integer to the buffer. Numbers outside the range
   * [-2^15,2^15) will be truncated.
   * @param {number} value The value to write.
   */
  writeInt16(value) {
    asserts.assert(value == Math.floor(value));
    asserts.assert((value >= -32768) && (value < 32768));
    this.buffer_.push((value >>> 0) & 0xFF);
    this.buffer_.push((value >>> 8) & 0xFF);
  }

  /**
   * Writes a 32-bit integer to the buffer. Numbers outside the range
   * [-2^31,2^31) will be truncated.
   * @param {number} value The value to write.
   */
  writeInt32(value) {
    asserts.assert(value == Math.floor(value));
    asserts.assert(
        (value >= -BinaryConstants.TWO_TO_31) &&
        (value < BinaryConstants.TWO_TO_31));
    this.buffer_.push((value >>> 0) & 0xFF);
    this.buffer_.push((value >>> 8) & 0xFF);
    this.buffer_.push((value >>> 16) & 0xFF);
    this.buffer_.push((value >>> 24) & 0xFF);
  }

  /**
   * Writes a 64-bit integer to the buffer. Numbers outside the range
   * [-2^63,2^63) will be truncated.
   * @param {number} value The value to write.
   */
  writeInt64(value) {
    asserts.assert(value == Math.floor(value));
    asserts.assert(
        (value >= -BinaryConstants.TWO_TO_63) &&
        (value < BinaryConstants.TWO_TO_63));
    utils.splitInt64(value);
    this.writeSplitFixed64(utils.getSplit64Low(), utils.getSplit64High());
  }

  /**
   * Writes a 64-bit integer decimal strings to the buffer. Numbers outside the
   * range [-2^63,2^63) will be truncated.
   * @param {string} value The value to write.
   */
  writeInt64String(value) {
    asserts.assert(value == Math.floor(value));
    asserts.assert(
        (+value >= -BinaryConstants.TWO_TO_63) &&
        (+value < BinaryConstants.TWO_TO_63));
    utils.splitDecimalString(value);
    this.writeSplitFixed64(utils.getSplit64Low(), utils.getSplit64High());
  }

  /**
   * Writes a single-precision floating point value to the buffer. Numbers
   * requiring more than 32 bits of precision will be truncated.
   * @param {number} value The value to write.
   */
  writeFloat(value) {
    asserts.assert(
        value === Infinity || value === -Infinity || isNaN(value) ||
        ((value >= -BinaryConstants.FLOAT32_MAX) &&
         (value <= BinaryConstants.FLOAT32_MAX)));
    utils.splitFloat32(value);
    this.writeUint32(utils.getSplit64Low());
  }

  /**
   * Writes a double-precision floating point value to the buffer. As this is
   * the native format used by JavaScript, no precision will be lost.
   * @param {number} value The value to write.
   */
  writeDouble(value) {
    asserts.assert(
        value === Infinity || value === -Infinity || isNaN(value) ||
        ((value >= -BinaryConstants.FLOAT64_MAX) &&
         (value <= BinaryConstants.FLOAT64_MAX)));
    utils.splitFloat64(value);
    this.writeUint32(utils.getSplit64Low());
    this.writeUint32(utils.getSplit64High());
  }

  /**
   * Writes a boolean value to the buffer as a varint. We allow numbers as input
   * because the JSPB code generator uses 0/1 instead of true/false to save
   * space in the string representation of the proto.
   * @param {boolean|number} value The value to write.
   */
  writeBool(value) {
    asserts.assert(typeof value === 'boolean' || typeof value === 'number');
    this.buffer_.push(value ? 1 : 0);
  }

  /**
   * Writes an enum value to the buffer as a varint.
   * @param {number} value The value to write.
   */
  writeEnum(value) {
    asserts.assert(value == Math.floor(value));
    asserts.assert(
        (value >= -BinaryConstants.TWO_TO_31) &&
        (value < BinaryConstants.TWO_TO_31));
    this.writeSignedVarint32(value);
  }

  /**
   * Writes an arbitrary byte array to the buffer.
   * @param {!Uint8Array} bytes The array of bytes to write.
   */
  writeBytes(bytes) {
    this.buffer_.push.apply(this.buffer_, bytes);
  }

  /**
   * Writes a UTF16 Javascript string to the buffer encoded as UTF8.
   * TODO(aappleby): Add support for surrogate pairs, reject unpaired
   * surrogates.
   * @param {string} value The string to write.
   * @return {number} The number of bytes used to encode the string.
   */
  writeString(value) {
    var oldLength = this.buffer_.length;

    for (var i = 0; i < value.length; i++) {
      var c = value.charCodeAt(i);

      if (c < 128) {
        this.buffer_.push(c);
      } else if (c < 2048) {
        this.buffer_.push((c >> 6) | 192);
        this.buffer_.push((c & 63) | 128);
      } else if (c < 65536) {
        // Look for surrogates
        if (c >= 0xD800 && c <= 0xDBFF && i + 1 < value.length) {
          var second = value.charCodeAt(i + 1);
          if (second >= 0xDC00 && second <= 0xDFFF) {  // low surrogate
            // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
            c = (c - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;

            this.buffer_.push((c >> 18) | 240);
            this.buffer_.push(((c >> 12) & 63) | 128);
            this.buffer_.push(((c >> 6) & 63) | 128);
            this.buffer_.push((c & 63) | 128);
            i++;
          }
        } else {
          this.buffer_.push((c >> 12) | 224);
          this.buffer_.push(((c >> 6) & 63) | 128);
          this.buffer_.push((c & 63) | 128);
        }
      }
    }

    var length = this.buffer_.length - oldLength;
    return length;
  }
};

exports = BinaryEncoder;

;return exports;});

//javascript/apps/jspb/binary/reader.js
goog.loadModule(function(exports) {'use strict';/**
 * @fileoverview This file contains utilities for converting binary,
 * wire-format protocol buffers into Javascript data structures.
 *
 * jspb's BinaryReader class wraps the BinaryDecoder class to add methods
 * that understand the protocol buffer syntax and can do the type checking and
 * bookkeeping necessary to parse trees of nested messages.
 *
 * Major caveat - Users of this library _must_ keep their Javascript proto
 * parsing code in sync with the original .proto file - presumably you'll be
 * using the typed jspb code generator, but if you bypass that you'll need
 * to keep things in sync by hand.
 *
 * @author aappleby@google.com (Austin Appleby)
 */

goog.module('jspb.BinaryReader');
goog.module.declareLegacyNamespace();

const AnyFieldType = goog.require('jspb.AnyFieldType');
const BinaryConstants = goog.require('jspb.BinaryConstants');
const BinaryDecoder = goog.require('jspb.BinaryDecoder');
const ByteSource = goog.require('jspb.ByteSource');
const asserts = goog.require('goog.asserts');
const utils = goog.require('jspb.utils');



class BinaryReader {
  /**
   * BinaryReader implements the decoders for all the wire types specified in
   * https://developers.google.com/protocol-buffers/docs/encoding.
   *
   * @param {?ByteSource=} bytes The bytes we're reading from.
   * @param {number=} start The optional offset to start reading at.
   * @param {number=} length The optional length of the block to read -
   *     we'll throw an assertion if we go off the end of the block.
   */
  constructor(bytes, start, length) {
    /**
     * Wire-format decoder.
     * @const @private {!BinaryDecoder}
     */
    this.decoder_ = BinaryDecoder.alloc(bytes, start, length);

    /**
     * Cursor immediately before the field tag.
     * @private {number}
     */
    this.fieldCursor_ = this.decoder_.getCursor();

    /**
     * Field number of the next field in the buffer, filled in by nextField().
     * @private {number}
     */
    this.nextField_ = BinaryConstants.INVALID_FIELD_NUMBER;

    /**
     * Wire type of the next proto field in the buffer, filled in by
     * nextField().
     * @private {!BinaryConstants.WireType}
     */
    this.nextWireType_ = BinaryConstants.WireType.INVALID;

    /**
     * Set to true if this reader encountered an error due to corrupt data.
     * @private {boolean}
     */
    this.error_ = false;

    /**
     * User-defined reader callbacks.
     * @private {?Object<string, function(!BinaryReader):*>}
     */
    this.readCallbacks_ = null;
  }



  /**
   * Pops an instance off the instance cache, or creates one if the cache is
   * empty.
   * @param {?ByteSource=} bytes The bytes we're reading from.
   * @param {number=} start The optional offset to start reading at.
   * @param {number=} length The optional length of the block to read -
   *     we'll throw an assertion if we go off the end of the block.
   * @return {!BinaryReader}
   */
  static alloc(bytes, start, length) {
    if (BinaryReader.instanceCache_.length) {
      var newReader = BinaryReader.instanceCache_.pop();
      if (bytes) {
        newReader.decoder_.setBlock(bytes, start, length);
      }
      return newReader;
    } else {
      return new BinaryReader(bytes, start, length);
    }
  }



  /**
   * Puts this instance back in the instance cache.
   */
  free() {
    this.decoder_.clear();
    this.nextField_ = BinaryConstants.INVALID_FIELD_NUMBER;
    this.nextWireType_ = BinaryConstants.WireType.INVALID;
    this.error_ = false;
    this.readCallbacks_ = null;

    if (BinaryReader.instanceCache_.length < 100) {
      BinaryReader.instanceCache_.push(this);
    }
  }


  /**
   * Returns the cursor immediately before the current field's tag.
   * @return {number} The internal read cursor.
   */
  getFieldCursor() {
    return this.fieldCursor_;
  }


  /**
   * Returns the internal read cursor.
   * @return {number} The internal read cursor.
   */
  getCursor() {
    return this.decoder_.getCursor();
  }


  /**
   * Returns the raw buffer.
   * @return {?Uint8Array} The raw buffer.
   */
  getBuffer() {
    return this.decoder_.getBuffer();
  }


  /**
   * @return {number} The field number of the next field in the buffer, or
   *     INVALID_FIELD_NUMBER if there is no next field.
   */
  getFieldNumber() {
    return this.nextField_;
  }


  /**
   * @return {!BinaryConstants.WireType} The wire type of the next field
   *     in the stream, or WireType.INVALID if there is no next field.
   */
  getWireType() {
    return this.nextWireType_;
  }


  /**
   * @return {boolean} Whether the current wire type is an end-group tag. Used
   *     as
   * an exit condition in decoder loops in generated code.
   */
  isEndGroup() {
    return this.nextWireType_ == BinaryConstants.WireType.END_GROUP;
  }

  /**
   * @return {boolean} Whether the current wire type is a delimited field. Used
   *     to
   * conditionally parse packed repeated fields.
   */
  isDelimited() {
    return this.nextWireType_ == BinaryConstants.WireType.DELIMITED;
  }


  /**
   * Returns true if this reader hit an error due to corrupt data.
   * @return {boolean}
   */
  getError() {
    return this.error_ || this.decoder_.getError();
  }


  /**
   * Points this reader at a new block of bytes.
   * @param {!Uint8Array} bytes The block of bytes we're reading from.
   * @param {number} start The offset to start reading at.
   * @param {number} length The length of the block to read.
   */
  setBlock(bytes, start, length) {
    this.decoder_.setBlock(bytes, start, length);
    this.nextField_ = BinaryConstants.INVALID_FIELD_NUMBER;
    this.nextWireType_ = BinaryConstants.WireType.INVALID;
  }


  /**
   * Rewinds the stream cursor to the beginning of the buffer and resets all
   * internal state.
   */
  reset() {
    this.decoder_.reset();
    this.nextField_ = BinaryConstants.INVALID_FIELD_NUMBER;
    this.nextWireType_ = BinaryConstants.WireType.INVALID;
  }


  /**
   * Advances the stream cursor by the given number of bytes.
   * @param {number} count The number of bytes to advance by.
   */
  advance(count) {
    this.decoder_.advance(count);
  }


  /**
   * Reads the next field header in the stream if there is one, returns true if
   * we saw a valid field header or false if we've read the whole stream.
   * Throws an error if we encountered a deprecated START_GROUP/END_GROUP field.
   * @return {boolean} True if the stream contains more fields.
   */
  nextField() {
    // If we're at the end of the block, there are no more fields.
    if (this.decoder_.atEnd()) {
      return false;
    }

    // If we hit an error decoding the previous field, stop now before we
    // try to decode anything else
    if (this.getError()) {
      asserts.fail('Decoder hit an error');
      return false;
    }

    // Otherwise just read the header of the next field.
    this.fieldCursor_ = this.decoder_.getCursor();
    var header = this.decoder_.readUnsignedVarint32();

    var nextField = header >>> 3;
    var nextWireType = /** @type {!BinaryConstants.WireType} */
        (header & 0x7);

    // If the wire type isn't one of the valid ones, something's broken.
    if (nextWireType != BinaryConstants.WireType.VARINT &&
        nextWireType != BinaryConstants.WireType.FIXED32 &&
        nextWireType != BinaryConstants.WireType.FIXED64 &&
        nextWireType != BinaryConstants.WireType.DELIMITED &&
        nextWireType != BinaryConstants.WireType.START_GROUP &&
        nextWireType != BinaryConstants.WireType.END_GROUP) {
      asserts.fail(
          'Invalid wire type: %s (at position %s)', nextWireType,
          this.fieldCursor_);
      this.error_ = true;
      return false;
    }

    this.nextField_ = nextField;
    this.nextWireType_ = nextWireType;

    return true;
  }


  /**
   * Winds the reader back to just before this field's header.
   */
  unskipHeader() {
    this.decoder_.unskipVarint((this.nextField_ << 3) | this.nextWireType_);
  }


  /**
   * Skips all contiguous fields whose header matches the one we just read.
   */
  skipMatchingFields() {
    var field = this.nextField_;
    this.unskipHeader();

    while (this.nextField() && (this.getFieldNumber() == field)) {
      this.skipField();
    }

    if (!this.decoder_.atEnd()) {
      this.unskipHeader();
    }
  }


  /**
   * Skips over the next varint field in the binary stream.
   */
  skipVarintField() {
    if (this.nextWireType_ != BinaryConstants.WireType.VARINT) {
      asserts.fail('Invalid wire type for skipVarintField');
      this.skipField();
      return;
    }

    this.decoder_.skipVarint();
  }


  /**
   * Skips over the next delimited field in the binary stream.
   */
  skipDelimitedField() {
    if (this.nextWireType_ != BinaryConstants.WireType.DELIMITED) {
      asserts.fail('Invalid wire type for skipDelimitedField');
      this.skipField();
      return;
    }

    var length = this.decoder_.readUnsignedVarint32();
    this.decoder_.advance(length);
  }


  /**
   * Skips over the next fixed32 field in the binary stream.
   */
  skipFixed32Field() {
    if (this.nextWireType_ != BinaryConstants.WireType.FIXED32) {
      asserts.fail('Invalid wire type for skipFixed32Field');
      this.skipField();
      return;
    }

    this.decoder_.advance(4);
  }


  /**
   * Skips over the next fixed64 field in the binary stream.
   */
  skipFixed64Field() {
    if (this.nextWireType_ != BinaryConstants.WireType.FIXED64) {
      asserts.fail('Invalid wire type for skipFixed64Field');
      this.skipField();
      return;
    }

    this.decoder_.advance(8);
  }


  /**
   * Skips over the next group field in the binary stream.
   */
  skipGroup() {
    var previousField = this.nextField_;
    do {
      if (!this.nextField()) {
        asserts.fail('Unmatched start-group tag: stream EOF');
        this.error_ = true;
        return;
      }
      if (this.nextWireType_ == BinaryConstants.WireType.END_GROUP) {
        // Group end: check that it matches top-of-stack.
        if (this.nextField_ != previousField) {
          asserts.fail('Unmatched end-group tag');
          this.error_ = true;
          return;
        }
        return;
      }
      this.skipField();
    } while (true);
  }


  /**
   * Skips over the next field in the binary stream - this is useful if we're
   * decoding a message that contain unknown fields.
   */
  skipField() {
    switch (this.nextWireType_) {
      case BinaryConstants.WireType.VARINT:
        this.skipVarintField();
        break;
      case BinaryConstants.WireType.FIXED64:
        this.skipFixed64Field();
        break;
      case BinaryConstants.WireType.DELIMITED:
        this.skipDelimitedField();
        break;
      case BinaryConstants.WireType.FIXED32:
        this.skipFixed32Field();
        break;
      case BinaryConstants.WireType.START_GROUP:
        this.skipGroup();
        break;
      default:
        this.error_ = true;
        asserts.fail('Invalid wire encoding for field.');
    }
  }


  /**
   * Registers a user-defined read callback.
   * @param {string} callbackName
   * @param {function(!BinaryReader):*} callback
   */
  registerReadCallback(callbackName, callback) {
    if (this.readCallbacks_ === null) {
      this.readCallbacks_ = {};
    }
    asserts.assert(!this.readCallbacks_[callbackName]);
    this.readCallbacks_[callbackName] = callback;
  }


  /**
   * Runs a registered read callback.
   * @param {string} callbackName The name the callback is registered under.
   * @return {*} The value returned by the callback.
   */
  runReadCallback(callbackName) {
    asserts.assert(this.readCallbacks_ !== null);
    var callback = this.readCallbacks_[callbackName];
    asserts.assert(callback);
    return callback(this);
  }


  /**
   * Reads a field of any valid non-message type from the binary stream.
   * @param {!BinaryConstants.FieldType} fieldType
   * @return {!AnyFieldType}
   */
  readAny(fieldType) {
    this.nextWireType_ = BinaryConstants.FieldTypeToWireType(fieldType);
    var fieldTypes = BinaryConstants.FieldType;
    switch (fieldType) {
      case fieldTypes.DOUBLE:
        return this.readDouble();
      case fieldTypes.FLOAT:
        return this.readFloat();
      case fieldTypes.INT64:
        return this.readInt64();
      case fieldTypes.UINT64:
        return this.readUint64();
      case fieldTypes.INT32:
        return this.readInt32();
      case fieldTypes.FIXED64:
        return this.readFixed64();
      case fieldTypes.FIXED32:
        return this.readFixed32();
      case fieldTypes.BOOL:
        return this.readBool();
      case fieldTypes.STRING:
        return this.readString();
      case fieldTypes.GROUP:
        asserts.fail('Group field type not supported in readAny()');
      case fieldTypes.MESSAGE:
        asserts.fail('Message field type not supported in readAny()');
      case fieldTypes.BYTES:
        return this.readBytes();
      case fieldTypes.UINT32:
        return this.readUint32();
      case fieldTypes.ENUM:
        return this.readEnum();
      case fieldTypes.SFIXED32:
        return this.readSfixed32();
      case fieldTypes.SFIXED64:
        return this.readSfixed64();
      case fieldTypes.SINT32:
        return this.readSint32();
      case fieldTypes.SINT64:
        return this.readSint64();
      default:
        asserts.fail('Invalid field type in readAny()');
    }
    return 0;
  }


  /**
   * Deserialize a proto into the provided message object using the provided
   * reader function. This function is templated as we currently have one client
   * who is using manual deserialization instead of the code-generated versions.
   * @template T
   * @param {T} message
   * @param {function(T, !BinaryReader)} reader
   */
  readMessage(message, reader) {
    asserts.assert(this.nextWireType_ == BinaryConstants.WireType.DELIMITED);

    // Save the current endpoint of the decoder and move it to the end of the
    // embedded message.
    var oldEnd = this.decoder_.getEnd();
    var length = this.decoder_.readUnsignedVarint32();
    var newEnd = this.decoder_.getCursor() + length;
    this.decoder_.setEnd(newEnd);

    // Deserialize the embedded message.
    reader(message, this);

    // Advance the decoder past the embedded message and restore the endpoint.
    this.decoder_.setCursor(newEnd);
    this.decoder_.setEnd(oldEnd);
  }


  /**
   * Deserialize a proto into the provided message object using the provided
   * reader function, assuming that the message is serialized as a group
   * with the given tag.
   * @template T
   * @param {number} field
   * @param {T} message
   * @param {function(T, !BinaryReader)} reader
   */
  readGroup(field, message, reader) {
    // Ensure that the wire type is correct.
    asserts.assert(this.nextWireType_ == BinaryConstants.WireType.START_GROUP);
    // Ensure that the field number is correct.
    asserts.assert(this.nextField_ == field);

    // Deserialize the message. The deserialization will stop at an END_GROUP
    // tag.
    reader(message, this);

    if (!this.error_ &&
        this.nextWireType_ != BinaryConstants.WireType.END_GROUP) {
      asserts.fail('Group submessage did not end with an END_GROUP tag');
      this.error_ = true;
    }
  }


  /**
   * Return a decoder that wraps the current delimited field.
   * @return {!BinaryDecoder}
   */
  getFieldDecoder() {
    asserts.assert(this.nextWireType_ == BinaryConstants.WireType.DELIMITED);

    var length = this.decoder_.readUnsignedVarint32();
    var start = this.decoder_.getCursor();
    var end = start + length;

    var innerDecoder =
        BinaryDecoder.alloc(this.decoder_.getBuffer(), start, length);
    this.decoder_.setCursor(end);
    return innerDecoder;
  }


  /**
   * Reads a signed 32-bit integer field from the binary stream, or throws an
   * error if the next field in the stream is not of the correct wire type.
   *
   * @return {number} The value of the signed 32-bit integer field.
   */
  readInt32() {
    asserts.assert(this.nextWireType_ == BinaryConstants.WireType.VARINT);
    return this.decoder_.readSignedVarint32();
  }


  /**
   * Reads a signed 32-bit integer field from the binary stream, or throws an
   * error if the next field in the stream is not of the correct wire type.
   *
   * Returns the value as a string.
   *
   * @return {string} The value of the signed 32-bit integer field as a decimal
   * string.
   */
  readInt32String() {
    asserts.assert(this.nextWireType_ == BinaryConstants.WireType.VARINT);
    return this.decoder_.readSignedVarint32String();
  }


  /**
   * Reads a signed 64-bit integer field from the binary stream, or throws an
   * error if the next field in the stream is not of the correct wire type.
   *
   * @return {number} The value of the signed 64-bit integer field.
   */
  readInt64() {
    asserts.assert(this.nextWireType_ == BinaryConstants.WireType.VARINT);
    return this.decoder_.readSignedVarint64();
  }


  /**
   * Reads a signed 64-bit integer field from the binary stream, or throws an
   * error if the next field in the stream is not of the correct wire type.
   *
   * Returns the value as a string.
   *
   * @return {string} The value of the signed 64-bit integer field as a decimal
   * string.
   */
  readInt64String() {
    asserts.assert(this.nextWireType_ == BinaryConstants.WireType.VARINT);
    return this.decoder_.readSignedVarint64String();
  }


  /**
   * Reads an unsigned 32-bit integer field from the binary stream, or throws an
   * error if the next field in the stream is not of the correct wire type.
   *
   * @return {number} The value of the unsigned 32-bit integer field.
   */
  readUint32() {
    asserts.assert(this.nextWireType_ == BinaryConstants.WireType.VARINT);
    return this.decoder_.readUnsignedVarint32();
  }


  /**
   * Reads an unsigned 32-bit integer field from the binary stream, or throws an
   * error if the next field in the stream is not of the correct wire type.
   *
   * Returns the value as a string.
   *
   * @return {string} The value of the unsigned 32-bit integer field as a
   *     decimal
   * string.
   */
  readUint32String() {
    asserts.assert(this.nextWireType_ == BinaryConstants.WireType.VARINT);
    return this.decoder_.readUnsignedVarint32String();
  }


  /**
   * Reads an unsigned 64-bit integer field from the binary stream, or throws an
   * error if the next field in the stream is not of the correct wire type.
   *
   * @return {number} The value of the unsigned 64-bit integer field.
   */
  readUint64() {
    asserts.assert(this.nextWireType_ == BinaryConstants.WireType.VARINT);
    return this.decoder_.readUnsignedVarint64();
  }

  /**
   * Reads an unsigned 64-bit integer field from the binary stream, or throws an
   * error if the next field in the stream is not of the correct wire type.
   *
   * Returns the value as a string.
   *
   * @return {string} The value of the unsigned 64-bit integer field as a
   *     decimal
   * string.
   */
  readUint64String() {
    asserts.assert(this.nextWireType_ == BinaryConstants.WireType.VARINT);
    return this.decoder_.readUnsignedVarint64String();
  }


  /**
   * Reads a signed zigzag-encoded 32-bit integer field from the binary stream,
   * or throws an error if the next field in the stream is not of the correct
   * wire type.
   *
   * @return {number} The value of the signed 32-bit integer field.
   */
  readSint32() {
    asserts.assert(this.nextWireType_ == BinaryConstants.WireType.VARINT);
    return this.decoder_.readZigzagVarint32();
  }


  /**
   * Reads a signed zigzag-encoded 64-bit integer field from the binary stream,
   * or throws an error if the next field in the stream is not of the correct
   * wire type.
   *
   * @return {number} The value of the signed 64-bit integer field.
   */
  readSint64() {
    asserts.assert(this.nextWireType_ == BinaryConstants.WireType.VARINT);
    return this.decoder_.readZigzagVarint64();
  }


  /**
   * Reads a signed zigzag-encoded 64-bit integer field from the binary stream,
   * or throws an error if the next field in the stream is not of the correct
   * wire type.
   *
   * @return {string} The value of the signed 64-bit integer field as a decimal
   *     string.
   */
  readSint64String() {
    asserts.assert(this.nextWireType_ == BinaryConstants.WireType.VARINT);
    return this.decoder_.readZigzagVarint64String();
  }


  /**
   * Reads an unsigned 32-bit fixed-length integer fiield from the binary
   * stream, or throws an error if the next field in the stream is not of the
   * correct wire type.
   *
   * @return {number} The value of the double field.
   */
  readFixed32() {
    asserts.assert(this.nextWireType_ == BinaryConstants.WireType.FIXED32);
    return this.decoder_.readUint32();
  }


  /**
   * Reads an unsigned 64-bit fixed-length integer fiield from the binary
   * stream, or throws an error if the next field in the stream is not of the
   * correct wire type.
   *
   * @return {number} The value of the float field.
   */
  readFixed64() {
    asserts.assert(this.nextWireType_ == BinaryConstants.WireType.FIXED64);
    return this.decoder_.readUint64();
  }


  /**
   * Reads a signed 64-bit integer field from the binary stream as a string, or
   * throws an error if the next field in the stream is not of the correct wire
   * type.
   *
   * Returns the value as a string.
   *
   * @return {string} The value of the unsigned 64-bit integer field as a
   *     decimal
   * string.
   */
  readFixed64String() {
    asserts.assert(this.nextWireType_ == BinaryConstants.WireType.FIXED64);
    return this.decoder_.readUint64String();
  }


  /**
   * Reads a signed 32-bit fixed-length integer fiield from the binary stream,
   * or throws an error if the next field in the stream is not of the correct
   * wire type.
   *
   * @return {number} The value of the signed 32-bit integer field.
   */
  readSfixed32() {
    asserts.assert(this.nextWireType_ == BinaryConstants.WireType.FIXED32);
    return this.decoder_.readInt32();
  }


  /**
   * Reads a signed 32-bit fixed-length integer fiield from the binary stream,
   * or throws an error if the next field in the stream is not of the correct
   * wire type.
   *
   * @return {string} The value of the signed 32-bit integer field as a decimal
   * string.
   */
  readSfixed32String() {
    asserts.assert(this.nextWireType_ == BinaryConstants.WireType.FIXED32);
    return this.decoder_.readInt32().toString();
  }


  /**
   * Reads a signed 64-bit fixed-length integer fiield from the binary stream,
   * or throws an error if the next field in the stream is not of the correct
   * wire type.
   *
   * @return {number} The value of the sfixed64 field.
   */
  readSfixed64() {
    asserts.assert(this.nextWireType_ == BinaryConstants.WireType.FIXED64);
    return this.decoder_.readInt64();
  }


  /**
   * Reads a signed 64-bit fixed-length integer fiield from the binary stream,
   * or throws an error if the next field in the stream is not of the correct
   * wire type.
   *
   * Returns the value as a string.
   *
   * @return {string} The value of the sfixed64 field as a decimal string.
   */
  readSfixed64String() {
    asserts.assert(this.nextWireType_ == BinaryConstants.WireType.FIXED64);
    return this.decoder_.readInt64String();
  }


  /**
   * Reads a 32-bit floating-point field from the binary stream, or throws an
   * error if the next field in the stream is not of the correct wire type.
   *
   * @return {number} The value of the float field.
   */
  readFloat() {
    asserts.assert(this.nextWireType_ == BinaryConstants.WireType.FIXED32);
    return this.decoder_.readFloat();
  }


  /**
   * Reads a 64-bit floating-point field from the binary stream, or throws an
   * error if the next field in the stream is not of the correct wire type.
   *
   * @return {number} The value of the double field.
   */
  readDouble() {
    asserts.assert(this.nextWireType_ == BinaryConstants.WireType.FIXED64);
    return this.decoder_.readDouble();
  }


  /**
   * Reads a boolean field from the binary stream, or throws an error if the
   * next field in the stream is not of the correct wire type.
   *
   * @return {boolean} The value of the boolean field.
   */
  readBool() {
    asserts.assert(this.nextWireType_ == BinaryConstants.WireType.VARINT);
    return !!this.decoder_.readUnsignedVarint32();
  }


  /**
   * Reads an enum field from the binary stream, or throws an error if the next
   * field in the stream is not of the correct wire type.
   *
   * @return {number} The value of the enum field.
   */
  readEnum() {
    asserts.assert(this.nextWireType_ == BinaryConstants.WireType.VARINT);
    return this.decoder_.readSignedVarint64();
  }


  /**
   * Reads a string field from the binary stream, or throws an error if the next
   * field in the stream is not of the correct wire type.
   *
   * @return {string} The value of the string field.
   */
  readString() {
    asserts.assert(this.nextWireType_ == BinaryConstants.WireType.DELIMITED);
    var length = this.decoder_.readUnsignedVarint32();
    return this.decoder_.readString(length);
  };


  /**
   * Reads a length-prefixed block of bytes from the binary stream, or returns
   * null if the next field in the stream has an invalid length value.
   *
   * @return {!Uint8Array} The block of bytes.
   */
  readBytes() {
    asserts.assert(this.nextWireType_ == BinaryConstants.WireType.DELIMITED);
    var length = this.decoder_.readUnsignedVarint32();
    return this.decoder_.readBytes(length);
  }


  /**
   * Reads a 64-bit varint field from the stream and invokes `convert` to
   * produce the return value, or throws an error if the next field in the
   * stream is not of the correct wire type.
   *
   * @param {function(number, number): T} convert Conversion function to produce
   *     the result value, takes parameters (lowBits, highBits).
   * @return {T}
   * @template T
   */
  readSplitVarint64(convert) {
    asserts.assert(this.nextWireType_ == BinaryConstants.WireType.VARINT);
    return this.decoder_.readSplitVarint64(convert);
  }


  /**
   * Reads a 64-bit zig-zag varint field from the stream and invokes `convert`
   * to produce the return value, or throws an error if the next field in the
   * stream is not of the correct wire type.
   *
   * @param {function(number, number): T} convert Conversion function to produce
   *     the result value, takes parameters (lowBits, highBits).
   * @return {T}
   * @template T
   */
  readSplitZigzagVarint64(convert) {
    asserts.assert(this.nextWireType_ == BinaryConstants.WireType.VARINT);
    return this.decoder_.readSplitVarint64(
        (lowBits, highBits) => utils.fromZigzag64(lowBits, highBits, convert));
  }


  /**
   * Reads a 64-bit fixed64 field from the stream and invokes `convert`
   * to produce the return value, or throws an error if the next field in the
   * stream is not of the correct wire type.
   *
   * @param {function(number, number): T} convert Conversion function to produce
   *     the result value, takes parameters (lowBits, highBits).
   * @return {T}
   * @template T
   */
  readSplitFixed64(convert) {
    asserts.assert(this.nextWireType_ == BinaryConstants.WireType.FIXED64);
    return this.decoder_.readSplitFixed64(convert);
  }


  /**
   * Reads a packed scalar field using the supplied raw reader function.
   * @param {function(this:BinaryDecoder):T} decodeMethod
   * @return {!Array<T>}
   * @template T
   * @private
   */
  readPackedField_(decodeMethod) {
    asserts.assert(this.nextWireType_ == BinaryConstants.WireType.DELIMITED);
    var length = this.decoder_.readUnsignedVarint32();
    var end = this.decoder_.getCursor() + length;
    var result = [];
    while (this.decoder_.getCursor() < end) {
      // TODO(aappleby): .call is slow
      result.push(decodeMethod.call(this.decoder_));
    }
    return result;
  }


  /**
   * Reads a packed int32 field, which consists of a length header and a list of
   * signed varints.
   * @return {!Array<number>}
   */
  readPackedInt32() {
    return this.readPackedField_(this.decoder_.readSignedVarint32);
  }


  /**
   * Reads a packed int32 field, which consists of a length header and a list of
   * signed varints. Returns a list of strings.
   * @return {!Array<string>}
   */
  readPackedInt32String() {
    return this.readPackedField_(this.decoder_.readSignedVarint32String);
  }


  /**
   * Reads a packed int64 field, which consists of a length header and a list of
   * signed varints.
   * @return {!Array<number>}
   */
  readPackedInt64() {
    return this.readPackedField_(this.decoder_.readSignedVarint64);
  }


  /**
   * Reads a packed int64 field, which consists of a length header and a list of
   * signed varints. Returns a list of strings.
   * @return {!Array<string>}
   */
  readPackedInt64String() {
    return this.readPackedField_(this.decoder_.readSignedVarint64String);
  }


  /**
   * Reads a packed uint32 field, which consists of a length header and a list
   * of unsigned varints.
   * @return {!Array<number>}
   */
  readPackedUint32() {
    return this.readPackedField_(this.decoder_.readUnsignedVarint32);
  }


  /**
   * Reads a packed uint32 field, which consists of a length header and a list
   * of unsigned varints. Returns a list of strings.
   * @return {!Array<string>}
   */
  readPackedUint32String() {
    return this.readPackedField_(this.decoder_.readUnsignedVarint32String);
  }


  /**
   * Reads a packed uint64 field, which consists of a length header and a list
   * of unsigned varints.
   * @return {!Array<number>}
   */
  readPackedUint64() {
    return this.readPackedField_(this.decoder_.readUnsignedVarint64);
  }


  /**
   * Reads a packed uint64 field, which consists of a length header and a list
   * of unsigned varints. Returns a list of strings.
   * @return {!Array<string>}
   */
  readPackedUint64String() {
    return this.readPackedField_(this.decoder_.readUnsignedVarint64String);
  }


  /**
   * Reads a packed sint32 field, which consists of a length header and a list
   * of zigzag varints.
   * @return {!Array<number>}
   */
  readPackedSint32() {
    return this.readPackedField_(this.decoder_.readZigzagVarint32);
  }


  /**
   * Reads a packed sint64 field, which consists of a length header and a list
   * of zigzag varints.
   * @return {!Array<number>}
   */
  readPackedSint64() {
    return this.readPackedField_(this.decoder_.readZigzagVarint64);
  }


  /**
   * Reads a packed sint64 field, which consists of a length header and a list
   * of zigzag varints.  Returns a list of strings.
   * @return {!Array<string>}
   */
  readPackedSint64String() {
    return this.readPackedField_(this.decoder_.readZigzagVarint64String);
  }

  /**
   * Reads a packed fixed32 field, which consists of a length header and a list
   * of unsigned 32-bit ints.
   * @return {!Array<number>}
   */
  readPackedFixed32() {
    return this.readPackedField_(this.decoder_.readUint32);
  }


  /**
   * Reads a packed fixed64 field, which consists of a length header and a list
   * of unsigned 64-bit ints.
   * @return {!Array<number>}
   */
  readPackedFixed64() {
    return this.readPackedField_(this.decoder_.readUint64);
  }


  /**
   * Reads a packed fixed64 field, which consists of a length header and a list
   * of unsigned 64-bit ints.  Returns a list of strings.
   * @return {!Array<string>}
   */
  readPackedFixed64String() {
    return this.readPackedField_(this.decoder_.readUint64String);
  }


  /**
   * Reads a packed sfixed32 field, which consists of a length header and a list
   * of 32-bit ints.
   * @return {!Array<number>}
   */
  readPackedSfixed32() {
    return this.readPackedField_(this.decoder_.readInt32);
  }


  /**
   * Reads a packed sfixed64 field, which consists of a length header and a list
   * of 64-bit ints.
   * @return {!Array<number>}
   */
  readPackedSfixed64() {
    return this.readPackedField_(this.decoder_.readInt64);
  }


  /**
   * Reads a packed sfixed64 field, which consists of a length header and a list
   * of 64-bit ints.  Returns a list of strings.
   * @return {!Array<string>}
   */
  readPackedSfixed64String() {
    return this.readPackedField_(this.decoder_.readInt64String);
  }


  /**
   * Reads a packed float field, which consists of a length header and a list of
   * floats.
   * @return {!Array<number>}
   */
  readPackedFloat() {
    return this.readPackedField_(this.decoder_.readFloat);
  }


  /**
   * Reads a packed double field, which consists of a length header and a list
   * of doubles.
   * @return {!Array<number>}
   */
  readPackedDouble() {
    return this.readPackedField_(this.decoder_.readDouble);
  }


  /**
   * Reads a packed bool field, which consists of a length header and a list of
   * unsigned varints.
   * @return {!Array<boolean>}
   */
  readPackedBool() {
    return this.readPackedField_(this.decoder_.readBool);
  }


  /**
   * Reads a packed enum field, which consists of a length header and a list of
   * unsigned varints.
   * @return {!Array<number>}
   */
  readPackedEnum() {
    return this.readPackedField_(this.decoder_.readEnum);
  }

  /**
   * Visible for testing.
   * @package
   */
  static resetInstanceCache() {
    BinaryReader.instanceCache_ = [];
  }

  /**
   * Visible for testing.
   * @return {!Array<!BinaryReader>}
   * @package
   */
  static getInstanceCache() {
    return BinaryReader.instanceCache_;
  }
}

/**
 * Global pool of BinaryReader instances.
 * @private {!Array<!BinaryReader>}
 */
BinaryReader.instanceCache_ = [];

exports = BinaryReader;

;return exports;});

//third_party/javascript/closure/labs/useragent/platform.js
/**
 * @license
 * Copyright The Closure Library Authors.
 * SPDX-License-Identifier: Apache-2.0
 */

/**
 * @fileoverview Closure user agent platform detection.
 * @see <a href="http://www.useragentstring.com/">User agent strings</a>
 * For more information on browser brand, rendering engine, or device see the
 * other sub-namespaces in goog.labs.userAgent (browser, engine, and device
 * respectively).
 */

goog.provide('goog.labs.userAgent.platform');

goog.require('goog.labs.userAgent.util');
goog.require('goog.string');


/**
 * @return {boolean} Whether the platform is Android.
 */
goog.labs.userAgent.platform.isAndroid = function() {
  'use strict';
  return goog.labs.userAgent.util.matchUserAgent('Android');
};


/**
 * @return {boolean} Whether the platform is iPod.
 */
goog.labs.userAgent.platform.isIpod = function() {
  'use strict';
  return goog.labs.userAgent.util.matchUserAgent('iPod');
};


/**
 * @return {boolean} Whether the platform is iPhone.
 */
goog.labs.userAgent.platform.isIphone = function() {
  'use strict';
  return goog.labs.userAgent.util.matchUserAgent('iPhone') &&
      !goog.labs.userAgent.util.matchUserAgent('iPod') &&
      !goog.labs.userAgent.util.matchUserAgent('iPad');
};


/**
 * @return {boolean} Whether the platform is iPad.
 */
goog.labs.userAgent.platform.isIpad = function() {
  'use strict';
  return goog.labs.userAgent.util.matchUserAgent('iPad');
};


/**
 * @return {boolean} Whether the platform is iOS.
 */
goog.labs.userAgent.platform.isIos = function() {
  'use strict';
  return goog.labs.userAgent.platform.isIphone() ||
      goog.labs.userAgent.platform.isIpad() ||
      goog.labs.userAgent.platform.isIpod();
};


/**
 * @return {boolean} Whether the platform is Mac.
 */
goog.labs.userAgent.platform.isMacintosh = function() {
  'use strict';
  return goog.labs.userAgent.util.matchUserAgent('Macintosh');
};


/**
 * Note: ChromeOS is not considered to be Linux as it does not report itself
 * as Linux in the user agent string.
 * @return {boolean} Whether the platform is Linux.
 */
goog.labs.userAgent.platform.isLinux = function() {
  'use strict';
  return goog.labs.userAgent.util.matchUserAgent('Linux');
};


/**
 * @return {boolean} Whether the platform is Windows.
 */
goog.labs.userAgent.platform.isWindows = function() {
  'use strict';
  return goog.labs.userAgent.util.matchUserAgent('Windows');
};


/**
 * @return {boolean} Whether the platform is ChromeOS.
 */
goog.labs.userAgent.platform.isChromeOS = function() {
  'use strict';
  return goog.labs.userAgent.util.matchUserAgent('CrOS');
};

/**
 * @return {boolean} Whether the platform is Chromecast.
 */
goog.labs.userAgent.platform.isChromecast = function() {
  'use strict';
  return goog.labs.userAgent.util.matchUserAgent('CrKey');
};

/**
 * @return {boolean} Whether the platform is KaiOS.
 */
goog.labs.userAgent.platform.isKaiOS = function() {
  'use strict';
  return goog.labs.userAgent.util.matchUserAgentIgnoreCase('KaiOS');
};

/**
 * The version of the platform. We only determine the version for Windows,
 * Mac, and Chrome OS. It doesn't make much sense on Linux. For Windows, we only
 * look at the NT version. Non-NT-based versions (e.g. 95, 98, etc.) are given
 * version 0.0.
 *
 * @return {string} The platform version or empty string if version cannot be
 *     determined.
 */
goog.labs.userAgent.platform.getVersion = function() {
  'use strict';
  var userAgentString = goog.labs.userAgent.util.getUserAgent();
  var version = '', re;
  if (goog.labs.userAgent.platform.isWindows()) {
    re = /Windows (?:NT|Phone) ([0-9.]+)/;
    var match = re.exec(userAgentString);
    if (match) {
      version = match[1];
    } else {
      version = '0.0';
    }
  } else if (goog.labs.userAgent.platform.isIos()) {
    re = /(?:iPhone|iPod|iPad|CPU)\s+OS\s+(\S+)/;
    var match = re.exec(userAgentString);
    // Report the version as x.y.z and not x_y_z
    version = match && match[1].replace(/_/g, '.');
  } else if (goog.labs.userAgent.platform.isMacintosh()) {
    re = /Mac OS X ([0-9_.]+)/;
    var match = re.exec(userAgentString);
    // Note: some old versions of Camino do not report an OSX version.
    // Default to 10.
    version = match ? match[1].replace(/_/g, '.') : '10';
  } else if (goog.labs.userAgent.platform.isKaiOS()) {
    re = /(?:KaiOS)\/(\S+)/i;
    var match = re.exec(userAgentString);
    version = match && match[1];
  } else if (goog.labs.userAgent.platform.isAndroid()) {
    re = /Android\s+([^\);]+)(\)|;)/;
    var match = re.exec(userAgentString);
    version = match && match[1];
  } else if (goog.labs.userAgent.platform.isChromeOS()) {
    re = /(?:CrOS\s+(?:i686|x86_64)\s+([0-9.]+))/;
    var match = re.exec(userAgentString);
    version = match && match[1];
  }
  return version || '';
};


/**
 * @param {string|number} version The version to check.
 * @return {boolean} Whether the browser version is higher or the same as the
 *     given version.
 */
goog.labs.userAgent.platform.isVersionOrHigher = function(version) {
  'use strict';
  return goog.string.compareVersions(
             goog.labs.userAgent.platform.getVersion(), version) >= 0;
};

//third_party/javascript/closure/labs/useragent/engine.js
/**
 * @license
 * Copyright The Closure Library Authors.
 * SPDX-License-Identifier: Apache-2.0
 */

/**
 * @fileoverview Closure user agent detection.
 * @see http://en.wikipedia.org/wiki/User_agent
 * For more information on browser brand, platform, or device see the other
 * sub-namespaces in goog.labs.userAgent (browser, platform, and device).
 */

goog.provide('goog.labs.userAgent.engine');

goog.require('goog.array');
goog.require('goog.labs.userAgent.util');
goog.require('goog.string');


/**
 * @return {boolean} Whether the rendering engine is Presto.
 */
goog.labs.userAgent.engine.isPresto = function() {
  'use strict';
  return goog.labs.userAgent.util.matchUserAgent('Presto');
};


/**
 * @return {boolean} Whether the rendering engine is Trident.
 */
goog.labs.userAgent.engine.isTrident = function() {
  'use strict';
  // IE only started including the Trident token in IE8.
  return goog.labs.userAgent.util.matchUserAgent('Trident') ||
      goog.labs.userAgent.util.matchUserAgent('MSIE');
};


/**
 * @return {boolean} Whether the rendering engine is EdgeHTML.
 */
goog.labs.userAgent.engine.isEdge = function() {
  'use strict';
  return goog.labs.userAgent.util.matchUserAgent('Edge');
};


/**
 * @return {boolean} Whether the rendering engine is WebKit. This will return
 * true for Chrome, Blink-based Opera (15+), Edge Chromium and Safari.
 */
goog.labs.userAgent.engine.isWebKit = function() {
  'use strict';
  return goog.labs.userAgent.util.matchUserAgentIgnoreCase('WebKit') &&
      !goog.labs.userAgent.engine.isEdge();
};


/**
 * @return {boolean} Whether the rendering engine is Gecko.
 */
goog.labs.userAgent.engine.isGecko = function() {
  'use strict';
  return goog.labs.userAgent.util.matchUserAgent('Gecko') &&
      !goog.labs.userAgent.engine.isWebKit() &&
      !goog.labs.userAgent.engine.isTrident() &&
      !goog.labs.userAgent.engine.isEdge();
};


/**
 * @return {string} The rendering engine's version or empty string if version
 *     can't be determined.
 */
goog.labs.userAgent.engine.getVersion = function() {
  'use strict';
  var userAgentString = goog.labs.userAgent.util.getUserAgent();
  if (userAgentString) {
    var tuples = goog.labs.userAgent.util.extractVersionTuples(userAgentString);

    var engineTuple = goog.labs.userAgent.engine.getEngineTuple_(tuples);
    if (engineTuple) {
      // In Gecko, the version string is either in the browser info or the
      // Firefox version.  See Gecko user agent string reference:
      // http://goo.gl/mULqa
      if (engineTuple[0] == 'Gecko') {
        return goog.labs.userAgent.engine.getVersionForKey_(tuples, 'Firefox');
      }

      return engineTuple[1];
    }

    // MSIE has only one version identifier, and the Trident version is
    // specified in the parenthetical. IE Edge is covered in the engine tuple
    // detection.
    var browserTuple = tuples[0];
    var info;
    if (browserTuple && (info = browserTuple[2])) {
      var match = /Trident\/([^\s;]+)/.exec(info);
      if (match) {
        return match[1];
      }
    }
  }
  return '';
};


/**
 * @param {!Array<!Array<string>>} tuples Extracted version tuples.
 * @return {!Array<string>|undefined} The engine tuple or undefined if not
 *     found.
 * @private
 */
goog.labs.userAgent.engine.getEngineTuple_ = function(tuples) {
  'use strict';
  if (!goog.labs.userAgent.engine.isEdge()) {
    return tuples[1];
  }
  for (var i = 0; i < tuples.length; i++) {
    var tuple = tuples[i];
    if (tuple[0] == 'Edge') {
      return tuple;
    }
  }
};


/**
 * @param {string|number} version The version to check.
 * @return {boolean} Whether the rendering engine version is higher or the same
 *     as the given version.
 */
goog.labs.userAgent.engine.isVersionOrHigher = function(version) {
  'use strict';
  return goog.string.compareVersions(
             goog.labs.userAgent.engine.getVersion(), version) >= 0;
};


/**
 * @param {!Array<!Array<string>>} tuples Version tuples.
 * @param {string} key The key to look for.
 * @return {string} The version string of the given key, if present.
 *     Otherwise, the empty string.
 * @private
 */
goog.labs.userAgent.engine.getVersionForKey_ = function(tuples, key) {
  'use strict';
  // TODO(nnaze): Move to util if useful elsewhere.

  var pair = goog.array.find(tuples, function(pair) {
    'use strict';
    return key == pair[0];
  });

  return pair && pair[1] || '';
};

//third_party/javascript/closure/reflect/reflect.js
/**
 * @license
 * Copyright The Closure Library Authors.
 * SPDX-License-Identifier: Apache-2.0
 */

/**
 * @fileoverview Useful compiler idioms.
 */

goog.provide('goog.reflect');


/**
 * Syntax for object literal casts.
 * @see http://go/jscompiler-renaming
 * @see https://goo.gl/CRs09P
 *
 * Use this if you have an object literal whose keys need to have the same names
 * as the properties of some class even after they are renamed by the compiler.
 *
 * @param {!Function} type Type to cast to.
 * @param {Object} object Object literal to cast.
 * @return {Object} The object literal.
 */
goog.reflect.object = function(type, object) {
  'use strict';
  return object;
};

/**
 * Syntax for renaming property strings.
 * @see http://go/jscompiler-renaming
 * @see https://goo.gl/CRs09P
 *
 * Use this if you have an need to access a property as a string, but want
 * to also have the property renamed by the compiler. In contrast to
 * goog.reflect.object, this method takes an instance of an object.
 *
 * Properties must be simple names (not qualified names).
 *
 * @param {string} prop Name of the property
 * @param {!Object} object Instance of the object whose type will be used
 *     for renaming
 * @return {string} The renamed property.
 */
goog.reflect.objectProperty = function(prop, object) {
  'use strict';
  return prop;
};

/**
 * To assert to the compiler that an operation is needed when it would
 * otherwise be stripped. For example:
 * <code>
 *     // Force a layout
 *     goog.reflect.sinkValue(dialog.offsetHeight);
 * </code>
 * @param {T} x
 * @return {T}
 * @template T
 */
goog.reflect.sinkValue = function(x) {
  'use strict';
  goog.reflect.sinkValue[' '](x);
  return x;
};


/**
 * The compiler should optimize this function away iff no one ever uses
 * goog.reflect.sinkValue.
 */
goog.reflect.sinkValue[' '] = goog.nullFunction;


/**
 * Check if a property can be accessed without throwing an exception.
 * @param {Object} obj The owner of the property.
 * @param {string} prop The property name.
 * @return {boolean} Whether the property is accessible. Will also return true
 *     if obj is null.
 */
goog.reflect.canAccessProperty = function(obj, prop) {
  'use strict';
  try {
    goog.reflect.sinkValue(obj[prop]);
    return true;
  } catch (e) {
  }
  return false;
};


/**
 * Retrieves a value from a cache given a key. The compiler provides special
 * consideration for this call such that it is generally considered side-effect
 * free. However, if the `opt_keyFn` or `valueFn` have side-effects
 * then the entire call is considered to have side-effects.
 *
 * Conventionally storing the value on the cache would be considered a
 * side-effect and preclude unused calls from being pruned, ie. even if
 * the value was never used, it would still always be stored in the cache.
 *
 * Providing a side-effect free `valueFn` and `opt_keyFn`
 * allows unused calls to `goog.reflect.cache` to be pruned.
 *
 * @param {!Object<K, V>} cacheObj The object that contains the cached values.
 * @param {?} key The key to lookup in the cache. If it is not string or number
 *     then a `opt_keyFn` should be provided. The key is also used as the
 *     parameter to the `valueFn`.
 * @param {function(?):V} valueFn The value provider to use to calculate the
 *     value to store in the cache. This function should be side-effect free
 *     to take advantage of the optimization.
 * @param {function(?):K=} opt_keyFn The key provider to determine the cache
 *     map key. This should be used if the given key is not a string or number.
 *     If not provided then the given key is used. This function should be
 *     side-effect free to take advantage of the optimization.
 * @return {V} The cached or calculated value.
 * @template K
 * @template V
 */
goog.reflect.cache = function(cacheObj, key, valueFn, opt_keyFn) {
  'use strict';
  const storedKey = opt_keyFn ? opt_keyFn(key) : key;

  if (Object.prototype.hasOwnProperty.call(cacheObj, storedKey)) {
    return cacheObj[storedKey];
  }

  return (cacheObj[storedKey] = valueFn(key));
};

//third_party/javascript/closure/useragent/useragent.js
/**
 * @license
 * Copyright The Closure Library Authors.
 * SPDX-License-Identifier: Apache-2.0
 */

/**
 * @fileoverview Rendering engine detection.
 * @see <a href="http://www.useragentstring.com/">User agent strings</a>
 * For information on the browser brand (such as Safari versus Chrome), see
 * goog.userAgent.product.
 * @see ../demos/useragent.html
 */

goog.provide('goog.userAgent');

goog.require('goog.labs.userAgent.browser');
goog.require('goog.labs.userAgent.engine');
goog.require('goog.labs.userAgent.platform');
goog.require('goog.labs.userAgent.util');
goog.require('goog.reflect');
goog.require('goog.string');


/**
 * @define {boolean} Whether we know at compile-time that the browser is IE.
 */
goog.userAgent.ASSUME_IE = goog.define('goog.userAgent.ASSUME_IE', false);


/**
 * @define {boolean} Whether we know at compile-time that the browser is EDGE,
 * referring to EdgeHTML based Edge.
 */
goog.userAgent.ASSUME_EDGE = goog.define('goog.userAgent.ASSUME_EDGE', false);


/**
 * @define {boolean} Whether we know at compile-time that the browser is GECKO.
 */
goog.userAgent.ASSUME_GECKO = goog.define('goog.userAgent.ASSUME_GECKO', false);


/**
 * @define {boolean} Whether we know at compile-time that the browser is WEBKIT.
 */
goog.userAgent.ASSUME_WEBKIT =
    goog.define('goog.userAgent.ASSUME_WEBKIT', false);


/**
 * @define {boolean} Whether we know at compile-time that the browser is a
 *     mobile device running WebKit e.g. iPhone or Android.
 */
goog.userAgent.ASSUME_MOBILE_WEBKIT =
    goog.define('goog.userAgent.ASSUME_MOBILE_WEBKIT', false);


/**
 * @define {boolean} Whether we know at compile-time that the browser is OPERA,
 * referring to Presto-based Opera.
 */
goog.userAgent.ASSUME_OPERA = goog.define('goog.userAgent.ASSUME_OPERA', false);


/**
 * @define {boolean} Whether the
 *     `goog.userAgent.isVersionOrHigher`
 *     function will return true for any version.
 */
goog.userAgent.ASSUME_ANY_VERSION =
    goog.define('goog.userAgent.ASSUME_ANY_VERSION', false);


/**
 * Whether we know the browser engine at compile-time.
 * @type {boolean}
 * @private
 */
goog.userAgent.BROWSER_KNOWN_ = goog.userAgent.ASSUME_IE ||
    goog.userAgent.ASSUME_EDGE || goog.userAgent.ASSUME_GECKO ||
    goog.userAgent.ASSUME_MOBILE_WEBKIT || goog.userAgent.ASSUME_WEBKIT ||
    goog.userAgent.ASSUME_OPERA;


/**
 * Returns the userAgent string for the current browser.
 *
 * @return {string} The userAgent string.
 */
goog.userAgent.getUserAgentString = function() {
  'use strict';
  return goog.labs.userAgent.util.getUserAgent();
};


/**
 * @return {?Navigator} The native navigator object.
 */
goog.userAgent.getNavigatorTyped = function() {
  'use strict';
  // Need a local navigator reference instead of using the global one,
  // to avoid the rare case where they reference different objects.
  // (in a WorkerPool, for example).
  return goog.global['navigator'] || null;
};


/**
 * TODO(nnaze): Change type to "Navigator" and update compilation targets.
 * @return {?Object} The native navigator object.
 */
goog.userAgent.getNavigator = function() {
  'use strict';
  return goog.userAgent.getNavigatorTyped();
};


/**
 * Whether the user agent is Presto-based Opera.
 * @type {boolean}
 */
goog.userAgent.OPERA = goog.userAgent.BROWSER_KNOWN_ ?
    goog.userAgent.ASSUME_OPERA :
    goog.labs.userAgent.browser.isOpera();


/**
 * Whether the user agent is Internet Explorer.
 * @type {boolean}
 */
goog.userAgent.IE = goog.userAgent.BROWSER_KNOWN_ ?
    goog.userAgent.ASSUME_IE :
    goog.labs.userAgent.browser.isIE();


/**
 * Whether the user agent is Microsoft Edge (EdgeHTML based).
 * @type {boolean}
 */
goog.userAgent.EDGE = goog.userAgent.BROWSER_KNOWN_ ?
    goog.userAgent.ASSUME_EDGE :
    goog.labs.userAgent.engine.isEdge();


/**
 * Whether the user agent is MS Internet Explorer or MS Edge (EdgeHTML based).
 * @type {boolean}
 */
goog.userAgent.EDGE_OR_IE = goog.userAgent.EDGE || goog.userAgent.IE;


/**
 * Whether the user agent is Gecko. Gecko is the rendering engine used by
 * Mozilla, Firefox, and others.
 * @type {boolean}
 */
goog.userAgent.GECKO = goog.userAgent.BROWSER_KNOWN_ ?
    goog.userAgent.ASSUME_GECKO :
    goog.labs.userAgent.engine.isGecko();


/**
 * Whether the user agent is WebKit. WebKit is the rendering engine that
 * Safari, Edge Chromium, Opera Chromium, Android and others use.
 * @type {boolean}
 */
goog.userAgent.WEBKIT = goog.userAgent.BROWSER_KNOWN_ ?
    goog.userAgent.ASSUME_WEBKIT || goog.userAgent.ASSUME_MOBILE_WEBKIT :
    goog.labs.userAgent.engine.isWebKit();


/**
 * Whether the user agent is running on a mobile device.
 *
 * This is a separate function so that the logic can be tested.
 *
 * TODO(nnaze): Investigate swapping in goog.labs.userAgent.device.isMobile().
 *
 * @return {boolean} Whether the user agent is running on a mobile device.
 * @private
 */
goog.userAgent.isMobile_ = function() {
  'use strict';
  return goog.userAgent.WEBKIT &&
      goog.labs.userAgent.util.matchUserAgent('Mobile');
};


/**
 * Whether the user agent is running on a mobile device.
 *
 * TODO(nnaze): Consider deprecating MOBILE when labs.userAgent
 *   is promoted as the gecko/webkit logic is likely inaccurate.
 *
 * @type {boolean}
 */
goog.userAgent.MOBILE =
    goog.userAgent.ASSUME_MOBILE_WEBKIT || goog.userAgent.isMobile_();


/**
 * Used while transitioning code to use WEBKIT instead.
 * @type {boolean}
 * @deprecated Use {@link goog.userAgent.product.SAFARI} instead.
 * TODO(nicksantos): Delete this from goog.userAgent.
 */
goog.userAgent.SAFARI = goog.userAgent.WEBKIT;


/**
 * @return {string} the platform (operating system) the user agent is running
 *     on. Default to empty string because navigator.platform may not be defined
 *     (on Rhino, for example).
 * @private
 */
goog.userAgent.determinePlatform_ = function() {
  'use strict';
  var navigator = goog.userAgent.getNavigatorTyped();
  return navigator && navigator.platform || '';
};


/**
 * The platform (operating system) the user agent is running on. Default to
 * empty string because navigator.platform may not be defined (on Rhino, for
 * example).
 * @type {string}
 */
goog.userAgent.PLATFORM = goog.userAgent.determinePlatform_();


/**
 * @define {boolean} Whether the user agent is running on a Macintosh operating
 *     system.
 */
goog.userAgent.ASSUME_MAC = goog.define('goog.userAgent.ASSUME_MAC', false);


/**
 * @define {boolean} Whether the user agent is running on a Windows operating
 *     system.
 */
goog.userAgent.ASSUME_WINDOWS =
    goog.define('goog.userAgent.ASSUME_WINDOWS', false);


/**
 * @define {boolean} Whether the user agent is running on a Linux operating
 *     system.
 */
goog.userAgent.ASSUME_LINUX = goog.define('goog.userAgent.ASSUME_LINUX', false);


/**
 * @define {boolean} Whether the user agent is running on a X11 windowing
 *     system.
 */
goog.userAgent.ASSUME_X11 = goog.define('goog.userAgent.ASSUME_X11', false);


/**
 * @define {boolean} Whether the user agent is running on Android.
 */
goog.userAgent.ASSUME_ANDROID =
    goog.define('goog.userAgent.ASSUME_ANDROID', false);


/**
 * @define {boolean} Whether the user agent is running on an iPhone.
 */
goog.userAgent.ASSUME_IPHONE =
    goog.define('goog.userAgent.ASSUME_IPHONE', false);


/**
 * @define {boolean} Whether the user agent is running on an iPad.
 */
goog.userAgent.ASSUME_IPAD = goog.define('goog.userAgent.ASSUME_IPAD', false);


/**
 * @define {boolean} Whether the user agent is running on an iPod.
 */
goog.userAgent.ASSUME_IPOD = goog.define('goog.userAgent.ASSUME_IPOD', false);


/**
 * @define {boolean} Whether the user agent is running on KaiOS.
 */
goog.userAgent.ASSUME_KAIOS = goog.define('goog.userAgent.ASSUME_KAIOS', false);


/**
 * @type {boolean}
 * @private
 */
goog.userAgent.PLATFORM_KNOWN_ = goog.userAgent.ASSUME_MAC ||
    goog.userAgent.ASSUME_WINDOWS || goog.userAgent.ASSUME_LINUX ||
    goog.userAgent.ASSUME_X11 || goog.userAgent.ASSUME_ANDROID ||
    goog.userAgent.ASSUME_IPHONE || goog.userAgent.ASSUME_IPAD ||
    goog.userAgent.ASSUME_IPOD;


/**
 * Whether the user agent is running on a Macintosh operating system.
 * @type {boolean}
 */
goog.userAgent.MAC = goog.userAgent.PLATFORM_KNOWN_ ?
    goog.userAgent.ASSUME_MAC :
    goog.labs.userAgent.platform.isMacintosh();


/**
 * Whether the user agent is running on a Windows operating system.
 * @type {boolean}
 */
goog.userAgent.WINDOWS = goog.userAgent.PLATFORM_KNOWN_ ?
    goog.userAgent.ASSUME_WINDOWS :
    goog.labs.userAgent.platform.isWindows();


/**
 * Whether the user agent is Linux per the legacy behavior of
 * goog.userAgent.LINUX, which considered ChromeOS to also be
 * Linux.
 * @return {boolean}
 * @private
 */
goog.userAgent.isLegacyLinux_ = function() {
  'use strict';
  return goog.labs.userAgent.platform.isLinux() ||
      goog.labs.userAgent.platform.isChromeOS();
};


/**
 * Whether the user agent is running on a Linux operating system.
 *
 * Note that goog.userAgent.LINUX considers ChromeOS to be Linux,
 * while goog.labs.userAgent.platform considers ChromeOS and
 * Linux to be different OSes.
 *
 * @type {boolean}
 */
goog.userAgent.LINUX = goog.userAgent.PLATFORM_KNOWN_ ?
    goog.userAgent.ASSUME_LINUX :
    goog.userAgent.isLegacyLinux_();


/**
 * @return {boolean} Whether the user agent is an X11 windowing system.
 * @private
 */
goog.userAgent.isX11_ = function() {
  'use strict';
  var navigator = goog.userAgent.getNavigatorTyped();
  return !!navigator &&
      goog.string.contains(navigator['appVersion'] || '', 'X11');
};


/**
 * Whether the user agent is running on a X11 windowing system.
 * @type {boolean}
 */
goog.userAgent.X11 = goog.userAgent.PLATFORM_KNOWN_ ?
    goog.userAgent.ASSUME_X11 :
    goog.userAgent.isX11_();


/**
 * Whether the user agent is running on Android.
 * @type {boolean}
 */
goog.userAgent.ANDROID = goog.userAgent.PLATFORM_KNOWN_ ?
    goog.userAgent.ASSUME_ANDROID :
    goog.labs.userAgent.platform.isAndroid();


/**
 * Whether the user agent is running on an iPhone.
 * @type {boolean}
 */
goog.userAgent.IPHONE = goog.userAgent.PLATFORM_KNOWN_ ?
    goog.userAgent.ASSUME_IPHONE :
    goog.labs.userAgent.platform.isIphone();


/**
 * Whether the user agent is running on an iPad.
 * @type {boolean}
 */
goog.userAgent.IPAD = goog.userAgent.PLATFORM_KNOWN_ ?
    goog.userAgent.ASSUME_IPAD :
    goog.labs.userAgent.platform.isIpad();


/**
 * Whether the user agent is running on an iPod.
 * @type {boolean}
 */
goog.userAgent.IPOD = goog.userAgent.PLATFORM_KNOWN_ ?
    goog.userAgent.ASSUME_IPOD :
    goog.labs.userAgent.platform.isIpod();


/**
 * Whether the user agent is running on iOS.
 * @type {boolean}
 */
goog.userAgent.IOS = goog.userAgent.PLATFORM_KNOWN_ ?
    (goog.userAgent.ASSUME_IPHONE || goog.userAgent.ASSUME_IPAD ||
     goog.userAgent.ASSUME_IPOD) :
    goog.labs.userAgent.platform.isIos();

/**
 * Whether the user agent is running on KaiOS.
 * @type {boolean}
 */
goog.userAgent.KAIOS = goog.userAgent.PLATFORM_KNOWN_ ?
    goog.userAgent.ASSUME_KAIOS :
    goog.labs.userAgent.platform.isKaiOS();


/**
 * @return {string} The string that describes the version number of the user
 *     agent.
 * @private
 */
goog.userAgent.determineVersion_ = function() {
  'use strict';
  // All browsers have different ways to detect the version and they all have
  // different naming schemes.
  // version is a string rather than a number because it may contain 'b', 'a',
  // and so on.
  var version = '';
  var arr = goog.userAgent.getVersionRegexResult_();
  if (arr) {
    version = arr ? arr[1] : '';
  }

  if (goog.userAgent.IE) {
    // IE9 can be in document mode 9 but be reporting an inconsistent user agent
    // version.  If it is identifying as a version lower than 9 we take the
    // documentMode as the version instead.  IE8 has similar behavior.
    // It is recommended to set the X-UA-Compatible header to ensure that IE9
    // uses documentMode 9.
    var docMode = goog.userAgent.getDocumentMode_();
    if (docMode != null && docMode > parseFloat(version)) {
      return String(docMode);
    }
  }

  return version;
};


/**
 * @return {?IArrayLike<string>|undefined} The version regex matches from
 *     parsing the user
 *     agent string. These regex statements must be executed inline so they can
 *     be compiled out by the closure compiler with the rest of the useragent
 *     detection logic when ASSUME_* is specified.
 * @private
 */
goog.userAgent.getVersionRegexResult_ = function() {
  'use strict';
  var userAgent = goog.userAgent.getUserAgentString();
  if (goog.userAgent.GECKO) {
    return /rv\:([^\);]+)(\)|;)/.exec(userAgent);
  }
  if (goog.userAgent.EDGE) {
    return /Edge\/([\d\.]+)/.exec(userAgent);
  }
  if (goog.userAgent.IE) {
    return /\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(userAgent);
  }
  if (goog.userAgent.WEBKIT) {
    // WebKit/125.4
    return /WebKit\/(\S+)/.exec(userAgent);
  }
  if (goog.userAgent.OPERA) {
    // If none of the above browsers were detected but the browser is Opera, the
    // only string that is of interest is 'Version/<number>'.
    return /(?:Version)[ \/]?(\S+)/.exec(userAgent);
  }
  return undefined;
};


/**
 * @return {number|undefined} Returns the document mode (for testing).
 * @private
 */
goog.userAgent.getDocumentMode_ = function() {
  'use strict';
  // NOTE(pupius): goog.userAgent may be used in context where there is no DOM.
  var doc = goog.global['document'];
  return doc ? doc['documentMode'] : undefined;
};


/**
 * The version of the user agent. This is a string because it might contain
 * 'b' (as in beta) as well as multiple dots.
 * @type {string}
 */
goog.userAgent.VERSION = goog.userAgent.determineVersion_();


/**
 * Compares two version numbers.
 *
 * @param {string} v1 Version of first item.
 * @param {string} v2 Version of second item.
 *
 * @return {number}  1 if first argument is higher
 *                   0 if arguments are equal
 *                  -1 if second argument is higher.
 * @deprecated Use goog.string.compareVersions.
 */
goog.userAgent.compare = function(v1, v2) {
  'use strict';
  return goog.string.compareVersions(v1, v2);
};


/**
 * Cache for {@link goog.userAgent.isVersionOrHigher}.
 * Calls to compareVersions are surprisingly expensive and, as a browser's
 * version number is unlikely to change during a session, we cache the results.
 * @const
 * @private
 */
goog.userAgent.isVersionOrHigherCache_ = {};


/**
 * Whether the user agent version is higher or the same as the given version.
 * NOTE: When checking the version numbers for Firefox and Safari, be sure to
 * use the engine's version, not the browser's version number.  For example,
 * Firefox 3.0 corresponds to Gecko 1.9 and Safari 3.0 to Webkit 522.11.
 * Opera and Internet Explorer versions match the product release number.<br>
 * @see <a href="http://en.wikipedia.org/wiki/Safari_version_history">
 *     Webkit</a>
 * @see <a href="http://en.wikipedia.org/wiki/Gecko_engine">Gecko</a>
 *
 * @param {string|number} version The version to check.
 * @return {boolean} Whether the user agent version is higher or the same as
 *     the given version.
 */
goog.userAgent.isVersionOrHigher = function(version) {
  'use strict';
  return goog.userAgent.ASSUME_ANY_VERSION ||
      goog.reflect.cache(
          goog.userAgent.isVersionOrHigherCache_, version, function() {
            'use strict';
            return goog.string.compareVersions(
                       goog.userAgent.VERSION, version) >= 0;
          });
};


/**
 * Deprecated alias to `goog.userAgent.isVersionOrHigher`.
 * @param {string|number} version The version to check.
 * @return {boolean} Whether the user agent version is higher or the same as
 *     the given version.
 * @deprecated Use goog.userAgent.isVersionOrHigher().
 */
goog.userAgent.isVersion = goog.userAgent.isVersionOrHigher;


/**
 * Whether the IE effective document mode is higher or the same as the given
 * document mode version.
 * NOTE: Only for IE, return false for another browser.
 *
 * @param {number} documentMode The document mode version to check.
 * @return {boolean} Whether the IE effective document mode is higher or the
 *     same as the given version.
 */
goog.userAgent.isDocumentModeOrHigher = function(documentMode) {
  'use strict';
  return Number(goog.userAgent.DOCUMENT_MODE) >= documentMode;
};


/**
 * Deprecated alias to `goog.userAgent.isDocumentModeOrHigher`.
 * @param {number} version The version to check.
 * @return {boolean} Whether the IE effective document mode is higher or the
 *      same as the given version.
 * @deprecated Use goog.userAgent.isDocumentModeOrHigher().
 */
goog.userAgent.isDocumentMode = goog.userAgent.isDocumentModeOrHigher;


/**
 * For IE version < 7, documentMode is undefined, so attempt to use the
 * CSS1Compat property to see if we are in standards mode. If we are in
 * standards mode, treat the browser version as the document mode. Otherwise,
 * IE is emulating version 5.
 *
 * NOTE(2019/05/31): Support for IE < 7 is long gone, so this is now simplified.
 * It returns document.documentMode for IE and undefined for everything else.
 *
 * @type {number|undefined}
 * @const
 */
goog.userAgent.DOCUMENT_MODE = (function() {
  'use strict';
  var doc = goog.global['document'];
  if (!doc || !goog.userAgent.IE) return undefined;
  // This must be an IE user agent.
  var documentMode = goog.userAgent.getDocumentMode_();
  if (documentMode) return documentMode;
  // The user agent version string begins with the major version.
  // Parse the major version and truncate anything following.
  var ieVersion = parseInt(goog.userAgent.VERSION, 10);
  return ieVersion || undefined;
})();

//third_party/javascript/closure/useragent/product.js
/**
 * @license
 * Copyright The Closure Library Authors.
 * SPDX-License-Identifier: Apache-2.0
 */

/**
 * @fileoverview Detects the specific browser and not just the rendering engine.
 */

goog.provide('goog.userAgent.product');

goog.require('goog.labs.userAgent.browser');
goog.require('goog.labs.userAgent.platform');
goog.require('goog.userAgent');


/**
 * @define {boolean} Whether the code is running on the Firefox web browser.
 */
goog.userAgent.product.ASSUME_FIREFOX =
    goog.define('goog.userAgent.product.ASSUME_FIREFOX', false);


/**
 * @define {boolean} Whether we know at compile-time that the product is an
 *     iPhone.
 */
goog.userAgent.product.ASSUME_IPHONE =
    goog.define('goog.userAgent.product.ASSUME_IPHONE', false);


/**
 * @define {boolean} Whether we know at compile-time that the product is an
 *     iPad.
 */
goog.userAgent.product.ASSUME_IPAD =
    goog.define('goog.userAgent.product.ASSUME_IPAD', false);


/**
 * @define {boolean} Whether we know at compile-time that the product is an
 *     AOSP browser or WebView inside a pre KitKat Android phone or tablet.
 */
goog.userAgent.product.ASSUME_ANDROID =
    goog.define('goog.userAgent.product.ASSUME_ANDROID', false);


/**
 * @define {boolean} Whether the code is running on the Chrome web browser on
 * any platform or AOSP browser or WebView in a KitKat+ Android phone or tablet.
 */
goog.userAgent.product.ASSUME_CHROME =
    goog.define('goog.userAgent.product.ASSUME_CHROME', false);


/**
 * @define {boolean} Whether the code is running on the Safari web browser.
 */
goog.userAgent.product.ASSUME_SAFARI =
    goog.define('goog.userAgent.product.ASSUME_SAFARI', false);


/**
 * Whether we know the product type at compile-time.
 * @type {boolean}
 * @private
 */
goog.userAgent.product.PRODUCT_KNOWN_ = goog.userAgent.ASSUME_IE ||
    goog.userAgent.ASSUME_EDGE || goog.userAgent.ASSUME_OPERA ||
    goog.userAgent.product.ASSUME_FIREFOX ||
    goog.userAgent.product.ASSUME_IPHONE ||
    goog.userAgent.product.ASSUME_IPAD ||
    goog.userAgent.product.ASSUME_ANDROID ||
    goog.userAgent.product.ASSUME_CHROME ||
    goog.userAgent.product.ASSUME_SAFARI;


/**
 * Whether the code is running on the Opera web browser.
 * @type {boolean}
 */
goog.userAgent.product.OPERA = goog.userAgent.OPERA;


/**
 * Whether the code is running on an IE web browser.
 * @type {boolean}
 */
goog.userAgent.product.IE = goog.userAgent.IE;


/**
 * Whether the code is running on an Edge web browser (EdgeHTML based).
 * @type {boolean}
 */
goog.userAgent.product.EDGE = goog.userAgent.EDGE;


/**
 * Whether the code is running on the Firefox web browser.
 * @type {boolean}
 */
goog.userAgent.product.FIREFOX = goog.userAgent.product.PRODUCT_KNOWN_ ?
    goog.userAgent.product.ASSUME_FIREFOX :
    goog.labs.userAgent.browser.isFirefox();


/**
 * Whether the user agent is an iPhone or iPod (as in iPod touch).
 * @return {boolean}
 * @private
 */
goog.userAgent.product.isIphoneOrIpod_ = function() {
  'use strict';
  return goog.labs.userAgent.platform.isIphone() ||
      goog.labs.userAgent.platform.isIpod();
};


/**
 * Whether the code is running on an iPhone or iPod touch.
 *
 * iPod touch is considered an iPhone for legacy reasons.
 * @type {boolean}
 */
goog.userAgent.product.IPHONE = goog.userAgent.product.PRODUCT_KNOWN_ ?
    goog.userAgent.product.ASSUME_IPHONE :
    goog.userAgent.product.isIphoneOrIpod_();


/**
 * Whether the code is running on an iPad.
 * @type {boolean}
 */
goog.userAgent.product.IPAD = goog.userAgent.product.PRODUCT_KNOWN_ ?
    goog.userAgent.product.ASSUME_IPAD :
    goog.labs.userAgent.platform.isIpad();


/**
 * Whether the code is running on AOSP browser or WebView inside
 * a pre KitKat Android phone or tablet.
 * @type {boolean}
 */
goog.userAgent.product.ANDROID = goog.userAgent.product.PRODUCT_KNOWN_ ?
    goog.userAgent.product.ASSUME_ANDROID :
    goog.labs.userAgent.browser.isAndroidBrowser();


/**
 * Whether the code is running on any Chromium-based web browser on any platform
 * or AOSP browser or WebView in a KitKat+ Android phone or tablet.
 * @type {boolean}
 */
goog.userAgent.product.CHROME = goog.userAgent.product.PRODUCT_KNOWN_ ?
    goog.userAgent.product.ASSUME_CHROME :
    goog.labs.userAgent.browser.isChrome();


/**
 * @return {boolean} Whether the browser is Safari on desktop.
 * @private
 */
goog.userAgent.product.isSafariDesktop_ = function() {
  'use strict';
  return goog.labs.userAgent.browser.isSafari() &&
      !goog.labs.userAgent.platform.isIos();
};


/**
 * Whether the code is running on the desktop Safari web browser.
 * Note: the legacy behavior here is only true for Safari not running
 * on iOS.
 * @type {boolean}
 */
goog.userAgent.product.SAFARI = goog.userAgent.product.PRODUCT_KNOWN_ ?
    goog.userAgent.product.ASSUME_SAFARI :
    goog.userAgent.product.isSafariDesktop_();

//third_party/javascript/closure/crypt/base64.js
/**
 * @license
 * Copyright The Closure Library Authors.
 * SPDX-License-Identifier: Apache-2.0
 */

/**
 * @fileoverview Base64 en/decoding. Not much to say here except that we
 * work with decoded values in arrays of bytes. By "byte" I mean a number
 * in [0, 255].
 */

goog.provide('goog.crypt.base64');

goog.require('goog.asserts');
goog.require('goog.crypt');
goog.require('goog.string');
goog.require('goog.userAgent');
goog.require('goog.userAgent.product');

/**
 * Default alphabet, shared between alphabets. Only 62 characters.
 * @private {string}
 */
goog.crypt.base64.DEFAULT_ALPHABET_COMMON_ = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' +
    'abcdefghijklmnopqrstuvwxyz' +
    '0123456789';


/**
 * Alphabet characters for Alphabet.DEFAULT encoding.
 * For characters without padding, please consider using
 * `goog.crypt.baseN.BASE_64` instead.
 *
 * @type {string}
 */
goog.crypt.base64.ENCODED_VALS =
    goog.crypt.base64.DEFAULT_ALPHABET_COMMON_ + '+/=';


/**
 * Alphabet characters for Alphabet.WEBSAFE_DOT_PADDING encoding.
 * The dot padding is no Internet Standard, according to RFC 4686.
 * https://tools.ietf.org/html/rfc4648
 * For characters without padding, please consider using
 * `goog.crypt.baseN.BASE_64_URL_SAFE` instead.
 *
 * @type {string}
 */
goog.crypt.base64.ENCODED_VALS_WEBSAFE =
    goog.crypt.base64.DEFAULT_ALPHABET_COMMON_ + '-_.';


/**
 * Alphabets for Base64 encoding
 * Alphabets with no padding character are for encoding without padding.
 * About the alphabets, please refer to RFC 4686.
 * https://tools.ietf.org/html/rfc4648
 * @enum {number}
 */
goog.crypt.base64.Alphabet = {
  DEFAULT: 0,
  NO_PADDING: 1,
  WEBSAFE: 2,
  WEBSAFE_DOT_PADDING: 3,
  WEBSAFE_NO_PADDING: 4,
};


/**
 * Padding chars for Base64 encoding
 * @const {string}
 * @private
 */
goog.crypt.base64.paddingChars_ = '=.';


/**
 * Check if a character is a padding character
 *
 * @param {string} char
 * @return {boolean}
 * @private
 */
goog.crypt.base64.isPadding_ = function(char) {
  'use strict';
  return goog.string.contains(goog.crypt.base64.paddingChars_, char);
};


// Static lookup maps, lazily populated by init_()

/**
 * For each `Alphabet`, maps from bytes to characters.
 *
 * @see https://jsperf.com/char-lookups
 * @type {!Object<!goog.crypt.base64.Alphabet, !Array<string>>}
 * @private
 */
goog.crypt.base64.byteToCharMaps_ = {};

/**
 * Maps characters to bytes.
 *
 * This map is used for all alphabets since, across alphabets, common chars
 * always map to the same byte.
 *
 * `null` indicates `init` has not yet been called.
 *
 * @type {?Object<string, number>}
 * @private
 */
goog.crypt.base64.charToByteMap_ = null;


/**
 * White list of implementations with known-good native atob and btoa functions.
 * Listing these explicitly (via the ASSUME_* wrappers) benefits dead-code
 * removal in per-browser compilations.
 * @private {boolean}
 */
goog.crypt.base64.ASSUME_NATIVE_SUPPORT_ = goog.userAgent.GECKO ||
    (goog.userAgent.WEBKIT && !goog.userAgent.product.SAFARI) ||
    goog.userAgent.OPERA;


/**
 * Does this browser have a working btoa function?
 * @private {boolean}
 */
goog.crypt.base64.HAS_NATIVE_ENCODE_ =
    goog.crypt.base64.ASSUME_NATIVE_SUPPORT_ ||
    typeof(goog.global.btoa) == 'function';


/**
 * Does this browser have a working atob function?
 * We blacklist known-bad implementations:
 *  - IE (10+) added atob() but it does not tolerate whitespace on the input.
 * @private {boolean}
 */
goog.crypt.base64.HAS_NATIVE_DECODE_ =
    goog.crypt.base64.ASSUME_NATIVE_SUPPORT_ ||
    (!goog.userAgent.product.SAFARI && !goog.userAgent.IE &&
     typeof(goog.global.atob) == 'function');


/**
 * Base64-encode an array of bytes.
 *
 * @param {Array<number>|Uint8Array} input An array of bytes (numbers with
 *     value in [0, 255]) to encode.
 * @param {!goog.crypt.base64.Alphabet=} alphabet Base 64 alphabet to
 *     use in encoding. Alphabet.DEFAULT is used by default.
 * @return {string} The base64 encoded string.
 */
goog.crypt.base64.encodeByteArray = function(input, alphabet) {
  'use strict';
  // Assert avoids runtime dependency on goog.isArrayLike, which helps reduce
  // size of jscompiler output, and which yields slight performance increase.
  goog.asserts.assert(
      goog.isArrayLike(input), 'encodeByteArray takes an array as a parameter');

  if (alphabet === undefined) {
    alphabet = goog.crypt.base64.Alphabet.DEFAULT;
  }

  goog.crypt.base64.init_();

  var byteToCharMap = goog.crypt.base64.byteToCharMaps_[alphabet];

  var output = [];

  for (var i = 0; i < input.length; i += 3) {
    var byte1 = input[i];
    var haveByte2 = i + 1 < input.length;
    var byte2 = haveByte2 ? input[i + 1] : 0;
    var haveByte3 = i + 2 < input.length;
    var byte3 = haveByte3 ? input[i + 2] : 0;

    var outByte1 = byte1 >> 2;
    var outByte2 = ((byte1 & 0x03) << 4) | (byte2 >> 4);
    var outByte3 = ((byte2 & 0x0F) << 2) | (byte3 >> 6);
    var outByte4 = byte3 & 0x3F;

    if (!haveByte3) {
      outByte4 = 64;

      if (!haveByte2) {
        outByte3 = 64;
      }
    }

    output.push(
        byteToCharMap[outByte1], byteToCharMap[outByte2],
        byteToCharMap[outByte3] || '', byteToCharMap[outByte4] || '');
  }

  return output.join('');
};


/**
 * Base64-encode a string.
 *
 * @param {string} input A string to encode.
 * @param {!goog.crypt.base64.Alphabet=} alphabet Base 64 alphabet to
 *     use in encoding. Alphabet.DEFAULT is used by default.
 * @return {string} The base64 encoded string.
 */
goog.crypt.base64.encodeString = function(input, alphabet) {
  'use strict';
  // Shortcut for browsers that implement
  // a native base64 encoder in the form of "btoa/atob"
  if (goog.crypt.base64.HAS_NATIVE_ENCODE_ && !alphabet) {
    return goog.global.btoa(input);
  }
  return goog.crypt.base64.encodeByteArray(
      goog.crypt.stringToByteArray(input), alphabet);
};


/**
 * Base64-decode a string.
 *
 * @param {string} input Input to decode. Any whitespace is ignored, and the
 *     input maybe encoded with either supported alphabet (or a mix thereof).
 * @param {boolean=} useCustomDecoder True indicates the custom decoder is used,
 *     which supports alternative alphabets. Note that passing false may still
 *     use the custom decoder on browsers without native support.
 * @return {string} string representing the decoded value.
 */
goog.crypt.base64.decodeString = function(input, useCustomDecoder) {
  'use strict';
  // Shortcut for browsers that implement
  // a native base64 encoder in the form of "btoa/atob"
  if (goog.crypt.base64.HAS_NATIVE_DECODE_ && !useCustomDecoder) {
    return goog.global.atob(input);
  }
  var output = '';
  function pushByte(b) {
    output += String.fromCharCode(b);
  }

  goog.crypt.base64.decodeStringInternal_(input, pushByte);

  return output;
};


/**
 * Base64-decode a string to an Array of numbers.
 *
 * In base-64 decoding, groups of four characters are converted into three
 * bytes.  If the encoder did not apply padding, the input length may not
 * be a multiple of 4.
 *
 * In this case, the last group will have fewer than 4 characters, and
 * padding will be inferred.  If the group has one or two characters, it decodes
 * to one byte.  If the group has three characters, it decodes to two bytes.
 *
 * @param {string} input Input to decode. Any whitespace is ignored, and the
 *     input maybe encoded with either supported alphabet (or a mix thereof).
 * @param {boolean=} opt_ignored Unused parameter, retained for compatibility.
 * @return {!Array<number>} bytes representing the decoded value.
 */
goog.crypt.base64.decodeStringToByteArray = function(input, opt_ignored) {
  'use strict';
  var output = [];
  function pushByte(b) {
    output.push(b);
  }

  goog.crypt.base64.decodeStringInternal_(input, pushByte);

  return output;
};


/**
 * Base64-decode a string to a Uint8Array.
 *
 * Note that Uint8Array is not supported on older browsers, e.g. IE < 10.
 * @see http://caniuse.com/uint8array
 *
 * In base-64 decoding, groups of four characters are converted into three
 * bytes.  If the encoder did not apply padding, the input length may not
 * be a multiple of 4.
 *
 * In this case, the last group will have fewer than 4 characters, and
 * padding will be inferred.  If the group has one or two characters, it decodes
 * to one byte.  If the group has three characters, it decodes to two bytes.
 *
 * @param {string} input Input to decode. Any whitespace is ignored, and the
 *     input maybe encoded with either supported alphabet (or a mix thereof).
 * @return {!Uint8Array} bytes representing the decoded value.
 */
goog.crypt.base64.decodeStringToUint8Array = function(input) {
  'use strict';
  goog.asserts.assert(
      !goog.userAgent.IE || goog.userAgent.isVersionOrHigher('10'),
      'Browser does not support typed arrays');
  var len = input.length;
  // Approximate the length of the array needed for output.
  // Our method varies according to the format of the input, which we can
  // consider in three categories:
  //   A) well-formed with proper padding
  //   B) well-formed without any padding
  //   C) not-well-formed, either with extra whitespace in the middle or with
  //      extra padding characters.
  //
  //  In the case of (A), (length * 3 / 4) will result in an integer number of
  //  bytes evenly divisible by 3, and we need only subtract bytes according to
  //  the padding observed.
  //
  //  In the case of (B), (length * 3 / 4) will result in a non-integer number
  //  of bytes, or not evenly divisible by 3. (If the result is evenly divisible
  //  by 3, it's well-formed with the proper amount of padding [0 padding]).
  //  This approximation can become exact by rounding down.
  //
  //  In the case of (C), the only way to get the length is to walk the full
  //  length of the string to consider each character. This is handled by
  //  tracking the number of bytes added to the array and using subarray to
  //  trim the array back down to size.
  var approxByteLength = len * 3 / 4;
  if (approxByteLength % 3) {
    // The string isn't complete, either because it didn't include padding, or
    // because it has extra white space.
    // In either case, we won't generate more bytes than are completely encoded,
    // so rounding down is appropriate to have a buffer at least as large as
    // output.
    approxByteLength = Math.floor(approxByteLength);
  } else if (goog.crypt.base64.isPadding_(input[len - 1])) {
    // The string has a round length, and has some padding.
    // Reduce the byte length according to the quantity of padding.
    if (goog.crypt.base64.isPadding_(input[len - 2])) {
      approxByteLength -= 2;
    } else {
      approxByteLength -= 1;
    }
  }
  var output = new Uint8Array(approxByteLength);
  var outLen = 0;
  function pushByte(b) {
    output[outLen++] = b;
  }

  goog.crypt.base64.decodeStringInternal_(input, pushByte);

  // Return a subarray to handle the case that input included extra whitespace
  // or extra padding and approxByteLength was incorrect.
  return output.subarray(0, outLen);
};


/**
 * @param {string} input Input to decode.
 * @param {function(number):void} pushByte result accumulator.
 * @private
 */
goog.crypt.base64.decodeStringInternal_ = function(input, pushByte) {
  'use strict';
  goog.crypt.base64.init_();

  var nextCharIndex = 0;
  /**
   * @param {number} default_val Used for end-of-input.
   * @return {number} The next 6-bit value, or the default for end-of-input.
   */
  function getByte(default_val) {
    while (nextCharIndex < input.length) {
      var ch = input.charAt(nextCharIndex++);
      var b = goog.crypt.base64.charToByteMap_[ch];
      if (b != null) {
        return b;  // Common case: decoded the char.
      }
      if (!goog.string.isEmptyOrWhitespace(ch)) {
        throw new Error('Unknown base64 encoding at char: ' + ch);
      }
      // We encountered whitespace: loop around to the next input char.
    }
    return default_val;  // No more input remaining.
  }

  while (true) {
    var byte1 = getByte(-1);
    var byte2 = getByte(0);
    var byte3 = getByte(64);
    var byte4 = getByte(64);

    // The common case is that all four bytes are present, so if we have byte4
    // we can skip over the truncated input special case handling.
    if (byte4 === 64) {
      if (byte1 === -1) {
        return;  // Terminal case: no input left to decode.
      }
      // Here we know an intermediate number of bytes are missing.
      // The defaults for byte2, byte3 and byte4 apply the inferred padding
      // rules per the public API documentation. i.e: 1 byte
      // missing should yield 2 bytes of output, but 2 or 3 missing bytes yield
      // a single byte of output. (Recall that 64 corresponds the padding char).
    }

    var outByte1 = (byte1 << 2) | (byte2 >> 4);
    pushByte(outByte1);

    if (byte3 != 64) {
      var outByte2 = ((byte2 << 4) & 0xF0) | (byte3 >> 2);
      pushByte(outByte2);

      if (byte4 != 64) {
        var outByte3 = ((byte3 << 6) & 0xC0) | byte4;
        pushByte(outByte3);
      }
    }
  }
};


/**
 * Lazy static initialization function. Called before
 * accessing any of the static map variables.
 * @private
 */
goog.crypt.base64.init_ = function() {
  'use strict';
  if (goog.crypt.base64.charToByteMap_) {
    return;
  }
  goog.crypt.base64.charToByteMap_ = {};

  // We want quick mappings back and forth, so we precompute encoding maps.

  /** @type {!Array<string>} */
  var commonChars = goog.crypt.base64.DEFAULT_ALPHABET_COMMON_.split('');
  var specialChars = [
    '+/=',  // DEFAULT
    '+/',   // NO_PADDING
    '-_=',  // WEBSAFE
    '-_.',  // WEBSAFE_DOT_PADDING
    '-_',   // WEBSAFE_NO_PADDING
  ];

  for (var i = 0; i < 5; i++) {
    // `i` is each value of the `goog.crypt.base64.Alphabet` enum
    var chars = commonChars.concat(specialChars[i].split(''));

    // Sets byte-to-char map
    goog.crypt.base64
        .byteToCharMaps_[/** @type {!goog.crypt.base64.Alphabet} */ (i)] =
        chars;

    // Sets char-to-byte map
    for (var j = 0; j < chars.length; j++) {
      var char = chars[j];

      var existingByte = goog.crypt.base64.charToByteMap_[char];
      if (existingByte === undefined) {
        goog.crypt.base64.charToByteMap_[char] = j;
      } else {
        goog.asserts.assert(existingByte === j);
      }
    }
  }
};

//javascript/apps/jspb/binary/writer.js
goog.loadModule(function(exports) {'use strict';/**
 * @fileoverview This file contains utilities for encoding Javascript objects
 * into binary, wire-format protocol buffers (in the form of Uint8Arrays) that
 * a server can consume directly.
 *
 * jspb's BinaryWriter class defines methods for efficiently encoding
 * Javascript objects into binary, wire-format protocol buffers and supports
 * all the fundamental field types used in protocol buffers.
 *
 * Major caveat 1 - Users of this library _must_ keep their Javascript proto
 * parsing code in sync with the original .proto file - presumably you'll be
 * using the typed jspb code generator, but if you bypass that you'll need
 * to keep things in sync by hand.
 *
 * Major caveat 2 - Javascript is unable to accurately represent integers
 * larger than 2^53 due to its use of a double-precision floating point format
 * for all numbers. BinaryWriter does not make any special effort to preserve
 * precision for values above this limit - if you need to pass 64-bit integers
 * (hash codes, for example) between the client and server without precision
 * loss, do _not_ use this library.
 *
 * Major caveat 3 - This class uses typed arrays and must not be used on older
 * browsers that do not support them.
 *
 * @author aappleby@google.com (Austin Appleby)
 */

goog.module('jspb.BinaryWriter');
goog.module.declareLegacyNamespace();

const AnyFieldType = goog.requireType('jspb.AnyFieldType');
const BinaryEncoder = goog.require('jspb.BinaryEncoder');
const ByteSource = goog.requireType('jspb.ByteSource');
const Int64 = goog.require('jspb.arith.Int64');
const UInt64 = goog.require('jspb.arith.UInt64');
const {Alphabet, encodeByteArray} = goog.require('goog.crypt.base64');
const {FieldType, TWO_TO_31, TWO_TO_32, TWO_TO_63, TWO_TO_64, WireType} = goog.require('jspb.BinaryConstants');
const {assert, fail} = goog.require('goog.asserts');
const {byteSourceToUint8Array} = goog.require('jspb.utils');


/**
 * BinaryWriter implements encoders for all the wire types specified in
 * https://developers.google.com/protocol-buffers/docs/encoding.
 */
const BinaryWriter = class {
  constructor() {
    /**
     * Blocks of serialized data that will be concatenated once all messages
     * have been written.
     * @private {!Array<!Uint8Array|!Array<number>>}
     */
    this.blocks_ = [];

    /**
     * Total number of bytes in the blocks_ array. Does _not_ include bytes in
     * the encoder below.
     * @private {number}
     */
    this.totalLength_ = 0;

    /**
     * Binary encoder holding pieces of a message that we're still serializing.
     * When we get to a stopping point (either the start of a new submessage, or
     * when we need to append a raw Uint8Array), the encoder's buffer will be
     * added to the block array above and the encoder will be reset.
     * @private @const {!BinaryEncoder}
     */
    this.encoder_ = new BinaryEncoder();

    /**
     * A stack of bookmarks containing the parent blocks for each message
     * started via beginSubMessage(), needed as bookkeeping for endSubMessage().
     * TODO(aappleby): Deprecated, users should be calling writeMessage().
     * @private {!Array<!Array<number>>}
     */
    this.bookmarks_ = [];
  }

  /**
   * Append a typed array of bytes onto the buffer.
   *
   * @param {!Uint8Array} arr The byte array to append.
   * @private
   */
  appendUint8Array_(arr) {
    const temp = this.encoder_.end();
    this.blocks_.push(temp);
    this.blocks_.push(arr);
    this.totalLength_ += temp.length + arr.length;
  }

  /**
   * Begins a new message by writing the field header and returning a bookmark
   * which we will use to patch in the message length to in endDelimited_ below.
   * @param {number} field
   * @return {!Array<number>}
   * @private
   */
  beginDelimited_(field) {
    this.writeFieldHeader_(field, WireType.DELIMITED);
    const bookmark = this.encoder_.end();
    this.blocks_.push(bookmark);
    this.totalLength_ += bookmark.length;
    bookmark.push(this.totalLength_);
    return bookmark;
  }

  /**
   * Ends a message by encoding the _change_ in length of the buffer to the
   * parent block and adds the number of bytes needed to encode that length to
   * the total byte length.
   * @param {!Array<number>} bookmark
   * @private
   */
  endDelimited_(bookmark) {
    const oldLength = bookmark.pop();
    let messageLength = this.totalLength_ + this.encoder_.length() - oldLength;
    assert(messageLength >= 0);

    while (messageLength > 127) {
      bookmark.push((messageLength & 0x7f) | 0x80);
      messageLength = messageLength >>> 7;
      this.totalLength_++;
    }

    bookmark.push(messageLength);
    this.totalLength_++;
  }

  /**
   * Writes a pre-serialized message to the buffer.
   * @param {!Uint8Array} bytes The array of bytes to write.
   * @param {number} start The start of the range to write.
   * @param {number} end The end of the range to write.
   */
  writeSerializedMessage(bytes, start, end) {
    this.appendUint8Array_(bytes.subarray(start, end));
  }

  /**
   * Writes a pre-serialized message to the buffer if the message and endpoints
   * are non-null.
   * @param {?Uint8Array} bytes The array of bytes to write.
   * @param {?number} start The start of the range to write.
   * @param {?number} end The end of the range to write.
   */
  maybeWriteSerializedMessage(bytes, start, end) {
    if (bytes != null && start != null && end != null) {
      this.writeSerializedMessage(bytes, start, end);
    }
  }

  /**
   * Resets the writer, throwing away any accumulated buffers.
   */
  reset() {
    this.blocks_ = [];
    this.encoder_.end();
    this.totalLength_ = 0;
    this.bookmarks_ = [];
  }

  /**
   * Converts the encoded data into a Uint8Array.
   * @return {!Uint8Array}
   */
  getResultBuffer() {
    assert(this.bookmarks_.length == 0);

    const flat = new Uint8Array(this.totalLength_ + this.encoder_.length());

    const blocks = this.blocks_;
    const blockCount = blocks.length;
    let offset = 0;

    for (let i = 0; i < blockCount; i++) {
      const block = blocks[i];
      flat.set(block, offset);
      offset += block.length;
    }

    const tail = this.encoder_.end();
    flat.set(tail, offset);
    offset += tail.length;

    // Post condition: `flattened` must have had every byte written.
    assert(offset == flat.length);

    // Replace our block list with the flattened block, which lets GC reclaim
    // the temp blocks sooner.
    this.blocks_ = [flat];

    return flat;
  }

  /**
   * Converts the encoded data into a base64-encoded string.
   * @param {!Alphabet=} alphabet Which flavor of base64 to
   *     use.
   * @return {string}
   */
  getResultBase64String(alphabet) {
    return encodeByteArray(this.getResultBuffer(), alphabet);
  }

  /**
   * Begins a new sub-message. The client must call endSubMessage() when they're
   * done.
   * TODO(aappleby): Deprecated. Move callers to writeMessage().
   * @param {number} field The field number of the sub-message.
   */
  beginSubMessage(field) {
    this.bookmarks_.push(this.beginDelimited_(field));
  }

  /**
   * Finishes a sub-message and packs it into the parent messages' buffer.
   * TODO(aappleby): Deprecated. Move callers to writeMessage().
   */
  endSubMessage() {
    assert(this.bookmarks_.length >= 0);
    this.endDelimited_(this.bookmarks_.pop());
  }

  /**
   * Encodes a (field number, wire type) tuple into a wire-format field header
   * and stores it in the buffer as a varint.
   * @param {number} field The field number.
   * @param {number} wireType The wire-type of the field, as specified in the
   *     protocol buffer documentation.
   * @private
   */
  writeFieldHeader_(field, wireType) {
    assert(field >= 1 && field == Math.floor(field));
    const x = field * 8 + wireType;
    this.encoder_.writeUnsignedVarint32(x);
  }

  /**
   * Writes a field of any valid scalar type to the binary stream.
   * @param {!FieldType} fieldType
   * @param {number} field
   * @param {!AnyFieldType} value
   */
  writeAny(fieldType, field, value) {
    const fieldTypes = FieldType;
    switch (fieldType) {
      case fieldTypes.DOUBLE:
        this.writeDouble(field, /** @type {number} */ (value));
        return;
      case fieldTypes.FLOAT:
        this.writeFloat(field, /** @type {number} */ (value));
        return;
      case fieldTypes.INT64:
        this.writeInt64(field, /** @type {number} */ (value));
        return;
      case fieldTypes.UINT64:
        this.writeUint64(field, /** @type {number} */ (value));
        return;
      case fieldTypes.INT32:
        this.writeInt32(field, /** @type {number} */ (value));
        return;
      case fieldTypes.FIXED64:
        this.writeFixed64(field, /** @type {number} */ (value));
        return;
      case fieldTypes.FIXED32:
        this.writeFixed32(field, /** @type {number} */ (value));
        return;
      case fieldTypes.BOOL:
        this.writeBool(field, /** @type {boolean} */ (value));
        return;
      case fieldTypes.STRING:
        this.writeString(field, /** @type {string} */ (value));
        return;
      case fieldTypes.GROUP:
        fail('Group field type not supported in writeAny()');
        return;
      case fieldTypes.MESSAGE:
        fail('Message field type not supported in writeAny()');
        return;
      case fieldTypes.BYTES:
        this.writeBytes(field, /** @type {?Uint8Array} */ (value));
        return;
      case fieldTypes.UINT32:
        this.writeUint32(field, /** @type {number} */ (value));
        return;
      case fieldTypes.ENUM:
        this.writeEnum(field, /** @type {number} */ (value));
        return;
      case fieldTypes.SFIXED32:
        this.writeSfixed32(field, /** @type {number} */ (value));
        return;
      case fieldTypes.SFIXED64:
        this.writeSfixed64(field, /** @type {number} */ (value));
        return;
      case fieldTypes.SINT32:
        this.writeSint32(field, /** @type {number} */ (value));
        return;
      case fieldTypes.SINT64:
        this.writeSint64(field, /** @type {number} */ (value));
        return;
      default:
        fail('Invalid field type in writeAny()');
        return;
    }
  }

  /**
   * Writes a varint field to the buffer without range checking.
   * @param {number} field The field number.
   * @param {number?} value The value to write.
   * @private
   */
  writeUnsignedVarint32_(field, value) {
    if (value == null) return;
    this.writeFieldHeader_(field, WireType.VARINT);
    this.encoder_.writeUnsignedVarint32(value);
  }

  /**
   * Writes a varint field to the buffer without range checking.
   * @param {number} field The field number.
   * @param {number?} value The value to write.
   * @private
   */
  writeSignedVarint32_(field, value) {
    if (value == null) return;
    assertSignedInteger(field, value);
    this.writeFieldHeader_(field, WireType.VARINT);
    this.encoder_.writeSignedVarint32(value);
  }

  /**
   * Writes a varint field to the buffer without range checking.
   * @param {number} field The field number.
   * @param {number?} value The value to write.
   * @private
   */
  writeUnsignedVarint64_(field, value) {
    if (value == null) return;
    this.writeFieldHeader_(field, WireType.VARINT);
    this.encoder_.writeUnsignedVarint64(value);
  }

  /**
   * Writes a varint field to the buffer without range checking.
   * @param {number} field The field number.
   * @param {number?} value The value to write.
   * @private
   */
  writeSignedVarint64_(field, value) {
    if (value == null) return;
    this.writeFieldHeader_(field, WireType.VARINT);
    this.encoder_.writeSignedVarint64(value);
  }

  /**
   * Writes a zigzag varint field to the buffer without range checking.
   * @param {number} field The field number.
   * @param {number?} value The value to write.
   * @private
   */
  writeZigzagVarint32_(field, value) {
    if (value == null) return;
    this.writeFieldHeader_(field, WireType.VARINT);
    this.encoder_.writeZigzagVarint32(value);
  }

  /**
   * Writes a zigzag varint field to the buffer without range checking.
   * @param {number} field The field number.
   * @param {number?} value The value to write.
   * @private
   */
  writeZigzagVarint64_(field, value) {
    if (value == null) return;
    this.writeFieldHeader_(field, WireType.VARINT);
    this.encoder_.writeZigzagVarint64(value);
  }

  /**
   * Writes a zigzag varint field to the buffer without range checking.
   * @param {number} field The field number.
   * @param {string?} value The value to write.
   * @private
   */
  writeZigzagVarint64String_(field, value) {
    if (value == null) return;
    this.writeFieldHeader_(field, WireType.VARINT);
    this.encoder_.writeZigzagVarint64String(value);
  }

  /**
   * Writes an int32 field to the buffer. Numbers outside the range [-2^31,2^31)
   * will be truncated.
   * @param {number} field The field number.
   * @param {number?} value The value to write.
   */
  writeInt32(field, value) {
    if (value == null) return;
    assertThat(field, value, (value >= -TWO_TO_31) && (value < TWO_TO_31));
    this.writeSignedVarint32_(field, value);
  }

  /**
   * Writes an int32 field represented as a string to the buffer. Numbers
   * outside the range [-2^31,2^31) will be truncated.
   * @param {number} field The field number.
   * @param {string?} value The value to write.
   */
  writeInt32String(field, value) {
    if (value == null) return;
    const intValue = /** number */ parseInt(value, 10);
    assertThat(
        field, intValue, (intValue >= -TWO_TO_31) && (intValue < TWO_TO_31));
    this.writeSignedVarint32_(field, intValue);
  }

  /**
   * Writes an int64 field to the buffer. Numbers outside the range [-2^63,2^63)
   * will be truncated.
   * @param {number} field The field number.
   * @param {number?} value The value to write.
   */
  writeInt64(field, value) {
    if (value == null) return;
    assertThat(field, value, (value >= -TWO_TO_63) && (value < TWO_TO_63));
    this.writeSignedVarint64_(field, value);
  }

  /**
   * Writes a int64 field (with value as a string) to the buffer.
   * @param {number} field The field number.
   * @param {string?} value The value to write.
   */
  writeInt64String(field, value) {
    if (value == null) return;
    const num = Int64.fromString(value);
    this.writeFieldHeader_(field, WireType.VARINT);
    this.encoder_.writeSplitVarint64(num.lo, num.hi);
  }

  /**
   * Writes a uint32 field to the buffer. Numbers outside the range [0,2^32)
   * will be truncated.
   * @param {number} field The field number.
   * @param {number?} value The value to write.
   */
  writeUint32(field, value) {
    if (value == null) return;
    assertThat(field, value, (value >= 0) && (value < TWO_TO_32));
    this.writeUnsignedVarint32_(field, value);
  }

  /**
   * Writes a uint32 field represented as a string to the buffer. Numbers
   * outside the range [0,2^32) will be truncated.
   * @param {number} field The field number.
   * @param {string?} value The value to write.
   */
  writeUint32String(field, value) {
    if (value == null) return;
    const intValue = /** number */ parseInt(value, 10);
    assertThat(field, value, (intValue >= 0) && (intValue < TWO_TO_32));
    this.writeUnsignedVarint32_(field, intValue);
  }

  /**
   * Writes a uint64 field to the buffer. Numbers outside the range [0,2^64)
   * will be truncated.
   * @param {number} field The field number.
   * @param {number?} value The value to write.
   */
  writeUint64(field, value) {
    if (value == null) return;
    assertThat(field, value, (value >= 0) && (value < TWO_TO_64));
    this.writeUnsignedVarint64_(field, value);
  }

  /**
   * Writes a uint64 field (with value as a string) to the buffer.
   * @param {number} field The field number.
   * @param {string?} value The value to write.
   */
  writeUint64String(field, value) {
    if (value == null) return;
    const num = UInt64.fromString(value);
    this.writeFieldHeader_(field, WireType.VARINT);
    this.encoder_.writeSplitVarint64(num.lo, num.hi);
  }

  /**
   * Writes an sint32 field to the buffer. Numbers outside the range
   * [-2^31,2^31) will be truncated.
   * @param {number} field The field number.
   * @param {number?} value The value to write.
   */
  writeSint32(field, value) {
    if (value == null) return;
    assertThat(field, value, (value >= -TWO_TO_31) && (value < TWO_TO_31));
    this.writeZigzagVarint32_(field, value);
  }

  /**
   * Writes an sint64 field to the buffer. Numbers outside the range
   * [-2^63,2^63) will be truncated.
   * @param {number} field The field number.
   * @param {number?} value The value to write.
   */
  writeSint64(field, value) {
    if (value == null) return;
    assertThat(field, value, (value >= -TWO_TO_63) && (value < TWO_TO_63));
    this.writeZigzagVarint64_(field, value);
  }

  /**
   * Writes an sint64 field to the buffer. Numbers outside the range
   * [-2^63,2^63) will be truncated.
   * @param {number} field The field number.
   * @param {string?} value The decimal string to write.
   */
  writeSint64String(field, value) {
    if (value == null) return;
    this.writeZigzagVarint64String_(field, value);
  }

  /**
   * Writes a fixed32 field to the buffer. Numbers outside the range [0,2^32)
   * will be truncated.
   * @param {number} field The field number.
   * @param {number?} value The value to write.
   */
  writeFixed32(field, value) {
    if (value == null) return;
    assertThat(field, value, (value >= 0) && (value < TWO_TO_32));
    this.writeFieldHeader_(field, WireType.FIXED32);
    this.encoder_.writeUint32(value);
  }

  /**
   * Writes a fixed64 field to the buffer. Numbers outside the range [0,2^64)
   * will be truncated.
   * @param {number} field The field number.
   * @param {number?} value The value to write.
   */
  writeFixed64(field, value) {
    if (value == null) return;
    assertThat(field, value, (value >= 0) && (value < TWO_TO_64));
    this.writeFieldHeader_(field, WireType.FIXED64);
    this.encoder_.writeUint64(value);
  }

  /**
   * Writes a fixed64 field (with value as a string) to the buffer.
   * @param {number} field The field number.
   * @param {string?} value The value to write.
   */
  writeFixed64String(field, value) {
    if (value == null) return;
    const num = UInt64.fromString(value);
    this.writeFieldHeader_(field, WireType.FIXED64);
    this.encoder_.writeSplitFixed64(num.lo, num.hi);
  }

  /**
   * Writes a sfixed32 field to the buffer. Numbers outside the range
   * [-2^31,2^31) will be truncated.
   * @param {number} field The field number.
   * @param {number?} value The value to write.
   */
  writeSfixed32(field, value) {
    if (value == null) return;
    assertThat(field, value, (value >= -TWO_TO_31) && (value < TWO_TO_31));
    this.writeFieldHeader_(field, WireType.FIXED32);
    this.encoder_.writeInt32(value);
  }

  /**
   * Writes a sfixed64 field to the buffer. Numbers outside the range
   * [-2^63,2^63) will be truncated.
   * @param {number} field The field number.
   * @param {number?} value The value to write.
   */
  writeSfixed64(field, value) {
    if (value == null) return;
    assertThat(field, value, (value >= -TWO_TO_63) && (value < TWO_TO_63));
    this.writeFieldHeader_(field, WireType.FIXED64);
    this.encoder_.writeInt64(value);
  }

  /**
   * Writes a sfixed64 string field to the buffer. Numbers outside the range
   * [-2^63,2^63) will be truncated.
   * @param {number} field The field number.
   * @param {string?} value The value to write.
   */
  writeSfixed64String(field, value) {
    if (value == null) return;
    const num = Int64.fromString(value);
    this.writeFieldHeader_(field, WireType.FIXED64);
    this.encoder_.writeSplitFixed64(num.lo, num.hi);
  }

  /**
   * Writes a single-precision floating point field to the buffer. Numbers
   * requiring more than 32 bits of precision will be truncated.
   * @param {number} field The field number.
   * @param {number?} value The value to write.
   */
  writeFloat(field, value) {
    if (value == null) return;
    this.writeFieldHeader_(field, WireType.FIXED32);
    this.encoder_.writeFloat(value);
  }

  /**
   * Writes a double-precision floating point field to the buffer. As this is
   * the native format used by JavaScript, no precision will be lost.
   * @param {number} field The field number.
   * @param {number?} value The value to write.
   */
  writeDouble(field, value) {
    if (value == null) return;
    this.writeFieldHeader_(field, WireType.FIXED64);
    this.encoder_.writeDouble(value);
  }

  /**
   * Writes a boolean field to the buffer. We allow numbers as input
   * because the JSPB code generator uses 0/1 instead of true/false to save
   * space in the string representation of the proto.
   * @param {number} field The field number.
   * @param {boolean?|number?} value The value to write.
   */
  writeBool(field, value) {
    if (value == null) return;
    assertThat(
        field, value, typeof value === 'boolean' || typeof value === 'number');
    this.writeFieldHeader_(field, WireType.VARINT);
    this.encoder_.writeBool(value);
  }

  /**
   * Writes an enum field to the buffer.
   * @param {number} field The field number.
   * @param {number?} value The value to write.
   */
  writeEnum(field, value) {
    if (value == null) return;
    // Converting since value might be object typed integer here.
    const intValue = /** number */ parseInt(value, 10);
    assertSignedInteger(field, intValue);
    this.writeFieldHeader_(field, WireType.VARINT);
    this.encoder_.writeSignedVarint32(intValue);
  }

  /**
   * Writes a string field to the buffer.
   * @param {number} field The field number.
   * @param {string?} value The string to write.
   */
  writeString(field, value) {
    if (value == null) return;
    const bookmark = this.beginDelimited_(field);
    this.encoder_.writeString(value);
    this.endDelimited_(bookmark);
  }

  /**
   * Writes an arbitrary byte field to the buffer. Note - to match the behavior
   * of the C++ implementation, empty byte arrays _are_ serialized.
   * @param {number} field The field number.
   * @param {?ByteSource} value The array of bytes to write.
   */
  writeBytes(field, value) {
    if (value == null) return;
    const bytes = byteSourceToUint8Array(value);
    this.writeFieldHeader_(field, WireType.DELIMITED);
    this.encoder_.writeUnsignedVarint32(bytes.length);
    this.appendUint8Array_(bytes);
  }

  /**
   * Writes a message to the buffer.
   * @param {number} field The field number.
   * @param {?MessageType} value The message to write.
   * @param {function(MessageTypeNonNull, !BinaryWriter)} writerCallback
   *     Will be invoked with the value to write and the writer to write it
   * with.
   * @template MessageType
   * Use go/closure-ttl to declare a non-nullable version of MessageType.
   * Replace the null in blah|null with none.  This is necessary because the
   * compiler will infer MessageType to be nullable if the value parameter is
   * nullable.
   * @template MessageTypeNonNull :=
   *     cond(isUnknown(MessageType), unknown(),
   *       mapunion(MessageType, (X) =>
   *         cond(eq(X, 'null'), none(), X)))
   * =:
   */
  writeMessage(field, value, writerCallback) {
    if (value == null) return;
    const bookmark = this.beginDelimited_(field);
    writerCallback(value, this);
    this.endDelimited_(bookmark);
  }

  /**
   * Writes a message set extension to the buffer.
   * @param {number} field The field number for the extension.
   * @param {?MessageType} value The extension message object to write. Note
   *     that message set can only have extensions with type of optional
   *     message.
   * @param {function(!MessageTypeNonNull, !BinaryWriter)} writerCallback
   *     Will be invoked with the value to write and the writer to write it
   * with.
   * @template MessageType
   * Use go/closure-ttl to declare a non-nullable version of MessageType.
   * Replace the null in blah|null with none.  This is necessary because the
   * compiler will infer MessageType to be nullable if the value parameter is
   * nullable.
   * @template MessageTypeNonNull :=
   *     cond(isUnknown(MessageType), unknown(),
   *       mapunion(MessageType, (X) =>
   *         cond(eq(X, 'null'), none(), X)))
   * =:
   */
  writeMessageSet(field, value, writerCallback) {
    if (value == null) return;
    // The wire format for a message set is defined by
    // google3/net/proto/message_set.proto
    this.writeFieldHeader_(1, WireType.START_GROUP);
    this.writeFieldHeader_(2, WireType.VARINT);
    this.encoder_.writeSignedVarint32(field);
    const bookmark = this.beginDelimited_(3);
    writerCallback(value, this);
    this.endDelimited_(bookmark);
    this.writeFieldHeader_(1, WireType.END_GROUP);
  }

  /**
   * Writes a group message to the buffer.
   *
   * @param {number} field The field number.
   * @param {?MessageType} value The message to write, wrapped with START_GROUP
   *     / END_GROUP tags. Will be a no-op if 'value' is null.
   * @param {function(MessageTypeNonNull, !BinaryWriter)} writerCallback
   *     Will be invoked with the value to write and the writer to write it
   * with.
   * @template MessageType
   * Use go/closure-ttl to declare a non-nullable version of MessageType.
   * Replace the null in blah|null with none.  This is necessary because the
   * compiler will infer MessageType to be nullable if the value parameter is
   * nullable.
   * @template MessageTypeNonNull :=
   *     cond(isUnknown(MessageType), unknown(),
   *       mapunion(MessageType, (X) =>
   *         cond(eq(X, 'null'), none(), X)))
   * =:
   */
  writeGroup(field, value, writerCallback) {
    if (value == null) return;
    this.writeFieldHeader_(field, WireType.START_GROUP);
    writerCallback(value, this);
    this.writeFieldHeader_(field, WireType.END_GROUP);
  }

  /**
   * Writes a 64-bit field to the buffer as a fixed64.
   * @param {number} field The field number.
   * @param {number} lowBits The low 32 bits.
   * @param {number} highBits The high 32 bits.
   */
  writeSplitFixed64(field, lowBits, highBits) {
    this.writeFieldHeader_(field, WireType.FIXED64);
    this.encoder_.writeSplitFixed64(lowBits, highBits);
  }

  /**
   * Writes a 64-bit field to the buffer as a varint.
   * @param {number} field The field number.
   * @param {number} lowBits The low 32 bits.
   * @param {number} highBits The high 32 bits.
   */
  writeSplitVarint64(field, lowBits, highBits) {
    this.writeFieldHeader_(field, WireType.VARINT);
    this.encoder_.writeSplitVarint64(lowBits, highBits);
  }

  /**
   * Writes a 64-bit field to the buffer as a zigzag encoded varint.
   * @param {number} field The field number.
   * @param {number} lowBits The low 32 bits.
   * @param {number} highBits The high 32 bits.
   */
  writeSplitZigzagVarint64(field, lowBits, highBits) {
    this.writeFieldHeader_(field, WireType.VARINT);
    this.encoder_.writeSplitZigzagVarint64(lowBits >>> 0, highBits >>> 0);
  }

  /**
   * Writes an array of numbers to the buffer as a repeated 32-bit int field.
   * @param {number} field The field number.
   * @param {?Array<number>} value The array of ints to write.
   */
  writeRepeatedInt32(field, value) {
    if (value == null) return;
    for (let i = 0; i < value.length; i++) {
      this.writeSignedVarint32_(field, value[i]);
    }
  }

  /**
   * Writes an array of numbers formatted as strings to the buffer as a repeated
   * 32-bit int field.
   * @param {number} field The field number.
   * @param {?Array<string>} value The array of ints to write.
   */
  writeRepeatedInt32String(field, value) {
    if (value == null) return;
    for (let i = 0; i < value.length; i++) {
      this.writeInt32String(field, value[i]);
    }
  }

  /**
   * Writes an array of numbers to the buffer as a repeated 64-bit int field.
   * @param {number} field The field number.
   * @param {?Array<number>} value The array of ints to write.
   */
  writeRepeatedInt64(field, value) {
    if (value == null) return;
    for (let i = 0; i < value.length; i++) {
      this.writeSignedVarint64_(field, value[i]);
    }
  }

  /**
   * Writes an array of 64-bit values to the buffer as a fixed64.
   * @param {number} field The field number.
   * @param {?Array<T>} value The value.
   * @param {function(T): number} lo Function to get low bits.
   * @param {function(T): number} hi Function to get high bits.
   * @template T
   */
  writeRepeatedSplitFixed64(field, value, lo, hi) {
    if (value == null) return;
    for (let i = 0; i < value.length; i++) {
      this.writeSplitFixed64(field, lo(value[i]), hi(value[i]));
    }
  }

  /**
   * Writes an array of 64-bit values to the buffer as a varint.
   * @param {number} field The field number.
   * @param {?Array<T>} value The value.
   * @param {function(T): number} lo Function to get low bits.
   * @param {function(T): number} hi Function to get high bits.
   * @template T
   */
  writeRepeatedSplitVarint64(field, value, lo, hi) {
    if (value == null) return;
    for (let i = 0; i < value.length; i++) {
      this.writeSplitVarint64(field, lo(value[i]), hi(value[i]));
    }
  }

  /**
   * Writes an array of 64-bit values to the buffer as a zigzag varint.
   * @param {number} field The field number.
   * @param {?Array<T>} value The value.
   * @param {function(T): number} lo Function to get low bits.
   * @param {function(T): number} hi Function to get high bits.
   * @template T
   */
  writeRepeatedSplitZigzagVarint64(field, value, lo, hi) {
    if (value == null) return;
    for (let i = 0; i < value.length; i++) {
      this.writeSplitZigzagVarint64(field, lo(value[i]), hi(value[i]));
    }
  }

  /**
   * Writes an array of numbers formatted as strings to the buffer as a repeated
   * 64-bit int field.
   * @param {number} field The field number.
   * @param {?Array<string>} value The array of ints to write.
   */
  writeRepeatedInt64String(field, value) {
    if (value == null) return;
    for (let i = 0; i < value.length; i++) {
      this.writeInt64String(field, value[i]);
    }
  }

  /**
   * Writes an array numbers to the buffer as a repeated unsigned 32-bit int
   *     field.
   * @param {number} field The field number.
   * @param {?Array<number>} value The array of ints to write.
   */
  writeRepeatedUint32(field, value) {
    if (value == null) return;
    for (let i = 0; i < value.length; i++) {
      this.writeUnsignedVarint32_(field, value[i]);
    }
  }

  /**
   * Writes an array of numbers formatted as strings to the buffer as a repeated
   * unsigned 32-bit int field.
   * @param {number} field The field number.
   * @param {?Array<string>} value The array of ints to write.
   */
  writeRepeatedUint32String(field, value) {
    if (value == null) return;
    for (let i = 0; i < value.length; i++) {
      this.writeUint32String(field, value[i]);
    }
  }

  /**
   * Writes an array numbers to the buffer as a repeated unsigned 64-bit int
   *     field.
   * @param {number} field The field number.
   * @param {?Array<number>} value The array of ints to write.
   */
  writeRepeatedUint64(field, value) {
    if (value == null) return;
    for (let i = 0; i < value.length; i++) {
      this.writeUnsignedVarint64_(field, value[i]);
    }
  }

  /**
   * Writes an array of numbers formatted as strings to the buffer as a repeated
   * unsigned 64-bit int field.
   * @param {number} field The field number.
   * @param {?Array<string>} value The array of ints to write.
   */
  writeRepeatedUint64String(field, value) {
    if (value == null) return;
    for (let i = 0; i < value.length; i++) {
      this.writeUint64String(field, value[i]);
    }
  }

  /**
   * Writes an array numbers to the buffer as a repeated signed 32-bit int
   * field.
   * @param {number} field The field number.
   * @param {?Array<number>} value The array of ints to write.
   */
  writeRepeatedSint32(field, value) {
    if (value == null) return;
    for (let i = 0; i < value.length; i++) {
      this.writeZigzagVarint32_(field, value[i]);
    }
  }

  /**
   * Writes an array numbers to the buffer as a repeated signed 64-bit int
   * field.
   * @param {number} field The field number.
   * @param {?Array<number>} value The array of ints to write.
   */
  writeRepeatedSint64(field, value) {
    if (value == null) return;
    for (let i = 0; i < value.length; i++) {
      this.writeZigzagVarint64_(field, value[i]);
    }
  }

  /**
   * Writes an array numbers to the buffer as a repeated signed 64-bit int
   * field.
   * @param {number} field The field number.
   * @param {?Array<string>} value The array of ints to write.
   */
  writeRepeatedSint64String(field, value) {
    if (value == null) return;
    for (let i = 0; i < value.length; i++) {
      this.writeZigzagVarint64String_(field, value[i]);
    }
  }

  /**
   * Writes an array of numbers to the buffer as a repeated fixed32 field. This
   * works for both signed and unsigned fixed32s.
   * @param {number} field The field number.
   * @param {?Array<number>} value The array of ints to write.
   */
  writeRepeatedFixed32(field, value) {
    if (value == null) return;
    for (let i = 0; i < value.length; i++) {
      this.writeFixed32(field, value[i]);
    }
  }

  /**
   * Writes an array of numbers to the buffer as a repeated fixed64 field. This
   * works for both signed and unsigned fixed64s.
   * @param {number} field The field number.
   * @param {?Array<number>} value The array of ints to write.
   */
  writeRepeatedFixed64(field, value) {
    if (value == null) return;
    for (let i = 0; i < value.length; i++) {
      this.writeFixed64(field, value[i]);
    }
  }

  /**
   * Writes an array of numbers to the buffer as a repeated fixed64 field. This
   * works for both signed and unsigned fixed64s.
   * @param {number} field The field number.
   * @param {?Array<string>} value The array of decimal strings to write.
   */
  writeRepeatedFixed64String(field, value) {
    if (value == null) return;
    for (let i = 0; i < value.length; i++) {
      this.writeFixed64String(field, value[i]);
    }
  }

  /**
   * Writes an array of numbers to the buffer as a repeated sfixed32 field.
   * @param {number} field The field number.
   * @param {?Array<number>} value The array of ints to write.
   */
  writeRepeatedSfixed32(field, value) {
    if (value == null) return;
    for (let i = 0; i < value.length; i++) {
      this.writeSfixed32(field, value[i]);
    }
  }

  /**
   * Writes an array of numbers to the buffer as a repeated sfixed64 field.
   * @param {number} field The field number.
   * @param {?Array<number>} value The array of ints to write.
   */
  writeRepeatedSfixed64(field, value) {
    if (value == null) return;
    for (let i = 0; i < value.length; i++) {
      this.writeSfixed64(field, value[i]);
    }
  }

  /**
   * Writes an array of decimal strings to the buffer as a repeated sfixed64
   * field.
   * @param {number} field The field number.
   * @param {?Array<string>} value The array of decimal strings to write.
   */
  writeRepeatedSfixed64String(field, value) {
    if (value == null) return;
    for (let i = 0; i < value.length; i++) {
      this.writeSfixed64String(field, value[i]);
    }
  }

  /**
   * Writes an array of numbers to the buffer as a repeated float field.
   * @param {number} field The field number.
   * @param {?Array<number>} value The array of ints to write.
   */
  writeRepeatedFloat(field, value) {
    if (value == null) return;
    for (let i = 0; i < value.length; i++) {
      this.writeFloat(field, value[i]);
    }
  }

  /**
   * Writes an array of numbers to the buffer as a repeated double field.
   * @param {number} field The field number.
   * @param {?Array<number>} value The array of ints to write.
   */
  writeRepeatedDouble(field, value) {
    if (value == null) return;
    for (let i = 0; i < value.length; i++) {
      this.writeDouble(field, value[i]);
    }
  }

  /**
   * Writes an array of booleans to the buffer as a repeated bool field.
   * @param {number} field The field number.
   * @param {?Array<boolean>} value The array of ints to write.
   */
  writeRepeatedBool(field, value) {
    if (value == null) return;
    for (let i = 0; i < value.length; i++) {
      this.writeBool(field, value[i]);
    }
  }

  /**
   * Writes an array of enums to the buffer as a repeated enum field.
   * @param {number} field The field number.
   * @param {?Array<number>} value The array of ints to write.
   */
  writeRepeatedEnum(field, value) {
    if (value == null) return;
    for (let i = 0; i < value.length; i++) {
      this.writeEnum(field, value[i]);
    }
  }

  /**
   * Writes an array of strings to the buffer as a repeated string field.
   * @param {number} field The field number.
   * @param {?Array<string>} value The array of strings to write.
   */
  writeRepeatedString(field, value) {
    if (value == null) return;
    for (let i = 0; i < value.length; i++) {
      this.writeString(field, value[i]);
    }
  }

  /**
   * Writes an array of arbitrary byte fields to the buffer.
   * @param {number} field The field number.
   * @param {?Array<!ByteSource>} value The arrays of arrays of bytes to
   *     write.
   */
  writeRepeatedBytes(field, value) {
    if (value == null) return;
    for (let i = 0; i < value.length; i++) {
      this.writeBytes(field, value[i]);
    }
  }

  /**
   * Writes an array of messages to the buffer.
   * @template MessageType
   * @param {number} field The field number.
   * @param {?Array<MessageType>} value The array of messages to
   *    write.
   * @param {function(MessageType, !BinaryWriter)} writerCallback
   *     Will be invoked with the value to write and the writer to write it
   * with.
   */
  writeRepeatedMessage(field, value, writerCallback) {
    if (value == null) return;
    for (let i = 0; i < value.length; i++) {
      const bookmark = this.beginDelimited_(field);
      writerCallback(value[i], this);
      this.endDelimited_(bookmark);
    }
  }

  /**
   * Writes an array of group messages to the buffer.
   * @template MessageType
   * @param {number} field The field number.
   * @param {?Array<MessageType>} value The array of messages to
   *    write.
   * @param {function(MessageType, !BinaryWriter)} writerCallback
   *     Will be invoked with the value to write and the writer to write it
   * with.
   */
  writeRepeatedGroup(field, value, writerCallback) {
    if (value == null) return;
    for (let i = 0; i < value.length; i++) {
      this.writeFieldHeader_(field, WireType.START_GROUP);
      writerCallback(value[i], this);
      this.writeFieldHeader_(field, WireType.END_GROUP);
    }
  }

  /**
   * Writes an array of numbers to the buffer as a packed 32-bit int field.
   * @param {number} field The field number.
   * @param {?Array<number>} value The array of ints to write.
   */
  writePackedInt32(field, value) {
    if (value == null || !value.length) return;
    const bookmark = this.beginDelimited_(field);
    for (let i = 0; i < value.length; i++) {
      assertSignedInteger(field, value[i]);
      this.encoder_.writeSignedVarint32(value[i]);
    }
    this.endDelimited_(bookmark);
  }

  /**
   * Writes an array of numbers represented as strings to the buffer as a packed
   * 32-bit int field.
   * @param {number} field
   * @param {?Array<string>} value
   */
  writePackedInt32String(field, value) {
    if (value == null || !value.length) return;
    const bookmark = this.beginDelimited_(field);
    for (let i = 0; i < value.length; i++) {
      const intValue = parseInt(value[i], 10);
      assertSignedInteger(field, intValue);
      this.encoder_.writeSignedVarint32(intValue);
    }
    this.endDelimited_(bookmark);
  }

  /**
   * Writes an array of numbers to the buffer as a packed 64-bit int field.
   * @param {number} field The field number.
   * @param {?Array<number>} value The array of ints to write.
   */
  writePackedInt64(field, value) {
    if (value == null || !value.length) return;
    const bookmark = this.beginDelimited_(field);
    for (let i = 0; i < value.length; i++) {
      this.encoder_.writeSignedVarint64(value[i]);
    }
    this.endDelimited_(bookmark);
  }

  /**
   * Writes an array of 64-bit values to the buffer as a fixed64.
   * @param {number} field The field number.
   * @param {?Array<T>} value The value.
   * @param {function(T): number} lo Function to get low bits.
   * @param {function(T): number} hi Function to get high bits.
   * @template T
   */
  writePackedSplitFixed64(field, value, lo, hi) {
    if (value == null) return;
    const bookmark = this.beginDelimited_(field);
    for (let i = 0; i < value.length; i++) {
      this.encoder_.writeSplitFixed64(lo(value[i]), hi(value[i]));
    }
    this.endDelimited_(bookmark);
  }

  /**
   * Writes an array of 64-bit values to the buffer as a varint.
   * @param {number} field The field number.
   * @param {?Array<T>} value The value.
   * @param {function(T): number} lo Function to get low bits.
   * @param {function(T): number} hi Function to get high bits.
   * @template T
   */
  writePackedSplitVarint64(field, value, lo, hi) {
    if (value == null) return;
    const bookmark = this.beginDelimited_(field);
    for (let i = 0; i < value.length; i++) {
      this.encoder_.writeSplitVarint64(lo(value[i]), hi(value[i]));
    }
    this.endDelimited_(bookmark);
  }

  /**
   * Writes an array of 64-bit values to the buffer as a zigzag varint.
   * @param {number} field The field number.
   * @param {?Array<T>} value The value.
   * @param {function(T): number} lo Function to get low bits.
   * @param {function(T): number} hi Function to get high bits.
   * @template T
   */
  writePackedSplitZigzagVarint64(field, value, lo, hi) {
    if (value == null) return;
    const bookmark = this.beginDelimited_(field);
    const encoder = this.encoder_;
    for (let i = 0; i < value.length; i++) {
      encoder.writeSplitZigzagVarint64(lo(value[i]), hi(value[i]));
    }
    this.endDelimited_(bookmark);
  }

  /**
   * Writes an array of numbers represented as strings to the buffer as a packed
   * 64-bit int field.
   * @param {number} field
   * @param {?Array<string>} value
   */
  writePackedInt64String(field, value) {
    if (value == null || !value.length) return;
    const bookmark = this.beginDelimited_(field);
    for (let i = 0; i < value.length; i++) {
      const num = Int64.fromString(value[i]);
      this.encoder_.writeSplitVarint64(num.lo, num.hi);
    }
    this.endDelimited_(bookmark);
  }

  /**
   * Writes an array numbers to the buffer as a packed unsigned 32-bit int
   * field.
   * @param {number} field The field number.
   * @param {?Array<number>} value The array of ints to write.
   */
  writePackedUint32(field, value) {
    if (value == null || !value.length) return;
    const bookmark = this.beginDelimited_(field);
    for (let i = 0; i < value.length; i++) {
      this.encoder_.writeUnsignedVarint32(value[i]);
    }
    this.endDelimited_(bookmark);
  }

  /**
   * Writes an array of numbers represented as strings to the buffer as a packed
   * unsigned 32-bit int field.
   * @param {number} field
   * @param {?Array<string>} value
   */
  writePackedUint32String(field, value) {
    if (value == null || !value.length) return;
    const bookmark = this.beginDelimited_(field);
    for (let i = 0; i < value.length; i++) {
      this.encoder_.writeUnsignedVarint32(parseInt(value[i], 10));
    }
    this.endDelimited_(bookmark);
  }

  /**
   * Writes an array numbers to the buffer as a packed unsigned 64-bit int
   * field.
   * @param {number} field The field number.
   * @param {?Array<number>} value The array of ints to write.
   */
  writePackedUint64(field, value) {
    if (value == null || !value.length) return;
    const bookmark = this.beginDelimited_(field);
    for (let i = 0; i < value.length; i++) {
      this.encoder_.writeUnsignedVarint64(value[i]);
    }
    this.endDelimited_(bookmark);
  }

  /**
   * Writes an array of numbers represented as strings to the buffer as a packed
   * unsigned 64-bit int field.
   * @param {number} field
   * @param {?Array<string>} value
   */
  writePackedUint64String(field, value) {
    if (value == null || !value.length) return;
    const bookmark = this.beginDelimited_(field);
    for (let i = 0; i < value.length; i++) {
      const num = UInt64.fromString(value[i]);
      this.encoder_.writeSplitVarint64(num.lo, num.hi);
    }
    this.endDelimited_(bookmark);
  }

  /**
   * Writes an array numbers to the buffer as a packed signed 32-bit int field.
   * @param {number} field The field number.
   * @param {?Array<number>} value The array of ints to write.
   */
  writePackedSint32(field, value) {
    if (value == null || !value.length) return;
    const bookmark = this.beginDelimited_(field);
    for (let i = 0; i < value.length; i++) {
      this.encoder_.writeZigzagVarint32(value[i]);
    }
    this.endDelimited_(bookmark);
  }

  /**
   * Writes an array of numbers to the buffer as a packed signed 64-bit int
   * field.
   * @param {number} field The field number.
   * @param {?Array<number>} value The array of ints to write.
   */
  writePackedSint64(field, value) {
    if (value == null || !value.length) return;
    const bookmark = this.beginDelimited_(field);
    for (let i = 0; i < value.length; i++) {
      this.encoder_.writeZigzagVarint64(value[i]);
    }
    this.endDelimited_(bookmark);
  }

  /**
   * Writes an array of decimal strings to the buffer as a packed signed 64-bit
   * int field.
   * @param {number} field The field number.
   * @param {?Array<string>} value The array of decimal strings to write.
   */
  writePackedSint64String(field, value) {
    if (value == null || !value.length) return;
    const bookmark = this.beginDelimited_(field);
    for (let i = 0; i < value.length; i++) {
      this.encoder_.writeZigzagVarint64String(value[i]);
    }
    this.endDelimited_(bookmark);
  }

  /**
   * Writes an array of numbers to the buffer as a packed fixed32 field.
   * @param {number} field The field number.
   * @param {?Array<number>} value The array of ints to write.
   */
  writePackedFixed32(field, value) {
    if (value == null || !value.length) return;
    this.writeFieldHeader_(field, WireType.DELIMITED);
    this.encoder_.writeUnsignedVarint32(value.length * 4);
    for (let i = 0; i < value.length; i++) {
      this.encoder_.writeUint32(value[i]);
    }
  }

  /**
   * Writes an array of numbers to the buffer as a packed fixed64 field.
   * @param {number} field The field number.
   * @param {?Array<number>} value The array of ints to write.
   */
  writePackedFixed64(field, value) {
    if (value == null || !value.length) return;
    this.writeFieldHeader_(field, WireType.DELIMITED);
    this.encoder_.writeUnsignedVarint32(value.length * 8);
    for (let i = 0; i < value.length; i++) {
      this.encoder_.writeUint64(value[i]);
    }
  }

  /**
   * Writes an array of numbers represented as strings to the buffer as a packed
   * fixed64 field.
   * @param {number} field The field number.
   * @param {?Array<string>} value The array of strings to write.
   */
  writePackedFixed64String(field, value) {
    if (value == null || !value.length) return;
    this.writeFieldHeader_(field, WireType.DELIMITED);
    this.encoder_.writeUnsignedVarint32(value.length * 8);
    for (let i = 0; i < value.length; i++) {
      const num = UInt64.fromString(value[i]);
      this.encoder_.writeSplitFixed64(num.lo, num.hi);
    }
  }

  /**
   * Writes an array of numbers to the buffer as a packed sfixed32 field.
   * @param {number} field The field number.
   * @param {?Array<number>} value The array of ints to write.
   */
  writePackedSfixed32(field, value) {
    if (value == null || !value.length) return;
    this.writeFieldHeader_(field, WireType.DELIMITED);
    this.encoder_.writeUnsignedVarint32(value.length * 4);
    for (let i = 0; i < value.length; i++) {
      this.encoder_.writeInt32(value[i]);
    }
  }

  /**
   * Writes an array of numbers to the buffer as a packed sfixed64 field.
   * @param {number} field The field number.
   * @param {?Array<number>} value The array of ints to write.
   */
  writePackedSfixed64(field, value) {
    if (value == null || !value.length) return;
    this.writeFieldHeader_(field, WireType.DELIMITED);
    this.encoder_.writeUnsignedVarint32(value.length * 8);
    for (let i = 0; i < value.length; i++) {
      this.encoder_.writeInt64(value[i]);
    }
  }

  /**
   * Writes an array of numbers to the buffer as a packed sfixed64 field.
   * @param {number} field The field number.
   * @param {?Array<string>} value The array of decimal strings to write.
   */
  writePackedSfixed64String(field, value) {
    if (value == null || !value.length) return;
    this.writeFieldHeader_(field, WireType.DELIMITED);
    this.encoder_.writeUnsignedVarint32(value.length * 8);
    for (let i = 0; i < value.length; i++) {
      this.encoder_.writeInt64String(value[i]);
    }
  }

  /**
   * Writes an array of numbers to the buffer as a packed float field.
   * @param {number} field The field number.
   * @param {?Array<number>} value The array of ints to write.
   */
  writePackedFloat(field, value) {
    if (value == null || !value.length) return;
    this.writeFieldHeader_(field, WireType.DELIMITED);
    this.encoder_.writeUnsignedVarint32(value.length * 4);
    for (let i = 0; i < value.length; i++) {
      this.encoder_.writeFloat(value[i]);
    }
  }

  /**
   * Writes an array of numbers to the buffer as a packed double field.
   * @param {number} field The field number.
   * @param {?Array<number>} value The array of ints to write.
   */
  writePackedDouble(field, value) {
    if (value == null || !value.length) return;
    this.writeFieldHeader_(field, WireType.DELIMITED);
    this.encoder_.writeUnsignedVarint32(value.length * 8);
    for (let i = 0; i < value.length; i++) {
      this.encoder_.writeDouble(value[i]);
    }
  }

  /**
   * Writes an array of booleans to the buffer as a packed bool field.
   * @param {number} field The field number.
   * @param {?Array<boolean>} value The array of ints to write.
   */
  writePackedBool(field, value) {
    if (value == null || !value.length) return;
    this.writeFieldHeader_(field, WireType.DELIMITED);
    this.encoder_.writeUnsignedVarint32(value.length);
    for (let i = 0; i < value.length; i++) {
      this.encoder_.writeBool(value[i]);
    }
  }

  /**
   * Writes an array of enums to the buffer as a packed enum field.
   * @param {number} field The field number.
   * @param {?Array<number>} value The array of ints to write.
   */
  writePackedEnum(field, value) {
    if (value == null || !value.length) return;
    const bookmark = this.beginDelimited_(field);
    for (let i = 0; i < value.length; i++) {
      this.encoder_.writeEnum(value[i]);
    }
    this.endDelimited_(bookmark);
  }
};

/**
 * Asserts that the value is signed integer.
 * @param {number} field
 * @param {?} value
 */
function assertSignedInteger(field, value) {
  assertThat(field, value, value === Math.floor(value));
  assertThat(field, value, value >= -TWO_TO_31 && value < TWO_TO_31);
}

/**
 * Asserts the condition.
 * @param {number} field
 * @param {?} value
 * @param {?} condition
 */
function assertThat(field, value, condition) {
  // Manual assertion here instead of asserts.assert(...) call for perf
  // reasons, to avoid unnecessary string concatenations.
  if (!condition) {
    fail(`for [${value}] at [${field}]`);
  }
}


exports = BinaryWriter;

;return exports;});

//javascript/apps/jspb/extension_field_info.js
goog.loadModule(function(exports) {'use strict';goog.module('jspb.ExtensionFieldInfo');
goog.module.declareLegacyNamespace();


const Message = goog.requireType('jspb.Message');

/**
 * Stores information for a single extension field.
 *
 * For example, an extension field defined like so:
 *
 *     extend BaseMessage {
 *       optional MyMessage my_field = 123;
 *     }
 *
 * will result in an ExtensionFieldInfo object with these properties:
 *
 *     {
 *       fieldIndex: 123,
 *       fieldName: {my_field_renamed: 0},
 *       ctor: proto.example.MyMessage,
 *       toObjectFn: proto.example.MyMessage.toObject,
 *       isRepeated: 0
 *     }
 *
 * We include `toObjectFn` to allow the JSCompiler to perform dead-code
 * removal on unused toObject() methods.
 *
 * If an extension field is primitive, ctor and toObjectFn will be null.
 * isRepeated should be 0 or 1.
 *
 * binary{Reader,Writer}Fn and (if message type) binaryMessageSerializeFn are
 * always provided. binaryReaderFn and binaryWriterFn are references to the
 * appropriate methods on BinaryReader/BinaryWriter to read/write the value of
 * this extension, and binaryMessageSerializeFn is a reference to the message
 * class's .serializeBinary method, if available.
 * @template T
 */
class ExtensionFieldInfo {
  /**
   *
   *
   * @param {number} fieldNumber
   * @param {?Object} fieldName This has the extension field name as a property.
   * @param {?function(new: Message, ?Array=)} ctor
   * @param {?function((boolean|undefined),!Message):!Object} toObjectFn
   * @param {number} isRepeated
   */
  constructor(fieldNumber, fieldName, ctor, toObjectFn, isRepeated) {
    /** @const {number} */
    this.fieldIndex = fieldNumber;
    /** @const {?Object} */
    this.fieldName = fieldName;
    /** @const ?function(new: Message, ?Array=)*/
    this.ctor = ctor;
    /** @const {?function((boolean|undefined),!Message):!Object} */
    this.toObjectFn = toObjectFn;
    /** @const {number} */
    this.isRepeated = isRepeated;
  }

  /**
   * @return {boolean} Does this field represent a sub Message?
   */
  isMessageType() {
    return !!this.ctor;
  }
}

exports = ExtensionFieldInfo;

;return exports;});

//javascript/apps/jspb/extension_field_binary_info.js
goog.loadModule(function(exports) {'use strict';goog.module('jspb.ExtensionFieldBinaryInfo');
goog.module.declareLegacyNamespace();

const BinaryReader = goog.require('jspb.BinaryReader');
const BinaryWriter = goog.require('jspb.BinaryWriter');
const ExtensionFieldInfo = goog.require('jspb.ExtensionFieldInfo');

/**
 * Stores binary-related information for a single extension field.
 * @template T
 */
class ExtensionFieldBinaryInfo {
  /**
   * @param {!ExtensionFieldInfo<T>} fieldInfo
   * @param {function(this:BinaryReader,number,?,?)} binaryReaderFn
   * @param {function(this:BinaryWriter,number,?)
   *        |function(this:BinaryWriter,number,?,?,?,?,?)} binaryWriterFn
   * @param {function(?,?)=} binaryMessageSerializeFn
   * @param {function(?,?)=} binaryMessageDeserializeFn
   * @param {boolean=} isPacked
   */

  constructor(
      fieldInfo, binaryReaderFn, binaryWriterFn, binaryMessageSerializeFn,
      binaryMessageDeserializeFn, isPacked) {
    /** @const {!ExtensionFieldInfo<T>} */
    this.fieldInfo = fieldInfo;
    /** @const {function(this:BinaryReader,number,?,?)} */
    this.binaryReaderFn = binaryReaderFn;
    /** @const {function(this:BinaryWriter,number,?)|function(this:BinaryWriter,number,?,?,?,?,?)} */
    this.binaryWriterFn = binaryWriterFn;
    /** @const {?function(?,?)|undefined} */
    this.binaryMessageSerializeFn = binaryMessageSerializeFn;
    /** @const {?function(?,?)|undefined} */
    this.binaryMessageDeserializeFn = binaryMessageDeserializeFn;
    /** @const {boolean} */
    this.isPacked = isPacked || false;
  }
}


exports = ExtensionFieldBinaryInfo;

;return exports;});

//javascript/apps/jspb/freezer_loading_info.js
goog.loadModule(function(exports) {'use strict';/**
 * @fileoverview this file stores a value to record if the freezer is loaded. It
 * is in a separate module such that both message.js and map.js can depend on it
 * directly.
 */

goog.module('jspb.Freezer.Loading.Info');

/**
 * If freezer is loaded. Currently, the use of message freezer is restricted.
 *
 * This property makes it easier for the JsCompiler to prove that freeze
 * is unused and eliminate the code for users who don't load freezer.js.
 * @package
 */
let isFreezerLoaded = false;

exports = {isFreezerLoaded};

;return exports;});

//javascript/apps/jspb/map.js
goog.loadModule(function(exports) {'use strict';
goog.module('jspb.Map');
goog.module.declareLegacyNamespace();

const BinaryReader = goog.requireType('jspb.BinaryReader');
const BinaryWriter = goog.requireType('jspb.BinaryWriter');
const FreezerInfo = goog.require('jspb.Freezer.Loading.Info');
const Message = goog.requireType('jspb.Message');
const asserts = goog.require('goog.asserts');

/**
 * A Map is a container that is used to implement map
 * fields on message objects. It closely follows the ES6 Map API; however,
 * it is distinct because we do not want to depend on external polyfills or
 * on ES6 itself.
 *
 * @template K, V
 */
class Map {
  /**
   * This constructor should only be called from generated message code. It is
   * not intended for general use by library consumers.
   *
   * @param {!Array<!Array<?>>} arr
   *
   * @param {?function(new:V, ?=)=} valueCtor
   *    The constructor for type V, if type V is a message type.
   *
   */
  constructor(arr, valueCtor) {
    /** @const @private */
    this.arr_ = arr;
    /** @const @package */
    this.valueCtor = valueCtor;

    /** @type {!Object<string, !Entry_<K,V>>} @package */
    this.map = {};

    /**
     * Is `this.arr_ updated with respect to `this.map`?
     * @type {boolean}
     */
    this.arrClean = true;

    /**
     * If this map is marked frozen, the caller should pass a function to mark
     * the messages inside this map frozen, if the map contains messages.
     * @type {?function(!Message)}
     * @private
     */
    this.markMessageFrozenFn_ = null;

    if (this.arr_.length > 0) {
      this.loadFromArray_();
    }
  }

  /**
   * Check if the map is marked as frozen.
   * @return {boolean}
   * @package
   */
  isFrozen() {
    return FreezerInfo.isFreezerLoaded && this.markMessageFrozenFn_ != null;
  }

  /**
   * Mark this map frozen and pass a function to mark message inside this map
   * frozen, if the map contains messages.
   * @param {function(!Message)} markMessageFrozenFn The function to mark
   * message frozen. Since map.js cannot depend on message.js, map.js will have
   * repeated code to freeze a message; instead, passing that freeze function
   * via this parameter from the message's callers would avoid this problem.
   * @package
   */
  internalMarkFrozen(markMessageFrozenFn) {
    asserts.assert(FreezerInfo.isFreezerLoaded);
    this.markMessageFrozenFn_ = markMessageFrozenFn;
  }

  /**
   * Throws if trying to mutate a frozen map.
   * @private
   */
  checkNotFrozen_() {
    if (FreezerInfo.isFreezerLoaded && this.isFrozen()) {
      throw new Error("Cannot mutate a frozen Map");
    }
  }

  /**
   * Load initial content from underlying array.
   * @private
   */
  loadFromArray_() {
    for (var i = 0; i < this.arr_.length; i++) {
      var record = this.arr_[i];
      var key = record[0];
      var value = record[1];
      this.map[key.toString()] = new Entry_(key, value);
    }
    this.arrClean = true;
  }

  /**
   * Synchronize content to underlying array, if needed, and return it. Throws
   * if this map is frozen or contains frozen messages.
   * @return {!Array<!Array<!Object>>}
   */
  toArray() {
    this.checkNotFrozen_();
    return this.syncInternalArray_(/* internalCall= */ false);
  }

  /**
   * Synchronize content to underlying array, if needed, and return it.
   * @return {!Array<!Array<!Object>>}
   * @package
   */
  toArrayInternal() {
    return this.syncInternalArray_(/* internalCall= */ true);
  }

  /**
   * Helps to call toArrayInternal() or toArray() for messages in this map.
   * @param {!Message} msg
   * @param {boolean} internalCall whether to call the internal toArrayInternal.
   * @return {!Array<!Array<!Object>>} The msg represented as an array.
   * @private
   */
  toArrayHelper_(msg, internalCall) {
    return FreezerInfo.isFreezerLoaded && internalCall
        ? msg.toArrayInternal() : msg.toArray();
  }

  /**
   * Helps to sync this.arr_ and return it.
   * @param {boolean} internalCall whether to call internal toArrayInternal() on
   *   messages.
   * @return {!Array<!Array<!Object>>}
   * @private
   */
  syncInternalArray_(internalCall) {
    if (this.arrClean) {
      if (this.valueCtor) {
        // We need to recursively sync maps in submessages to their arrays.
        let m = this.map;
        for (var p in m) {
          if (Object.prototype.hasOwnProperty.call(m, p)) {
            var valueWrapper = /** @type {?Message} */ (m[p].valueWrapper);
            if (valueWrapper) {
              this.toArrayHelper_(valueWrapper, internalCall);
            }
          }
        }
      }
    } else {
      // Delete all elements.
      this.arr_.length = 0;
      var strKeys = this.stringKeys_();
      // Output keys in deterministic (sorted) order.
      strKeys.sort();
      for (var i = 0; i < strKeys.length; i++) {
        let entry = this.map[strKeys[i]];
        var valueWrapper = /** @type {?Message} */ (entry.valueWrapper);
        if (valueWrapper) {
          this.toArrayHelper_(valueWrapper, internalCall);
        }
        this.arr_.push([entry.key, entry.value]);
      }
      this.arrClean = true;
    }
    return this.arr_;
  }

  /**
   * Returns the map formatted as an array of key-value pairs, suitable for the
   * toObject() form of a message.
   *
   * @param {boolean=} includeInstance Whether to include the JSPB instance for
   *    transitional soy proto support: http://goto/soy-param-migration
   * @param {function((boolean|undefined),V):!Object=} valueToObject
   *    The static toObject() method, if V is a message type.
   * @return {!Array<!Array<!Object>>}
   */
  toObject(includeInstance, valueToObject) {
    let rawArray = this.toArrayInternal();
    var entries = [];
    for (var i = 0; i < rawArray.length; i++) {
      let entry = this.map[rawArray[i][0].toString()];
      this.wrapEntry_(entry);
      var valueWrapper = /** @type {V|undefined} */ (entry.valueWrapper);
      if (valueWrapper) {
        asserts.assert(valueToObject);
        entries.push([entry.key, valueToObject(includeInstance, valueWrapper)]);
      } else {
        entries.push([entry.key, entry.value]);
      }
    }
    return entries;
  }

  /**
   * Returns a Map from the given array of key-value pairs when the values are
   * of message type. The values in the array must match the format returned by
   * their message type's toObject() method.
   *
   * @template K, V
   * @param {!Array<!Array<!Object>>} entries
   * @param {function(new:V,?=)} valueCtor
   *    The constructor for type V.
   * @param {function(!Object):V} valueFromObject
   *    The fromObject function for type V.
   * @return {!Map<K, V>}
   */
  static fromObject(entries, valueCtor, valueFromObject) {
    var result = new Map([], valueCtor);
    for (var i = 0; i < entries.length; i++) {
      var key = entries[i][0];
      var value = valueFromObject(entries[i][1]);
      result.set(key, value);
    }
    return result;
  }

  /**
   * Returns the map's length (number of key/value pairs).
   * @return {number}
   */
  getLength() {
    return this.stringKeys_().length;
  }

  /**
   * Clears the map.
   */
  clear() {
    this.checkNotFrozen_();
    this.map = {};
    this.arrClean = false;
  }

  /**
   * Deletes a particular key from the map.
   * N.B.: differs in name from ES6 Map's `delete` because IE8 does not support
   * reserved words as property names.
   * @this {jspb.Map}
   * @param {K} key
   * @return {boolean} Whether any entry with this key was deleted.
   */
  del(key) {
    this.checkNotFrozen_();
    var keyValue = key.toString();
    let hadKey = this.map.hasOwnProperty(keyValue);
    delete this.map[keyValue];
    this.arrClean = false;
    return hadKey;
  }

  /**
   * Returns an array of [key, value] pairs in the map.
   *
   * This is redundant compared to the plain entries() method, but we provide
   * this to help out Angular 1.x users.  Still evaluating whether this is the
   * best option.
   *
   * @return {!Array<!Array<K|V>>}
   */
  getEntryList() {
    var entries = [];
    var strKeys = this.stringKeys_();
    strKeys.sort();
    for (var i = 0; i < strKeys.length; i++) {
      let entry = this.map[strKeys[i]];
      entries.push([entry.key, entry.value]);  // TODO: why not wrapEntry_()?
    }
    return entries;
  }

  /**
   * Returns an iterator-iterable over [key, value] pairs in the map.
   * Closure compiler sadly doesn't support tuples, ie. Iterator<[K,V]>.
   * @return {!IteratorIterable<!Array<K|V>>} The iterator-iterable.
   */
  entries() {
    var entries = [];
    var strKeys = this.stringKeys_();
    strKeys.sort();
    for (var i = 0; i < strKeys.length; i++) {
      let entry = this.map[strKeys[i]];
      entries.push([entry.key, this.wrapEntry_(entry)]);
    }
    return new ArrayIteratorIterable(entries);
  }

  /**
   * Returns an iterator-iterable over keys in the map.
   * @return {!IteratorIterable<K>} The iterator-iterable.
   */
  keys() {
    var keys = [];
    var strKeys = this.stringKeys_();
    strKeys.sort();
    for (var i = 0; i < strKeys.length; i++) {
      let entry = this.map[strKeys[i]];
      keys.push(entry.key);
    }
    return new ArrayIteratorIterable(keys);
  }

  /**
   * Returns an iterator-iterable over values in the map.
   * @return {!IteratorIterable<V>} The iterator-iterable.
   */
  values() {
    var values = [];
    var strKeys = this.stringKeys_();
    strKeys.sort();
    for (var i = 0; i < strKeys.length; i++) {
      let entry = this.map[strKeys[i]];
      values.push(this.wrapEntry_(entry));
    }
    return new ArrayIteratorIterable(values);
  }

  /**
   * Iterates over entries in the map, calling a function on each.
   * @template T
   * @param {function(this:T, V, K, ?Map<K, V>)} cb
   * @param {T=} thisArg
   */
  forEach(cb, thisArg) {
    var strKeys = this.stringKeys_();
    strKeys.sort();
    for (var i = 0; i < strKeys.length; i++) {
      let entry = this.map[strKeys[i]];
      cb.call(thisArg, this.wrapEntry_(entry), entry.key, this);
    }
  }


  /**
   * Sets a key in the map to the given value.
   * @param {K} key The key
   * @param {V} value The value
   * @return {!Map<K,V>}
   */
  set(key, value) {
    this.checkNotFrozen_();
    var entry = new Entry_(key);
    if (this.valueCtor) {
      entry.valueWrapper = value;
      // .toArray() on a message returns a reference to the underlying array
      // rather than a copy.
      entry.value = value.toArrayInternal();
    } else {
      entry.value = value;
    }
    this.map[key.toString()] = entry;
    this.arrClean = false;
    return this;
  }

  /**
   * Sets an unconstructed/primitive value. Internal use only.
   * @param {K} key The key
   * @param {V} rawData The raw data, could be an array or a primitive
   * @package
   */
  setRawData(key, rawData) {
    let entry = new Entry_(key, rawData);
    this.map[key.toString()] = entry;
    this.arrClean = false;
  }

  /**
   * Helper: lazily construct a wrapper around an entry, if needed, and return
   * the user-visible type.
   * @param {!Entry_<K,V>} entry
   * @return {V}
   * @private
   * @suppress {visibility} Access to message's private field in order to
   *   freeze it. Cannot call Message.internalMarkFrozen because it will result
   *   in a circular dependency.
   */
  wrapEntry_(entry) {
    if (this.valueCtor) {
      if (!entry.valueWrapper) {
        entry.valueWrapper = new this.valueCtor(entry.value);
        if (this.isFrozen()) {
          asserts.assert(this.markMessageFrozenFn_ != null);
          this.markMessageFrozenFn_(
              /** @type {!Message} */ (entry.valueWrapper));
        }
      }
      return /** @type {V} */ (entry.valueWrapper);
    } else {
      return entry.value;
    }
  }

  /**
   * Gets the value corresponding to a key in the map.
   * @param {K} key
   * @return {V|undefined} The value, or `undefined` if key not present
   */
  get(key) {
    var keyValue = key.toString();
    let entry = this.map[keyValue];
    if (entry) {
      return this.wrapEntry_(entry);
    } else {
      return undefined;
    }
  }

  /**
   * Determines whether the given key is present in the map.
   * @param {K} key
   * @return {boolean} `true` if the key is present
   */
  has(key) {
    var keyValue = key.toString();
    return (keyValue in this.map);
  }


  /**
   * Write this Map field in wire format to a BinaryWriter, using the given
   * field number.
   * @param {number} fieldNumber
   * @param {!BinaryWriter} writer
   * @param {function(this:BinaryWriter,number,K)} keyWriterFn
   *     The method on BinaryWriter that writes type K to the stream.
   * @param {function(this:BinaryWriter,number,V,?=)|
   *          function(this:BinaryWriter,number,V,?)} valueWriterFn
   *     The method on BinaryWriter that writes type V to the stream.  May be
   *     writeMessage, in which case the second callback arg form is used.
   * @param {function(V,!BinaryWriter)=} valueWriterCallback
   *    The BinaryWriter serialization callback for type V, if V is a message
   *    type.
   */
  serializeBinary(
      fieldNumber, writer, keyWriterFn, valueWriterFn, valueWriterCallback) {
    var strKeys = this.stringKeys_();
    strKeys.sort();
    for (var i = 0; i < strKeys.length; i++) {
      let entry = this.map[strKeys[i]];
      writer.beginSubMessage(fieldNumber);
      keyWriterFn.call(writer, 1, entry.key);
      if (this.valueCtor) {
        valueWriterFn.call(
            writer, 2, this.wrapEntry_(entry), valueWriterCallback);
      } else {
        /** @type {function(this:BinaryWriter,number,?)} */ (valueWriterFn)
            .call(writer, 2, entry.value);
      }
      writer.endSubMessage();
    }
  }

  /**
   * Read one key/value message from the given BinaryReader. Compatible as the
   * `reader` callback parameter to BinaryReader.readMessage, to be called
   * when a key/value pair submessage is encountered. If the Key is undefined,
   * we should default it to 0.
   * @template K, V
   * @param {!jspb.Map} map
   * @param {!BinaryReader} reader
   * @param {function(this:BinaryReader):K} keyReaderFn
   *     The method on BinaryReader that reads type K from the stream.
   *
   * @param {function(this:BinaryReader):V|
   *          function(this:BinaryReader,V,
   *                  function(V,!BinaryReader))} valueReaderFn
   *    The method on BinaryReader that reads type V from the stream. May be
   *    readMessage, in which case the second callback arg form is used.
   *
   * @param {?function(V,!BinaryReader)=} valueReaderCallback
   *    The BinaryReader parsing callback for type V, if V is a message type
   *
   * @param {K=} defaultKey
   *    The default value for the type of map keys. Accepting map entries with
   *    unset keys is required for maps to be backwards compatible with the
   *    repeated message representation described here: goo.gl/zuoLAC
   *
   * @param {V=} defaultValue
   *    The default value for the type of map values. Accepting map entries with
   *    unset values is required for maps to be backwards compatible with the
   *    repeated message representation described here: goo.gl/zuoLAC
   *
   */
  static deserializeBinary(
      map, reader, keyReaderFn, valueReaderFn, valueReaderCallback, defaultKey,
      defaultValue) {
    var key = defaultKey;
    var value = defaultValue;

    while (reader.nextField()) {
      if (reader.isEndGroup()) {
        break;
      }
      var field = reader.getFieldNumber();

      if (field == 1) {
        // Key.
        key = keyReaderFn.call(reader);
      } else if (field == 2) {
        // Value.
        if (map.valueCtor) {
          asserts.assert(valueReaderCallback);
          if (!value) {
            // Old generator still doesn't provide default value message.
            // Need this for backward compatibility.
            value = new map.valueCtor();
          }
          valueReaderFn.call(reader, value, valueReaderCallback);
        } else {
          value = (/** @type {function(this:BinaryReader):?} */ (valueReaderFn))
                      .call(reader);
        }
      }
    }

    asserts.assert(key != undefined);
    asserts.assert(value != undefined);
    map.set(key, value);
  }

  /**
   * Helper: compute the list of all stringified keys in the underlying Object
   * map.
   * @return {!Array<string>}
   * @private
   */
  stringKeys_() {
    let m = this.map;
    var ret = [];
    for (var p in m) {
      if (Object.prototype.hasOwnProperty.call(m, p)) {
        ret.push(p);
      }
    }
    return ret;
  }
}

/**
 * @template K, V
 * @private
 */
class Entry_ {
  /**
   * @param {K} key The entry's key.
   * @param {V=} value The entry's value wrapper.
   */
  constructor(key, value) {
    /** @const {K} */
    this.key = key;

    // The JSPB-serializable value.  For primitive types this will be of type V.
    // For message types it will be an array.
    /** @type {V} */
    this.value = value;

    // Only used for submessage values.
    /** @type {V} */
    this.valueWrapper = undefined;
  }
}

/**
 * Helper: an IteratorIterable over an array.
 * @implements {IteratorIterable<T>}
 * @template T
 */
class ArrayIteratorIterable {
  /**
   * @param {!Array<T>} arr the array
   */
  constructor(arr) {
    /** @type {number} @private */
    this.idx_ = 0;

    /** @const @private */
    this.arr_ = arr;
  }

  /** @override @final */
  next() {
    if (this.idx_ < this.arr_.length) {
      return {done: false, value: this.arr_[this.idx_++]};
    } else {
      return {done: true, value: undefined};
    }
  }
}

if (typeof Symbol != 'undefined' && typeof Symbol.iterator != 'undefined') {
  /** @override */
  ArrayIteratorIterable.prototype[Symbol.iterator] = function() {
    return this;
  };
}



exports = Map;

;return exports;});

//javascript/apps/jspb/message.js
goog.loadModule(function(exports) {'use strict';// Copyright 2010 Google Inc. All Rights Reserved.

/**
 * @fileoverview Definition of Message.
 *
 * @author mwr@google.com (Mark Rawling)
 */
goog.module('jspb.Message');
goog.module.declareLegacyNamespace();

// BEGIN GOOGLE-INTERNAL
const BinaryConstants = goog.require('jspb.BinaryConstants');
// END GOOGLE-INTERNAL
const BinaryReader = goog.require('jspb.BinaryReader');
const ExtensionFieldBinaryInfo = goog.require('jspb.ExtensionFieldBinaryInfo');
const ExtensionFieldInfo = goog.require('jspb.ExtensionFieldInfo');
const FreezerInfo = goog.require('jspb.Freezer.Loading.Info');
const JspbMap = goog.require('jspb.Map');
// BEGIN GOOGLE-INTERNAL
// Not needed in compilation units that have no protos with xids.
const XString = goog.requireType('xid.String');
// END GOOGLE-INTERNAL
const asserts = goog.require('goog.asserts');
const base64 = goog.require('goog.crypt.base64');
const garray = goog.require('goog.array');


/**
 * Base class for all JsPb messages.
 *
 * Several common methods (toObject, serializeBinary, in particular) are not
 * defined on the prototype to encourage code patterns that minimize code bloat
 * due to otherwise unused code on all protos contained in the project.
 *
 * If you want to call these methods on a generic message, either
 * pass in your instance of method as a parameter:
 *     someFunction(instanceOfKnownProto,
 *                  KnownProtoClass.prototype.serializeBinary);
 * or use a lambda that knows the type:
 *     someFunction(()=>instanceOfKnownProto.serializeBinary());
 * or, if you don't care about code size, just suppress the
 *     WARNING - Property serializeBinary never defined on Message
 * and call it the intuitive way.
 *
 * @constructor
 * @struct
 */
const Message = function() {};


/**
 * @define {boolean} Whether to generate toObject methods for objects. Turn
 *     this off, if you do not want toObject to be ever used in your project.
 *     When turning off this flag, consider adding a conformance test that bans
 *     calling toObject. Enabling this will disable the JSCompiler's ability to
 *     dead code eliminate fields used in protocol buffers that are never used
 *     in an application.
 */
Message.GENERATE_TO_OBJECT =
    goog.define('jspb.Message.GENERATE_TO_OBJECT', true);


/**
 * @define {boolean} Whether to generate fromObject methods for objects. Turn
 *     this off, if you do not want fromObject to be ever used in your project.
 *     When turning off this flag, consider adding a conformance test that bans
 *     calling fromObject. Enabling this might disable the JSCompiler's ability
 *     to dead code eliminate fields used in protocol buffers that are never
 *     used in an application.
 *     By default this is enabled for test code only.
 */
Message.GENERATE_FROM_OBJECT = goog.define(
    'jspb.Message.GENERATE_FROM_OBJECT', !goog.DISALLOW_TEST_ONLY_CODE);


/**
 * @define {boolean} Whether to generate toString methods for objects. Turn
 *     this off if you do not use toString in your project and want to trim it
 *     from the compiled JS.
 */
Message.GENERATE_TO_STRING =
    goog.define('jspb.Message.GENERATE_TO_STRING', true);



// TODO(jakubvrana): Turn this off by default.
/**
 * @define {boolean} Disabling the serialization of empty trailing fields
 *     reduces the size of serialized protos. The price is an extra iteration of
 *     the proto before serialization. This is enabled by default to be
 *     backwards compatible. Projects are advised to turn this flag always off.
 */
Message.SERIALIZE_EMPTY_TRAILING_FIELDS =
    goog.define('jspb.Message.SERIALIZE_EMPTY_TRAILING_FIELDS', true);


/**
 * Does this JavaScript environment support Uint8Aray typed arrays?
 * @const {boolean}
 * @package
 * @suppress {underscore}
 */
Message.SUPPORTS_UINT8ARRAY_ = (typeof Uint8Array == 'function');


/**
 * The internal data array.
 * TODO(shaod): make it private or package-private.
 * @type {!Array}
 * @protected
 */
Message.prototype.array;


/**
 * Wrappers are the constructed instances of message-type fields. They are built
 * on demand from the raw array data. Includes message fields, repeated message
 * fields and extension message fields. Indexed by field number.
 * @type {Object}
 * @package
 */
Message.prototype.wrappers_;


/**
 * The object that contains extension fields, if any. This is an object that
 * maps from a proto field number to the field's value.
 * @type {Object}
 * @package
 */
Message.prototype.extensionObject_;


/**
 * Non-extension fields with a field number at or above the pivot are
 * stored in the extension object (in addition to all extension fields).
 * @type {number}
 * @private
 */
Message.prototype.pivot_;


/**
 * The JsPb message_id of this proto.
 * @type {string|undefined} the message id or undefined if this message
 *     has no id.
 * @private
 */
Message.prototype.messageId_;


/**
 * Repeated fields that have been converted to their proper type. This is used
 * for numbers stored as strings (typically "NaN", "Infinity" and "-Infinity")
 * and for booleans stored as numbers (0 or 1).
 * @private {!Object<number,boolean>|undefined}
 */
Message.prototype.convertedPrimitiveFields_;

/**
 * Repeated fields numbers.
 * @protected {?Array<number>|undefined}
 */
Message.prototype.repeatedFields;

// BEGIN GOOGLE-INTERNAL
/**
 * The xid of this proto type (The same for all instances of a proto). Provides
 * a way to identify a proto by stable obfuscated name.
 * @see {xid}.
 * Available if {@link jspb.generate_xid} is added as a Message option to
 * a protocol buffer.
 * @const {!XString|undefined} The xid or undefined if message is
 *     annotated to generate the xid.
 */
Message.prototype.messageXid;
// END GOOGLE-INTERNAL

/**
 * Returns the JsPb message_id of this proto.
 * @return {string|undefined} the message id or undefined if this message
 *     has no id.
 */
Message.prototype.getJsPbMessageId = function() {
  return this.messageId_;
};


/**
 * An offset applied to lookups into this.array to account for the presence or
 * absence of a messageId at position 0. For response messages, this will be 0.
 * Otherwise, it will be -1 so that the first array position is not wasted.
 * @type {number}
 * @private
 */
Message.prototype.arrayIndexOffset_;


/**
 * Returns the index into msg.array at which the proto field with tag number
 * fieldNumber will be located.
 * @param {!Message} msg Message for which we're calculating an index.
 * @param {number} fieldNumber The field number.
 * @return {number} The index.
 * @private
 */
Message.getIndex_ = function(msg, fieldNumber) {
  return fieldNumber + msg.arrayIndexOffset_;
};

// This is only here to ensure we are not back sliding on ES6 requiements for
// protos in g3.
Message.hiddenES6Property_ = class {};


/**
 * Returns the tag number based on the index in msg.array.
 * @param {!Message} msg Message for which we're calculating an index.
 * @param {number} index The tag number.
 * @return {number} The field number.
 * @package
 */
Message.getFieldNumber = function(msg, index) {
  return index - msg.arrayIndexOffset_;
};


/**
 * Initializes a JsPb Message.
 * @param {!Message} msg The JsPb proto to modify.
 * @param {Array|undefined} data An initial data array.
 * @param {string|number} messageId For response messages, the message id or ''
 *     if no message id is specified. For non-response messages, 0.
 * @param {number} suggestedPivot The field number at which to start putting
 *     fields into the extension object. This is only used if data does not
 *     contain an extension object already. -1 if no extension object is
 *     required for this message type.
 * @param {Array<number>} repeatedFields The message's repeated fields.
 * @param {Array<!Array<number>>=} opt_oneofFields The fields belonging to
 *     each of the message's oneof unions.
 * @protected
 */
Message.initialize = function(
    msg, data, messageId, suggestedPivot, repeatedFields, opt_oneofFields) {
  msg.wrappers_ = null;
  if (!data) {
    data = messageId ? [messageId] : [];
  }
  msg.messageId_ = messageId ? String(messageId) : undefined;
  // If the messageId is 0, this message is not a response message, so we shift
  // array indices down by 1 so as not to waste the first position in the array,
  // which would otherwise go unused.
  msg.arrayIndexOffset_ = messageId === 0 ? -1 : 0;
  msg.array = data;
  Message.initPivotAndExtensionObject_(msg, suggestedPivot);
  msg.convertedPrimitiveFields_ = {};

  if (!Message.SERIALIZE_EMPTY_TRAILING_FIELDS) {
    // TODO(jakubvrana): This is same for all instances, move to prototype.
    // TODO(jakubvrana): There are indexOf calls on this in serializtion,
    // consider switching to a set.
    msg.repeatedFields = repeatedFields;
  }



  if (repeatedFields) {
    for (var i = 0; i < repeatedFields.length; i++) {
      var fieldNumber = repeatedFields[i];
      if (fieldNumber < msg.pivot_) {
        var index = Message.getIndex_(msg, fieldNumber);
        msg.array[index] = msg.array[index] || Message.EMPTY_LIST_SENTINEL_;
      } else {
        Message.maybeInitEmptyExtensionObject_(msg);
        msg.extensionObject_[fieldNumber] =
            msg.extensionObject_[fieldNumber] || Message.EMPTY_LIST_SENTINEL_;
      }
    }
  }

  if (opt_oneofFields && opt_oneofFields.length) {
    // Compute the oneof case for each union. This ensures only one value is
    // set in the union.
    for (var i = 0; i < opt_oneofFields.length; i++) {
      Message.computeOneofCase(msg, opt_oneofFields[i]);
    }
  }
};


/**
 * Used to mark empty repeated fields. Serializes to null when serialized
 * to JSON.
 * When reading a repeated field readers must check the return value against
 * this value and return and replace it with a new empty array if it is
 * present.
 * @private @const {!Object}
 */
Message.EMPTY_LIST_SENTINEL_ =
    goog.DEBUG && Object.freeze ? Object.freeze([]) : [];


/**
 * Returns true if the provided argument is an extension object.
 * @param {*} o The object to classify as array or not.
 * @return {boolean} True if the provided object is an extension object.
 * @package
 */
Message.isExtensionObject = function(o) {
  // Normal fields are never objects, so we can be sure that if we find an
  // object here, then it's the extension object. However, we must ensure that
  // the object is not an array, since arrays are valid field values (bytes
  // fields can also be array).
  // NOTE(lukestebbing): We avoid looking at .length to avoid a JIT bug
  // in Safari on iOS 8. See the description of CL/86511464 for details.
  return (
      o !== null && typeof o == 'object' && !Array.isArray(o) &&
      !(Message.SUPPORTS_UINT8ARRAY_ && o instanceof Uint8Array));
};


/**
 * If the array contains an extension object in its last position, then the
 * object is kept in place and its position is used as the pivot.  If not,
 * decides the pivot of the message based on suggestedPivot without
 * materializing the extension object.
 *
 * @param {!Message} msg The JsPb proto to modify.
 * @param {number} suggestedPivot See description for initialize().
 * @private
 */
Message.initPivotAndExtensionObject_ = function(msg, suggestedPivot) {
  // There are 3 variants that need to be dealt with which are the
  // combination of whether there exists an extension object (EO) and
  // whether there is a suggested pivot (SP).
  //
  // EO,    ?    : pivot is the index of the EO
  // no-EO, no-SP: pivot is MAX_INT
  // no-EO, SP   : pivot is the max(lastindex + 1, SP)

  var msgLength = msg.array.length;
  var lastIndex = -1;
  if (msgLength) {
    lastIndex = msgLength - 1;
    var obj = msg.array[lastIndex];
    if (Message.isExtensionObject(obj)) {
      msg.pivot_ = Message.getFieldNumber(msg, lastIndex);
      msg.extensionObject_ = obj;
      return;
    }
  }

  if (suggestedPivot > -1) {
    // If a extension object is not present, set the pivot value as being
    // after the last value in the array to avoid overwriting values, etc.
    msg.pivot_ =
        Math.max(suggestedPivot, Message.getFieldNumber(msg, lastIndex + 1));
    // Avoid changing the shape of the proto with an empty extension object by
    // deferring the materialization of the extension object until the first
    // time a field set into it (may be due to getting a repeated proto field
    // from it, in which case a new empty array is set into it at first).
    msg.extensionObject_ = null;
  } else {
    // suggestedPivot is -1, which means that we don't have an extension object
    // at all, in which case all fields are stored in the array.
    msg.pivot_ = Number.MAX_VALUE;
  }
};


/**
 * Creates an empty extensionObject_ if non exists.
 * @param {!Message} msg The JsPb proto to modify.
 * @private
 */
Message.maybeInitEmptyExtensionObject_ = function(msg) {
  var pivotIndex = Message.getIndex_(msg, msg.pivot_);
  if (!msg.array[pivotIndex]) {
    if (!Message.isFrozen(msg)) {
      msg.extensionObject_ = msg.array[pivotIndex] = {};
    } else {
      // When initializing the empty extension object of a frozen msg.
      msg.extensionObject_ = {};
      Object.freeze(msg.extensionObject_);
    }
  }
};


/**
 * Converts a JsPb repeated message field into an object list.
 * @param {!Array<T>} field The repeated message field to be
 *     converted.
 * @param {?function(boolean=): Object|
 *     function((boolean|undefined),T): Object} toObjectFn The toObject
 *     function for this field.  We need to pass this for effective dead code
 *     removal.
 * @param {boolean=} opt_includeInstance Whether to include the JSPB instance
 *     for transitional soy proto support: http://goto/soy-param-migration
 * @return {!Array<Object>} An array of converted message objects.
 * @template T
 */
Message.toObjectList = function(field, toObjectFn, opt_includeInstance) {
  // Not using array.map in the generated code to keep it small.
  // And not using it here to avoid a function call.
  var result = [];
  for (var i = 0; i < field.length; i++) {
    result[i] = toObjectFn.call(field[i], opt_includeInstance, field[i]);
  }
  return result;
};


/**
 * Adds a proto's extension data to a Soy rendering object.
 * @param {!Message} proto The proto whose extensions to convert.
 * @param {!Object} obj The Soy object to add converted extension data to.
 * @param {!Object} extensions The proto class' registered extensions.
 * @param {function(this:?, ExtensionFieldInfo) : *} getExtensionFn
 *     The proto class' getExtension function. Passed for effective dead code
 *     removal.
 * @param {boolean=} opt_includeInstance Whether to include the JSPB instance
 *     for transitional soy proto support: http://goto/soy-param-migration
 */
Message.toObjectExtension = function(
    proto, obj, extensions, getExtensionFn, opt_includeInstance) {
  for (var fieldNumber in extensions) {
    if (!hasOwnProperty(extensions, fieldNumber)) {
      continue;
    }
    var fieldInfo = extensions[fieldNumber];
    var value = getExtensionFn.call(proto, fieldInfo);
    if (value != null) {
      for (var name in fieldInfo.fieldName) {
        if (fieldInfo.fieldName.hasOwnProperty(name)) {
          break;  // the compiled field name
        }
      }
      if (!fieldInfo.toObjectFn) {
        obj[name] = value;
      } else {
        if (fieldInfo.isRepeated) {
          obj[name] = Message.toObjectList(
              /** @type {!Array<!Message>} */ (value), fieldInfo.toObjectFn,
              opt_includeInstance);
        } else {
          obj[name] = fieldInfo.toObjectFn(
              opt_includeInstance, /** @type {!Message} */ (value));
        }
      }
    }
  }
};


/**
 * Writes a proto's extension data to a binary-format output stream.
 * @param {!Message} proto The proto whose extensions to convert.
 * @param {*} writer The binary-format writer to write to.
 * @param {!Object} extensions The proto class' registered extensions.
 * @param {function(this:Message,!ExtensionFieldInfo) : *} getExtensionFn The
 *     proto class' getExtension function. Passed for effective dead code
 *     removal.
 */
Message.serializeBinaryExtensions = function(
    proto, writer, extensions, getExtensionFn) {
  for (var fieldNumber in extensions) {
    if (!hasOwnProperty(extensions, fieldNumber)) {
      continue;
    }
    var binaryFieldInfo = extensions[fieldNumber];
    var fieldInfo = binaryFieldInfo.fieldInfo;

    // The old codegen doesn't add the extra fields to ExtensionFieldInfo, so we
    // need to gracefully error-out here rather than produce a null dereference
    // below.
    if (!binaryFieldInfo.binaryWriterFn) {
      throw new Error(
          'Message extension present that was generated ' +
          'without binary serialization support');
    }
    var value = getExtensionFn.call(proto, fieldInfo);
    if (value != null) {
      if (fieldInfo.isMessageType()) {
        // If the message type of the extension was generated without binary
        // support, there may not be a binary message serializer function, and
        // we can't know when we codegen the extending message that the extended
        // message may require binary support, so we can *only* catch this error
        // here, at runtime (and this decoupled codegen is the whole point of
        // extensions!).
        if (binaryFieldInfo.binaryMessageSerializeFn) {
          binaryFieldInfo.binaryWriterFn.call(
              writer, fieldInfo.fieldIndex, value,
              binaryFieldInfo.binaryMessageSerializeFn);
        } else {
          throw new Error(
              'Message extension present holding submessage ' +
              'without binary support enabled, and message is ' +
              'being serialized to binary format');
        }
      } else {
        binaryFieldInfo.binaryWriterFn.call(
            writer, fieldInfo.fieldIndex, value);
      }
    }
  }
};

// BEGIN GOOGLE-INTERNAL

/**
 * Reads an message set extension from the given reader and, if a valid
 * extension, sets the extension value to the message set message.
 * @param {!Message} msg A jspb proto.
 * @param {!BinaryReader} reader
 * @param {!Object} extensions The extensions object.
 * @param {function(this:Message,!ExtensionFieldInfo)} getExtensionFn
 * @param {function(this:Message,!ExtensionFieldInfo, ?)} setExtensionFn
 */
Message.readBinaryExtensionMessageSet = function(
    msg, reader, extensions, getExtensionFn, setExtensionFn) {
  // The wire format for a message set is defined by
  // google3/net/proto/message_set.proto
  if (reader.getFieldNumber() == 1 &&
      reader.getWireType() == BinaryConstants.WireType.START_GROUP) {
    var fieldNumber = 0;
    var rawBytes = null;
    while (reader.nextField()) {
      //  tag = 0 case
      if (reader.getWireType() == 0 && reader.getFieldNumber() == 0) {
        break;
      }
      if (reader.getWireType() == BinaryConstants.WireType.VARINT &&
          reader.getFieldNumber() == 2) {
        // message set type id case
        fieldNumber = reader.readUint32();
      } else if (
          reader.getWireType() == BinaryConstants.WireType.DELIMITED &&
          reader.getFieldNumber() == 3) {
        // message set contents case
        rawBytes = reader.readBytes();
      } else if (reader.getWireType() == BinaryConstants.WireType.END_GROUP) {
        // message set ending case
        break;
      } else {
        reader.skipField();
      }
    }
    if (reader.getFieldNumber() != 1 ||
        reader.getWireType() != BinaryConstants.WireType.END_GROUP ||
        rawBytes == null || fieldNumber == 0) {
      throw new Error('Malformed binary bytes for message set');
    }
    var binaryFieldInfo = extensions[fieldNumber];
    if (binaryFieldInfo) {
      var fieldInfo = binaryFieldInfo.fieldInfo;
      var newValue = new fieldInfo.ctor();
      binaryFieldInfo.binaryMessageDeserializeFn.call(
          newValue, newValue, new BinaryReader(rawBytes));
      setExtensionFn.call(msg, fieldInfo, newValue);
    }
  } else {
    // TODO(yilunchong): change delimited type to be restored in unknowns when
    // jspb support unknowns.
    reader.skipField();
  }
};

// END GOOGLE-INTERNAL

/**
 * Reads an extension field from the given reader and, if a valid extension,
 * sets the extension value.
 * @param {!Message} msg A jspb proto.
 * @param {!BinaryReader} reader
 * @param {!Object} extensions The extensions object.
 * @param {function(this:Message,!ExtensionFieldInfo)} getExtensionFn
 * @param {function(this:Message,!ExtensionFieldInfo, ?)} setExtensionFn
 */
Message.readBinaryExtension = function(
    msg, reader, extensions, getExtensionFn, setExtensionFn) {
  var binaryFieldInfo = extensions[reader.getFieldNumber()];
  if (!binaryFieldInfo) {
    reader.skipField();
    return;
  }
  var fieldInfo = binaryFieldInfo.fieldInfo;
  if (!binaryFieldInfo.binaryReaderFn) {
    throw new Error(
        'Deserializing extension whose generated code does not ' +
        'support binary format');
  }

  var value;
  if (fieldInfo.isMessageType()) {
    value = new fieldInfo.ctor();
    binaryFieldInfo.binaryReaderFn.call(
        reader, value, binaryFieldInfo.binaryMessageDeserializeFn);
  } else {
    // All other types.
    value = binaryFieldInfo.binaryReaderFn.call(reader);
  }

  if (fieldInfo.isRepeated && !binaryFieldInfo.isPacked) {
    var currentList = getExtensionFn.call(msg, fieldInfo);
    if (!currentList) {
      setExtensionFn.call(msg, fieldInfo, [value]);
    } else {
      currentList.push(value);
    }
  } else {
    setExtensionFn.call(msg, fieldInfo, value);
  }
};


/**
 * Gets the value of a non-extension field.
 * @param {!Message} msg A jspb proto.
 * @param {number} fieldNumber The field number.
 * @return {string|number|boolean|Uint8Array|Array|null|undefined}
 * The field's value.
 * @protected
 */
Message.getField = function(msg, fieldNumber) {
  if (fieldNumber < msg.pivot_) {
    var index = Message.getIndex_(msg, fieldNumber);
    var val = msg.array[index];
    if (val === Message.EMPTY_LIST_SENTINEL_ && !Message.isFrozen(msg)) {
      return msg.array[index] = [];
    }
    return val;
  } else {
    if (!msg.extensionObject_) {
      return undefined;
    }
    var val = msg.extensionObject_[fieldNumber];
    if (val === Message.EMPTY_LIST_SENTINEL_) {
      return msg.extensionObject_[fieldNumber] = [];
    }
    return val;
  }
};

/**
 * Returns whether the given field is set.
 * @param {!Message} msg A jspb proto.
 * @param {number} fieldNumber The field number.
 * @return {boolean}
 * @protected
 */
Message.hasField = function(msg, fieldNumber) {
  return Message.getField(msg, fieldNumber) != null;
};

/**
 * Gets the value of a non-extension repeated field.
 * @param {!Message} msg A jspb proto.
 * @param {number} fieldNumber The field number.
 * @return {!Array}
 * The field's value.
 * @protected
 */
Message.getRepeatedField = function(msg, fieldNumber) {
  let values = /** @type {!Array} */ (Message.getField(msg, fieldNumber));
  if (Message.isFrozen(msg)) {
    Message.internalMarkFrozen(values);
  }
  return values;
};


/**
 * Gets the value of an optional float or double field.
 * @param {!Message} msg A jspb proto.
 * @param {number} fieldNumber The field number.
 * @return {?number|undefined} The field's value.
 * @protected
 */
Message.getOptionalFloatingPointField = function(msg, fieldNumber) {
  var value = Message.getField(msg, fieldNumber);
  // Converts "NaN", "Infinity" and "-Infinity" to their corresponding numbers.
  return value == null ? value : +value;
};


/**
 * Gets the value of an optional boolean field.
 * @param {!Message} msg A jspb proto.
 * @param {number} fieldNumber The field number.
 * @return {?boolean|undefined} The field's value.
 * @protected
 */
Message.getBooleanField = function(msg, fieldNumber) {
  var value = Message.getField(msg, fieldNumber);
  // TODO(b/122673075): always return null when the value is null-ish.
  return value == null ? (value) : !!value;
};


/**
 * Gets the value of a repeated float or double field.
 * @param {!Message} msg A jspb proto.
 * @param {number} fieldNumber The field number.
 * @return {!Array<number>} The field's value.
 * @protected
 */
Message.getRepeatedFloatingPointField = function(msg, fieldNumber) {
  let values = /** @type {!Array} */ (Message.getField(msg, fieldNumber));
  if (!msg.convertedPrimitiveFields_) {
    msg.convertedPrimitiveFields_ = {};
  }
  if (!msg.convertedPrimitiveFields_[fieldNumber]) {
    for (var i = 0; i < values.length; i++) {
      // Converts "NaN", "Infinity" and "-Infinity" to their corresponding
      // numbers.
      values[i] = +values[i];
    }
    msg.convertedPrimitiveFields_[fieldNumber] = true;
  }

  if (Message.isFrozen(msg)) {
    Message.internalMarkFrozen(values);
  }

  return /** @type {!Array<number>} */ (values);
};

/**
 * Gets the value of a repeated boolean field.
 * @param {!Message} msg A jspb proto.
 * @param {number} fieldNumber The field number.
 * @return {!Array<boolean>} The field's value.
 * @protected
 */
Message.getRepeatedBooleanField = function(msg, fieldNumber) {
  let values = /** @type {!Array} */ (Message.getField(msg, fieldNumber));
  if (!msg.convertedPrimitiveFields_) {
    msg.convertedPrimitiveFields_ = {};
  }
  if (!msg.convertedPrimitiveFields_[fieldNumber]) {
    for (var i = 0; i < values.length; i++) {
      // Converts 0 and 1 to their corresponding booleans.
      values[i] = !!values[i];
    }
    msg.convertedPrimitiveFields_[fieldNumber] = true;
  }

  if (Message.isFrozen(msg)) {
    Message.internalMarkFrozen(values);
  }

  return /** @type {!Array<boolean>} */ (values);
};


/**
 * Coerce a 'bytes' field to a base 64 string.
 * @param {string|Uint8Array|null} value
 * @return {?string} The field's coerced value.
 */
Message.bytesAsB64 = function(value) {
  if (value == null || typeof value === 'string') {
    return value;
  }
  if (Message.SUPPORTS_UINT8ARRAY_ && value instanceof Uint8Array) {
    return base64.encodeByteArray(value);
  }
  asserts.fail('Cannot coerce to b64 string: ' + goog.typeOf(value));
  return null;
};


/**
 * Coerce a 'bytes' field to a Uint8Array byte buffer.
 * Note that Uint8Array is not supported on IE versions before 10 nor on Opera
 * Mini. @see http://caniuse.com/Uint8Array
 * @param {string|Uint8Array|null} value
 * @return {?Uint8Array} The field's coerced value.
 */
Message.bytesAsU8 = function(value) {
  if (value == null || value instanceof Uint8Array) {
    return value;
  }
  if (typeof value === 'string') {
    return base64.decodeStringToUint8Array(value);
  }
  asserts.fail('Cannot coerce to Uint8Array: ' + goog.typeOf(value));
  return null;
};


/**
 * Coerce a repeated 'bytes' field to an array of base 64 strings.
 * Note: the returned array should be treated as immutable.
 * @param {!Array<string>|!Array<!Uint8Array>} value
 * @return {!Array<string?>} The field's coerced value.
 */
Message.bytesListAsB64 = function(value) {
  Message.assertConsistentTypes_(value);
  if (!value.length || typeof value[0] === 'string') {
    return /** @type {!Array<string>} */ (value);
  }
  return garray.map(value, Message.bytesAsB64);
};


/**
 * Coerce a repeated 'bytes' field to an array of Uint8Array byte buffers.
 * Note: the returned array should be treated as immutable.
 * Note that Uint8Array is not supported on IE versions before 10 nor on Opera
 * Mini. @see http://caniuse.com/Uint8Array
 * @param {!Array<string>|!Array<!Uint8Array>} value
 * @return {!Array<Uint8Array?>} The field's coerced value.
 */
Message.bytesListAsU8 = function(value) {
  Message.assertConsistentTypes_(value);
  if (!value.length || value[0] instanceof Uint8Array) {
    return /** @type {!Array<!Uint8Array>} */ (value);
  }
  return garray.map(value, Message.bytesAsU8);
};


/**
 * Asserts that all elements of an array are of the same type.
 * @param {Array?} array The array to test.
 * @private
 */
Message.assertConsistentTypes_ = function(array) {
  if (goog.DEBUG && array && array.length > 1) {
    var expected = goog.typeOf(array[0]);
    garray.forEach(array, function(e) {
      if (goog.typeOf(e) != expected) {
        asserts.fail(
            'Inconsistent type in JSPB repeated field array. ' +
            'Got ' + goog.typeOf(e) + ' expected ' + expected);
      }
    });
  }
};


/**
 * Gets the value of a non-extension primitive field, with proto3 (non-nullable
 * primitives) semantics. Returns `defaultValue` if the field is not otherwise
 * set.
 * @template T
 * @param {!Message} msg A jspb proto.
 * @param {number} fieldNumber The field number.
 * @param {T} defaultValue The default value.
 * @return {T} The field's value.
 * @protected
 */
Message.getFieldWithDefault = function(msg, fieldNumber, defaultValue) {
  var value = Message.getField(msg, fieldNumber);
  if (value == null) {
    return defaultValue;
  } else {
    return value;
  }
};

/**
 * Gets the value of an integer field, with proto3 (non-nullable primitives)
 * semantics. If no value is set, returns 0 by default.
 * @param {!Message} msg A jspb proto.
 * @param {number} fieldNumber The field number.
 * @param {number=} defaultValue The default value. 0 if not set.
 * @return {number} The field's value.
 * @protected
 */
Message.getIntegerFieldWithDefault =
    function(msg, fieldNumber, defaultValue = 0) {
  return Message.getFieldWithDefault(msg, fieldNumber, defaultValue);
};

/**
 * Gets the value of a string field, with proto3 (non-nullable primitives)
 * semantics. If no value is set, returns an empty string by default.
 * @param {!Message} msg A jspb proto.
 * @param {number} fieldNumber The field number.
 * @param {T=} defaultValue The default value. An empty string if not set.
 * @return {T} The field's value.
 * @template T
 * @protected
 */
Message.getStringFieldWithDefault =
    function(msg, fieldNumber, defaultValue = "") {
  return Message.getFieldWithDefault(msg, fieldNumber, defaultValue);
};

/**
 * Gets the value of an integer field with jstype = string, with proto3
 * (non-nullable primitives) semantics. If no value is set, returns a string "0"
 * by default.
 * @param {!Message} msg A jspb proto.
 * @param {number} fieldNumber The field number.
 * @param {string=} defaultValue The default value. false if not set.
 * @return {string}
 * @protected
 */
Message.getIntegerInStringFieldWithDefault =
    function(msg, fieldNumber, defaultValue = "0") {
  return Message.getFieldWithDefault(msg, fieldNumber, defaultValue);
};


/**
 * Gets the value of a boolean field, with proto3 (non-nullable primitives)
 * semantics. Returns `defaultValue` if the field is not otherwise set.
 * @template T
 * @param {!Message} msg A jspb proto.
 * @param {number} fieldNumber The field number.
 * @param {boolean=} defaultValue The default value. false if not set.
 * @return {boolean} The field's value.
 * @protected
 */
Message.getBooleanFieldWithDefault =
    function(msg, fieldNumber, defaultValue = false) {
  var value = Message.getBooleanField(msg, fieldNumber);
  if (value == null) {
    return defaultValue;
  } else {
    return value;
  }
};


/**
 * Gets the value of a floating point field, with proto3 (non-nullable
 * primitives) semantics. Returns `defaultValue` if the field is not otherwise
 * set.
 * @template T
 * @param {!Message} msg A jspb proto.
 * @param {number} fieldNumber The field number.
 * @param {number=} defaultValue The default value. 0.0 if not set.
 * @return {number} The field's value.
 * @protected
 */
Message.getFloatingPointFieldWithDefault = function(
    msg, fieldNumber, defaultValue = 0.0) {
  var value = Message.getOptionalFloatingPointField(msg, fieldNumber);
  if (value == null) {
    return defaultValue;
  } else {
    return value;
  }
};


/**
 * Alias for getFieldWithDefault used by older generated code.
 * @template T
 * @param {!Message} msg A jspb proto.
 * @param {number} fieldNumber The field number.
 * @param {T} defaultValue The default value.
 * @return {T} The field's value.
 * @protected
 */
Message.getFieldProto3 = Message.getFieldWithDefault;


/**
 * Gets the value of a map field, lazily creating the map container if
 * necessary.
 *
 * This should only be called from generated code, because it requires knowledge
 * of serialization/parsing callbacks (which are required by the map at
 * construction time, and the map may be constructed here).
 *
 * @template K, V
 * @param {!Message} msg
 * @param {number} fieldNumber
 * @param {boolean|undefined} noLazyCreate
 * @param {?=} opt_valueCtor
 * @return {!JspbMap<K, V>|undefined}
 * @protected
 */
Message.getMapField = function(msg, fieldNumber, noLazyCreate, opt_valueCtor) {
  if (!msg.wrappers_) {
    msg.wrappers_ = {};
  }
  // If we already have a map in the map wrappers, return that.
  if (fieldNumber in msg.wrappers_) {
    return msg.wrappers_[fieldNumber];
  }
  var arr = Message.getField(msg, fieldNumber);
  // Wrap the underlying elements array with a Map.
  if (!arr) {
    if (noLazyCreate) {
      return undefined;
    }
    arr = [];
    if (!Message.isFrozen(msg)) {
      // Don't set the internal array; it's frozen anyway.
      Message.setField(msg, fieldNumber, arr);
    }
  }

  let jspbMap =
      new JspbMap(/** @type {!Array<!Array<!Object>>} */ (arr), opt_valueCtor);
  if (Message.isFrozen(msg)) {
     jspbMap.internalMarkFrozen(Message.internalMarkFrozen);
  }
  return msg.wrappers_[fieldNumber] = jspbMap;
};


/**
 * Sets the value of a non-extension field.
 * TODO(shaod): document unexpected behavior of set a frozen repeated field
 * inside a mutable message.
 * @param {T} msg A jspb proto.
 * @param {number} fieldNumber The field number.
 * @param {string|number|boolean|Uint8Array|Array|undefined} value New value
 * @return {T} return msg
 * @template T
 * @protected
 */
Message.setField = function(msg, fieldNumber, value) {
  // TODO(b/35241823): replace this with a bounded generic when available
  asserts.assertInstanceof(msg, Message);
  Message.checkNotFrozen_(msg);
  if (fieldNumber < msg.pivot_) {
    msg.array[Message.getIndex_(msg, fieldNumber)] = value;
  } else {
    Message.maybeInitEmptyExtensionObject_(msg);
    msg.extensionObject_[fieldNumber] = value;
  }
  return msg;
};


/**
 * Clears a primitive field by making it undefined.
 * @param {T} msg A jspb proto
 * @param {number} fieldNumber The field number.
 * @return {T} return msg
 * @template T
 * @protected
 */
Message.clearField = function(msg, fieldNumber) {
  return Message.setField(msg, fieldNumber, undefined);
};

/**
 * Clears a repeated primitive field by making it empty.
 * @param {T} msg A jspb proto
 * @param {number} fieldNumber The field number.
 * @return {T} return msg
 * @template T
 * @protected
 */
Message.clearRepeatedField = function(msg, fieldNumber) {
  return Message.setField(msg, fieldNumber, []);
};

/**
 * Clears a wrapper field by making it undefined.
 * @param {T} msg A jspb proto
 * @param {number} fieldNumber The field number.
 * @return {T} return msg
 * @template T
 * @protected
 */
Message.clearWrapperField = function(msg, fieldNumber) {
  return Message.setWrapperField(msg, fieldNumber, undefined);
};

/**
 * Clears a repeated wrapper field by making it empty.
 * @param {T} msg A jspb proto
 * @param {number} fieldNumber The field number.
 * @return {T} return msg
 * @template T
 * @protected
 */
Message.clearRepeatedWrapperField = function(msg, fieldNumber) {
  return Message.setRepeatedWrapperField(msg, fieldNumber, []);
};

/**
 * Clears an oneof primitive field by making it undefined.
 * @param {T} msg A jspb proto
 * @param {number} fieldNumber The field number.
 * @param {!Array<number>} oneof The fields belonging to the union.
 * @return {T} return msg
 * @template T
 * @protected
 */
Message.clearOneofField = function(msg, fieldNumber, oneof) {
  return Message.setOneofField(msg, fieldNumber, oneof, undefined);
};

/**
 * Clears an oneof wrapper field by making it undefined.
 * @param {T} msg A jspb proto
 * @param {number} fieldNumber The field number.
 * @param {!Array<number>} oneof The fields belonging to the union.
 * @return {T} return msg
 * @template T
 * @protected
 */
Message.clearOneofWrapperField = function(msg, fieldNumber, oneof) {
  return Message.setOneofWrapperField(msg, fieldNumber, oneof, undefined);
};

/**
 * Sets the value of a non-extension integer field of a proto3
 * @param {T} msg A jspb proto.
 * @param {number} fieldNumber The field number.
 * @param {number} value New value
 * @return {T} return msg
 * @template T
 * @protected
 */
Message.setProto3IntField = function(msg, fieldNumber, value) {
  return Message.setFieldIgnoringDefault_(msg, fieldNumber, value, 0);
};


/**
 * Sets the value of a non-extension floating point field of a proto3
 * @param {T} msg A jspb proto.
 * @param {number} fieldNumber The field number.
 * @param {number} value New value
 * @return {T} return msg
 * @template T
 * @protected
 */
Message.setProto3FloatField = function(msg, fieldNumber, value) {
  return Message.setFieldIgnoringDefault_(msg, fieldNumber, value, 0.0);
};


/**
 * Sets the value of a non-extension boolean field of a proto3
 * @param {T} msg A jspb proto.
 * @param {number} fieldNumber The field number.
 * @param {boolean} value New value
 * @return {T} return msg
 * @template T
 * @protected
 */
Message.setProto3BooleanField = function(msg, fieldNumber, value) {
  return Message.setFieldIgnoringDefault_(msg, fieldNumber, value, false);
};


/**
 * Sets the value of a non-extension String field of a proto3
 * @param {T} msg A jspb proto.
 * @param {number} fieldNumber The field number.
 * @param {string} value New value
 * @return {T} return msg
 * @template T
 * @protected
 */
Message.setProto3StringField = function(msg, fieldNumber, value) {
  return Message.setFieldIgnoringDefault_(msg, fieldNumber, value, '');
};


/**
 * Sets the value of a non-extension Bytes field of a proto3
 * @param {T} msg A jspb proto.
 * @param {number} fieldNumber The field number.
 * @param {!Uint8Array|string} value New value
 * @return {T} return msg
 * @template T
 * @protected
 */
Message.setProto3BytesField = function(msg, fieldNumber, value) {
  return Message.setFieldIgnoringDefault_(msg, fieldNumber, value, '');
};


/**
 * Sets the value of a non-extension enum field of a proto3
 * @param {T} msg A jspb proto.
 * @param {number} fieldNumber The field number.
 * @param {number} value New value
 * @return {T} return msg
 * @template T
 * @protected
 */
Message.setProto3EnumField = function(msg, fieldNumber, value) {
  return Message.setFieldIgnoringDefault_(msg, fieldNumber, value, 0);
};


/**
 * Sets the value of a non-extension int field of a proto3 that has jstype set
 * to String.
 * @param {T} msg A jspb proto.
 * @param {number} fieldNumber The field number.
 * @param {string} value New value
 * @return {T} return msg
 * @template T
 * @protected
 */
Message.setProto3StringIntField = function(msg, fieldNumber, value) {
  return Message.setFieldIgnoringDefault_(msg, fieldNumber, value, '0');
};

/**
 * Sets the value of a non-extension primitive field, with proto3 (non-nullable
 * primitives) semantics of ignoring values that are equal to the type's
 * default.
 * @param {T} msg A jspb proto.
 * @param {number} fieldNumber The field number.
 * @param {!Uint8Array|string|number|boolean|undefined} value New value
 * @param {!Uint8Array|string|number|boolean} defaultValue The default value.
 * @return {T} return msg
 * @template T
 * @private
 */
Message.setFieldIgnoringDefault_ = function(
    msg, fieldNumber, value, defaultValue) {
  // TODO(b/35241823): replace this with a bounded generic when available
  asserts.assertInstanceof(msg, Message);
  Message.checkNotFrozen_(msg);
  if (value !== defaultValue) {
    Message.setField(msg, fieldNumber, value);
  } else if (fieldNumber < msg.pivot_) {
    msg.array[Message.getIndex_(msg, fieldNumber)] = null;
  } else {
    Message.maybeInitEmptyExtensionObject_(msg);
    delete msg.extensionObject_[fieldNumber];
  }
  return msg;
};


/**
 * Adds a value to a repeated, primitive field.
 * @param {T} msg A jspb proto.
 * @param {number} fieldNumber The field number.
 * @param {string|number|boolean|!Uint8Array} value New value
 * @param {number=} opt_index Index where to put new value.
 * @return {T} return msg
 * @template T
 * @protected
 */
Message.addToRepeatedField = function(msg, fieldNumber, value, opt_index) {
  // TODO(b/35241823): replace this with a bounded generic when available
  asserts.assertInstanceof(msg, Message);
  Message.checkNotFrozen_(msg);
  var arr = Message.getRepeatedField(msg, fieldNumber);
  if (opt_index != undefined) {
    arr.splice(opt_index, 0, value);
  } else {
    arr.push(value);
  }
  return msg;
};


/**
 * Sets the value of a field in a oneof union and clears all other fields in
 * the union.
 * @param {T} msg A jspb proto.
 * @param {number} fieldNumber The field number.
 * @param {!Array<number>} oneof The fields belonging to the union.
 * @param {string|number|boolean|Uint8Array|Array|undefined} value New value
 * @return {T} return msg
 * @template T
 * @protected
 */
Message.setOneofField = function(msg, fieldNumber, oneof, value) {
  // TODO(b/35241823): replace this with a bounded generic when available
  asserts.assertInstanceof(msg, Message);
  Message.checkNotFrozen_(msg);
  var currentCase = Message.computeOneofCase(msg, oneof);
  if (currentCase && currentCase !== fieldNumber && value !== undefined) {
    if (msg.wrappers_ && currentCase in msg.wrappers_) {
      msg.wrappers_[currentCase] = undefined;
    }
    Message.setField(msg, currentCase, undefined);
  }
  return Message.setField(msg, fieldNumber, value);
};



/**
 * Computes the selection in a oneof group for the given message, ensuring
 * only one field is set in the process.
 *
 * According to the protobuf language guide (
 * https://developers.google.com/protocol-buffers/docs/proto#oneof), "if the
 * parser encounters multiple members of the same oneof on the wire, only the
 * last member seen is used in the parsed message." Since JSPB serializes
 * messages to a JSON array, the "last member seen" will always be the field
 * with the greatest field number (directly corresponding to the greatest
 * array index).
 *
 * @param {!Message} msg A jspb proto.
 * @param {!Array<number>} oneof The field numbers belonging to the union.
 * @return {number} The field number currently set in the union, or 0 if none.
 * @protected
 */
Message.computeOneofCase = function(msg, oneof) {
  var oneofField;
  var oneofValue;
  let isFrozen = Message.isFrozen(msg);

  for (var i = 0; i < oneof.length; i++) {
    var fieldNumber = oneof[i];
    var value = Message.getField(msg, fieldNumber);
    if (value != null) {
      oneofField = fieldNumber;
      oneofValue = value;
      if (!isFrozen) {
        Message.setField(msg, fieldNumber, undefined);
      }
    }
  }

  if (oneofField) {
    // NB: We know the value is unique, so we can call Message.setField
    // directly instead of jpsb.Message.setOneofField. Also, setOneofField
    // calls this function.
    if (!isFrozen) {
      Message.setField(msg, oneofField, oneofValue);
    }
    return oneofField;
  }

  return 0;
};


/**
 * Gets and wraps a proto field on access.
 * @param {!Message} msg A jspb proto.
 * @param {function(new:Message, Array)} ctor Constructor for the field.
 * @param {number} fieldNumber The field number.
 * @param {number=} opt_required True (1) if this is a required field.
 * @return {Message} The field as a jspb proto.
 * @protected
 */
Message.getWrapperField = function(msg, ctor, fieldNumber, opt_required) {
  // TODO(mwr): Consider copying data and/or arrays.
  if (!msg.wrappers_) {
    msg.wrappers_ = {};
  }
  if (!msg.wrappers_[fieldNumber]) {
    var data = /** @type {Array} */ (Message.getField(msg, fieldNumber));
    if (opt_required || data) {
      // TODO(mwr): Remove existence test for always valid default protos.
      msg.wrappers_[fieldNumber] = new ctor(data);
      if (Message.isFrozen(msg)) {
        Message.internalMarkFrozen(msg.wrappers_[fieldNumber]);
      }
    }
  }
  return /** @type {Message} */ (msg.wrappers_[fieldNumber]);
};


/**
 * Gets and wraps a repeated proto field on access.
 * @param {!Message} msg A jspb proto.
 * @param {function(new:Message, Array)} ctor Constructor for the field.
 * @param {number} fieldNumber The field number.
 * @return {!Array<!Message>} The repeated field as an array of protos.
 * @protected
 */
Message.getRepeatedWrapperField = function(msg, ctor, fieldNumber) {
  Message.wrapRepeatedField_(msg, ctor, fieldNumber);
  var val = msg.wrappers_[fieldNumber];
  if (val == Message.EMPTY_LIST_SENTINEL_) {
    // TODO(shaod): no need to check this case; should delete it.
    val = msg.wrappers_[fieldNumber] = [];
  }
  return /** @type {!Array<!Message>} */ (val);
};


/**
 * Wraps underlying array into proto message representation if it wasn't done
 * before.
 * @param {!Message} msg A jspb proto.
 * @param {?function(new:Message, ?Array)} ctor Constructor for the field.
 * @param {number} fieldNumber The field number.
 * @private
 */
Message.wrapRepeatedField_ = function(msg, ctor, fieldNumber) {
  if (!msg.wrappers_) {
    msg.wrappers_ = {};
  }
  if (!msg.wrappers_[fieldNumber]) {
    let data = Message.getRepeatedField(msg, fieldNumber);
    for (var wrappers = [], i = 0; i < data.length; i++) {
      wrappers[i] = new ctor(data[i]);
      if (Message.isFrozen(msg)) {
        Message.internalMarkFrozen(wrappers[i]);
      }
    }
    if (Message.isFrozen(msg)) {
      Message.internalMarkFrozen(wrappers);
    }
    msg.wrappers_[fieldNumber] = wrappers;
  }
};


/**
 * Sets a proto field and syncs it to the backing array.
 * @param {T} msg A jspb proto.
 * @param {number} fieldNumber The field number.
 * @param {?Message|?JspbMap|undefined} value A new value for this proto
 * field.
 * @return {T} the msg
 * @template T
 * @protected
 */
Message.setWrapperField = function(msg, fieldNumber, value) {
  // TODO(b/35241823): replace this with a bounded generic when available
  asserts.assertInstanceof(msg, Message);
  Message.checkNotFrozen_(msg);
  if (!msg.wrappers_) {
    msg.wrappers_ = {};
  }
  let data =
      value ? Message.toArrayHelper_(value, /* internalCall= */ true) : value;
  msg.wrappers_[fieldNumber] = value;
  return Message.setField(msg, fieldNumber, data);
};


/**
 * Sets a proto field in a oneof union and syncs it to the backing array.
 * @param {T} msg A jspb proto.
 * @param {number} fieldNumber The field number.
 * @param {!Array<number>} oneof The fields belonging to the union.
 * @param {Message|undefined} value A new value for this proto field.
 * @return {T} the msg
 * @template T
 * @protected
 */
Message.setOneofWrapperField = function(msg, fieldNumber, oneof, value) {
  // TODO(b/35241823): replace this with a bounded generic when available
  asserts.assertInstanceof(msg, Message);
  Message.checkNotFrozen_(msg);
  if (!msg.wrappers_) {
    msg.wrappers_ = {};
  }
  let data =
      value ? Message.toArrayHelper_(value, /* internalCall= */ true) : value;
  msg.wrappers_[fieldNumber] = value;
  return Message.setOneofField(msg, fieldNumber, oneof, data);
};

/**
 * Sets a repeated proto field and syncs it to the backing array.
 * @param {T} msg A jspb proto.
 * @param {number} fieldNumber The field number.
 * @param {Array<!Message>|undefined} value An array of protos.
 * @return {T} the msg
 * @template T
 * @protected
 */
Message.setRepeatedWrapperField = function(msg, fieldNumber, value) {
  // TODO(b/35241823): replace this with a bounded generic when available
  asserts.assertInstanceof(msg, Message);
  Message.checkNotFrozen_(msg);
  if (!msg.wrappers_) {
    msg.wrappers_ = {};
  }
  value = value || [];
  for (var data = [], i = 0; i < value.length; i++) {
    data[i] = Message.toArrayHelper_(value[i], /* internalCall= */ true);
  }
  msg.wrappers_[fieldNumber] = value;
  return Message.setField(msg, fieldNumber, data);
};

/**
 * Add a message to a repeated proto field.
 * @param {!Message} msg A jspb proto.
 * @param {number} fieldNumber The field number.
 * @param {T_CHILD|undefined} value Proto that will be added to the
 *     repeated field.
 * @param {function(new:T_CHILD, ?Array=)} ctor The constructor of the
 *     message type.
 * @param {number|undefined} index Index at which to insert the value.
 * @return {T_CHILD_NOT_UNDEFINED} proto that was inserted to the repeated field
 * @template MessageType
 * Use go/closure-ttl to declare a non-undefined version of T_CHILD. Replace the
 * undefined in blah|undefined with none. This is necessary because the compiler
 * will infer T_CHILD to be |undefined.
 * @template T_CHILD
 * @template T_CHILD_NOT_UNDEFINED :=
 *     cond(isUnknown(T_CHILD), unknown(),
 *       mapunion(T_CHILD, (X) =>
 *         cond(eq(X, 'undefined'), none(), X)))
 * =:
 * @protected
 */
Message.addToRepeatedWrapperField = function(
    msg, fieldNumber, value, ctor, index) {
  Message.checkNotFrozen_(msg);
  let wrapperArray = Message.getRepeatedWrapperField(msg, ctor, fieldNumber);
  var insertedValue = value ? value : new ctor();
  var array = Message.getRepeatedField(msg, fieldNumber);
  if (index != undefined) {
    wrapperArray.splice(index, 0, insertedValue);
    array.splice(index, 0, Message.toArrayHelper_(
        insertedValue, /* internalCall= */ true));
  } else {
    wrapperArray.push(insertedValue);
    array.push(Message.toArrayHelper_(insertedValue, /* internalCall= */ true));
  }
  return insertedValue;
};


/**
 * Converts a JsPb repeated message field into a map. The map will contain
 * protos unless an optional toObject function is given, in which case it will
 * contain objects suitable for Soy rendering.
 * @param {!Array<T>} field The repeated message field to be
 *     converted.
 * @param {function() : string?} mapKeyGetterFn The function to get the key of
 *     the map.
 * @param {?function(boolean=): Object|
 *     function((boolean|undefined),T): Object} opt_toObjectFn The
 *     toObject function for this field. We need to pass this for effective
 *     dead code removal.
 * @param {boolean=} opt_includeInstance Whether to include the JSPB instance
 *     for transitional soy proto support: http://goto/soy-param-migration
 * @return {!Object<string, Object>} A map of proto or Soy objects.
 * @template T
 */
Message.toMap = function(
    field, mapKeyGetterFn, opt_toObjectFn, opt_includeInstance) {
  var result = {};
  for (var i = 0; i < field.length; i++) {
    result[mapKeyGetterFn.call(field[i])] = opt_toObjectFn ?
        opt_toObjectFn.call(
            field[i], opt_includeInstance,
            /** @type {!Message} */ (field[i])) :
        field[i];
  }
  return result;
};


/**
 * Syncs all map fields' contents back to their underlying arrays.
 * @param {boolean} internalCall if true, will use toArrayInternal which does
 * not check the message's frozen status.
 * @private
 */
Message.prototype.syncMapFields_ = function(internalCall) {
  // This iterates over submessage, map, and repeated fields, which is intended.
  // Submessages can contain maps which also need to be synced.
  //
  // There is a lot of opportunity for optimization here.  For example we could
  // statically determine that some messages have no submessages with maps and
  // optimize this method away for those just by generating one extra static
  // boolean per message type.
  if (this.wrappers_) {
    for (var fieldNumber in this.wrappers_) {
      if (!hasOwnProperty(this.wrappers_, fieldNumber)) {
        continue;
      }
      var val = this.wrappers_[fieldNumber];
      if (Array.isArray(val)) {
        for (var i = 0; i < val.length; i++) {
          if (val[i]) {
            Message.toArrayHelper_(val[i], internalCall);
          }
        }
      } else {
        // Works for submessages and maps.
        if (val) {
          Message.toArrayHelper_(val, internalCall);
        }
      }
    }
  }
};

/**
 * Helps to call toArrayInternal() or toArray() on a Message.
 * @param {!Message|!JspbMap} msg
 * @param {boolean} internalCall whether to call the internal toArrayInternal.
 * @return {!Array} The msg represented as an array.
 * @private
 */
Message.toArrayHelper_ = function(msg, internalCall) {
  return FreezerInfo.isFreezerLoaded && internalCall
      ? msg.toArrayInternal() : msg.toArray();
};

/**
 * Returns the internal array of this proto. Throws an error if the message
 * is frozen or contains any frozen submessages.
 * <p>Note: If you use this array to construct a second proto, the content
 * would then be partially shared between the two protos.
 * @return {!Array} The proto represented as an array.
 */
Message.prototype.toArray = function() {
  Message.checkNotFrozen_(this);
  this.syncMapFields_(/* internalCall= */ false);
  return this.array;
};

/**
 * The same as toArray, but only for internal use and does not check frozen
 * status.
 * @return {!Array} The proto represented as an array.
 * @package
 */
Message.prototype.toArrayInternal = function() {
  this.syncMapFields_(/* internalCall= */ true);
  return this.array;
};



// BEGIN GOOGLE-INTERNAL

// We are not releasing the JSPB wire format in open-source until it is
// better standardized.


/**
 * Serializes a JsPb proto for use in server requests.
 * @this {!Message}
 * @return {string} The serialized proto.
 */
Message.prototype.serialize = Message.SUPPORTS_UINT8ARRAY_ ?
    /**
     * @return {string} The serialized proto.
     */
    function() {
      // Monkey-patch Uint8Array to generate JSON in base64 encoding. We do this
      // rather than use stringify's |replacer| to dodge a >50% performance hit.
      // See http://b/26173701#comment4 for more background.
      var old_toJSON = Uint8Array.prototype.toJSON;
      /** @override */
      Uint8Array.prototype.toJSON = function() {
        return base64.encodeByteArray(this);
      };
      try {
        return JSON.stringify(
            this.array
            && Message.prepareForSerialize_(
                Message.toArrayHelper_(this, /* internalCall= */ true), this),
            Message.serializeSpecialNumbers_);
      } finally {
        /** @override */
        Uint8Array.prototype.toJSON = old_toJSON;
      }
    } :
    function() {
      return JSON.stringify(
          this.array
          && Message.prepareForSerialize_(
              Message.toArrayHelper_(this, /* internalCall= */ true), this),
          Message.serializeSpecialNumbers_);
    };


/**
 * Removes empty fields from arrays.
 * @param {!Array} array
 * @param {!Message|!Array<!Message>|undefined} msg This is
 *     Message when serializing messages, Array when serializing nested
 *     repeated fields and undefined if the type is unknown.
 * @return {!Array}
 * @private
 */
Message.prepareForSerialize_ = function(array, msg) {
  if (Message.SERIALIZE_EMPTY_TRAILING_FIELDS) {
    return array;
  }
  // To minimize memory allocations, we copy the array only if it's different
  // from the original.
  var result;
  var length = array.length;
  var needsCopy = false;
  var extension;
  for (var i = array.length; i--;) {
    var value = array[i];
    if (Array.isArray(value)) {
      // wrappers contain an array of Message for a repeated field or
      // Message for a single field.
      var nestedMsg;
      if (Array.isArray(msg)) {
        nestedMsg = msg[i];
      } else if (msg && msg.wrappers_) {
        nestedMsg = msg.wrappers_[Message.getFieldNumber(msg, i)];
      } else {
        nestedMsg = undefined;
      }
      value = Message.prepareForSerialize_(value, nestedMsg);
      if (!value.length && msg) {
        if (Array.isArray(msg)) {
          // We are inside a repeated field of nested messages. It means that
          // value is a message and not a repeated field. We must keep it.
        } else if (msg.repeatedFields) {
          let fieldNumber = Message.getFieldNumber(msg, i);
          if (msg.repeatedFields.indexOf(fieldNumber) != -1) {
            // This is a repeated field, we could remove it.
            value = null;
          }
          // Otherwise, it's a nested message, keep it.
        } else {
          // We know nothing about the field, rather keep it.
        }
      }
      if (value != array[i]) {
        needsCopy = true;
      }
    } else if (Message.isExtensionObject(value)) {
      extension = Message.prepareExtensionForSerialize_(
          value, msg && asserts.assertInstanceof(msg, Message));
      if (extension != value) {
        needsCopy = true;
      }
      length--;
      continue;
    }
    if (value == null && length == i + 1) {
      needsCopy = true;
      length--;
    } else if (needsCopy) {
      if (!result) {
        result = array.slice(0, length);
      }
      result[i] = value;
    }
  }
  if (!needsCopy) {
    return array;
  }
  if (!result) {
    result = array.slice(0, length);
  }
  if (extension) {
    result.push(extension);
  }
  return result;
};


/**
 * Removes empty fields from extension.
 * @param {!Object} extension
 * @param {!Message|undefined} msg
 * @return {?Object} Extension object with removed empty fields or null if
 *     empty.
 * @private
 */
Message.prepareExtensionForSerialize_ = function(extension, msg) {
  var result = {};
  var changed = false;
  for (var key in extension) {
    if (!hasOwnProperty(extension, key)) {
      continue;
    }
    var value = extension[key];
    if (Array.isArray(value)) {
      var prepared = Message.prepareForSerialize_(
          value, msg && msg.wrappers_ && msg.wrappers_[key]);
      if (prepared.length || !msg || !msg.repeatedFields ||
          msg.repeatedFields.indexOf(+key) == -1) {
        result[key] = prepared;
      }
      if (result[key] != value) {
        changed = true;
      }
    } else if (value != null) {
      result[key] = value;
    } else {
      changed = true;
    }
  }
  if (!changed) {
    // We return the original object if possible.
    return extension;
  }
  // Equivalent to goog.object.isEmpty.
  for (var key in result) {
    return result;
  }
  return null;
};


/**
 * Converts NaN to "NaN", Infinity to "Infinity" and -Infinity to "-Infinity".
 * These numbers are otherwise serialized as null.
 * @param {string} key
 * @param {*} value
 * @return {*} The converted proto message.
 * @private
 */
Message.serializeSpecialNumbers_ = function(key, value) {
  if (typeof value === 'number') {
    if (isNaN(value) || value === Infinity || value === -Infinity) {
      return String(value);
    }
  }
  return value;
};


/**
 * Deserialize a JsPb string.
 * @param {function(new:JSPB, ?Array=)} ctor The constructor of the
 *     message type.
 * @param {string} data Our serialized data.
 * @return {JSPB} The new message with the serialized data populating
 *     its fields.
 * @template JSPB
 */
Message.deserializeWithCtor = function(ctor, data) {
  // data should be always non-empty but especially tests are sometimes passing
  // undefined.
  var msg = new ctor(data ? /** @type {?Array} */ (JSON.parse(data)) : null);
  asserts.assertInstanceof(msg, Message);
  return msg;
};

// END GOOGLE-INTERNAL

if (Message.GENERATE_TO_STRING) {
  /**
   * Creates a string representation of the internal data array of this proto.
   * <p>NOTE: This string is *not* suitable for use in server requests.
   * @return {string} A string representation of this proto.
   * @override
   */
  Message.prototype.toString = function() {
    return Message.toArrayHelper_(this, /* internalCall= */ true).toString();
  };
}

/**
 * Gets the value of the extension field from the extended object.
 * @param {ExtensionFieldInfo<T>} fieldInfo Specifies the field to get.
 * @return {T} The value of the field.
 * @template T
 */
Message.prototype.getExtension = function(fieldInfo) {
  Message.maybeInitEmptyExtensionObject_(this);
  if (!this.wrappers_) {
    this.wrappers_ = {};
  }
  const isFrozen = Message.isFrozen(this);
  var fieldNumber = fieldInfo.fieldIndex;
  if (fieldInfo.isRepeated) {
    if (fieldInfo.isMessageType()) {
      if (!this.wrappers_[fieldNumber]) {
        this.wrappers_[fieldNumber] =
            // The data of an extension must be extracted from the
            // extensionObject of msg; otherwise, if using getField or
            // getRepeatedField, it might return null even it exists due to
            // the semantics of JSPB transport format.
            garray.map(this.extensionObject_[fieldNumber] || [], function(arr) {
              let msg = new fieldInfo.ctor(arr);
              if (isFrozen) {
                Message.internalMarkFrozen(msg);
              }
              return msg;
            });
      }
      if (isFrozen) {
        Message.internalMarkFrozen(this.wrappers_[fieldNumber]);
      }
      return this.wrappers_[fieldNumber];
    } else {
      if (isFrozen) {
        let res = this.extensionObject_[fieldNumber];
        if (!res) {
          res = [];
          Message.internalMarkFrozen(res);
        }
        return res;
      } else {
        return this.extensionObject_[fieldNumber] =
                   this.extensionObject_[fieldNumber] || [];
      }
    }
  } else {
    if (fieldInfo.isMessageType()) {
      if (!this.wrappers_[fieldNumber] && this.extensionObject_[fieldNumber]) {
        this.wrappers_[fieldNumber] = new fieldInfo.ctor(
            /** @type {Array|undefined} */ (
                this.extensionObject_[fieldNumber]));
        if (isFrozen) {
          Message.internalMarkFrozen(this.wrappers_[fieldNumber]);
        }
      }

      return this.wrappers_[fieldNumber];
    } else {
      return this.extensionObject_[fieldNumber];
    }
  }
};


/**
 * Sets the value of the extension field in the extended object.
 * @param {ExtensionFieldInfo} fieldInfo Specifies the field to set.
 * @param {Message|string|Uint8Array|number|boolean|Array?} value The value
 *     to set.
 * @return {THIS} For chaining
 * @this {THIS}
 * @template THIS
 */
Message.prototype.setExtension = function(fieldInfo, value) {
  // Cast self, since the inferred THIS is unknown inside the function body.
  // https://github.com/google/closure-compiler/issues/1411#issuecomment-232442220
  var self = /** @type {!Message} */ (this);
  Message.checkNotFrozen_(self);
  if (!self.wrappers_) {
    self.wrappers_ = {};
  }
  Message.maybeInitEmptyExtensionObject_(self);
  var fieldNumber = fieldInfo.fieldIndex;
  if (fieldInfo.isRepeated) {
    value = value || [];
    if (fieldInfo.isMessageType()) {
      self.wrappers_[fieldNumber] = value;
      self.extensionObject_[fieldNumber] = garray.map(
          /** @type {!Array<!Message>} */ (value), function(msg) {
            return Message.toArrayHelper_(msg, /* internalCall= */ true);
          });
    } else {
      self.extensionObject_[fieldNumber] = value;
    }
  } else {
    if (fieldInfo.isMessageType()) {
      self.wrappers_[fieldNumber] = value;
      self.extensionObject_[fieldNumber] =
          value
          ? Message.toArrayHelper_(
              /** @type {!Message} */ (value), /* internalCall= */ true)
          : value;
    } else {
      self.extensionObject_[fieldNumber] = value;
    }
  }
  return self;
};


/**
 * Creates a difference object between two messages.
 *
 * The result will contain the top-level fields of m2 that differ from those of
 * m1 at any level of nesting. No data is cloned, the result object will
 * share its top-level elements with m2 (but not with m1).
 *
 * Note that repeated fields should not have null/undefined elements, but if
 * they do, this operation will treat repeated fields of different length as
 * the same if the only difference between them is due to trailing
 * null/undefined values.
 *
 * @param {!Message} m1 The first message object.
 * @param {!Message} m2 The second message object.
 * @return {!Message} The difference returned as a proto message.
 *     Note that the returned message may be missing required fields. This is
 *     currently tolerated in Js, but would cause an error if you tried to
 *     send such a proto to the server. You can access the raw difference
 *     array with result.toArray().
 * @throws {Error} If the messages are responses with different types.
 */
Message.difference = function(m1, m2) {
  if (!(m1 instanceof m2.constructor)) {
    throw new Error('Messages have different types.');
  }
  let arr1 = Message.toArrayHelper_(m1, /* internalCall= */ true);
  let arr2 = Message.toArrayHelper_(m2, /* internalCall= */ true);
  var res = [];
  var start = 0;
  var length = arr1.length > arr2.length ? arr1.length : arr2.length;
  if (m1.getJsPbMessageId()) {
    res[0] = m1.getJsPbMessageId();
    start = 1;
  }
  for (var i = start; i < length; i++) {
    if (!Message.compareFields(arr1[i], arr2[i])) {
      res[i] = arr2[i];
    }
  }
  return new m1.constructor(res);
};


/**
 * Tests whether two messages are equal.
 * @param {Message|undefined} m1 The first message object.
 * @param {Message|undefined} m2 The second message object.
 * @return {boolean} true if both messages are null/undefined, or if both are
 *     of the same type and have the same field values.
 */
Message.equals = function(m1, m2) {
  return m1 == m2 ||
      (!!(m1 && m2) && (m1 instanceof m2.constructor) &&
       Message.compareFields(
           Message.toArrayHelper_(m1, /* internalCall= */ true),
           Message.toArrayHelper_(m2, /* internalCall= */ true)));
};


/**
 * Compares two message extension fields recursively.
 * @param {!Object} extension1 The first field.
 * @param {!Object} extension2 The second field.
 * @return {boolean} true if the extensions are null/undefined, or otherwise
 *     equal.
 */
Message.compareExtensions = function(extension1, extension2) {
  extension1 = extension1 || {};
  extension2 = extension2 || {};

  var keys = {};
  for (var name in extension1) {
    if (!hasOwnProperty(extension1, name)) {
      continue;
    }
    keys[name] = 0;
  }
  for (var name in extension2) {
    if (!hasOwnProperty(extension2, name)) {
      continue;
    }
    keys[name] = 0;
  }
  for (name in keys) {
    if (!hasOwnProperty(keys, name)) {
      continue;
    }
    if (!Message.compareFields(extension1[name], extension2[name])) {
      return false;
    }
  }
  return true;
};


/**
 * Compares two message fields recursively.
 * @param {*} field1 The first field.
 * @param {*} field2 The second field.
 * @return {boolean} true if the fields are null/undefined, or otherwise equal.
 */
Message.compareFields = function(field1, field2) {
  // If the fields are trivially equal, they're equal.
  if (field1 == field2) return true;

  if (!goog.isObject(field1) || !goog.isObject(field2)) {
    // NaN != NaN so we cover this case.
    if ((typeof field1 === 'number' && isNaN(field1)) ||
        (typeof field2 === 'number' && isNaN(field2))) {
      // One of the fields might be a string 'NaN'.
      return String(field1) == String(field2);
    }
    // If the fields aren't trivially equal and one of them isn't an object,
    // they can't possibly be equal.
    return false;
  }

  // We have two objects. If they're different types, they're not equal.
  field1 = /** @type {!Object} */ (field1);
  field2 = /** @type {!Object} */ (field2);
  if (field1.constructor != field2.constructor) return false;

  // If both are Uint8Arrays, compare them element-by-element.
  if (Message.SUPPORTS_UINT8ARRAY_ && field1.constructor === Uint8Array) {
    var bytes1 = /** @type {!Uint8Array} */ (field1);
    var bytes2 = /** @type {!Uint8Array} */ (field2);
    if (bytes1.length != bytes2.length) return false;
    for (var i = 0; i < bytes1.length; i++) {
      if (bytes1[i] != bytes2[i]) return false;
    }
    return true;
  }

  // If they're both Arrays, compare them element by element except for the
  // optional extension objects at the end, which we compare separately.
  if (field1.constructor === Array) {
    var typedField1 = /** @type {!Array<?>} */ (field1);
    var typedField2 = /** @type {!Array<?>} */ (field2);
    var extension1 = undefined;
    var extension2 = undefined;

    var length = Math.max(typedField1.length, typedField2.length);
    for (var i = 0; i < length; i++) {
      var val1 = typedField1[i];
      var val2 = typedField2[i];

      if (val1 && (val1.constructor == Object)) {
        asserts.assert(extension1 === undefined);
        asserts.assert(i === typedField1.length - 1);
        extension1 = val1;
        val1 = undefined;
      }

      if (val2 && (val2.constructor == Object)) {
        asserts.assert(extension2 === undefined);
        asserts.assert(i === typedField2.length - 1);
        extension2 = val2;
        val2 = undefined;
      }

      if (!Message.compareFields(val1, val2)) {
        return false;
      }
    }

    if (extension1 || extension2) {
      extension1 = extension1 || {};
      extension2 = extension2 || {};
      return Message.compareExtensions(extension1, extension2);
    }

    return true;
  }

  // If they're both plain Objects (i.e. extensions), compare them as
  // extensions.
  if (field1.constructor === Object) {
    return Message.compareExtensions(field1, field2);
  }

  throw new Error('Invalid type in JSPB array');
};


/**
 * Templated, type-safe cloneMessage definition.
 * @return {THIS}
 * @this {THIS}
 * @template THIS
 */
Message.prototype.cloneMessage = function() {
  return Message.cloneMessage(/** @type {!Message} */ (this));
};

/**
 * Alias clone to cloneMessage. goog.object.unsafeClone uses clone to
 * efficiently copy objects. Without this alias, copying jspb messages comes
 * with a large performance penalty.
 * @return {THIS}
 * @this {THIS}
 * @template THIS
 */
Message.prototype.clone = function() {
  return Message.cloneMessage(/** @type {!Message} */ (this));
};

/**
 * Static clone function. NOTE: A type-safe method called "cloneMessage"
 * exists
 * on each generated JsPb class. Do not call this function directly.
 * @param {!Message} msg A message to clone.
 * @return {!Message} A deep clone of the given message.
 */
Message.clone = function(msg) {
  // Although we could include the wrappers, we leave them out here.
  return Message.cloneMessage(msg);
};

// TODO(shaod): add tests to catch the b/178741724 when/after cl/353040167 is
// submitted.
/**
 * @param {!Message} msg A message to clone.
 * @return {!Message} A deep clone of the given message.
 * @protected
 */
Message.cloneMessage = function(msg) {
  const clonedData =
        /** @type {!Array} */
      (Message.clone_(Message.toArrayHelper_(msg, /* internalCall= */ true)));

  // Intercepts the call to Message.initialize by injecting the cloned data
  // array directly.
  // TODO(b/178741724): This is only a workaround; delete this once the
  // parameter of msg.constructor is no longer optimized out by the JS Compiler.
  const oldInitialize = Message.initialize;
  Message.initialize =
      function(message, ignoredData, messageId, pivot, repeated, oneof) {
    oldInitialize(message, clonedData, messageId, pivot, repeated, oneof);

    // There are cases where other JSPB generated message constructors are
    // called within a JSPB message subclass constructor, so we need to set
    // Message.initialize back immediately to not intercept those calls.
    Message.initialize = oldInitialize;
  };

  // clonedData is needed for classes extending JSPB messages that have
  // initializations in addition to Message.initialize.
  const newInstance = new msg.constructor(clonedData);

  // Sometimes the msg.constructor is the base message's constructor (or direct
  // subclass of Message with super() called) that does not call
  // Message.initialize at all. We ensure to also set it back in this case.
  if (Message.initialize !== oldInitialize) {
    Message.initialize = oldInitialize;
  }
  return newInstance;
};


/**
 * Takes 2 messages of the same type and copies the contents of the first
 * message into the second. After this the 2 messages will equals in terms of
 * value semantics but share no state. All data in the destination message will
 * be overridden.
 *
 * @param {MESSAGE} fromMessage Message that will be copied into toMessage.
 * @param {MESSAGE} toMessage Message which will receive a copy of fromMessage
 *     as its contents.
 * @template MESSAGE
 */
Message.copyInto = function(fromMessage, toMessage) {
  asserts.assertInstanceof(fromMessage, Message);
  asserts.assertInstanceof(toMessage, Message);
  asserts.assert(
      fromMessage.constructor == toMessage.constructor,
      'Copy source and target message should have the same type.');
  var copyOfFrom = Message.clone(fromMessage);

  let to = Message.toArrayHelper_(toMessage, /* internalCall= */ true);
  let from = Message.toArrayHelper_(copyOfFrom, /* internalCall= */ true);

  // Empty destination in case it has more values at the end of the array.
  to.length = 0;
  // and then copy everything from the new to the existing message.
  for (var i = 0; i < from.length; i++) {
    to[i] = from[i];
  }

  // This is either null or empty for a fresh copy.
  toMessage.wrappers_ = copyOfFrom.wrappers_;
  // Just a reference into the shared array.
  toMessage.extensionObject_ = copyOfFrom.extensionObject_;
};


/**
 * Helper for cloning an internal JsPb object.
 * @param {!Object} obj A JsPb object, eg, a field, to be cloned.
 * @return {!Object} A clone of the input object.
 * @suppress {underscore}
 * @package
 */
Message.clone_ = function(obj) {
  var o;
  if (Array.isArray(obj)) {
    // Allocate array of correct size.
    var clonedArray = new Array(obj.length);
    // Use array iteration where possible because it is faster than for-in.
    for (var i = 0; i < obj.length; i++) {
      o = obj[i];
      if (o != null) {
        // NOTE:redundant null check existing for NTI compatibility.
        // see b/70515949
        clonedArray[i] =
            (typeof o == 'object') ? Message.clone_(asserts.assert(o)) : o;
      }
    }
    return clonedArray;
  }
  if (Message.SUPPORTS_UINT8ARRAY_ && obj instanceof Uint8Array) {
    return new Uint8Array(obj);
  }
  var clone = {};
  for (var key in obj) {
    if (!hasOwnProperty(obj, key)) {
      continue;
    }
    o = obj[key];
    if (o != null) {
      // NOTE:redundant null check existing for NTI compatibility.
      // see b/70515949
      clone[key] =
          (typeof o == 'object') ? Message.clone_(asserts.assert(o)) : o;
    }
  }
  return clone;
};


/**
 * The extensions registered on MessageSet. This is a map of extension
 * field number to field info object. This should be considered as a
 * private API.
 *
 * This is similar to [jspb class name].extensions object for
 * non-MessageSet. We special case MessageSet so that we do not need
 * to goog.require MessageSet from classes that extends MessageSet.
 *
 * @type {!Object<number, ExtensionFieldInfo>}
 */
Message.messageSetExtensions = {};

/**
 * @type {!Object<number, ExtensionFieldBinaryInfo>}
 */
Message.messageSetExtensionsBinary = {};

/**
 * Returns true if the provided message has been frozen.
 * @param {!Message} msg Message to check.
 * @return {boolean}
 * @package
 */
Message.isFrozen = function(msg) {
  if (FreezerInfo.isFreezerLoaded) {
    let extensionObject =
      !msg.extensionObject_ || Object.isFrozen(msg.extensionObject_);
    return Object.isFrozen(msg.array) && extensionObject;
  }
  return false;
};

/**
 * Freeze a message or an array.
 * @param {!Message|!Array} value
 * @package
 */
Message.internalMarkFrozen = function(value) {
  asserts.assert(FreezerInfo.isFreezerLoaded);
  if (Array.isArray(value)) {
    Object.freeze(value);
  } else {
    Object.freeze(value.array);
    if (value.extensionObject_) {
      Object.freeze(value.extensionObject_);
    }
  }
};

/**
 * Throws an error if the msg is frozen.
 * @param {!Message} msg The message to check against.
 * @private
 */
Message.checkNotFrozen_ = function(msg) {
  if (FreezerInfo.isFreezerLoaded && Message.isFrozen(msg)) {
    throw new Error("Cannot mutate a frozen Message");
  }
};

/**
 * Helper method to ensure that properties iterated with for-in loop come from
 * the object. If JS runs on a pages with other 3rd party code it's possible
 * that that code (e.g. prototype.js) patches native Object.prototype. Without
 * hasOwnProperty JSPB code might get broken by that. Most google code runs on
 * owned pages and it's very unlikely to get patched native prototype. So by
 * default this check always returns true. The check is only enabled when
 * goog.TRUSTED_SITE is set to false.
 *
 * @param {!Object} obj
 * @param {string} property
 * @return {boolean}
 */
function hasOwnProperty(obj, property) {
  return goog.TRUSTED_SITE ||
      Object.prototype.hasOwnProperty.call(obj, property);
}

exports = Message;

;return exports;});

//location/unified/proto/location_descriptor_proto_jspb/activityrecord.jspb.js
// source: location/unified/proto/location_descriptor.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.location.unified.ActivityRecord');
goog.provide('proto.location.unified.ActivityRecord.Type');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.location.unified.ActivityRecord = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.location.unified.ActivityRecord, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.location.unified.ActivityRecord.displayName = 'proto.location.unified.ActivityRecord';
}



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.location.unified.ActivityRecord.prototype.toObject = function(opt_includeInstance) {
  return proto.location.unified.ActivityRecord.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.location.unified.ActivityRecord} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.location.unified.ActivityRecord.toObject = function(includeInstance, msg) {
  let f, obj = {
    type: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    confidence: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of ActivityRecord as accepted by the `fromObject` method.
 * @record
 */
proto.location.unified.ActivityRecord.ObjectFormat = function() {
  /** @type {?number|undefined} */
  this.type;

  /** @type {?number|undefined} */
  this.confidence;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.location.unified.ActivityRecord.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.location.unified.ActivityRecord}
 */
proto.location.unified.ActivityRecord.fromObject = function(obj) {
  const msg = new proto.location.unified.ActivityRecord();
  obj.type != null && jspb.Message.setField(msg, 1, obj.type);
  obj.confidence != null && jspb.Message.setField(msg, 2, obj.confidence);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.location.unified.ActivityRecord}
 */
proto.location.unified.ActivityRecord.deserializeBinary = function(bytes) {
  return proto.location.unified.ActivityRecord.deserializeBinaryFromReader(
      new proto.location.unified.ActivityRecord(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.location.unified.ActivityRecord} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.location.unified.ActivityRecord}
 */
proto.location.unified.ActivityRecord.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {!proto.location.unified.ActivityRecord.Type} */ (reader.readEnum());
      msg.setType(value);
      break;
    case 2:
      value = /** @type {number} */ (reader.readInt32());
      msg.setConfidence(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.location.unified.ActivityRecord.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.location.unified.ActivityRecord.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.location.unified.ActivityRecord} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.location.unified.ActivityRecord.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {!proto.location.unified.ActivityRecord.Type} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeEnum(
      1,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeInt32(
      2,
      f
    );
  }
};


/**
 * @enum {number}
 */
proto.location.unified.ActivityRecord.Type = {
  IN_VEHICLE: 0,
  ON_BICYCLE: 1,
  ON_FOOT: 2,
  STILL: 3,
  UNKNOWN: 4,
  TILTING: 5,
  EXITING_VEHICLE: 6,
  WALKING: 7,
  RUNNING: 8,
  OFF_BODY: 9,
  TRUSTED_GAIT: 10,
  FLOOR_CHANGE: 11,
  ON_STAIRS: 12,
  ON_ESCALATOR: 13,
  IN_ELEVATOR: 14,
  SLEEPING: 15,
  IN_ROAD_VEHICLE: 16,
  IN_RAIL_VEHICLE: 17,
  IN_TWO_WHEELER_VEHICLE: 18,
  IN_FOUR_WHEELER_VEHICLE: 19,
  IN_CAR: 20,
  IN_BUS: 21,
  EXPERIMENTAL_EXTRA_PERSONAL_VEHICLE: -1000
};

/**
 * optional Type type = 1;
 * @return {!proto.location.unified.ActivityRecord.Type}
 */
proto.location.unified.ActivityRecord.prototype.getType = function() {
  return /** @type {!proto.location.unified.ActivityRecord.Type} */ (jspb.Message.getField(this, 1));
};


/**
 * @param {?proto.location.unified.ActivityRecord.Type|undefined} value
 * @return {!proto.location.unified.ActivityRecord} returns this
 */
proto.location.unified.ActivityRecord.prototype.setType = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.ActivityRecord} returns this
 */
proto.location.unified.ActivityRecord.prototype.clearType = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.ActivityRecord.prototype.hasType = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional int32 confidence = 2;
 * @return {?number}
 */
proto.location.unified.ActivityRecord.prototype.getConfidence = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 2));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.location.unified.ActivityRecord} returns this
 */
proto.location.unified.ActivityRecord.prototype.setConfidence = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.ActivityRecord} returns this
 */
proto.location.unified.ActivityRecord.prototype.clearConfidence = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.ActivityRecord.prototype.hasConfidence = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.location.unified.ActivityRecord}
 */
proto.location.unified.ActivityRecord.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.location.unified.ActivityRecord, data);
};



//location/unified/proto/location_descriptor_proto_jspb/featureidproto.jspb.js
// source: location/unified/proto/location_descriptor.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.location.unified.FeatureIdProto');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.location.unified.FeatureIdProto = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.location.unified.FeatureIdProto, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.location.unified.FeatureIdProto.displayName = 'proto.location.unified.FeatureIdProto';
}



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.location.unified.FeatureIdProto.prototype.toObject = function(opt_includeInstance) {
  return proto.location.unified.FeatureIdProto.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.location.unified.FeatureIdProto} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.location.unified.FeatureIdProto.toObject = function(includeInstance, msg) {
  let f, obj = {
    cellId: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    fprint: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of FeatureIdProto as accepted by the `fromObject` method.
 * @record
 */
proto.location.unified.FeatureIdProto.ObjectFormat = function() {
  /** @type {?string|undefined} */
  this.cellId;

  /** @type {?string|undefined} */
  this.fprint;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.location.unified.FeatureIdProto.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.location.unified.FeatureIdProto}
 */
proto.location.unified.FeatureIdProto.fromObject = function(obj) {
  const msg = new proto.location.unified.FeatureIdProto();
  obj.cellId != null && jspb.Message.setField(msg, 1, obj.cellId);
  obj.fprint != null && jspb.Message.setField(msg, 2, obj.fprint);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.location.unified.FeatureIdProto}
 */
proto.location.unified.FeatureIdProto.deserializeBinary = function(bytes) {
  return proto.location.unified.FeatureIdProto.deserializeBinaryFromReader(
      new proto.location.unified.FeatureIdProto(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.location.unified.FeatureIdProto} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.location.unified.FeatureIdProto}
 */
proto.location.unified.FeatureIdProto.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {string} */ (reader.readFixed64String());
      msg.setCellId(value);
      break;
    case 2:
      value = /** @type {string} */ (reader.readFixed64String());
      msg.setFprint(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.location.unified.FeatureIdProto.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.location.unified.FeatureIdProto.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.location.unified.FeatureIdProto} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.location.unified.FeatureIdProto.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {?string} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeFixed64String(
      1,
      f
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeFixed64String(
      2,
      f
    );
  }
};


/**
 * optional fixed64 cell_id = 1;
 * @return {?string}
 */
proto.location.unified.FeatureIdProto.prototype.getCellId = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 1));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.location.unified.FeatureIdProto} returns this
 */
proto.location.unified.FeatureIdProto.prototype.setCellId = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.FeatureIdProto} returns this
 */
proto.location.unified.FeatureIdProto.prototype.clearCellId = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.FeatureIdProto.prototype.hasCellId = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional fixed64 fprint = 2;
 * @return {?string}
 */
proto.location.unified.FeatureIdProto.prototype.getFprint = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 2));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.location.unified.FeatureIdProto} returns this
 */
proto.location.unified.FeatureIdProto.prototype.setFprint = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.FeatureIdProto} returns this
 */
proto.location.unified.FeatureIdProto.prototype.clearFprint = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.FeatureIdProto.prototype.hasFprint = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.location.unified.FeatureIdProto}
 */
proto.location.unified.FeatureIdProto.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.location.unified.FeatureIdProto, data);
};



//location/unified/proto/location_descriptor_proto_jspb/fieldofview.jspb.js
// source: location/unified/proto/location_descriptor.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.location.unified.FieldOfView');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.location.unified.FieldOfView = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.location.unified.FieldOfView, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.location.unified.FieldOfView.displayName = 'proto.location.unified.FieldOfView';
}



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.location.unified.FieldOfView.prototype.toObject = function(opt_includeInstance) {
  return proto.location.unified.FieldOfView.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.location.unified.FieldOfView} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.location.unified.FieldOfView.toObject = function(includeInstance, msg) {
  let f, obj = {
    fieldOfViewXDegrees: (f = jspb.Message.getOptionalFloatingPointField(msg, 1)) == null ? undefined : f,
    fieldOfViewYDegrees: (f = jspb.Message.getOptionalFloatingPointField(msg, 2)) == null ? undefined : f,
    screenWidthPixels: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of FieldOfView as accepted by the `fromObject` method.
 * @record
 */
proto.location.unified.FieldOfView.ObjectFormat = function() {
  /** @type {?number|undefined} */
  this.fieldOfViewXDegrees;

  /** @type {?number|undefined} */
  this.fieldOfViewYDegrees;

  /** @type {?number|undefined} */
  this.screenWidthPixels;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.location.unified.FieldOfView.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.location.unified.FieldOfView}
 */
proto.location.unified.FieldOfView.fromObject = function(obj) {
  const msg = new proto.location.unified.FieldOfView();
  obj.fieldOfViewXDegrees != null && jspb.Message.setField(msg, 1, obj.fieldOfViewXDegrees);
  obj.fieldOfViewYDegrees != null && jspb.Message.setField(msg, 2, obj.fieldOfViewYDegrees);
  obj.screenWidthPixels != null && jspb.Message.setField(msg, 3, obj.screenWidthPixels);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.location.unified.FieldOfView}
 */
proto.location.unified.FieldOfView.deserializeBinary = function(bytes) {
  return proto.location.unified.FieldOfView.deserializeBinaryFromReader(
      new proto.location.unified.FieldOfView(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.location.unified.FieldOfView} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.location.unified.FieldOfView}
 */
proto.location.unified.FieldOfView.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {number} */ (reader.readFloat());
      msg.setFieldOfViewXDegrees(value);
      break;
    case 2:
      value = /** @type {number} */ (reader.readFloat());
      msg.setFieldOfViewYDegrees(value);
      break;
    case 3:
      value = /** @type {number} */ (reader.readInt32());
      msg.setScreenWidthPixels(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.location.unified.FieldOfView.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.location.unified.FieldOfView.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.location.unified.FieldOfView} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.location.unified.FieldOfView.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {?number} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeFloat(
      1,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeFloat(
      2,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeInt32(
      3,
      f
    );
  }
};


/**
 * optional float field_of_view_x_degrees = 1;
 * @return {?number}
 */
proto.location.unified.FieldOfView.prototype.getFieldOfViewXDegrees = function() {
  return /** @type {?number} */ (jspb.Message.getOptionalFloatingPointField(this, 1));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.location.unified.FieldOfView} returns this
 */
proto.location.unified.FieldOfView.prototype.setFieldOfViewXDegrees = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.FieldOfView} returns this
 */
proto.location.unified.FieldOfView.prototype.clearFieldOfViewXDegrees = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.FieldOfView.prototype.hasFieldOfViewXDegrees = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional float field_of_view_y_degrees = 2;
 * @return {?number}
 */
proto.location.unified.FieldOfView.prototype.getFieldOfViewYDegrees = function() {
  return /** @type {?number} */ (jspb.Message.getOptionalFloatingPointField(this, 2));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.location.unified.FieldOfView} returns this
 */
proto.location.unified.FieldOfView.prototype.setFieldOfViewYDegrees = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.FieldOfView} returns this
 */
proto.location.unified.FieldOfView.prototype.clearFieldOfViewYDegrees = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.FieldOfView.prototype.hasFieldOfViewYDegrees = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional int32 screen_width_pixels = 3;
 * @return {?number}
 */
proto.location.unified.FieldOfView.prototype.getScreenWidthPixels = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 3));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.location.unified.FieldOfView} returns this
 */
proto.location.unified.FieldOfView.prototype.setScreenWidthPixels = function(value) {
  return jspb.Message.setField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.FieldOfView} returns this
 */
proto.location.unified.FieldOfView.prototype.clearScreenWidthPixels = function() {
  return jspb.Message.clearField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.FieldOfView.prototype.hasScreenWidthPixels = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.location.unified.FieldOfView}
 */
proto.location.unified.FieldOfView.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.location.unified.FieldOfView, data);
};



//location/unified/proto/location_descriptor_proto_jspb/latlng.jspb.js
// source: location/unified/proto/location_descriptor.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.location.unified.LatLng');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.location.unified.LatLng = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.location.unified.LatLng, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.location.unified.LatLng.displayName = 'proto.location.unified.LatLng';
}



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.location.unified.LatLng.prototype.toObject = function(opt_includeInstance) {
  return proto.location.unified.LatLng.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.location.unified.LatLng} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.location.unified.LatLng.toObject = function(includeInstance, msg) {
  let f, obj = {
    latitudeE7: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    longitudeE7: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of LatLng as accepted by the `fromObject` method.
 * @record
 */
proto.location.unified.LatLng.ObjectFormat = function() {
  /** @type {?number|undefined} */
  this.latitudeE7;

  /** @type {?number|undefined} */
  this.longitudeE7;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.location.unified.LatLng.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.location.unified.LatLng}
 */
proto.location.unified.LatLng.fromObject = function(obj) {
  const msg = new proto.location.unified.LatLng();
  obj.latitudeE7 != null && jspb.Message.setField(msg, 1, obj.latitudeE7);
  obj.longitudeE7 != null && jspb.Message.setField(msg, 2, obj.longitudeE7);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.location.unified.LatLng}
 */
proto.location.unified.LatLng.deserializeBinary = function(bytes) {
  return proto.location.unified.LatLng.deserializeBinaryFromReader(
      new proto.location.unified.LatLng(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.location.unified.LatLng} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.location.unified.LatLng}
 */
proto.location.unified.LatLng.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {number} */ (reader.readSfixed32());
      msg.setLatitudeE7(value);
      break;
    case 2:
      value = /** @type {number} */ (reader.readSfixed32());
      msg.setLongitudeE7(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.location.unified.LatLng.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.location.unified.LatLng.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.location.unified.LatLng} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.location.unified.LatLng.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {?number} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeSfixed32(
      1,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeSfixed32(
      2,
      f
    );
  }
};


/**
 * optional sfixed32 latitude_e7 = 1;
 * @return {?number}
 */
proto.location.unified.LatLng.prototype.getLatitudeE7 = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 1));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.location.unified.LatLng} returns this
 */
proto.location.unified.LatLng.prototype.setLatitudeE7 = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.LatLng} returns this
 */
proto.location.unified.LatLng.prototype.clearLatitudeE7 = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.LatLng.prototype.hasLatitudeE7 = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional sfixed32 longitude_e7 = 2;
 * @return {?number}
 */
proto.location.unified.LatLng.prototype.getLongitudeE7 = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 2));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.location.unified.LatLng} returns this
 */
proto.location.unified.LatLng.prototype.setLongitudeE7 = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.LatLng} returns this
 */
proto.location.unified.LatLng.prototype.clearLongitudeE7 = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.LatLng.prototype.hasLongitudeE7 = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.location.unified.LatLng}
 */
proto.location.unified.LatLng.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.location.unified.LatLng, data);
};



//location/unified/proto/location_descriptor_proto_jspb/latlngrect.jspb.js
// source: location/unified/proto/location_descriptor.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.location.unified.LatLngRect');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.location.unified.LatLng');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.location.unified.LatLngRect = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.location.unified.LatLngRect, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.location.unified.LatLngRect.displayName = 'proto.location.unified.LatLngRect';
}



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.location.unified.LatLngRect.prototype.toObject = function(opt_includeInstance) {
  return proto.location.unified.LatLngRect.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.location.unified.LatLngRect} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.location.unified.LatLngRect.toObject = function(includeInstance, msg) {
  let f, obj = {
    lo: (f = msg.getLo()) && proto.location.unified.LatLng.toObject(includeInstance, f),
    hi: (f = msg.getHi()) && proto.location.unified.LatLng.toObject(includeInstance, f)
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of LatLngRect as accepted by the `fromObject` method.
 * @record
 */
proto.location.unified.LatLngRect.ObjectFormat = function() {
  /** @type {?proto.location.unified.LatLng.ObjectFormat|undefined} */
  this.lo;

  /** @type {?proto.location.unified.LatLng.ObjectFormat|undefined} */
  this.hi;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.location.unified.LatLngRect.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.location.unified.LatLngRect}
 */
proto.location.unified.LatLngRect.fromObject = function(obj) {
  const msg = new proto.location.unified.LatLngRect();
  obj.lo && jspb.Message.setWrapperField(
      msg, 1, proto.location.unified.LatLng.fromObject(obj.lo));
  obj.hi && jspb.Message.setWrapperField(
      msg, 2, proto.location.unified.LatLng.fromObject(obj.hi));
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.location.unified.LatLngRect}
 */
proto.location.unified.LatLngRect.deserializeBinary = function(bytes) {
  return proto.location.unified.LatLngRect.deserializeBinaryFromReader(
      new proto.location.unified.LatLngRect(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.location.unified.LatLngRect} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.location.unified.LatLngRect}
 */
proto.location.unified.LatLngRect.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = new proto.location.unified.LatLng();
      reader.readMessage(value,proto.location.unified.LatLng.deserializeBinaryFromReader);
      msg.setLo(value);
      break;
    case 2:
      value = new proto.location.unified.LatLng();
      reader.readMessage(value,proto.location.unified.LatLng.deserializeBinaryFromReader);
      msg.setHi(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.location.unified.LatLngRect.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.location.unified.LatLngRect.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.location.unified.LatLngRect} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.location.unified.LatLngRect.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = message.getLo();
  if (f != null) {
    writer.writeMessage(
      1,
      f,
      proto.location.unified.LatLng.serializeBinaryToWriter
    );
  }
  f = message.getHi();
  if (f != null) {
    writer.writeMessage(
      2,
      f,
      proto.location.unified.LatLng.serializeBinaryToWriter
    );
  }
};


/**
 * optional LatLng lo = 1;
 * @return {?proto.location.unified.LatLng}
 */
proto.location.unified.LatLngRect.prototype.getLo = function() {
  return /** @type{?proto.location.unified.LatLng} */ (
    jspb.Message.getWrapperField(this, proto.location.unified.LatLng, 1));
};


/**
 * @param {?proto.location.unified.LatLng|undefined} value
 * @return {!proto.location.unified.LatLngRect} returns this
*/
proto.location.unified.LatLngRect.prototype.setLo = function(value) {
  return jspb.Message.setWrapperField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.LatLngRect} returns this
 */
proto.location.unified.LatLngRect.prototype.clearLo = function() {
  return jspb.Message.clearWrapperField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.LatLngRect.prototype.hasLo = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional LatLng hi = 2;
 * @return {?proto.location.unified.LatLng}
 */
proto.location.unified.LatLngRect.prototype.getHi = function() {
  return /** @type{?proto.location.unified.LatLng} */ (
    jspb.Message.getWrapperField(this, proto.location.unified.LatLng, 2));
};


/**
 * @param {?proto.location.unified.LatLng|undefined} value
 * @return {!proto.location.unified.LatLngRect} returns this
*/
proto.location.unified.LatLngRect.prototype.setHi = function(value) {
  return jspb.Message.setWrapperField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.LatLngRect} returns this
 */
proto.location.unified.LatLngRect.prototype.clearHi = function() {
  return jspb.Message.clearWrapperField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.LatLngRect.prototype.hasHi = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.location.unified.LatLngRect}
 */
proto.location.unified.LatLngRect.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.location.unified.LatLngRect, data);
};



//location/unified/proto/location_descriptor_proto_jspb/personalizedlocationattributes.jspb.js
// source: location/unified/proto/location_descriptor.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.location.unified.PersonalizedLocationAttributes');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.location.unified.PersonalizedLocationAttributes = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.location.unified.PersonalizedLocationAttributes, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.location.unified.PersonalizedLocationAttributes.displayName = 'proto.location.unified.PersonalizedLocationAttributes';
}



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.location.unified.PersonalizedLocationAttributes.prototype.toObject = function(opt_includeInstance) {
  return proto.location.unified.PersonalizedLocationAttributes.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.location.unified.PersonalizedLocationAttributes} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.location.unified.PersonalizedLocationAttributes.toObject = function(includeInstance, msg) {
  let f, obj = {
    ppSupportingDays: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f,
    ppSupportingWeeks: (f = jspb.Message.getField(msg, 5)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of PersonalizedLocationAttributes as accepted by the `fromObject` method.
 * @record
 */
proto.location.unified.PersonalizedLocationAttributes.ObjectFormat = function() {
  /** @type {?number|undefined} */
  this.ppSupportingDays;

  /** @type {?number|undefined} */
  this.ppSupportingWeeks;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.location.unified.PersonalizedLocationAttributes.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.location.unified.PersonalizedLocationAttributes}
 */
proto.location.unified.PersonalizedLocationAttributes.fromObject = function(obj) {
  const msg = new proto.location.unified.PersonalizedLocationAttributes();
  obj.ppSupportingDays != null && jspb.Message.setField(msg, 4, obj.ppSupportingDays);
  obj.ppSupportingWeeks != null && jspb.Message.setField(msg, 5, obj.ppSupportingWeeks);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.location.unified.PersonalizedLocationAttributes}
 */
proto.location.unified.PersonalizedLocationAttributes.deserializeBinary = function(bytes) {
  return proto.location.unified.PersonalizedLocationAttributes.deserializeBinaryFromReader(
      new proto.location.unified.PersonalizedLocationAttributes(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.location.unified.PersonalizedLocationAttributes} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.location.unified.PersonalizedLocationAttributes}
 */
proto.location.unified.PersonalizedLocationAttributes.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 4:
      value = /** @type {number} */ (reader.readInt32());
      msg.setPpSupportingDays(value);
      break;
    case 5:
      value = /** @type {number} */ (reader.readInt32());
      msg.setPpSupportingWeeks(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.location.unified.PersonalizedLocationAttributes.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.location.unified.PersonalizedLocationAttributes.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.location.unified.PersonalizedLocationAttributes} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.location.unified.PersonalizedLocationAttributes.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {?number} */ (jspb.Message.getField(message, 4));
  if (f != null) {
    writer.writeInt32(
      4,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 5));
  if (f != null) {
    writer.writeInt32(
      5,
      f
    );
  }
};


/**
 * optional int32 pp_supporting_days = 4;
 * @return {?number}
 */
proto.location.unified.PersonalizedLocationAttributes.prototype.getPpSupportingDays = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 4));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.location.unified.PersonalizedLocationAttributes} returns this
 */
proto.location.unified.PersonalizedLocationAttributes.prototype.setPpSupportingDays = function(value) {
  return jspb.Message.setField(this, 4, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.PersonalizedLocationAttributes} returns this
 */
proto.location.unified.PersonalizedLocationAttributes.prototype.clearPpSupportingDays = function() {
  return jspb.Message.clearField(this, 4);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.PersonalizedLocationAttributes.prototype.hasPpSupportingDays = function() {
  return jspb.Message.hasField(this, 4);
};


/**
 * optional int32 pp_supporting_weeks = 5;
 * @return {?number}
 */
proto.location.unified.PersonalizedLocationAttributes.prototype.getPpSupportingWeeks = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 5));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.location.unified.PersonalizedLocationAttributes} returns this
 */
proto.location.unified.PersonalizedLocationAttributes.prototype.setPpSupportingWeeks = function(value) {
  return jspb.Message.setField(this, 5, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.PersonalizedLocationAttributes} returns this
 */
proto.location.unified.PersonalizedLocationAttributes.prototype.clearPpSupportingWeeks = function() {
  return jspb.Message.clearField(this, 5);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.PersonalizedLocationAttributes.prototype.hasPpSupportingWeeks = function() {
  return jspb.Message.hasField(this, 5);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.location.unified.PersonalizedLocationAttributes}
 */
proto.location.unified.PersonalizedLocationAttributes.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.location.unified.PersonalizedLocationAttributes, data);
};



//location/unified/proto/location_descriptor_proto_jspb/locationattributesproto.jspb.js
// source: location/unified/proto/location_descriptor.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.location.unified.LocationAttributesProto');
goog.provide('proto.location.unified.LocationAttributesProto.CarrierIpType');
goog.provide('proto.location.unified.LocationAttributesProto.Inference');
goog.provide('proto.location.unified.LocationAttributesProto.ManualEntry');
goog.provide('proto.location.unified.LocationAttributesProto.PLMType');
goog.provide('proto.location.unified.LocationAttributesProto.ViewportSearchOptions');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.location.unified.ActivityRecord');
goog.require('proto.location.unified.FieldOfView');
goog.require('proto.location.unified.PersonalizedLocationAttributes');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.location.unified.LocationAttributesProto = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, proto.location.unified.LocationAttributesProto.repeatedFields_, null);
};
goog.inherits(proto.location.unified.LocationAttributesProto, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.location.unified.LocationAttributesProto.displayName = 'proto.location.unified.LocationAttributesProto';
}

/**
 * List of repeated fields within this message type.
 * @private {!Array<number>}
 * @const
 */
proto.location.unified.LocationAttributesProto.repeatedFields_ = [11];



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.location.unified.LocationAttributesProto.prototype.toObject = function(opt_includeInstance) {
  return proto.location.unified.LocationAttributesProto.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.location.unified.LocationAttributesProto} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.location.unified.LocationAttributesProto.toObject = function(includeInstance, msg) {
  let f, obj = {
    headingDegrees: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f,
    bearingDegrees: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f,
    bearingAccuracyDegrees: (f = jspb.Message.getField(msg, 12)) == null ? undefined : f,
    speedKph: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f,
    speedAccuracyKph: (f = jspb.Message.getField(msg, 13)) == null ? undefined : f,
    tiltDegrees: (f = jspb.Message.getField(msg, 5)) == null ? undefined : f,
    rollDegrees: (f = jspb.Message.getField(msg, 6)) == null ? undefined : f,
    altitudeMetersFromGround: (f = jspb.Message.getOptionalFloatingPointField(msg, 7)) == null ? undefined : f,
    fieldOfView: (f = msg.getFieldOfView()) && proto.location.unified.FieldOfView.toObject(includeInstance, f),
    boardedTransitVehicleToken: (f = jspb.Message.getField(msg, 9)) == null ? undefined : f,
    activityRecordList: jspb.Message.toObjectList(msg.getActivityRecordList(),
    proto.location.unified.ActivityRecord.toObject, includeInstance),
    plmType: (f = jspb.Message.getField(msg, 14)) == null ? undefined : f,
    inference: (f = jspb.Message.getField(msg, 15)) == null ? undefined : f,
    manualEntry: (f = jspb.Message.getField(msg, 16)) == null ? undefined : f,
    weekSecondConfidence: (f = jspb.Message.getOptionalFloatingPointField(msg, 17)) == null ? undefined : f,
    ipRangeConfidence: (f = jspb.Message.getOptionalFloatingPointField(msg, 18)) == null ? undefined : f,
    carrierIpType: (f = jspb.Message.getField(msg, 19)) == null ? undefined : f,
    adsConfidence: (f = jspb.Message.getOptionalFloatingPointField(msg, 20)) == null ? undefined : f,
    viewportSearchOptions: (f = jspb.Message.getField(msg, 21)) == null ? undefined : f,
    deviceLocationRatio: (f = jspb.Message.getOptionalFloatingPointField(msg, 10)) == null ? undefined : f,
    plmSourceLocationCount: (f = jspb.Message.getField(msg, 22)) == null ? undefined : f,
    personalizedLocationAttributes: (f = msg.getPersonalizedLocationAttributes()) && proto.location.unified.PersonalizedLocationAttributes.toObject(includeInstance, f)
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of LocationAttributesProto as accepted by the `fromObject` method.
 * @record
 */
proto.location.unified.LocationAttributesProto.ObjectFormat = function() {
  /** @type {?number|undefined} */
  this.headingDegrees;

  /** @type {?number|undefined} */
  this.bearingDegrees;

  /** @type {?number|undefined} */
  this.bearingAccuracyDegrees;

  /** @type {?number|undefined} */
  this.speedKph;

  /** @type {?number|undefined} */
  this.speedAccuracyKph;

  /** @type {?number|undefined} */
  this.tiltDegrees;

  /** @type {?number|undefined} */
  this.rollDegrees;

  /** @type {?number|undefined} */
  this.altitudeMetersFromGround;

  /** @type {?proto.location.unified.FieldOfView.ObjectFormat|undefined} */
  this.fieldOfView;

  /** @type {?string|undefined} */
  this.boardedTransitVehicleToken;

  /** @type {?Array<!proto.location.unified.ActivityRecord.ObjectFormat>|undefined} */
  this.activityRecordList;

  /** @type {?number|undefined} */
  this.plmType;

  /** @type {?number|undefined} */
  this.inference;

  /** @type {?number|undefined} */
  this.manualEntry;

  /** @type {?number|undefined} */
  this.weekSecondConfidence;

  /** @type {?number|undefined} */
  this.ipRangeConfidence;

  /** @type {?number|undefined} */
  this.carrierIpType;

  /** @type {?number|undefined} */
  this.adsConfidence;

  /** @type {?number|undefined} */
  this.viewportSearchOptions;

  /** @type {?number|undefined} */
  this.deviceLocationRatio;

  /** @type {?number|undefined} */
  this.plmSourceLocationCount;

  /** @type {?proto.location.unified.PersonalizedLocationAttributes.ObjectFormat|undefined} */
  this.personalizedLocationAttributes;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.location.unified.LocationAttributesProto.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.location.unified.LocationAttributesProto}
 */
proto.location.unified.LocationAttributesProto.fromObject = function(obj) {
  const msg = new proto.location.unified.LocationAttributesProto();
  obj.headingDegrees != null && jspb.Message.setField(msg, 2, obj.headingDegrees);
  obj.bearingDegrees != null && jspb.Message.setField(msg, 3, obj.bearingDegrees);
  obj.bearingAccuracyDegrees != null && jspb.Message.setField(msg, 12, obj.bearingAccuracyDegrees);
  obj.speedKph != null && jspb.Message.setField(msg, 4, obj.speedKph);
  obj.speedAccuracyKph != null && jspb.Message.setField(msg, 13, obj.speedAccuracyKph);
  obj.tiltDegrees != null && jspb.Message.setField(msg, 5, obj.tiltDegrees);
  obj.rollDegrees != null && jspb.Message.setField(msg, 6, obj.rollDegrees);
  obj.altitudeMetersFromGround != null && jspb.Message.setField(msg, 7, obj.altitudeMetersFromGround);
  obj.fieldOfView && jspb.Message.setWrapperField(
      msg, 8, proto.location.unified.FieldOfView.fromObject(obj.fieldOfView));
  obj.boardedTransitVehicleToken != null && jspb.Message.setField(msg, 9, obj.boardedTransitVehicleToken);
  obj.activityRecordList && jspb.Message.setRepeatedWrapperField(
      msg, 11, obj.activityRecordList.map(
          proto.location.unified.ActivityRecord.fromObject));
  obj.plmType != null && jspb.Message.setField(msg, 14, obj.plmType);
  obj.inference != null && jspb.Message.setField(msg, 15, obj.inference);
  obj.manualEntry != null && jspb.Message.setField(msg, 16, obj.manualEntry);
  obj.weekSecondConfidence != null && jspb.Message.setField(msg, 17, obj.weekSecondConfidence);
  obj.ipRangeConfidence != null && jspb.Message.setField(msg, 18, obj.ipRangeConfidence);
  obj.carrierIpType != null && jspb.Message.setField(msg, 19, obj.carrierIpType);
  obj.adsConfidence != null && jspb.Message.setField(msg, 20, obj.adsConfidence);
  obj.viewportSearchOptions != null && jspb.Message.setField(msg, 21, obj.viewportSearchOptions);
  obj.deviceLocationRatio != null && jspb.Message.setField(msg, 10, obj.deviceLocationRatio);
  obj.plmSourceLocationCount != null && jspb.Message.setField(msg, 22, obj.plmSourceLocationCount);
  obj.personalizedLocationAttributes && jspb.Message.setWrapperField(
      msg, 23, proto.location.unified.PersonalizedLocationAttributes.fromObject(obj.personalizedLocationAttributes));
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.location.unified.LocationAttributesProto}
 */
proto.location.unified.LocationAttributesProto.deserializeBinary = function(bytes) {
  return proto.location.unified.LocationAttributesProto.deserializeBinaryFromReader(
      new proto.location.unified.LocationAttributesProto(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.location.unified.LocationAttributesProto} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.location.unified.LocationAttributesProto}
 */
proto.location.unified.LocationAttributesProto.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 2:
      value = /** @type {number} */ (reader.readInt32());
      msg.setHeadingDegrees(value);
      break;
    case 3:
      value = /** @type {number} */ (reader.readInt32());
      msg.setBearingDegrees(value);
      break;
    case 12:
      value = /** @type {number} */ (reader.readInt32());
      msg.setBearingAccuracyDegrees(value);
      break;
    case 4:
      value = /** @type {number} */ (reader.readInt32());
      msg.setSpeedKph(value);
      break;
    case 13:
      value = /** @type {number} */ (reader.readInt32());
      msg.setSpeedAccuracyKph(value);
      break;
    case 5:
      value = /** @type {number} */ (reader.readInt32());
      msg.setTiltDegrees(value);
      break;
    case 6:
      value = /** @type {number} */ (reader.readInt32());
      msg.setRollDegrees(value);
      break;
    case 7:
      value = /** @type {number} */ (reader.readDouble());
      msg.setAltitudeMetersFromGround(value);
      break;
    case 8:
      value = new proto.location.unified.FieldOfView();
      reader.readMessage(value,proto.location.unified.FieldOfView.deserializeBinaryFromReader);
      msg.setFieldOfView(value);
      break;
    case 9:
      value = /** @type {string} */ (reader.readString());
      msg.setBoardedTransitVehicleToken(value);
      break;
    case 11:
      value = new proto.location.unified.ActivityRecord();
      reader.readMessage(value,proto.location.unified.ActivityRecord.deserializeBinaryFromReader);
      msg.addActivityRecord(value);
      break;
    case 14:
      value = /** @type {!proto.location.unified.LocationAttributesProto.PLMType} */ (reader.readEnum());
      msg.setPlmType(value);
      break;
    case 15:
      value = /** @type {!proto.location.unified.LocationAttributesProto.Inference} */ (reader.readEnum());
      msg.setInference(value);
      break;
    case 16:
      value = /** @type {!proto.location.unified.LocationAttributesProto.ManualEntry} */ (reader.readEnum());
      msg.setManualEntry(value);
      break;
    case 17:
      value = /** @type {number} */ (reader.readFloat());
      msg.setWeekSecondConfidence(value);
      break;
    case 18:
      value = /** @type {number} */ (reader.readFloat());
      msg.setIpRangeConfidence(value);
      break;
    case 19:
      value = /** @type {!proto.location.unified.LocationAttributesProto.CarrierIpType} */ (reader.readEnum());
      msg.setCarrierIpType(value);
      break;
    case 20:
      value = /** @type {number} */ (reader.readFloat());
      msg.setAdsConfidence(value);
      break;
    case 21:
      value = /** @type {!proto.location.unified.LocationAttributesProto.ViewportSearchOptions} */ (reader.readEnum());
      msg.setViewportSearchOptions(value);
      break;
    case 10:
      value = /** @type {number} */ (reader.readFloat());
      msg.setDeviceLocationRatio(value);
      break;
    case 22:
      value = /** @type {number} */ (reader.readInt32());
      msg.setPlmSourceLocationCount(value);
      break;
    case 23:
      value = new proto.location.unified.PersonalizedLocationAttributes();
      reader.readMessage(value,proto.location.unified.PersonalizedLocationAttributes.deserializeBinaryFromReader);
      msg.setPersonalizedLocationAttributes(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.location.unified.LocationAttributesProto.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.location.unified.LocationAttributesProto.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.location.unified.LocationAttributesProto} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.location.unified.LocationAttributesProto.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {?number} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeInt32(
      2,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeInt32(
      3,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 12));
  if (f != null) {
    writer.writeInt32(
      12,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 4));
  if (f != null) {
    writer.writeInt32(
      4,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 13));
  if (f != null) {
    writer.writeInt32(
      13,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 5));
  if (f != null) {
    writer.writeInt32(
      5,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 6));
  if (f != null) {
    writer.writeInt32(
      6,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 7));
  if (f != null) {
    writer.writeDouble(
      7,
      f
    );
  }
  f = message.getFieldOfView();
  if (f != null) {
    writer.writeMessage(
      8,
      f,
      proto.location.unified.FieldOfView.serializeBinaryToWriter
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 9));
  if (f != null) {
    writer.writeString(
      9,
      f
    );
  }
  f = message.getActivityRecordList();
  if (f.length > 0) {
    writer.writeRepeatedMessage(
      11,
      f,
      proto.location.unified.ActivityRecord.serializeBinaryToWriter
    );
  }
  f = /** @type {!proto.location.unified.LocationAttributesProto.PLMType} */ (jspb.Message.getField(message, 14));
  if (f != null) {
    writer.writeEnum(
      14,
      f
    );
  }
  f = /** @type {!proto.location.unified.LocationAttributesProto.Inference} */ (jspb.Message.getField(message, 15));
  if (f != null) {
    writer.writeEnum(
      15,
      f
    );
  }
  f = /** @type {!proto.location.unified.LocationAttributesProto.ManualEntry} */ (jspb.Message.getField(message, 16));
  if (f != null) {
    writer.writeEnum(
      16,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 17));
  if (f != null) {
    writer.writeFloat(
      17,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 18));
  if (f != null) {
    writer.writeFloat(
      18,
      f
    );
  }
  f = /** @type {!proto.location.unified.LocationAttributesProto.CarrierIpType} */ (jspb.Message.getField(message, 19));
  if (f != null) {
    writer.writeEnum(
      19,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 20));
  if (f != null) {
    writer.writeFloat(
      20,
      f
    );
  }
  f = /** @type {!proto.location.unified.LocationAttributesProto.ViewportSearchOptions} */ (jspb.Message.getField(message, 21));
  if (f != null) {
    writer.writeEnum(
      21,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 10));
  if (f != null) {
    writer.writeFloat(
      10,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 22));
  if (f != null) {
    writer.writeInt32(
      22,
      f
    );
  }
  f = message.getPersonalizedLocationAttributes();
  if (f != null) {
    writer.writeMessage(
      23,
      f,
      proto.location.unified.PersonalizedLocationAttributes.serializeBinaryToWriter
    );
  }
};


/**
 * @enum {number}
 */
proto.location.unified.LocationAttributesProto.PLMType = {
  PLMTYPE_UNKNOWN: 0,
  PLMTYPE_FIRST: 1,
  PLMTYPE_SECOND: 2,
  PLMTYPE_THIRD: 3,
  PLMTYPE_FOURTH: 4,
  PLMTYPE_FIFTH: 5,
  PLMTYPE_SIXTH: 6,
  PLMTYPE_SEVENTH: 7,
  PLMTYPE_EIGHTH: 8,
  PLMTYPE_NINTH: 9
};

/**
 * @enum {number}
 */
proto.location.unified.LocationAttributesProto.Inference = {
  INFERENCE_NONE: 0,
  INFERENCE_HULK_HEURISTIC: 1,
  INFERENCE_HULK_CLASSIFIED: 2,
  INFERENCE_HULK_UNKNOWN: 3,
  INFERENCE_PLM: 4
};

/**
 * @enum {number}
 */
proto.location.unified.LocationAttributesProto.ManualEntry = {
  MANUAL_ENTRY_NONE: 0,
  MANUAL_ENTRY_UNKNOWN: 1,
  MANUAL_ENTRY: 2,
  MANUAL_ENTRY_DROPPED_PIN: 3,
  MANUAL_ENTRY_HIGH_LEVEL: 4,
  MANUAL_ENTRY_STALE: 5,
  MANUAL_ENTRY_INSUFFICIENT_LOCATIONS: 6
};

/**
 * @enum {number}
 */
proto.location.unified.LocationAttributesProto.CarrierIpType = {
  CARRIER_IP_UNKNOWN: 0,
  CARRIER_IP_NOT_CARRIER: 1,
  CARRIER_IP_MOBILE: 2
};

/**
 * @enum {number}
 */
proto.location.unified.LocationAttributesProto.ViewportSearchOptions = {
  VIEWPORT_SEARCH_OPTIONS_UNSPECIFIED: 0,
  VIEWPORT_SEARCH_OPTIONS_AROUND: 1,
  VIEWPORT_SEARCH_OPTIONS_RESTRICT: 2,
  VIEWPORT_SEARCH_OPTIONS_FILTER_ONLY: 3,
  VIEWPORT_SEARCH_OPTIONS_FORCE_AROUND: 4
};

/**
 * optional int32 heading_degrees = 2;
 * @return {?number}
 */
proto.location.unified.LocationAttributesProto.prototype.getHeadingDegrees = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 2));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.location.unified.LocationAttributesProto} returns this
 */
proto.location.unified.LocationAttributesProto.prototype.setHeadingDegrees = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.LocationAttributesProto} returns this
 */
proto.location.unified.LocationAttributesProto.prototype.clearHeadingDegrees = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.LocationAttributesProto.prototype.hasHeadingDegrees = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional int32 bearing_degrees = 3;
 * @return {?number}
 */
proto.location.unified.LocationAttributesProto.prototype.getBearingDegrees = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 3));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.location.unified.LocationAttributesProto} returns this
 */
proto.location.unified.LocationAttributesProto.prototype.setBearingDegrees = function(value) {
  return jspb.Message.setField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.LocationAttributesProto} returns this
 */
proto.location.unified.LocationAttributesProto.prototype.clearBearingDegrees = function() {
  return jspb.Message.clearField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.LocationAttributesProto.prototype.hasBearingDegrees = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * optional int32 bearing_accuracy_degrees = 12;
 * @return {?number}
 */
proto.location.unified.LocationAttributesProto.prototype.getBearingAccuracyDegrees = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 12));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.location.unified.LocationAttributesProto} returns this
 */
proto.location.unified.LocationAttributesProto.prototype.setBearingAccuracyDegrees = function(value) {
  return jspb.Message.setField(this, 12, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.LocationAttributesProto} returns this
 */
proto.location.unified.LocationAttributesProto.prototype.clearBearingAccuracyDegrees = function() {
  return jspb.Message.clearField(this, 12);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.LocationAttributesProto.prototype.hasBearingAccuracyDegrees = function() {
  return jspb.Message.hasField(this, 12);
};


/**
 * optional int32 speed_kph = 4;
 * @return {?number}
 */
proto.location.unified.LocationAttributesProto.prototype.getSpeedKph = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 4));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.location.unified.LocationAttributesProto} returns this
 */
proto.location.unified.LocationAttributesProto.prototype.setSpeedKph = function(value) {
  return jspb.Message.setField(this, 4, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.LocationAttributesProto} returns this
 */
proto.location.unified.LocationAttributesProto.prototype.clearSpeedKph = function() {
  return jspb.Message.clearField(this, 4);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.LocationAttributesProto.prototype.hasSpeedKph = function() {
  return jspb.Message.hasField(this, 4);
};


/**
 * optional int32 speed_accuracy_kph = 13;
 * @return {?number}
 */
proto.location.unified.LocationAttributesProto.prototype.getSpeedAccuracyKph = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 13));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.location.unified.LocationAttributesProto} returns this
 */
proto.location.unified.LocationAttributesProto.prototype.setSpeedAccuracyKph = function(value) {
  return jspb.Message.setField(this, 13, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.LocationAttributesProto} returns this
 */
proto.location.unified.LocationAttributesProto.prototype.clearSpeedAccuracyKph = function() {
  return jspb.Message.clearField(this, 13);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.LocationAttributesProto.prototype.hasSpeedAccuracyKph = function() {
  return jspb.Message.hasField(this, 13);
};


/**
 * optional int32 tilt_degrees = 5;
 * @return {?number}
 */
proto.location.unified.LocationAttributesProto.prototype.getTiltDegrees = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 5));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.location.unified.LocationAttributesProto} returns this
 */
proto.location.unified.LocationAttributesProto.prototype.setTiltDegrees = function(value) {
  return jspb.Message.setField(this, 5, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.LocationAttributesProto} returns this
 */
proto.location.unified.LocationAttributesProto.prototype.clearTiltDegrees = function() {
  return jspb.Message.clearField(this, 5);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.LocationAttributesProto.prototype.hasTiltDegrees = function() {
  return jspb.Message.hasField(this, 5);
};


/**
 * optional int32 roll_degrees = 6;
 * @return {?number}
 */
proto.location.unified.LocationAttributesProto.prototype.getRollDegrees = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 6));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.location.unified.LocationAttributesProto} returns this
 */
proto.location.unified.LocationAttributesProto.prototype.setRollDegrees = function(value) {
  return jspb.Message.setField(this, 6, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.LocationAttributesProto} returns this
 */
proto.location.unified.LocationAttributesProto.prototype.clearRollDegrees = function() {
  return jspb.Message.clearField(this, 6);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.LocationAttributesProto.prototype.hasRollDegrees = function() {
  return jspb.Message.hasField(this, 6);
};


/**
 * optional double altitude_meters_from_ground = 7;
 * @return {?number}
 */
proto.location.unified.LocationAttributesProto.prototype.getAltitudeMetersFromGround = function() {
  return /** @type {?number} */ (jspb.Message.getOptionalFloatingPointField(this, 7));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.location.unified.LocationAttributesProto} returns this
 */
proto.location.unified.LocationAttributesProto.prototype.setAltitudeMetersFromGround = function(value) {
  return jspb.Message.setField(this, 7, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.LocationAttributesProto} returns this
 */
proto.location.unified.LocationAttributesProto.prototype.clearAltitudeMetersFromGround = function() {
  return jspb.Message.clearField(this, 7);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.LocationAttributesProto.prototype.hasAltitudeMetersFromGround = function() {
  return jspb.Message.hasField(this, 7);
};


/**
 * optional FieldOfView field_of_view = 8;
 * @return {?proto.location.unified.FieldOfView}
 */
proto.location.unified.LocationAttributesProto.prototype.getFieldOfView = function() {
  return /** @type{?proto.location.unified.FieldOfView} */ (
    jspb.Message.getWrapperField(this, proto.location.unified.FieldOfView, 8));
};


/**
 * @param {?proto.location.unified.FieldOfView|undefined} value
 * @return {!proto.location.unified.LocationAttributesProto} returns this
*/
proto.location.unified.LocationAttributesProto.prototype.setFieldOfView = function(value) {
  return jspb.Message.setWrapperField(this, 8, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.LocationAttributesProto} returns this
 */
proto.location.unified.LocationAttributesProto.prototype.clearFieldOfView = function() {
  return jspb.Message.clearWrapperField(this, 8);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.LocationAttributesProto.prototype.hasFieldOfView = function() {
  return jspb.Message.hasField(this, 8);
};


/**
 * optional string boarded_transit_vehicle_token = 9;
 * @return {?string}
 */
proto.location.unified.LocationAttributesProto.prototype.getBoardedTransitVehicleToken = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 9));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.location.unified.LocationAttributesProto} returns this
 */
proto.location.unified.LocationAttributesProto.prototype.setBoardedTransitVehicleToken = function(value) {
  return jspb.Message.setField(this, 9, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.LocationAttributesProto} returns this
 */
proto.location.unified.LocationAttributesProto.prototype.clearBoardedTransitVehicleToken = function() {
  return jspb.Message.clearField(this, 9);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.LocationAttributesProto.prototype.hasBoardedTransitVehicleToken = function() {
  return jspb.Message.hasField(this, 9);
};


/**
 * repeated ActivityRecord activity_record = 11;
 * @return {!Array<!proto.location.unified.ActivityRecord>}
 */
proto.location.unified.LocationAttributesProto.prototype.getActivityRecordList = function() {
  return /** @type{!Array<!proto.location.unified.ActivityRecord>} */ (
    jspb.Message.getRepeatedWrapperField(this, proto.location.unified.ActivityRecord, 11));
};


/**
 * @param {Array<!proto.location.unified.ActivityRecord>|undefined} value
 * @return {!proto.location.unified.LocationAttributesProto} returns this
*/
proto.location.unified.LocationAttributesProto.prototype.setActivityRecordList = function(value) {
  return jspb.Message.setRepeatedWrapperField(this, 11, value);
};


/**
 * @param {!proto.location.unified.ActivityRecord=} opt_value
 * @param {number=} opt_index
 * @return {!proto.location.unified.ActivityRecord}
 */
proto.location.unified.LocationAttributesProto.prototype.addActivityRecord = function(opt_value, opt_index) {
  return jspb.Message.addToRepeatedWrapperField(this, 11, opt_value, proto.location.unified.ActivityRecord, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.location.unified.LocationAttributesProto} returns this
 */
proto.location.unified.LocationAttributesProto.prototype.clearActivityRecordList = function() {
  return jspb.Message.clearRepeatedWrapperField(this, 11);
};


/**
 * optional PLMType plm_type = 14;
 * @return {!proto.location.unified.LocationAttributesProto.PLMType}
 */
proto.location.unified.LocationAttributesProto.prototype.getPlmType = function() {
  return /** @type {!proto.location.unified.LocationAttributesProto.PLMType} */ (jspb.Message.getField(this, 14));
};


/**
 * @param {?proto.location.unified.LocationAttributesProto.PLMType|undefined} value
 * @return {!proto.location.unified.LocationAttributesProto} returns this
 */
proto.location.unified.LocationAttributesProto.prototype.setPlmType = function(value) {
  return jspb.Message.setField(this, 14, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.LocationAttributesProto} returns this
 */
proto.location.unified.LocationAttributesProto.prototype.clearPlmType = function() {
  return jspb.Message.clearField(this, 14);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.LocationAttributesProto.prototype.hasPlmType = function() {
  return jspb.Message.hasField(this, 14);
};


/**
 * optional Inference inference = 15;
 * @return {!proto.location.unified.LocationAttributesProto.Inference}
 */
proto.location.unified.LocationAttributesProto.prototype.getInference = function() {
  return /** @type {!proto.location.unified.LocationAttributesProto.Inference} */ (jspb.Message.getField(this, 15));
};


/**
 * @param {?proto.location.unified.LocationAttributesProto.Inference|undefined} value
 * @return {!proto.location.unified.LocationAttributesProto} returns this
 */
proto.location.unified.LocationAttributesProto.prototype.setInference = function(value) {
  return jspb.Message.setField(this, 15, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.LocationAttributesProto} returns this
 */
proto.location.unified.LocationAttributesProto.prototype.clearInference = function() {
  return jspb.Message.clearField(this, 15);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.LocationAttributesProto.prototype.hasInference = function() {
  return jspb.Message.hasField(this, 15);
};


/**
 * optional ManualEntry manual_entry = 16;
 * @return {!proto.location.unified.LocationAttributesProto.ManualEntry}
 */
proto.location.unified.LocationAttributesProto.prototype.getManualEntry = function() {
  return /** @type {!proto.location.unified.LocationAttributesProto.ManualEntry} */ (jspb.Message.getField(this, 16));
};


/**
 * @param {?proto.location.unified.LocationAttributesProto.ManualEntry|undefined} value
 * @return {!proto.location.unified.LocationAttributesProto} returns this
 */
proto.location.unified.LocationAttributesProto.prototype.setManualEntry = function(value) {
  return jspb.Message.setField(this, 16, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.LocationAttributesProto} returns this
 */
proto.location.unified.LocationAttributesProto.prototype.clearManualEntry = function() {
  return jspb.Message.clearField(this, 16);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.LocationAttributesProto.prototype.hasManualEntry = function() {
  return jspb.Message.hasField(this, 16);
};


/**
 * optional float week_second_confidence = 17;
 * @return {?number}
 */
proto.location.unified.LocationAttributesProto.prototype.getWeekSecondConfidence = function() {
  return /** @type {?number} */ (jspb.Message.getOptionalFloatingPointField(this, 17));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.location.unified.LocationAttributesProto} returns this
 */
proto.location.unified.LocationAttributesProto.prototype.setWeekSecondConfidence = function(value) {
  return jspb.Message.setField(this, 17, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.LocationAttributesProto} returns this
 */
proto.location.unified.LocationAttributesProto.prototype.clearWeekSecondConfidence = function() {
  return jspb.Message.clearField(this, 17);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.LocationAttributesProto.prototype.hasWeekSecondConfidence = function() {
  return jspb.Message.hasField(this, 17);
};


/**
 * optional float ip_range_confidence = 18;
 * @return {?number}
 */
proto.location.unified.LocationAttributesProto.prototype.getIpRangeConfidence = function() {
  return /** @type {?number} */ (jspb.Message.getOptionalFloatingPointField(this, 18));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.location.unified.LocationAttributesProto} returns this
 */
proto.location.unified.LocationAttributesProto.prototype.setIpRangeConfidence = function(value) {
  return jspb.Message.setField(this, 18, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.LocationAttributesProto} returns this
 */
proto.location.unified.LocationAttributesProto.prototype.clearIpRangeConfidence = function() {
  return jspb.Message.clearField(this, 18);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.LocationAttributesProto.prototype.hasIpRangeConfidence = function() {
  return jspb.Message.hasField(this, 18);
};


/**
 * optional CarrierIpType carrier_ip_type = 19;
 * @return {!proto.location.unified.LocationAttributesProto.CarrierIpType}
 */
proto.location.unified.LocationAttributesProto.prototype.getCarrierIpType = function() {
  return /** @type {!proto.location.unified.LocationAttributesProto.CarrierIpType} */ (jspb.Message.getField(this, 19));
};


/**
 * @param {?proto.location.unified.LocationAttributesProto.CarrierIpType|undefined} value
 * @return {!proto.location.unified.LocationAttributesProto} returns this
 */
proto.location.unified.LocationAttributesProto.prototype.setCarrierIpType = function(value) {
  return jspb.Message.setField(this, 19, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.LocationAttributesProto} returns this
 */
proto.location.unified.LocationAttributesProto.prototype.clearCarrierIpType = function() {
  return jspb.Message.clearField(this, 19);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.LocationAttributesProto.prototype.hasCarrierIpType = function() {
  return jspb.Message.hasField(this, 19);
};


/**
 * optional float ads_confidence = 20;
 * @return {?number}
 */
proto.location.unified.LocationAttributesProto.prototype.getAdsConfidence = function() {
  return /** @type {?number} */ (jspb.Message.getOptionalFloatingPointField(this, 20));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.location.unified.LocationAttributesProto} returns this
 */
proto.location.unified.LocationAttributesProto.prototype.setAdsConfidence = function(value) {
  return jspb.Message.setField(this, 20, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.LocationAttributesProto} returns this
 */
proto.location.unified.LocationAttributesProto.prototype.clearAdsConfidence = function() {
  return jspb.Message.clearField(this, 20);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.LocationAttributesProto.prototype.hasAdsConfidence = function() {
  return jspb.Message.hasField(this, 20);
};


/**
 * optional ViewportSearchOptions viewport_search_options = 21;
 * @return {!proto.location.unified.LocationAttributesProto.ViewportSearchOptions}
 */
proto.location.unified.LocationAttributesProto.prototype.getViewportSearchOptions = function() {
  return /** @type {!proto.location.unified.LocationAttributesProto.ViewportSearchOptions} */ (jspb.Message.getField(this, 21));
};


/**
 * @param {?proto.location.unified.LocationAttributesProto.ViewportSearchOptions|undefined} value
 * @return {!proto.location.unified.LocationAttributesProto} returns this
 */
proto.location.unified.LocationAttributesProto.prototype.setViewportSearchOptions = function(value) {
  return jspb.Message.setField(this, 21, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.LocationAttributesProto} returns this
 */
proto.location.unified.LocationAttributesProto.prototype.clearViewportSearchOptions = function() {
  return jspb.Message.clearField(this, 21);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.LocationAttributesProto.prototype.hasViewportSearchOptions = function() {
  return jspb.Message.hasField(this, 21);
};


/**
 * optional float device_location_ratio = 10;
 * @return {?number}
 */
proto.location.unified.LocationAttributesProto.prototype.getDeviceLocationRatio = function() {
  return /** @type {?number} */ (jspb.Message.getOptionalFloatingPointField(this, 10));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.location.unified.LocationAttributesProto} returns this
 */
proto.location.unified.LocationAttributesProto.prototype.setDeviceLocationRatio = function(value) {
  return jspb.Message.setField(this, 10, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.LocationAttributesProto} returns this
 */
proto.location.unified.LocationAttributesProto.prototype.clearDeviceLocationRatio = function() {
  return jspb.Message.clearField(this, 10);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.LocationAttributesProto.prototype.hasDeviceLocationRatio = function() {
  return jspb.Message.hasField(this, 10);
};


/**
 * optional int32 plm_source_location_count = 22;
 * @return {?number}
 */
proto.location.unified.LocationAttributesProto.prototype.getPlmSourceLocationCount = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 22));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.location.unified.LocationAttributesProto} returns this
 */
proto.location.unified.LocationAttributesProto.prototype.setPlmSourceLocationCount = function(value) {
  return jspb.Message.setField(this, 22, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.LocationAttributesProto} returns this
 */
proto.location.unified.LocationAttributesProto.prototype.clearPlmSourceLocationCount = function() {
  return jspb.Message.clearField(this, 22);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.LocationAttributesProto.prototype.hasPlmSourceLocationCount = function() {
  return jspb.Message.hasField(this, 22);
};


/**
 * optional PersonalizedLocationAttributes personalized_location_attributes = 23;
 * @return {?proto.location.unified.PersonalizedLocationAttributes}
 */
proto.location.unified.LocationAttributesProto.prototype.getPersonalizedLocationAttributes = function() {
  return /** @type{?proto.location.unified.PersonalizedLocationAttributes} */ (
    jspb.Message.getWrapperField(this, proto.location.unified.PersonalizedLocationAttributes, 23));
};


/**
 * @param {?proto.location.unified.PersonalizedLocationAttributes|undefined} value
 * @return {!proto.location.unified.LocationAttributesProto} returns this
*/
proto.location.unified.LocationAttributesProto.prototype.setPersonalizedLocationAttributes = function(value) {
  return jspb.Message.setWrapperField(this, 23, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.LocationAttributesProto} returns this
 */
proto.location.unified.LocationAttributesProto.prototype.clearPersonalizedLocationAttributes = function() {
  return jspb.Message.clearWrapperField(this, 23);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.LocationAttributesProto.prototype.hasPersonalizedLocationAttributes = function() {
  return jspb.Message.hasField(this, 23);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.location.unified.LocationAttributesProto}
 */
proto.location.unified.LocationAttributesProto.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.location.unified.LocationAttributesProto, data);
};



//location/unified/proto/location_descriptor_proto_jspb/presenceinterval.jspb.js
// source: location/unified/proto/location_descriptor.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.location.unified.PresenceInterval');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.location.unified.PresenceInterval = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.location.unified.PresenceInterval, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.location.unified.PresenceInterval.displayName = 'proto.location.unified.PresenceInterval';
}



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.location.unified.PresenceInterval.prototype.toObject = function(opt_includeInstance) {
  return proto.location.unified.PresenceInterval.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.location.unified.PresenceInterval} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.location.unified.PresenceInterval.toObject = function(includeInstance, msg) {
  let f, obj = {
    startOffsetSec: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    durationSec: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f,
    confidence: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of PresenceInterval as accepted by the `fromObject` method.
 * @record
 */
proto.location.unified.PresenceInterval.ObjectFormat = function() {
  /** @type {?number|undefined} */
  this.startOffsetSec;

  /** @type {?number|undefined} */
  this.durationSec;

  /** @type {?number|undefined} */
  this.confidence;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.location.unified.PresenceInterval.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.location.unified.PresenceInterval}
 */
proto.location.unified.PresenceInterval.fromObject = function(obj) {
  const msg = new proto.location.unified.PresenceInterval();
  obj.startOffsetSec != null && jspb.Message.setField(msg, 1, obj.startOffsetSec);
  obj.durationSec != null && jspb.Message.setField(msg, 2, obj.durationSec);
  obj.confidence != null && jspb.Message.setField(msg, 3, obj.confidence);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.location.unified.PresenceInterval}
 */
proto.location.unified.PresenceInterval.deserializeBinary = function(bytes) {
  return proto.location.unified.PresenceInterval.deserializeBinaryFromReader(
      new proto.location.unified.PresenceInterval(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.location.unified.PresenceInterval} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.location.unified.PresenceInterval}
 */
proto.location.unified.PresenceInterval.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {number} */ (reader.readUint64());
      msg.setStartOffsetSec(value);
      break;
    case 2:
      value = /** @type {number} */ (reader.readUint64());
      msg.setDurationSec(value);
      break;
    case 3:
      value = /** @type {number} */ (reader.readUint32());
      msg.setConfidence(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.location.unified.PresenceInterval.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.location.unified.PresenceInterval.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.location.unified.PresenceInterval} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.location.unified.PresenceInterval.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {?number} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeUint64(
      1,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeUint64(
      2,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeUint32(
      3,
      f
    );
  }
};


/**
 * optional uint64 start_offset_sec = 1;
 * @return {?number}
 */
proto.location.unified.PresenceInterval.prototype.getStartOffsetSec = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 1));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.location.unified.PresenceInterval} returns this
 */
proto.location.unified.PresenceInterval.prototype.setStartOffsetSec = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.PresenceInterval} returns this
 */
proto.location.unified.PresenceInterval.prototype.clearStartOffsetSec = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.PresenceInterval.prototype.hasStartOffsetSec = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional uint64 duration_sec = 2;
 * @return {?number}
 */
proto.location.unified.PresenceInterval.prototype.getDurationSec = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 2));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.location.unified.PresenceInterval} returns this
 */
proto.location.unified.PresenceInterval.prototype.setDurationSec = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.PresenceInterval} returns this
 */
proto.location.unified.PresenceInterval.prototype.clearDurationSec = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.PresenceInterval.prototype.hasDurationSec = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional uint32 confidence = 3;
 * @return {?number}
 */
proto.location.unified.PresenceInterval.prototype.getConfidence = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 3));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.location.unified.PresenceInterval} returns this
 */
proto.location.unified.PresenceInterval.prototype.setConfidence = function(value) {
  return jspb.Message.setField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.PresenceInterval} returns this
 */
proto.location.unified.PresenceInterval.prototype.clearConfidence = function() {
  return jspb.Message.clearField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.PresenceInterval.prototype.hasConfidence = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.location.unified.PresenceInterval}
 */
proto.location.unified.PresenceInterval.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.location.unified.PresenceInterval, data);
};



//location/unified/proto/location_descriptor_proto_jspb/semanticplace.jspb.js
// source: location/unified/proto/location_descriptor.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.location.unified.SemanticPlace');
goog.provide('proto.location.unified.SemanticPlace.GConceptInstanceProto');
goog.provide('proto.location.unified.SemanticPlace.GConceptInstanceProto.Prominence');
goog.provide('proto.location.unified.SemanticPlace.SemanticPlaceConfidence');
goog.provide('proto.location.unified.SemanticPlace.Source');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.location.unified.FeatureIdProto');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.location.unified.SemanticPlace = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, proto.location.unified.SemanticPlace.repeatedFields_, null);
};
goog.inherits(proto.location.unified.SemanticPlace, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.location.unified.SemanticPlace.displayName = 'proto.location.unified.SemanticPlace';
}
/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.location.unified.SemanticPlace.GConceptInstanceProto = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.location.unified.SemanticPlace.GConceptInstanceProto, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.location.unified.SemanticPlace.GConceptInstanceProto.displayName = 'proto.location.unified.SemanticPlace.GConceptInstanceProto';
}

/**
 * List of repeated fields within this message type.
 * @private {!Array<number>}
 * @const
 */
proto.location.unified.SemanticPlace.repeatedFields_ = [2];



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.location.unified.SemanticPlace.prototype.toObject = function(opt_includeInstance) {
  return proto.location.unified.SemanticPlace.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.location.unified.SemanticPlace} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.location.unified.SemanticPlace.toObject = function(includeInstance, msg) {
  let f, obj = {
    featureId: (f = msg.getFeatureId()) && proto.location.unified.FeatureIdProto.toObject(includeInstance, f),
    gconceptInstanceList: jspb.Message.toObjectList(msg.getGconceptInstanceList(),
    proto.location.unified.SemanticPlace.GConceptInstanceProto.toObject, includeInstance),
    score: (f = jspb.Message.getOptionalFloatingPointField(msg, 3)) == null ? undefined : f,
    confidence: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f,
    source: (f = jspb.Message.getField(msg, 5)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of SemanticPlace as accepted by the `fromObject` method.
 * @record
 */
proto.location.unified.SemanticPlace.ObjectFormat = function() {
  /** @type {?proto.location.unified.FeatureIdProto.ObjectFormat|undefined} */
  this.featureId;

  /** @type {?Array<!proto.location.unified.SemanticPlace.GConceptInstanceProto.ObjectFormat>|undefined} */
  this.gconceptInstanceList;

  /** @type {?number|undefined} */
  this.score;

  /** @type {?number|undefined} */
  this.confidence;

  /** @type {?number|undefined} */
  this.source;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.location.unified.SemanticPlace.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.location.unified.SemanticPlace}
 */
proto.location.unified.SemanticPlace.fromObject = function(obj) {
  const msg = new proto.location.unified.SemanticPlace();
  obj.featureId && jspb.Message.setWrapperField(
      msg, 1, proto.location.unified.FeatureIdProto.fromObject(obj.featureId));
  obj.gconceptInstanceList && jspb.Message.setRepeatedWrapperField(
      msg, 2, obj.gconceptInstanceList.map(
          proto.location.unified.SemanticPlace.GConceptInstanceProto.fromObject));
  obj.score != null && jspb.Message.setField(msg, 3, obj.score);
  obj.confidence != null && jspb.Message.setField(msg, 4, obj.confidence);
  obj.source != null && jspb.Message.setField(msg, 5, obj.source);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.location.unified.SemanticPlace}
 */
proto.location.unified.SemanticPlace.deserializeBinary = function(bytes) {
  return proto.location.unified.SemanticPlace.deserializeBinaryFromReader(
      new proto.location.unified.SemanticPlace(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.location.unified.SemanticPlace} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.location.unified.SemanticPlace}
 */
proto.location.unified.SemanticPlace.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = new proto.location.unified.FeatureIdProto();
      reader.readMessage(value,proto.location.unified.FeatureIdProto.deserializeBinaryFromReader);
      msg.setFeatureId(value);
      break;
    case 2:
      value = new proto.location.unified.SemanticPlace.GConceptInstanceProto();
      reader.readMessage(value,proto.location.unified.SemanticPlace.GConceptInstanceProto.deserializeBinaryFromReader);
      msg.addGconceptInstance(value);
      break;
    case 3:
      value = /** @type {number} */ (reader.readFloat());
      msg.setScore(value);
      break;
    case 4:
      value = /** @type {!proto.location.unified.SemanticPlace.SemanticPlaceConfidence} */ (reader.readEnum());
      msg.setConfidence(value);
      break;
    case 5:
      value = /** @type {!proto.location.unified.SemanticPlace.Source} */ (reader.readEnum());
      msg.setSource(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.location.unified.SemanticPlace.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.location.unified.SemanticPlace.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.location.unified.SemanticPlace} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.location.unified.SemanticPlace.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = message.getFeatureId();
  if (f != null) {
    writer.writeMessage(
      1,
      f,
      proto.location.unified.FeatureIdProto.serializeBinaryToWriter
    );
  }
  f = message.getGconceptInstanceList();
  if (f.length > 0) {
    writer.writeRepeatedMessage(
      2,
      f,
      proto.location.unified.SemanticPlace.GConceptInstanceProto.serializeBinaryToWriter
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeFloat(
      3,
      f
    );
  }
  f = /** @type {!proto.location.unified.SemanticPlace.SemanticPlaceConfidence} */ (jspb.Message.getField(message, 4));
  if (f != null) {
    writer.writeEnum(
      4,
      f
    );
  }
  f = /** @type {!proto.location.unified.SemanticPlace.Source} */ (jspb.Message.getField(message, 5));
  if (f != null) {
    writer.writeEnum(
      5,
      f
    );
  }
};


/**
 * @enum {number}
 */
proto.location.unified.SemanticPlace.SemanticPlaceConfidence = {
  UNKNOWN_CONFIDENCE: 0,
  LOW_CONFIDENCE: 1,
  MEDIUM_CONFIDENCE: 2,
  HIGH_CONFIDENCE: 3
};

/**
 * @enum {number}
 */
proto.location.unified.SemanticPlace.Source = {
  UNKNOWN: 0,
  HAPPY_HOUR: 1,
  HULK_REAL_TIME: 2,
  ANDROID_CONTEXT: 3
};




if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.location.unified.SemanticPlace.GConceptInstanceProto.prototype.toObject = function(opt_includeInstance) {
  return proto.location.unified.SemanticPlace.GConceptInstanceProto.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.location.unified.SemanticPlace.GConceptInstanceProto} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.location.unified.SemanticPlace.GConceptInstanceProto.toObject = function(includeInstance, msg) {
  let f, obj = {
    gconceptId: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    prominence: jspb.Message.getFieldWithDefault(msg, 2, 0)
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of GConceptInstanceProto as accepted by the `fromObject` method.
 * @record
 */
proto.location.unified.SemanticPlace.GConceptInstanceProto.ObjectFormat = function() {
  /** @type {?string|undefined} */
  this.gconceptId;

  /** @type {?number|undefined} */
  this.prominence;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.location.unified.SemanticPlace.GConceptInstanceProto.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.location.unified.SemanticPlace.GConceptInstanceProto}
 */
proto.location.unified.SemanticPlace.GConceptInstanceProto.fromObject = function(obj) {
  const msg = new proto.location.unified.SemanticPlace.GConceptInstanceProto();
  obj.gconceptId != null && jspb.Message.setField(msg, 1, obj.gconceptId);
  obj.prominence != null && jspb.Message.setField(msg, 2, obj.prominence);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.location.unified.SemanticPlace.GConceptInstanceProto}
 */
proto.location.unified.SemanticPlace.GConceptInstanceProto.deserializeBinary = function(bytes) {
  return proto.location.unified.SemanticPlace.GConceptInstanceProto.deserializeBinaryFromReader(
      new proto.location.unified.SemanticPlace.GConceptInstanceProto(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.location.unified.SemanticPlace.GConceptInstanceProto} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.location.unified.SemanticPlace.GConceptInstanceProto}
 */
proto.location.unified.SemanticPlace.GConceptInstanceProto.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {string} */ (reader.readString());
      msg.setGconceptId(value);
      break;
    case 2:
      value = /** @type {!proto.location.unified.SemanticPlace.GConceptInstanceProto.Prominence} */ (reader.readEnum());
      msg.setProminence(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.location.unified.SemanticPlace.GConceptInstanceProto.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.location.unified.SemanticPlace.GConceptInstanceProto.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.location.unified.SemanticPlace.GConceptInstanceProto} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.location.unified.SemanticPlace.GConceptInstanceProto.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {?string} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeString(
      1,
      f
    );
  }
  f = /** @type {!proto.location.unified.SemanticPlace.GConceptInstanceProto.Prominence} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeEnum(
      2,
      f
    );
  }
};


/**
 * @enum {number}
 */
proto.location.unified.SemanticPlace.GConceptInstanceProto.Prominence = {
  NON_PRIMARY: 0,
  PRIMARY: 1000
};

/**
 * optional string gconcept_id = 1;
 * @return {?string}
 */
proto.location.unified.SemanticPlace.GConceptInstanceProto.prototype.getGconceptId = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 1));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.location.unified.SemanticPlace.GConceptInstanceProto} returns this
 */
proto.location.unified.SemanticPlace.GConceptInstanceProto.prototype.setGconceptId = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.SemanticPlace.GConceptInstanceProto} returns this
 */
proto.location.unified.SemanticPlace.GConceptInstanceProto.prototype.clearGconceptId = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.SemanticPlace.GConceptInstanceProto.prototype.hasGconceptId = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional Prominence prominence = 2;
 * @return {!proto.location.unified.SemanticPlace.GConceptInstanceProto.Prominence}
 */
proto.location.unified.SemanticPlace.GConceptInstanceProto.prototype.getProminence = function() {
  return /** @type {!proto.location.unified.SemanticPlace.GConceptInstanceProto.Prominence} */ (jspb.Message.getFieldWithDefault(this, 2, 0));
};


/**
 * @param {?proto.location.unified.SemanticPlace.GConceptInstanceProto.Prominence|undefined} value
 * @return {!proto.location.unified.SemanticPlace.GConceptInstanceProto} returns this
 */
proto.location.unified.SemanticPlace.GConceptInstanceProto.prototype.setProminence = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.SemanticPlace.GConceptInstanceProto} returns this
 */
proto.location.unified.SemanticPlace.GConceptInstanceProto.prototype.clearProminence = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.SemanticPlace.GConceptInstanceProto.prototype.hasProminence = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.location.unified.SemanticPlace.GConceptInstanceProto}
 */
proto.location.unified.SemanticPlace.GConceptInstanceProto.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.location.unified.SemanticPlace.GConceptInstanceProto, data);
};


/**
 * optional FeatureIdProto feature_id = 1;
 * @return {?proto.location.unified.FeatureIdProto}
 */
proto.location.unified.SemanticPlace.prototype.getFeatureId = function() {
  return /** @type{?proto.location.unified.FeatureIdProto} */ (
    jspb.Message.getWrapperField(this, proto.location.unified.FeatureIdProto, 1));
};


/**
 * @param {?proto.location.unified.FeatureIdProto|undefined} value
 * @return {!proto.location.unified.SemanticPlace} returns this
*/
proto.location.unified.SemanticPlace.prototype.setFeatureId = function(value) {
  return jspb.Message.setWrapperField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.SemanticPlace} returns this
 */
proto.location.unified.SemanticPlace.prototype.clearFeatureId = function() {
  return jspb.Message.clearWrapperField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.SemanticPlace.prototype.hasFeatureId = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * repeated GConceptInstanceProto gconcept_instance = 2;
 * @return {!Array<!proto.location.unified.SemanticPlace.GConceptInstanceProto>}
 */
proto.location.unified.SemanticPlace.prototype.getGconceptInstanceList = function() {
  return /** @type{!Array<!proto.location.unified.SemanticPlace.GConceptInstanceProto>} */ (
    jspb.Message.getRepeatedWrapperField(this, proto.location.unified.SemanticPlace.GConceptInstanceProto, 2));
};


/**
 * @param {Array<!proto.location.unified.SemanticPlace.GConceptInstanceProto>|undefined} value
 * @return {!proto.location.unified.SemanticPlace} returns this
*/
proto.location.unified.SemanticPlace.prototype.setGconceptInstanceList = function(value) {
  return jspb.Message.setRepeatedWrapperField(this, 2, value);
};


/**
 * @param {!proto.location.unified.SemanticPlace.GConceptInstanceProto=} opt_value
 * @param {number=} opt_index
 * @return {!proto.location.unified.SemanticPlace.GConceptInstanceProto}
 */
proto.location.unified.SemanticPlace.prototype.addGconceptInstance = function(opt_value, opt_index) {
  return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.location.unified.SemanticPlace.GConceptInstanceProto, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.location.unified.SemanticPlace} returns this
 */
proto.location.unified.SemanticPlace.prototype.clearGconceptInstanceList = function() {
  return jspb.Message.clearRepeatedWrapperField(this, 2);
};


/**
 * optional float score = 3;
 * @return {?number}
 */
proto.location.unified.SemanticPlace.prototype.getScore = function() {
  return /** @type {?number} */ (jspb.Message.getOptionalFloatingPointField(this, 3));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.location.unified.SemanticPlace} returns this
 */
proto.location.unified.SemanticPlace.prototype.setScore = function(value) {
  return jspb.Message.setField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.SemanticPlace} returns this
 */
proto.location.unified.SemanticPlace.prototype.clearScore = function() {
  return jspb.Message.clearField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.SemanticPlace.prototype.hasScore = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * optional SemanticPlaceConfidence confidence = 4;
 * @return {!proto.location.unified.SemanticPlace.SemanticPlaceConfidence}
 */
proto.location.unified.SemanticPlace.prototype.getConfidence = function() {
  return /** @type {!proto.location.unified.SemanticPlace.SemanticPlaceConfidence} */ (jspb.Message.getField(this, 4));
};


/**
 * @param {?proto.location.unified.SemanticPlace.SemanticPlaceConfidence|undefined} value
 * @return {!proto.location.unified.SemanticPlace} returns this
 */
proto.location.unified.SemanticPlace.prototype.setConfidence = function(value) {
  return jspb.Message.setField(this, 4, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.SemanticPlace} returns this
 */
proto.location.unified.SemanticPlace.prototype.clearConfidence = function() {
  return jspb.Message.clearField(this, 4);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.SemanticPlace.prototype.hasConfidence = function() {
  return jspb.Message.hasField(this, 4);
};


/**
 * optional Source source = 5;
 * @return {!proto.location.unified.SemanticPlace.Source}
 */
proto.location.unified.SemanticPlace.prototype.getSource = function() {
  return /** @type {!proto.location.unified.SemanticPlace.Source} */ (jspb.Message.getField(this, 5));
};


/**
 * @param {?proto.location.unified.SemanticPlace.Source|undefined} value
 * @return {!proto.location.unified.SemanticPlace} returns this
 */
proto.location.unified.SemanticPlace.prototype.setSource = function(value) {
  return jspb.Message.setField(this, 5, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.SemanticPlace} returns this
 */
proto.location.unified.SemanticPlace.prototype.clearSource = function() {
  return jspb.Message.clearField(this, 5);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.SemanticPlace.prototype.hasSource = function() {
  return jspb.Message.hasField(this, 5);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.location.unified.SemanticPlace}
 */
proto.location.unified.SemanticPlace.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.location.unified.SemanticPlace, data);
};



//location/unified/proto/location_descriptor_proto_jspb/visiblenetwork.jspb.js
// source: location/unified/proto/location_descriptor.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.location.unified.VisibleNetwork');
goog.provide('proto.location.unified.VisibleNetwork.Cell');
goog.provide('proto.location.unified.VisibleNetwork.Cell.Type');
goog.provide('proto.location.unified.VisibleNetwork.TypeCase');
goog.provide('proto.location.unified.VisibleNetwork.WiFi');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.location.unified.VisibleNetwork = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, proto.location.unified.VisibleNetwork.oneofGroups_);
};
goog.inherits(proto.location.unified.VisibleNetwork, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.location.unified.VisibleNetwork.displayName = 'proto.location.unified.VisibleNetwork';
}
/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.location.unified.VisibleNetwork.WiFi = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.location.unified.VisibleNetwork.WiFi, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.location.unified.VisibleNetwork.WiFi.displayName = 'proto.location.unified.VisibleNetwork.WiFi';
}
/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.location.unified.VisibleNetwork.Cell = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.location.unified.VisibleNetwork.Cell, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.location.unified.VisibleNetwork.Cell.displayName = 'proto.location.unified.VisibleNetwork.Cell';
}

/**
 * Oneof group definitions for this message. Each group defines the field
 * numbers belonging to that group. When of these fields' value is set, all
 * other fields in the group are cleared. During deserialization, if multiple
 * fields are encountered for a group, only the last value seen will be kept.
 * @private {!Array<!Array<number>>}
 * @const
 */
proto.location.unified.VisibleNetwork.oneofGroups_ = [[1,2]];

/**
 * @enum {number}
 */
proto.location.unified.VisibleNetwork.TypeCase = {
  TYPE_NOT_SET: 0,
  WIFI: 1,
  CELL: 2
};

/**
 * @return {!proto.location.unified.VisibleNetwork.TypeCase}
 */
proto.location.unified.VisibleNetwork.prototype.getTypeCase = function() {
  return /** @type {!proto.location.unified.VisibleNetwork.TypeCase} */(jspb.Message.computeOneofCase(this, proto.location.unified.VisibleNetwork.oneofGroups_[0]));
};



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.location.unified.VisibleNetwork.prototype.toObject = function(opt_includeInstance) {
  return proto.location.unified.VisibleNetwork.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.location.unified.VisibleNetwork} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.location.unified.VisibleNetwork.toObject = function(includeInstance, msg) {
  let f, obj = {
    wifi: (f = msg.getWifi()) && proto.location.unified.VisibleNetwork.WiFi.toObject(includeInstance, f),
    cell: (f = msg.getCell()) && proto.location.unified.VisibleNetwork.Cell.toObject(includeInstance, f),
    connected: (f = jspb.Message.getBooleanField(msg, 3)) == null ? undefined : f,
    timestampMs: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of VisibleNetwork as accepted by the `fromObject` method.
 * @record
 */
proto.location.unified.VisibleNetwork.ObjectFormat = function() {
  /** @type {?proto.location.unified.VisibleNetwork.WiFi.ObjectFormat|undefined} */
  this.wifi;

  /** @type {?proto.location.unified.VisibleNetwork.Cell.ObjectFormat|undefined} */
  this.cell;

  /** @type {?boolean|undefined} */
  this.connected;

  /** @type {?number|undefined} */
  this.timestampMs;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.location.unified.VisibleNetwork.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.location.unified.VisibleNetwork}
 */
proto.location.unified.VisibleNetwork.fromObject = function(obj) {
  const msg = new proto.location.unified.VisibleNetwork();
  obj.wifi && jspb.Message.setOneofWrapperField(
      msg, 1, proto.location.unified.VisibleNetwork.oneofGroups_[0], proto.location.unified.VisibleNetwork.WiFi.fromObject(obj.wifi));
  obj.cell && jspb.Message.setOneofWrapperField(
      msg, 2, proto.location.unified.VisibleNetwork.oneofGroups_[0], proto.location.unified.VisibleNetwork.Cell.fromObject(obj.cell));
  obj.connected != null && jspb.Message.setField(msg, 3, obj.connected);
  obj.timestampMs != null && jspb.Message.setField(msg, 4, obj.timestampMs);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.location.unified.VisibleNetwork}
 */
proto.location.unified.VisibleNetwork.deserializeBinary = function(bytes) {
  return proto.location.unified.VisibleNetwork.deserializeBinaryFromReader(
      new proto.location.unified.VisibleNetwork(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.location.unified.VisibleNetwork} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.location.unified.VisibleNetwork}
 */
proto.location.unified.VisibleNetwork.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = new proto.location.unified.VisibleNetwork.WiFi();
      reader.readMessage(value,proto.location.unified.VisibleNetwork.WiFi.deserializeBinaryFromReader);
      msg.setWifi(value);
      break;
    case 2:
      value = new proto.location.unified.VisibleNetwork.Cell();
      reader.readMessage(value,proto.location.unified.VisibleNetwork.Cell.deserializeBinaryFromReader);
      msg.setCell(value);
      break;
    case 3:
      value = /** @type {boolean} */ (reader.readBool());
      msg.setConnected(value);
      break;
    case 4:
      value = /** @type {number} */ (reader.readInt64());
      msg.setTimestampMs(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.location.unified.VisibleNetwork.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.location.unified.VisibleNetwork.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.location.unified.VisibleNetwork} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.location.unified.VisibleNetwork.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = message.getWifi();
  if (f != null) {
    writer.writeMessage(
      1,
      f,
      proto.location.unified.VisibleNetwork.WiFi.serializeBinaryToWriter
    );
  }
  f = message.getCell();
  if (f != null) {
    writer.writeMessage(
      2,
      f,
      proto.location.unified.VisibleNetwork.Cell.serializeBinaryToWriter
    );
  }
  f = /** @type {?boolean} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeBool(
      3,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 4));
  if (f != null) {
    writer.writeInt64(
      4,
      f
    );
  }
};





if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.location.unified.VisibleNetwork.WiFi.prototype.toObject = function(opt_includeInstance) {
  return proto.location.unified.VisibleNetwork.WiFi.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.location.unified.VisibleNetwork.WiFi} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.location.unified.VisibleNetwork.WiFi.toObject = function(includeInstance, msg) {
  let f, obj = {
    bssid: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    levelDbm: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of WiFi as accepted by the `fromObject` method.
 * @record
 */
proto.location.unified.VisibleNetwork.WiFi.ObjectFormat = function() {
  /** @type {?string|undefined} */
  this.bssid;

  /** @type {?number|undefined} */
  this.levelDbm;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.location.unified.VisibleNetwork.WiFi.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.location.unified.VisibleNetwork.WiFi}
 */
proto.location.unified.VisibleNetwork.WiFi.fromObject = function(obj) {
  const msg = new proto.location.unified.VisibleNetwork.WiFi();
  obj.bssid != null && jspb.Message.setField(msg, 1, obj.bssid);
  obj.levelDbm != null && jspb.Message.setField(msg, 2, obj.levelDbm);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.location.unified.VisibleNetwork.WiFi}
 */
proto.location.unified.VisibleNetwork.WiFi.deserializeBinary = function(bytes) {
  return proto.location.unified.VisibleNetwork.WiFi.deserializeBinaryFromReader(
      new proto.location.unified.VisibleNetwork.WiFi(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.location.unified.VisibleNetwork.WiFi} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.location.unified.VisibleNetwork.WiFi}
 */
proto.location.unified.VisibleNetwork.WiFi.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {string} */ (reader.readString());
      msg.setBssid(value);
      break;
    case 2:
      value = /** @type {number} */ (reader.readInt32());
      msg.setLevelDbm(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.location.unified.VisibleNetwork.WiFi.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.location.unified.VisibleNetwork.WiFi.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.location.unified.VisibleNetwork.WiFi} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.location.unified.VisibleNetwork.WiFi.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {?string} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeString(
      1,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeInt32(
      2,
      f
    );
  }
};


/**
 * optional string bssid = 1;
 * @return {?string}
 */
proto.location.unified.VisibleNetwork.WiFi.prototype.getBssid = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 1));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.location.unified.VisibleNetwork.WiFi} returns this
 */
proto.location.unified.VisibleNetwork.WiFi.prototype.setBssid = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.VisibleNetwork.WiFi} returns this
 */
proto.location.unified.VisibleNetwork.WiFi.prototype.clearBssid = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.VisibleNetwork.WiFi.prototype.hasBssid = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional int32 level_dbm = 2;
 * @return {?number}
 */
proto.location.unified.VisibleNetwork.WiFi.prototype.getLevelDbm = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 2));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.location.unified.VisibleNetwork.WiFi} returns this
 */
proto.location.unified.VisibleNetwork.WiFi.prototype.setLevelDbm = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.VisibleNetwork.WiFi} returns this
 */
proto.location.unified.VisibleNetwork.WiFi.prototype.clearLevelDbm = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.VisibleNetwork.WiFi.prototype.hasLevelDbm = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.location.unified.VisibleNetwork.WiFi}
 */
proto.location.unified.VisibleNetwork.WiFi.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.location.unified.VisibleNetwork.WiFi, data);
};





if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.location.unified.VisibleNetwork.Cell.prototype.toObject = function(opt_includeInstance) {
  return proto.location.unified.VisibleNetwork.Cell.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.location.unified.VisibleNetwork.Cell} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.location.unified.VisibleNetwork.Cell.toObject = function(includeInstance, msg) {
  let f, obj = {
    type: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    cellId: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f,
    locationAreaCode: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f,
    mobileCountryCode: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f,
    mobileNetworkCode: (f = jspb.Message.getField(msg, 5)) == null ? undefined : f,
    primaryScramblingCode: (f = jspb.Message.getField(msg, 6)) == null ? undefined : f,
    physicalCellId: (f = jspb.Message.getField(msg, 7)) == null ? undefined : f,
    trackingAreaCode: (f = jspb.Message.getField(msg, 8)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of Cell as accepted by the `fromObject` method.
 * @record
 */
proto.location.unified.VisibleNetwork.Cell.ObjectFormat = function() {
  /** @type {?number|undefined} */
  this.type;

  /** @type {?number|undefined} */
  this.cellId;

  /** @type {?number|undefined} */
  this.locationAreaCode;

  /** @type {?number|undefined} */
  this.mobileCountryCode;

  /** @type {?number|undefined} */
  this.mobileNetworkCode;

  /** @type {?number|undefined} */
  this.primaryScramblingCode;

  /** @type {?number|undefined} */
  this.physicalCellId;

  /** @type {?number|undefined} */
  this.trackingAreaCode;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.location.unified.VisibleNetwork.Cell.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.location.unified.VisibleNetwork.Cell}
 */
proto.location.unified.VisibleNetwork.Cell.fromObject = function(obj) {
  const msg = new proto.location.unified.VisibleNetwork.Cell();
  obj.type != null && jspb.Message.setField(msg, 1, obj.type);
  obj.cellId != null && jspb.Message.setField(msg, 2, obj.cellId);
  obj.locationAreaCode != null && jspb.Message.setField(msg, 3, obj.locationAreaCode);
  obj.mobileCountryCode != null && jspb.Message.setField(msg, 4, obj.mobileCountryCode);
  obj.mobileNetworkCode != null && jspb.Message.setField(msg, 5, obj.mobileNetworkCode);
  obj.primaryScramblingCode != null && jspb.Message.setField(msg, 6, obj.primaryScramblingCode);
  obj.physicalCellId != null && jspb.Message.setField(msg, 7, obj.physicalCellId);
  obj.trackingAreaCode != null && jspb.Message.setField(msg, 8, obj.trackingAreaCode);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.location.unified.VisibleNetwork.Cell}
 */
proto.location.unified.VisibleNetwork.Cell.deserializeBinary = function(bytes) {
  return proto.location.unified.VisibleNetwork.Cell.deserializeBinaryFromReader(
      new proto.location.unified.VisibleNetwork.Cell(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.location.unified.VisibleNetwork.Cell} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.location.unified.VisibleNetwork.Cell}
 */
proto.location.unified.VisibleNetwork.Cell.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {!proto.location.unified.VisibleNetwork.Cell.Type} */ (reader.readEnum());
      msg.setType(value);
      break;
    case 2:
      value = /** @type {number} */ (reader.readInt32());
      msg.setCellId(value);
      break;
    case 3:
      value = /** @type {number} */ (reader.readInt32());
      msg.setLocationAreaCode(value);
      break;
    case 4:
      value = /** @type {number} */ (reader.readInt32());
      msg.setMobileCountryCode(value);
      break;
    case 5:
      value = /** @type {number} */ (reader.readInt32());
      msg.setMobileNetworkCode(value);
      break;
    case 6:
      value = /** @type {number} */ (reader.readInt32());
      msg.setPrimaryScramblingCode(value);
      break;
    case 7:
      value = /** @type {number} */ (reader.readInt32());
      msg.setPhysicalCellId(value);
      break;
    case 8:
      value = /** @type {number} */ (reader.readInt32());
      msg.setTrackingAreaCode(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.location.unified.VisibleNetwork.Cell.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.location.unified.VisibleNetwork.Cell.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.location.unified.VisibleNetwork.Cell} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.location.unified.VisibleNetwork.Cell.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {!proto.location.unified.VisibleNetwork.Cell.Type} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeEnum(
      1,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeInt32(
      2,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeInt32(
      3,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 4));
  if (f != null) {
    writer.writeInt32(
      4,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 5));
  if (f != null) {
    writer.writeInt32(
      5,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 6));
  if (f != null) {
    writer.writeInt32(
      6,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 7));
  if (f != null) {
    writer.writeInt32(
      7,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 8));
  if (f != null) {
    writer.writeInt32(
      8,
      f
    );
  }
};


/**
 * @enum {number}
 */
proto.location.unified.VisibleNetwork.Cell.Type = {
  UNKNOWN: 0,
  GSM: 1,
  LTE: 2,
  CDMA: 3,
  WCDMA: 4
};

/**
 * optional Type type = 1;
 * @return {!proto.location.unified.VisibleNetwork.Cell.Type}
 */
proto.location.unified.VisibleNetwork.Cell.prototype.getType = function() {
  return /** @type {!proto.location.unified.VisibleNetwork.Cell.Type} */ (jspb.Message.getField(this, 1));
};


/**
 * @param {?proto.location.unified.VisibleNetwork.Cell.Type|undefined} value
 * @return {!proto.location.unified.VisibleNetwork.Cell} returns this
 */
proto.location.unified.VisibleNetwork.Cell.prototype.setType = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.VisibleNetwork.Cell} returns this
 */
proto.location.unified.VisibleNetwork.Cell.prototype.clearType = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.VisibleNetwork.Cell.prototype.hasType = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional int32 cell_id = 2;
 * @return {?number}
 */
proto.location.unified.VisibleNetwork.Cell.prototype.getCellId = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 2));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.location.unified.VisibleNetwork.Cell} returns this
 */
proto.location.unified.VisibleNetwork.Cell.prototype.setCellId = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.VisibleNetwork.Cell} returns this
 */
proto.location.unified.VisibleNetwork.Cell.prototype.clearCellId = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.VisibleNetwork.Cell.prototype.hasCellId = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional int32 location_area_code = 3;
 * @return {?number}
 */
proto.location.unified.VisibleNetwork.Cell.prototype.getLocationAreaCode = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 3));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.location.unified.VisibleNetwork.Cell} returns this
 */
proto.location.unified.VisibleNetwork.Cell.prototype.setLocationAreaCode = function(value) {
  return jspb.Message.setField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.VisibleNetwork.Cell} returns this
 */
proto.location.unified.VisibleNetwork.Cell.prototype.clearLocationAreaCode = function() {
  return jspb.Message.clearField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.VisibleNetwork.Cell.prototype.hasLocationAreaCode = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * optional int32 mobile_country_code = 4;
 * @return {?number}
 */
proto.location.unified.VisibleNetwork.Cell.prototype.getMobileCountryCode = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 4));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.location.unified.VisibleNetwork.Cell} returns this
 */
proto.location.unified.VisibleNetwork.Cell.prototype.setMobileCountryCode = function(value) {
  return jspb.Message.setField(this, 4, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.VisibleNetwork.Cell} returns this
 */
proto.location.unified.VisibleNetwork.Cell.prototype.clearMobileCountryCode = function() {
  return jspb.Message.clearField(this, 4);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.VisibleNetwork.Cell.prototype.hasMobileCountryCode = function() {
  return jspb.Message.hasField(this, 4);
};


/**
 * optional int32 mobile_network_code = 5;
 * @return {?number}
 */
proto.location.unified.VisibleNetwork.Cell.prototype.getMobileNetworkCode = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 5));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.location.unified.VisibleNetwork.Cell} returns this
 */
proto.location.unified.VisibleNetwork.Cell.prototype.setMobileNetworkCode = function(value) {
  return jspb.Message.setField(this, 5, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.VisibleNetwork.Cell} returns this
 */
proto.location.unified.VisibleNetwork.Cell.prototype.clearMobileNetworkCode = function() {
  return jspb.Message.clearField(this, 5);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.VisibleNetwork.Cell.prototype.hasMobileNetworkCode = function() {
  return jspb.Message.hasField(this, 5);
};


/**
 * optional int32 primary_scrambling_code = 6;
 * @return {?number}
 */
proto.location.unified.VisibleNetwork.Cell.prototype.getPrimaryScramblingCode = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 6));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.location.unified.VisibleNetwork.Cell} returns this
 */
proto.location.unified.VisibleNetwork.Cell.prototype.setPrimaryScramblingCode = function(value) {
  return jspb.Message.setField(this, 6, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.VisibleNetwork.Cell} returns this
 */
proto.location.unified.VisibleNetwork.Cell.prototype.clearPrimaryScramblingCode = function() {
  return jspb.Message.clearField(this, 6);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.VisibleNetwork.Cell.prototype.hasPrimaryScramblingCode = function() {
  return jspb.Message.hasField(this, 6);
};


/**
 * optional int32 physical_cell_id = 7;
 * @return {?number}
 */
proto.location.unified.VisibleNetwork.Cell.prototype.getPhysicalCellId = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 7));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.location.unified.VisibleNetwork.Cell} returns this
 */
proto.location.unified.VisibleNetwork.Cell.prototype.setPhysicalCellId = function(value) {
  return jspb.Message.setField(this, 7, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.VisibleNetwork.Cell} returns this
 */
proto.location.unified.VisibleNetwork.Cell.prototype.clearPhysicalCellId = function() {
  return jspb.Message.clearField(this, 7);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.VisibleNetwork.Cell.prototype.hasPhysicalCellId = function() {
  return jspb.Message.hasField(this, 7);
};


/**
 * optional int32 tracking_area_code = 8;
 * @return {?number}
 */
proto.location.unified.VisibleNetwork.Cell.prototype.getTrackingAreaCode = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 8));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.location.unified.VisibleNetwork.Cell} returns this
 */
proto.location.unified.VisibleNetwork.Cell.prototype.setTrackingAreaCode = function(value) {
  return jspb.Message.setField(this, 8, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.VisibleNetwork.Cell} returns this
 */
proto.location.unified.VisibleNetwork.Cell.prototype.clearTrackingAreaCode = function() {
  return jspb.Message.clearField(this, 8);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.VisibleNetwork.Cell.prototype.hasTrackingAreaCode = function() {
  return jspb.Message.hasField(this, 8);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.location.unified.VisibleNetwork.Cell}
 */
proto.location.unified.VisibleNetwork.Cell.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.location.unified.VisibleNetwork.Cell, data);
};


/**
 * optional WiFi wifi = 1;
 * @return {?proto.location.unified.VisibleNetwork.WiFi}
 */
proto.location.unified.VisibleNetwork.prototype.getWifi = function() {
  return /** @type{?proto.location.unified.VisibleNetwork.WiFi} */ (
    jspb.Message.getWrapperField(this, proto.location.unified.VisibleNetwork.WiFi, 1));
};


/**
 * @param {?proto.location.unified.VisibleNetwork.WiFi|undefined} value
 * @return {!proto.location.unified.VisibleNetwork} returns this
*/
proto.location.unified.VisibleNetwork.prototype.setWifi = function(value) {
  return jspb.Message.setOneofWrapperField(this, 1, proto.location.unified.VisibleNetwork.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.VisibleNetwork} returns this
 */
proto.location.unified.VisibleNetwork.prototype.clearWifi = function() {
  return jspb.Message.clearOneofWrapperField(this, 1, proto.location.unified.VisibleNetwork.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.VisibleNetwork.prototype.hasWifi = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional Cell cell = 2;
 * @return {?proto.location.unified.VisibleNetwork.Cell}
 */
proto.location.unified.VisibleNetwork.prototype.getCell = function() {
  return /** @type{?proto.location.unified.VisibleNetwork.Cell} */ (
    jspb.Message.getWrapperField(this, proto.location.unified.VisibleNetwork.Cell, 2));
};


/**
 * @param {?proto.location.unified.VisibleNetwork.Cell|undefined} value
 * @return {!proto.location.unified.VisibleNetwork} returns this
*/
proto.location.unified.VisibleNetwork.prototype.setCell = function(value) {
  return jspb.Message.setOneofWrapperField(this, 2, proto.location.unified.VisibleNetwork.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.VisibleNetwork} returns this
 */
proto.location.unified.VisibleNetwork.prototype.clearCell = function() {
  return jspb.Message.clearOneofWrapperField(this, 2, proto.location.unified.VisibleNetwork.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.VisibleNetwork.prototype.hasCell = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional bool connected = 3;
 * @return {?boolean}
 */
proto.location.unified.VisibleNetwork.prototype.getConnected = function() {
  return /** @type {?boolean} */ (jspb.Message.getBooleanField(this, 3));
};


/**
 * @param {?boolean|undefined} value
 * @return {!proto.location.unified.VisibleNetwork} returns this
 */
proto.location.unified.VisibleNetwork.prototype.setConnected = function(value) {
  return jspb.Message.setField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.VisibleNetwork} returns this
 */
proto.location.unified.VisibleNetwork.prototype.clearConnected = function() {
  return jspb.Message.clearField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.VisibleNetwork.prototype.hasConnected = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * optional int64 timestamp_ms = 4;
 * @return {?number}
 */
proto.location.unified.VisibleNetwork.prototype.getTimestampMs = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 4));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.location.unified.VisibleNetwork} returns this
 */
proto.location.unified.VisibleNetwork.prototype.setTimestampMs = function(value) {
  return jspb.Message.setField(this, 4, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.VisibleNetwork} returns this
 */
proto.location.unified.VisibleNetwork.prototype.clearTimestampMs = function() {
  return jspb.Message.clearField(this, 4);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.VisibleNetwork.prototype.hasTimestampMs = function() {
  return jspb.Message.hasField(this, 4);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.location.unified.VisibleNetwork}
 */
proto.location.unified.VisibleNetwork.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.location.unified.VisibleNetwork, data);
};



//location/unified/proto/location_descriptor_proto_jspb/locationdescriptor.jspb.js
// source: location/unified/proto/location_descriptor.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.location.unified.LocationDescriptor');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.location.unified.FeatureIdProto');
goog.require('proto.location.unified.LatLng');
goog.require('proto.location.unified.LatLngRect');
goog.require('proto.location.unified.LocationAttributesProto');
goog.require('proto.location.unified.PresenceInterval');
goog.require('proto.location.unified.SemanticPlace');
goog.require('proto.location.unified.VisibleNetwork');
goog.requireType('jspb.ByteSource');
goog.requireType('proto.location.unified.LocationProducer');
goog.requireType('proto.location.unified.LocationProvenance');
goog.requireType('proto.location.unified.LocationRole');
goog.requireType('proto.location.unified.LocationSemantic');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.location.unified.LocationDescriptor = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, proto.location.unified.LocationDescriptor.repeatedFields_, null);
};
goog.inherits(proto.location.unified.LocationDescriptor, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.location.unified.LocationDescriptor.displayName = 'proto.location.unified.LocationDescriptor';
}

/**
 * List of repeated fields within this message type.
 * @private {!Array<number>}
 * @const
 */
proto.location.unified.LocationDescriptor.repeatedFields_ = [21,22,23,24];



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.location.unified.LocationDescriptor.prototype.toObject = function(opt_includeInstance) {
  return proto.location.unified.LocationDescriptor.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.location.unified.LocationDescriptor} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.location.unified.LocationDescriptor.toObject = function(includeInstance, msg) {
  let f, obj = {
    role: jspb.Message.getFieldWithDefault(msg, 1, 0),
    producer: jspb.Message.getFieldWithDefault(msg, 2, 0),
    timestamp: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f,
    loc: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f,
    latlng: (f = msg.getLatlng()) && proto.location.unified.LatLng.toObject(includeInstance, f),
    latlngSpan: (f = msg.getLatlngSpan()) && proto.location.unified.LatLng.toObject(includeInstance, f),
    rect: (f = msg.getRect()) && proto.location.unified.LatLngRect.toObject(includeInstance, f),
    radius: (f = jspb.Message.getOptionalFloatingPointField(msg, 7)) == null ? undefined : f,
    confidence: jspb.Message.getIntegerFieldWithDefault(msg, 8, 100),
    featureId: (f = msg.getFeatureId()) && proto.location.unified.FeatureIdProto.toObject(includeInstance, f),
    mid: (f = jspb.Message.getField(msg, 16)) == null ? undefined : f,
    levelFeatureId: (f = msg.getLevelFeatureId()) && proto.location.unified.FeatureIdProto.toObject(includeInstance, f),
    levelNumber: (f = jspb.Message.getOptionalFloatingPointField(msg, 18)) == null ? undefined : f,
    language: (f = jspb.Message.getField(msg, 11)) == null ? undefined : f,
    provenance: jspb.Message.getFieldWithDefault(msg, 9, 0),
    historicalRole: jspb.Message.getFieldWithDefault(msg, 12, 0),
    historicalProducer: jspb.Message.getFieldWithDefault(msg, 13, 0),
    historicalProminence: (f = jspb.Message.getField(msg, 15)) == null ? undefined : f,
    attributes: (f = msg.getAttributes()) && proto.location.unified.LocationAttributesProto.toObject(includeInstance, f),
    diagnosticInfo: (f = jspb.Message.getField(msg, 20)) == null ? undefined : f,
    semanticList: (f = jspb.Message.getRepeatedField(msg, 21)) == null ? undefined : f,
    semanticPlaceList: jspb.Message.toObjectList(msg.getSemanticPlaceList(),
    proto.location.unified.SemanticPlace.toObject, includeInstance),
    visibleNetworkList: jspb.Message.toObjectList(msg.getVisibleNetworkList(),
    proto.location.unified.VisibleNetwork.toObject, includeInstance),
    presenceIntervalList: jspb.Message.toObjectList(msg.getPresenceIntervalList(),
    proto.location.unified.PresenceInterval.toObject, includeInstance)
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of LocationDescriptor as accepted by the `fromObject` method.
 * @record
 */
proto.location.unified.LocationDescriptor.ObjectFormat = function() {
  /** @type {?number|undefined} */
  this.role;

  /** @type {?number|undefined} */
  this.producer;

  /** @type {?number|undefined} */
  this.timestamp;

  /** @type {?string|undefined} */
  this.loc;

  /** @type {?proto.location.unified.LatLng.ObjectFormat|undefined} */
  this.latlng;

  /** @type {?proto.location.unified.LatLng.ObjectFormat|undefined} */
  this.latlngSpan;

  /** @type {?proto.location.unified.LatLngRect.ObjectFormat|undefined} */
  this.rect;

  /** @type {?number|undefined} */
  this.radius;

  /** @type {?number|undefined} */
  this.confidence;

  /** @type {?proto.location.unified.FeatureIdProto.ObjectFormat|undefined} */
  this.featureId;

  /** @type {?number|undefined} */
  this.mid;

  /** @type {?proto.location.unified.FeatureIdProto.ObjectFormat|undefined} */
  this.levelFeatureId;

  /** @type {?number|undefined} */
  this.levelNumber;

  /** @type {?string|undefined} */
  this.language;

  /** @type {?number|undefined} */
  this.provenance;

  /** @type {?number|undefined} */
  this.historicalRole;

  /** @type {?number|undefined} */
  this.historicalProducer;

  /** @type {?number|undefined} */
  this.historicalProminence;

  /** @type {?proto.location.unified.LocationAttributesProto.ObjectFormat|undefined} */
  this.attributes;

  /** @type {?string|undefined} */
  this.diagnosticInfo;

  /** @type {?Array<number>|undefined} */
  this.semanticList;

  /** @type {?Array<!proto.location.unified.SemanticPlace.ObjectFormat>|undefined} */
  this.semanticPlaceList;

  /** @type {?Array<!proto.location.unified.VisibleNetwork.ObjectFormat>|undefined} */
  this.visibleNetworkList;

  /** @type {?Array<!proto.location.unified.PresenceInterval.ObjectFormat>|undefined} */
  this.presenceIntervalList;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.location.unified.LocationDescriptor.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.location.unified.LocationDescriptor}
 */
proto.location.unified.LocationDescriptor.fromObject = function(obj) {
  const msg = new proto.location.unified.LocationDescriptor();
  obj.role != null && jspb.Message.setField(msg, 1, obj.role);
  obj.producer != null && jspb.Message.setField(msg, 2, obj.producer);
  obj.timestamp != null && jspb.Message.setField(msg, 3, obj.timestamp);
  obj.loc != null && jspb.Message.setField(msg, 4, obj.loc);
  obj.latlng && jspb.Message.setWrapperField(
      msg, 5, proto.location.unified.LatLng.fromObject(obj.latlng));
  obj.latlngSpan && jspb.Message.setWrapperField(
      msg, 6, proto.location.unified.LatLng.fromObject(obj.latlngSpan));
  obj.rect && jspb.Message.setWrapperField(
      msg, 14, proto.location.unified.LatLngRect.fromObject(obj.rect));
  obj.radius != null && jspb.Message.setField(msg, 7, obj.radius);
  obj.confidence != null && jspb.Message.setField(msg, 8, obj.confidence);
  obj.featureId && jspb.Message.setWrapperField(
      msg, 10, proto.location.unified.FeatureIdProto.fromObject(obj.featureId));
  obj.mid != null && jspb.Message.setField(msg, 16, obj.mid);
  obj.levelFeatureId && jspb.Message.setWrapperField(
      msg, 17, proto.location.unified.FeatureIdProto.fromObject(obj.levelFeatureId));
  obj.levelNumber != null && jspb.Message.setField(msg, 18, obj.levelNumber);
  obj.language != null && jspb.Message.setField(msg, 11, obj.language);
  obj.provenance != null && jspb.Message.setField(msg, 9, obj.provenance);
  obj.historicalRole != null && jspb.Message.setField(msg, 12, obj.historicalRole);
  obj.historicalProducer != null && jspb.Message.setField(msg, 13, obj.historicalProducer);
  obj.historicalProminence != null && jspb.Message.setField(msg, 15, obj.historicalProminence);
  obj.attributes && jspb.Message.setWrapperField(
      msg, 19, proto.location.unified.LocationAttributesProto.fromObject(obj.attributes));
  obj.diagnosticInfo != null && jspb.Message.setField(msg, 20, obj.diagnosticInfo);
  obj.semanticList != null && jspb.Message.setField(msg, 21, obj.semanticList);
  obj.semanticPlaceList && jspb.Message.setRepeatedWrapperField(
      msg, 22, obj.semanticPlaceList.map(
          proto.location.unified.SemanticPlace.fromObject));
  obj.visibleNetworkList && jspb.Message.setRepeatedWrapperField(
      msg, 23, obj.visibleNetworkList.map(
          proto.location.unified.VisibleNetwork.fromObject));
  obj.presenceIntervalList && jspb.Message.setRepeatedWrapperField(
      msg, 24, obj.presenceIntervalList.map(
          proto.location.unified.PresenceInterval.fromObject));
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.location.unified.LocationDescriptor}
 */
proto.location.unified.LocationDescriptor.deserializeBinary = function(bytes) {
  return proto.location.unified.LocationDescriptor.deserializeBinaryFromReader(
      new proto.location.unified.LocationDescriptor(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.location.unified.LocationDescriptor} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.location.unified.LocationDescriptor}
 */
proto.location.unified.LocationDescriptor.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {!proto.location.unified.LocationRole} */ (reader.readEnum());
      msg.setRole(value);
      break;
    case 2:
      value = /** @type {!proto.location.unified.LocationProducer} */ (reader.readEnum());
      msg.setProducer(value);
      break;
    case 3:
      value = /** @type {number} */ (reader.readInt64());
      msg.setTimestamp(value);
      break;
    case 4:
      value = /** @type {string} */ (reader.readString());
      msg.setLoc(value);
      break;
    case 5:
      value = new proto.location.unified.LatLng();
      reader.readMessage(value,proto.location.unified.LatLng.deserializeBinaryFromReader);
      msg.setLatlng(value);
      break;
    case 6:
      value = new proto.location.unified.LatLng();
      reader.readMessage(value,proto.location.unified.LatLng.deserializeBinaryFromReader);
      msg.setLatlngSpan(value);
      break;
    case 14:
      value = new proto.location.unified.LatLngRect();
      reader.readMessage(value,proto.location.unified.LatLngRect.deserializeBinaryFromReader);
      msg.setRect(value);
      break;
    case 7:
      value = /** @type {number} */ (reader.readFloat());
      msg.setRadius(value);
      break;
    case 8:
      value = /** @type {number} */ (reader.readInt32());
      msg.setConfidence(value);
      break;
    case 10:
      value = new proto.location.unified.FeatureIdProto();
      reader.readMessage(value,proto.location.unified.FeatureIdProto.deserializeBinaryFromReader);
      msg.setFeatureId(value);
      break;
    case 16:
      value = /** @type {number} */ (reader.readUint64());
      msg.setMid(value);
      break;
    case 17:
      value = new proto.location.unified.FeatureIdProto();
      reader.readMessage(value,proto.location.unified.FeatureIdProto.deserializeBinaryFromReader);
      msg.setLevelFeatureId(value);
      break;
    case 18:
      value = /** @type {number} */ (reader.readFloat());
      msg.setLevelNumber(value);
      break;
    case 11:
      value = /** @type {string} */ (reader.readString());
      msg.setLanguage(value);
      break;
    case 9:
      value = /** @type {!proto.location.unified.LocationProvenance} */ (reader.readEnum());
      msg.setProvenance(value);
      break;
    case 12:
      value = /** @type {!proto.location.unified.LocationRole} */ (reader.readEnum());
      msg.setHistoricalRole(value);
      break;
    case 13:
      value = /** @type {!proto.location.unified.LocationProducer} */ (reader.readEnum());
      msg.setHistoricalProducer(value);
      break;
    case 15:
      value = /** @type {number} */ (reader.readInt32());
      msg.setHistoricalProminence(value);
      break;
    case 19:
      value = new proto.location.unified.LocationAttributesProto();
      reader.readMessage(value,proto.location.unified.LocationAttributesProto.deserializeBinaryFromReader);
      msg.setAttributes(value);
      break;
    case 20:
      value = /** @type {string} */ (reader.readString());
      msg.setDiagnosticInfo(value);
      break;
    case 21:
      value = /** @type {!Array<!proto.location.unified.LocationSemantic>} */ (reader.isDelimited() ? reader.readPackedEnum() : [reader.readEnum()]);
      for (let i = 0; i < value.length; i++) {
        msg.addSemantic(value[i]);
      }
      break;
    case 22:
      value = new proto.location.unified.SemanticPlace();
      reader.readMessage(value,proto.location.unified.SemanticPlace.deserializeBinaryFromReader);
      msg.addSemanticPlace(value);
      break;
    case 23:
      value = new proto.location.unified.VisibleNetwork();
      reader.readMessage(value,proto.location.unified.VisibleNetwork.deserializeBinaryFromReader);
      msg.addVisibleNetwork(value);
      break;
    case 24:
      value = new proto.location.unified.PresenceInterval();
      reader.readMessage(value,proto.location.unified.PresenceInterval.deserializeBinaryFromReader);
      msg.addPresenceInterval(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.location.unified.LocationDescriptor.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.location.unified.LocationDescriptor.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.location.unified.LocationDescriptor} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.location.unified.LocationDescriptor.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {!proto.location.unified.LocationRole} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeEnum(
      1,
      f
    );
  }
  f = /** @type {!proto.location.unified.LocationProducer} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeEnum(
      2,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeInt64(
      3,
      f
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 4));
  if (f != null) {
    writer.writeString(
      4,
      f
    );
  }
  f = message.getLatlng();
  if (f != null) {
    writer.writeMessage(
      5,
      f,
      proto.location.unified.LatLng.serializeBinaryToWriter
    );
  }
  f = message.getLatlngSpan();
  if (f != null) {
    writer.writeMessage(
      6,
      f,
      proto.location.unified.LatLng.serializeBinaryToWriter
    );
  }
  f = message.getRect();
  if (f != null) {
    writer.writeMessage(
      14,
      f,
      proto.location.unified.LatLngRect.serializeBinaryToWriter
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 7));
  if (f != null) {
    writer.writeFloat(
      7,
      f
    );
  }
  f = /** @type {number} */ (jspb.Message.getField(message, 8));
  if (f != null) {
    writer.writeInt32(
      8,
      f
    );
  }
  f = message.getFeatureId();
  if (f != null) {
    writer.writeMessage(
      10,
      f,
      proto.location.unified.FeatureIdProto.serializeBinaryToWriter
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 16));
  if (f != null) {
    writer.writeUint64(
      16,
      f
    );
  }
  f = message.getLevelFeatureId();
  if (f != null) {
    writer.writeMessage(
      17,
      f,
      proto.location.unified.FeatureIdProto.serializeBinaryToWriter
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 18));
  if (f != null) {
    writer.writeFloat(
      18,
      f
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 11));
  if (f != null) {
    writer.writeString(
      11,
      f
    );
  }
  f = /** @type {!proto.location.unified.LocationProvenance} */ (jspb.Message.getField(message, 9));
  if (f != null) {
    writer.writeEnum(
      9,
      f
    );
  }
  f = /** @type {!proto.location.unified.LocationRole} */ (jspb.Message.getField(message, 12));
  if (f != null) {
    writer.writeEnum(
      12,
      f
    );
  }
  f = /** @type {!proto.location.unified.LocationProducer} */ (jspb.Message.getField(message, 13));
  if (f != null) {
    writer.writeEnum(
      13,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 15));
  if (f != null) {
    writer.writeInt32(
      15,
      f
    );
  }
  f = message.getAttributes();
  if (f != null) {
    writer.writeMessage(
      19,
      f,
      proto.location.unified.LocationAttributesProto.serializeBinaryToWriter
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 20));
  if (f != null) {
    writer.writeString(
      20,
      f
    );
  }
  f = message.getSemanticList();
  if (f.length > 0) {
    writer.writeRepeatedEnum(
      21,
      f
    );
  }
  f = message.getSemanticPlaceList();
  if (f.length > 0) {
    writer.writeRepeatedMessage(
      22,
      f,
      proto.location.unified.SemanticPlace.serializeBinaryToWriter
    );
  }
  f = message.getVisibleNetworkList();
  if (f.length > 0) {
    writer.writeRepeatedMessage(
      23,
      f,
      proto.location.unified.VisibleNetwork.serializeBinaryToWriter
    );
  }
  f = message.getPresenceIntervalList();
  if (f.length > 0) {
    writer.writeRepeatedMessage(
      24,
      f,
      proto.location.unified.PresenceInterval.serializeBinaryToWriter
    );
  }
};


/**
 * optional LocationRole role = 1;
 * @return {!proto.location.unified.LocationRole}
 */
proto.location.unified.LocationDescriptor.prototype.getRole = function() {
  return /** @type {!proto.location.unified.LocationRole} */ (jspb.Message.getFieldWithDefault(this, 1, 0));
};


/**
 * @param {?proto.location.unified.LocationRole|undefined} value
 * @return {!proto.location.unified.LocationDescriptor} returns this
 */
proto.location.unified.LocationDescriptor.prototype.setRole = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.LocationDescriptor} returns this
 */
proto.location.unified.LocationDescriptor.prototype.clearRole = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.LocationDescriptor.prototype.hasRole = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional LocationProducer producer = 2;
 * @return {!proto.location.unified.LocationProducer}
 */
proto.location.unified.LocationDescriptor.prototype.getProducer = function() {
  return /** @type {!proto.location.unified.LocationProducer} */ (jspb.Message.getFieldWithDefault(this, 2, 0));
};


/**
 * @param {?proto.location.unified.LocationProducer|undefined} value
 * @return {!proto.location.unified.LocationDescriptor} returns this
 */
proto.location.unified.LocationDescriptor.prototype.setProducer = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.LocationDescriptor} returns this
 */
proto.location.unified.LocationDescriptor.prototype.clearProducer = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.LocationDescriptor.prototype.hasProducer = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional int64 timestamp = 3;
 * @return {?number}
 */
proto.location.unified.LocationDescriptor.prototype.getTimestamp = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 3));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.location.unified.LocationDescriptor} returns this
 */
proto.location.unified.LocationDescriptor.prototype.setTimestamp = function(value) {
  return jspb.Message.setField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.LocationDescriptor} returns this
 */
proto.location.unified.LocationDescriptor.prototype.clearTimestamp = function() {
  return jspb.Message.clearField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.LocationDescriptor.prototype.hasTimestamp = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * optional string loc = 4;
 * @return {?string}
 */
proto.location.unified.LocationDescriptor.prototype.getLoc = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 4));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.location.unified.LocationDescriptor} returns this
 */
proto.location.unified.LocationDescriptor.prototype.setLoc = function(value) {
  return jspb.Message.setField(this, 4, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.LocationDescriptor} returns this
 */
proto.location.unified.LocationDescriptor.prototype.clearLoc = function() {
  return jspb.Message.clearField(this, 4);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.LocationDescriptor.prototype.hasLoc = function() {
  return jspb.Message.hasField(this, 4);
};


/**
 * optional LatLng latlng = 5;
 * @return {?proto.location.unified.LatLng}
 */
proto.location.unified.LocationDescriptor.prototype.getLatlng = function() {
  return /** @type{?proto.location.unified.LatLng} */ (
    jspb.Message.getWrapperField(this, proto.location.unified.LatLng, 5));
};


/**
 * @param {?proto.location.unified.LatLng|undefined} value
 * @return {!proto.location.unified.LocationDescriptor} returns this
*/
proto.location.unified.LocationDescriptor.prototype.setLatlng = function(value) {
  return jspb.Message.setWrapperField(this, 5, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.LocationDescriptor} returns this
 */
proto.location.unified.LocationDescriptor.prototype.clearLatlng = function() {
  return jspb.Message.clearWrapperField(this, 5);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.LocationDescriptor.prototype.hasLatlng = function() {
  return jspb.Message.hasField(this, 5);
};


/**
 * optional LatLng latlng_span = 6;
 * @return {?proto.location.unified.LatLng}
 * @deprecated
 */
proto.location.unified.LocationDescriptor.prototype.getLatlngSpan = function() {
  return /** @type{?proto.location.unified.LatLng} */ (
    jspb.Message.getWrapperField(this, proto.location.unified.LatLng, 6));
};


/**
 * @param {?proto.location.unified.LatLng|undefined} value
 * @return {!proto.location.unified.LocationDescriptor} returns this
 * @deprecated
*/
proto.location.unified.LocationDescriptor.prototype.setLatlngSpan = function(value) {
  return jspb.Message.setWrapperField(this, 6, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.LocationDescriptor} returns this
 * @deprecated
 */
proto.location.unified.LocationDescriptor.prototype.clearLatlngSpan = function() {
  return jspb.Message.clearWrapperField(this, 6);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 * @deprecated
 */
proto.location.unified.LocationDescriptor.prototype.hasLatlngSpan = function() {
  return jspb.Message.hasField(this, 6);
};


/**
 * optional LatLngRect rect = 14;
 * @return {?proto.location.unified.LatLngRect}
 */
proto.location.unified.LocationDescriptor.prototype.getRect = function() {
  return /** @type{?proto.location.unified.LatLngRect} */ (
    jspb.Message.getWrapperField(this, proto.location.unified.LatLngRect, 14));
};


/**
 * @param {?proto.location.unified.LatLngRect|undefined} value
 * @return {!proto.location.unified.LocationDescriptor} returns this
*/
proto.location.unified.LocationDescriptor.prototype.setRect = function(value) {
  return jspb.Message.setWrapperField(this, 14, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.LocationDescriptor} returns this
 */
proto.location.unified.LocationDescriptor.prototype.clearRect = function() {
  return jspb.Message.clearWrapperField(this, 14);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.LocationDescriptor.prototype.hasRect = function() {
  return jspb.Message.hasField(this, 14);
};


/**
 * optional float radius = 7;
 * @return {?number}
 */
proto.location.unified.LocationDescriptor.prototype.getRadius = function() {
  return /** @type {?number} */ (jspb.Message.getOptionalFloatingPointField(this, 7));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.location.unified.LocationDescriptor} returns this
 */
proto.location.unified.LocationDescriptor.prototype.setRadius = function(value) {
  return jspb.Message.setField(this, 7, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.LocationDescriptor} returns this
 */
proto.location.unified.LocationDescriptor.prototype.clearRadius = function() {
  return jspb.Message.clearField(this, 7);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.LocationDescriptor.prototype.hasRadius = function() {
  return jspb.Message.hasField(this, 7);
};


/**
 * optional int32 confidence = 8;
 * @return {number}
 */
proto.location.unified.LocationDescriptor.prototype.getConfidence = function() {
  return jspb.Message.getIntegerFieldWithDefault(this, 8, 100);
};


/**
 * @param {?number|undefined} value
 * @return {!proto.location.unified.LocationDescriptor} returns this
 */
proto.location.unified.LocationDescriptor.prototype.setConfidence = function(value) {
  return jspb.Message.setField(this, 8, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.LocationDescriptor} returns this
 */
proto.location.unified.LocationDescriptor.prototype.clearConfidence = function() {
  return jspb.Message.clearField(this, 8);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.LocationDescriptor.prototype.hasConfidence = function() {
  return jspb.Message.hasField(this, 8);
};


/**
 * optional FeatureIdProto feature_id = 10;
 * @return {?proto.location.unified.FeatureIdProto}
 */
proto.location.unified.LocationDescriptor.prototype.getFeatureId = function() {
  return /** @type{?proto.location.unified.FeatureIdProto} */ (
    jspb.Message.getWrapperField(this, proto.location.unified.FeatureIdProto, 10));
};


/**
 * @param {?proto.location.unified.FeatureIdProto|undefined} value
 * @return {!proto.location.unified.LocationDescriptor} returns this
*/
proto.location.unified.LocationDescriptor.prototype.setFeatureId = function(value) {
  return jspb.Message.setWrapperField(this, 10, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.LocationDescriptor} returns this
 */
proto.location.unified.LocationDescriptor.prototype.clearFeatureId = function() {
  return jspb.Message.clearWrapperField(this, 10);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.LocationDescriptor.prototype.hasFeatureId = function() {
  return jspb.Message.hasField(this, 10);
};


/**
 * optional uint64 mid = 16;
 * @return {?number}
 */
proto.location.unified.LocationDescriptor.prototype.getMid = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 16));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.location.unified.LocationDescriptor} returns this
 */
proto.location.unified.LocationDescriptor.prototype.setMid = function(value) {
  return jspb.Message.setField(this, 16, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.LocationDescriptor} returns this
 */
proto.location.unified.LocationDescriptor.prototype.clearMid = function() {
  return jspb.Message.clearField(this, 16);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.LocationDescriptor.prototype.hasMid = function() {
  return jspb.Message.hasField(this, 16);
};


/**
 * optional FeatureIdProto level_feature_id = 17;
 * @return {?proto.location.unified.FeatureIdProto}
 */
proto.location.unified.LocationDescriptor.prototype.getLevelFeatureId = function() {
  return /** @type{?proto.location.unified.FeatureIdProto} */ (
    jspb.Message.getWrapperField(this, proto.location.unified.FeatureIdProto, 17));
};


/**
 * @param {?proto.location.unified.FeatureIdProto|undefined} value
 * @return {!proto.location.unified.LocationDescriptor} returns this
*/
proto.location.unified.LocationDescriptor.prototype.setLevelFeatureId = function(value) {
  return jspb.Message.setWrapperField(this, 17, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.LocationDescriptor} returns this
 */
proto.location.unified.LocationDescriptor.prototype.clearLevelFeatureId = function() {
  return jspb.Message.clearWrapperField(this, 17);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.LocationDescriptor.prototype.hasLevelFeatureId = function() {
  return jspb.Message.hasField(this, 17);
};


/**
 * optional float level_number = 18;
 * @return {?number}
 */
proto.location.unified.LocationDescriptor.prototype.getLevelNumber = function() {
  return /** @type {?number} */ (jspb.Message.getOptionalFloatingPointField(this, 18));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.location.unified.LocationDescriptor} returns this
 */
proto.location.unified.LocationDescriptor.prototype.setLevelNumber = function(value) {
  return jspb.Message.setField(this, 18, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.LocationDescriptor} returns this
 */
proto.location.unified.LocationDescriptor.prototype.clearLevelNumber = function() {
  return jspb.Message.clearField(this, 18);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.LocationDescriptor.prototype.hasLevelNumber = function() {
  return jspb.Message.hasField(this, 18);
};


/**
 * optional string language = 11;
 * @return {?string}
 * @deprecated
 */
proto.location.unified.LocationDescriptor.prototype.getLanguage = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 11));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.location.unified.LocationDescriptor} returns this
 * @deprecated
 */
proto.location.unified.LocationDescriptor.prototype.setLanguage = function(value) {
  return jspb.Message.setField(this, 11, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.LocationDescriptor} returns this
 * @deprecated
 */
proto.location.unified.LocationDescriptor.prototype.clearLanguage = function() {
  return jspb.Message.clearField(this, 11);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 * @deprecated
 */
proto.location.unified.LocationDescriptor.prototype.hasLanguage = function() {
  return jspb.Message.hasField(this, 11);
};


/**
 * optional LocationProvenance provenance = 9;
 * @return {!proto.location.unified.LocationProvenance}
 */
proto.location.unified.LocationDescriptor.prototype.getProvenance = function() {
  return /** @type {!proto.location.unified.LocationProvenance} */ (jspb.Message.getFieldWithDefault(this, 9, 0));
};


/**
 * @param {?proto.location.unified.LocationProvenance|undefined} value
 * @return {!proto.location.unified.LocationDescriptor} returns this
 */
proto.location.unified.LocationDescriptor.prototype.setProvenance = function(value) {
  return jspb.Message.setField(this, 9, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.LocationDescriptor} returns this
 */
proto.location.unified.LocationDescriptor.prototype.clearProvenance = function() {
  return jspb.Message.clearField(this, 9);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.LocationDescriptor.prototype.hasProvenance = function() {
  return jspb.Message.hasField(this, 9);
};


/**
 * optional LocationRole historical_role = 12;
 * @return {!proto.location.unified.LocationRole}
 */
proto.location.unified.LocationDescriptor.prototype.getHistoricalRole = function() {
  return /** @type {!proto.location.unified.LocationRole} */ (jspb.Message.getFieldWithDefault(this, 12, 0));
};


/**
 * @param {?proto.location.unified.LocationRole|undefined} value
 * @return {!proto.location.unified.LocationDescriptor} returns this
 */
proto.location.unified.LocationDescriptor.prototype.setHistoricalRole = function(value) {
  return jspb.Message.setField(this, 12, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.LocationDescriptor} returns this
 */
proto.location.unified.LocationDescriptor.prototype.clearHistoricalRole = function() {
  return jspb.Message.clearField(this, 12);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.LocationDescriptor.prototype.hasHistoricalRole = function() {
  return jspb.Message.hasField(this, 12);
};


/**
 * optional LocationProducer historical_producer = 13;
 * @return {!proto.location.unified.LocationProducer}
 */
proto.location.unified.LocationDescriptor.prototype.getHistoricalProducer = function() {
  return /** @type {!proto.location.unified.LocationProducer} */ (jspb.Message.getFieldWithDefault(this, 13, 0));
};


/**
 * @param {?proto.location.unified.LocationProducer|undefined} value
 * @return {!proto.location.unified.LocationDescriptor} returns this
 */
proto.location.unified.LocationDescriptor.prototype.setHistoricalProducer = function(value) {
  return jspb.Message.setField(this, 13, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.LocationDescriptor} returns this
 */
proto.location.unified.LocationDescriptor.prototype.clearHistoricalProducer = function() {
  return jspb.Message.clearField(this, 13);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.LocationDescriptor.prototype.hasHistoricalProducer = function() {
  return jspb.Message.hasField(this, 13);
};


/**
 * optional int32 historical_prominence = 15;
 * @return {?number}
 * @deprecated
 */
proto.location.unified.LocationDescriptor.prototype.getHistoricalProminence = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 15));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.location.unified.LocationDescriptor} returns this
 * @deprecated
 */
proto.location.unified.LocationDescriptor.prototype.setHistoricalProminence = function(value) {
  return jspb.Message.setField(this, 15, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.LocationDescriptor} returns this
 * @deprecated
 */
proto.location.unified.LocationDescriptor.prototype.clearHistoricalProminence = function() {
  return jspb.Message.clearField(this, 15);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 * @deprecated
 */
proto.location.unified.LocationDescriptor.prototype.hasHistoricalProminence = function() {
  return jspb.Message.hasField(this, 15);
};


/**
 * optional LocationAttributesProto attributes = 19;
 * @return {?proto.location.unified.LocationAttributesProto}
 */
proto.location.unified.LocationDescriptor.prototype.getAttributes = function() {
  return /** @type{?proto.location.unified.LocationAttributesProto} */ (
    jspb.Message.getWrapperField(this, proto.location.unified.LocationAttributesProto, 19));
};


/**
 * @param {?proto.location.unified.LocationAttributesProto|undefined} value
 * @return {!proto.location.unified.LocationDescriptor} returns this
*/
proto.location.unified.LocationDescriptor.prototype.setAttributes = function(value) {
  return jspb.Message.setWrapperField(this, 19, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.LocationDescriptor} returns this
 */
proto.location.unified.LocationDescriptor.prototype.clearAttributes = function() {
  return jspb.Message.clearWrapperField(this, 19);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.LocationDescriptor.prototype.hasAttributes = function() {
  return jspb.Message.hasField(this, 19);
};


/**
 * optional string diagnostic_info = 20;
 * @return {?string}
 */
proto.location.unified.LocationDescriptor.prototype.getDiagnosticInfo = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 20));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.location.unified.LocationDescriptor} returns this
 */
proto.location.unified.LocationDescriptor.prototype.setDiagnosticInfo = function(value) {
  return jspb.Message.setField(this, 20, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.location.unified.LocationDescriptor} returns this
 */
proto.location.unified.LocationDescriptor.prototype.clearDiagnosticInfo = function() {
  return jspb.Message.clearField(this, 20);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.location.unified.LocationDescriptor.prototype.hasDiagnosticInfo = function() {
  return jspb.Message.hasField(this, 20);
};


/**
 * repeated LocationSemantic semantic = 21;
 * @return {!Array<!proto.location.unified.LocationSemantic>}
 */
proto.location.unified.LocationDescriptor.prototype.getSemanticList = function() {
  return /** @type {!Array<!proto.location.unified.LocationSemantic>} */ (jspb.Message.getRepeatedField(this, 21));
};


/**
 * @param {Array<!proto.location.unified.LocationSemantic>|undefined} value
 * @return {!proto.location.unified.LocationDescriptor} returns this
 */
proto.location.unified.LocationDescriptor.prototype.setSemanticList = function(value) {
  return jspb.Message.setField(this, 21, value || []);
};


/**
 * @param {!proto.location.unified.LocationSemantic} value
 * @param {number=} opt_index
 * @return {!proto.location.unified.LocationDescriptor} returns this
 */
proto.location.unified.LocationDescriptor.prototype.addSemantic = function(value, opt_index) {
  return jspb.Message.addToRepeatedField(this, 21, value, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.location.unified.LocationDescriptor} returns this
 */
proto.location.unified.LocationDescriptor.prototype.clearSemanticList = function() {
  return jspb.Message.clearRepeatedField(this, 21);
};


/**
 * repeated SemanticPlace semantic_place = 22;
 * @return {!Array<!proto.location.unified.SemanticPlace>}
 */
proto.location.unified.LocationDescriptor.prototype.getSemanticPlaceList = function() {
  return /** @type{!Array<!proto.location.unified.SemanticPlace>} */ (
    jspb.Message.getRepeatedWrapperField(this, proto.location.unified.SemanticPlace, 22));
};


/**
 * @param {Array<!proto.location.unified.SemanticPlace>|undefined} value
 * @return {!proto.location.unified.LocationDescriptor} returns this
*/
proto.location.unified.LocationDescriptor.prototype.setSemanticPlaceList = function(value) {
  return jspb.Message.setRepeatedWrapperField(this, 22, value);
};


/**
 * @param {!proto.location.unified.SemanticPlace=} opt_value
 * @param {number=} opt_index
 * @return {!proto.location.unified.SemanticPlace}
 */
proto.location.unified.LocationDescriptor.prototype.addSemanticPlace = function(opt_value, opt_index) {
  return jspb.Message.addToRepeatedWrapperField(this, 22, opt_value, proto.location.unified.SemanticPlace, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.location.unified.LocationDescriptor} returns this
 */
proto.location.unified.LocationDescriptor.prototype.clearSemanticPlaceList = function() {
  return jspb.Message.clearRepeatedWrapperField(this, 22);
};


/**
 * repeated VisibleNetwork visible_network = 23;
 * @return {!Array<!proto.location.unified.VisibleNetwork>}
 */
proto.location.unified.LocationDescriptor.prototype.getVisibleNetworkList = function() {
  return /** @type{!Array<!proto.location.unified.VisibleNetwork>} */ (
    jspb.Message.getRepeatedWrapperField(this, proto.location.unified.VisibleNetwork, 23));
};


/**
 * @param {Array<!proto.location.unified.VisibleNetwork>|undefined} value
 * @return {!proto.location.unified.LocationDescriptor} returns this
*/
proto.location.unified.LocationDescriptor.prototype.setVisibleNetworkList = function(value) {
  return jspb.Message.setRepeatedWrapperField(this, 23, value);
};


/**
 * @param {!proto.location.unified.VisibleNetwork=} opt_value
 * @param {number=} opt_index
 * @return {!proto.location.unified.VisibleNetwork}
 */
proto.location.unified.LocationDescriptor.prototype.addVisibleNetwork = function(opt_value, opt_index) {
  return jspb.Message.addToRepeatedWrapperField(this, 23, opt_value, proto.location.unified.VisibleNetwork, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.location.unified.LocationDescriptor} returns this
 */
proto.location.unified.LocationDescriptor.prototype.clearVisibleNetworkList = function() {
  return jspb.Message.clearRepeatedWrapperField(this, 23);
};


/**
 * repeated PresenceInterval presence_interval = 24;
 * @return {!Array<!proto.location.unified.PresenceInterval>}
 */
proto.location.unified.LocationDescriptor.prototype.getPresenceIntervalList = function() {
  return /** @type{!Array<!proto.location.unified.PresenceInterval>} */ (
    jspb.Message.getRepeatedWrapperField(this, proto.location.unified.PresenceInterval, 24));
};


/**
 * @param {Array<!proto.location.unified.PresenceInterval>|undefined} value
 * @return {!proto.location.unified.LocationDescriptor} returns this
*/
proto.location.unified.LocationDescriptor.prototype.setPresenceIntervalList = function(value) {
  return jspb.Message.setRepeatedWrapperField(this, 24, value);
};


/**
 * @param {!proto.location.unified.PresenceInterval=} opt_value
 * @param {number=} opt_index
 * @return {!proto.location.unified.PresenceInterval}
 */
proto.location.unified.LocationDescriptor.prototype.addPresenceInterval = function(opt_value, opt_index) {
  return jspb.Message.addToRepeatedWrapperField(this, 24, opt_value, proto.location.unified.PresenceInterval, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.location.unified.LocationDescriptor} returns this
 */
proto.location.unified.LocationDescriptor.prototype.clearPresenceIntervalList = function() {
  return jspb.Message.clearRepeatedWrapperField(this, 24);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.location.unified.LocationDescriptor}
 */
proto.location.unified.LocationDescriptor.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.location.unified.LocationDescriptor, data);
};



//speech/tts/public/lucid/voice_selection_proto_jspb/voiceattribute.jspb.js
// source: speech/tts/public/lucid/voice_selection.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.lucid.VoiceAttribute');
goog.provide('proto.speech.tts.lucid.VoiceAttribute.AttributeCase');
goog.provide('proto.speech.tts.lucid.VoiceAttribute.Feature');
goog.provide('proto.speech.tts.lucid.VoiceAttribute.Gender');
goog.provide('proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency');
goog.provide('proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency.Proficiency');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.lucid.VoiceAttribute = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, proto.speech.tts.lucid.VoiceAttribute.oneofGroups_);
};
goog.inherits(proto.speech.tts.lucid.VoiceAttribute, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.lucid.VoiceAttribute.displayName = 'proto.speech.tts.lucid.VoiceAttribute';
}
/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency.displayName = 'proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency';
}

/**
 * Oneof group definitions for this message. Each group defines the field
 * numbers belonging to that group. When of these fields' value is set, all
 * other fields in the group are cleared. During deserialization, if multiple
 * fields are encountered for a group, only the last value seen will be kept.
 * @private {!Array<!Array<number>>}
 * @const
 */
proto.speech.tts.lucid.VoiceAttribute.oneofGroups_ = [[1,2,3,4]];

/**
 * @enum {number}
 */
proto.speech.tts.lucid.VoiceAttribute.AttributeCase = {
  ATTRIBUTE_NOT_SET: 0,
  SPEAKER_NAME: 1,
  SUPPORTED_FEATURE: 2,
  LANGUAGE_PROFICIENCY: 3,
  GENDER: 4
};

/**
 * @return {!proto.speech.tts.lucid.VoiceAttribute.AttributeCase}
 */
proto.speech.tts.lucid.VoiceAttribute.prototype.getAttributeCase = function() {
  return /** @type {!proto.speech.tts.lucid.VoiceAttribute.AttributeCase} */(jspb.Message.computeOneofCase(this, proto.speech.tts.lucid.VoiceAttribute.oneofGroups_[0]));
};



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.lucid.VoiceAttribute.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.lucid.VoiceAttribute.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.lucid.VoiceAttribute} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.VoiceAttribute.toObject = function(includeInstance, msg) {
  let f, obj = {
    speakerName: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    supportedFeature: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f,
    languageProficiency: (f = msg.getLanguageProficiency()) && proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency.toObject(includeInstance, f),
    gender: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of VoiceAttribute as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.lucid.VoiceAttribute.ObjectFormat = function() {
  /** @type {?string|undefined} */
  this.speakerName;

  /** @type {?number|undefined} */
  this.supportedFeature;

  /** @type {?proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency.ObjectFormat|undefined} */
  this.languageProficiency;

  /** @type {?number|undefined} */
  this.gender;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.lucid.VoiceAttribute.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.lucid.VoiceAttribute}
 */
proto.speech.tts.lucid.VoiceAttribute.fromObject = function(obj) {
  const msg = new proto.speech.tts.lucid.VoiceAttribute();
  obj.speakerName != null && jspb.Message.setOneofField(msg, 1, proto.speech.tts.lucid.VoiceAttribute.oneofGroups_[0], obj.speakerName);
  obj.supportedFeature != null && jspb.Message.setOneofField(msg, 2, proto.speech.tts.lucid.VoiceAttribute.oneofGroups_[0], obj.supportedFeature);
  obj.languageProficiency && jspb.Message.setOneofWrapperField(
      msg, 3, proto.speech.tts.lucid.VoiceAttribute.oneofGroups_[0], proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency.fromObject(obj.languageProficiency));
  obj.gender != null && jspb.Message.setOneofField(msg, 4, proto.speech.tts.lucid.VoiceAttribute.oneofGroups_[0], obj.gender);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.lucid.VoiceAttribute}
 */
proto.speech.tts.lucid.VoiceAttribute.deserializeBinary = function(bytes) {
  return proto.speech.tts.lucid.VoiceAttribute.deserializeBinaryFromReader(
      new proto.speech.tts.lucid.VoiceAttribute(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.lucid.VoiceAttribute} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.lucid.VoiceAttribute}
 */
proto.speech.tts.lucid.VoiceAttribute.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {string} */ (reader.readString());
      msg.setSpeakerName(value);
      break;
    case 2:
      value = /** @type {!proto.speech.tts.lucid.VoiceAttribute.Feature} */ (reader.readEnum());
      msg.setSupportedFeature(value);
      break;
    case 3:
      value = new proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency();
      reader.readMessage(value,proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency.deserializeBinaryFromReader);
      msg.setLanguageProficiency(value);
      break;
    case 4:
      value = /** @type {!proto.speech.tts.lucid.VoiceAttribute.Gender} */ (reader.readEnum());
      msg.setGender(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.lucid.VoiceAttribute.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.lucid.VoiceAttribute.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.lucid.VoiceAttribute} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.VoiceAttribute.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {?string} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeString(
      1,
      f
    );
  }
  f = /** @type {!proto.speech.tts.lucid.VoiceAttribute.Feature} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeEnum(
      2,
      f
    );
  }
  f = message.getLanguageProficiency();
  if (f != null) {
    writer.writeMessage(
      3,
      f,
      proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency.serializeBinaryToWriter
    );
  }
  f = /** @type {!proto.speech.tts.lucid.VoiceAttribute.Gender} */ (jspb.Message.getField(message, 4));
  if (f != null) {
    writer.writeEnum(
      4,
      f
    );
  }
};


/**
 * @enum {number}
 */
proto.speech.tts.lucid.VoiceAttribute.Feature = {
  UNSPECIFIED_FEATURE: 0,
  UNSPECIFIED_PHONATION: 256,
  STANDARD_PHONATION: 257,
  WHISPER_PHONATION: 258,
  SOFT_PHONATION: 259,
  UNSPECIFIED_STYLE: 512,
  NEUTRAL_STYLE: 528,
  NEWS_STYLE: 544,
  ADVERTISING_STYLE: 560
};

/**
 * @enum {number}
 */
proto.speech.tts.lucid.VoiceAttribute.Gender = {
  UNSPECIFIED_GENDER: 0,
  MALE: 1,
  FEMALE: 2,
  NEUTRAL: 3
};




if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency.toObject = function(includeInstance, msg) {
  let f, obj = {
    language: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    proficiency: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of LanguageProficiency as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency.ObjectFormat = function() {
  /** @type {?string|undefined} */
  this.language;

  /** @type {?number|undefined} */
  this.proficiency;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency}
 */
proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency.fromObject = function(obj) {
  const msg = new proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency();
  obj.language != null && jspb.Message.setField(msg, 1, obj.language);
  obj.proficiency != null && jspb.Message.setField(msg, 2, obj.proficiency);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency}
 */
proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency.deserializeBinary = function(bytes) {
  return proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency.deserializeBinaryFromReader(
      new proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency}
 */
proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {string} */ (reader.readString());
      msg.setLanguage(value);
      break;
    case 2:
      value = /** @type {!proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency.Proficiency} */ (reader.readEnum());
      msg.setProficiency(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {?string} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeString(
      1,
      f
    );
  }
  f = /** @type {!proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency.Proficiency} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeEnum(
      2,
      f
    );
  }
};


/**
 * @enum {number}
 */
proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency.Proficiency = {
  UNSPECIFIED_PROFICIENCY: 0,
  PRIMARY: 256,
  BASIC: 512
};

/**
 * optional string language = 1;
 * @return {?string}
 */
proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency.prototype.getLanguage = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 1));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency} returns this
 */
proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency.prototype.setLanguage = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency} returns this
 */
proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency.prototype.clearLanguage = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency.prototype.hasLanguage = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional Proficiency proficiency = 2;
 * @return {!proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency.Proficiency}
 */
proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency.prototype.getProficiency = function() {
  return /** @type {!proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency.Proficiency} */ (jspb.Message.getField(this, 2));
};


/**
 * @param {?proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency.Proficiency|undefined} value
 * @return {!proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency} returns this
 */
proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency.prototype.setProficiency = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency} returns this
 */
proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency.prototype.clearProficiency = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency.prototype.hasProficiency = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency}
 */
proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency, data);
};


/**
 * optional string speaker_name = 1;
 * @return {?string}
 */
proto.speech.tts.lucid.VoiceAttribute.prototype.getSpeakerName = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 1));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.VoiceAttribute} returns this
 */
proto.speech.tts.lucid.VoiceAttribute.prototype.setSpeakerName = function(value) {
  return jspb.Message.setOneofField(this, 1, proto.speech.tts.lucid.VoiceAttribute.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.VoiceAttribute} returns this
 */
proto.speech.tts.lucid.VoiceAttribute.prototype.clearSpeakerName = function() {
  return jspb.Message.clearOneofField(this, 1, proto.speech.tts.lucid.VoiceAttribute.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.VoiceAttribute.prototype.hasSpeakerName = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional Feature supported_feature = 2;
 * @return {!proto.speech.tts.lucid.VoiceAttribute.Feature}
 */
proto.speech.tts.lucid.VoiceAttribute.prototype.getSupportedFeature = function() {
  return /** @type {!proto.speech.tts.lucid.VoiceAttribute.Feature} */ (jspb.Message.getField(this, 2));
};


/**
 * @param {?proto.speech.tts.lucid.VoiceAttribute.Feature|undefined} value
 * @return {!proto.speech.tts.lucid.VoiceAttribute} returns this
 */
proto.speech.tts.lucid.VoiceAttribute.prototype.setSupportedFeature = function(value) {
  return jspb.Message.setOneofField(this, 2, proto.speech.tts.lucid.VoiceAttribute.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.VoiceAttribute} returns this
 */
proto.speech.tts.lucid.VoiceAttribute.prototype.clearSupportedFeature = function() {
  return jspb.Message.clearOneofField(this, 2, proto.speech.tts.lucid.VoiceAttribute.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.VoiceAttribute.prototype.hasSupportedFeature = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional LanguageProficiency language_proficiency = 3;
 * @return {?proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency}
 */
proto.speech.tts.lucid.VoiceAttribute.prototype.getLanguageProficiency = function() {
  return /** @type{?proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency, 3));
};


/**
 * @param {?proto.speech.tts.lucid.VoiceAttribute.LanguageProficiency|undefined} value
 * @return {!proto.speech.tts.lucid.VoiceAttribute} returns this
*/
proto.speech.tts.lucid.VoiceAttribute.prototype.setLanguageProficiency = function(value) {
  return jspb.Message.setOneofWrapperField(this, 3, proto.speech.tts.lucid.VoiceAttribute.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.VoiceAttribute} returns this
 */
proto.speech.tts.lucid.VoiceAttribute.prototype.clearLanguageProficiency = function() {
  return jspb.Message.clearOneofWrapperField(this, 3, proto.speech.tts.lucid.VoiceAttribute.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.VoiceAttribute.prototype.hasLanguageProficiency = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * optional Gender gender = 4;
 * @return {!proto.speech.tts.lucid.VoiceAttribute.Gender}
 */
proto.speech.tts.lucid.VoiceAttribute.prototype.getGender = function() {
  return /** @type {!proto.speech.tts.lucid.VoiceAttribute.Gender} */ (jspb.Message.getField(this, 4));
};


/**
 * @param {?proto.speech.tts.lucid.VoiceAttribute.Gender|undefined} value
 * @return {!proto.speech.tts.lucid.VoiceAttribute} returns this
 */
proto.speech.tts.lucid.VoiceAttribute.prototype.setGender = function(value) {
  return jspb.Message.setOneofField(this, 4, proto.speech.tts.lucid.VoiceAttribute.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.VoiceAttribute} returns this
 */
proto.speech.tts.lucid.VoiceAttribute.prototype.clearGender = function() {
  return jspb.Message.clearOneofField(this, 4, proto.speech.tts.lucid.VoiceAttribute.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.VoiceAttribute.prototype.hasGender = function() {
  return jspb.Message.hasField(this, 4);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.lucid.VoiceAttribute}
 */
proto.speech.tts.lucid.VoiceAttribute.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.lucid.VoiceAttribute, data);
};



//speech/tts/engine/pipeline/resources/voice_params_proto_jspb/speakerparams.jspb.js
// source: speech/tts/engine/pipeline/resources/voice_params.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.SpeakerParams');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.speech.tts.lucid.VoiceAttribute');
goog.requireType('jspb.ByteSource');
goog.requireType('proto.speech.Voice.LaunchStatus');
goog.requireType('proto.speech.Voice.Usage');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.SpeakerParams = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, proto.speech.tts.SpeakerParams.repeatedFields_, null);
};
goog.inherits(proto.speech.tts.SpeakerParams, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.SpeakerParams.displayName = 'proto.speech.tts.SpeakerParams';
}

/**
 * List of repeated fields within this message type.
 * @private {!Array<number>}
 * @const
 */
proto.speech.tts.SpeakerParams.repeatedFields_ = [9,12];



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.SpeakerParams.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.SpeakerParams.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.SpeakerParams} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.SpeakerParams.toObject = function(includeInstance, msg) {
  let f, obj = {
    speaker: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    runtimeSpeaker: (f = jspb.Message.getField(msg, 13)) == null ? undefined : f,
    gender: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f,
    wavenetSynthesizerRef: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f,
    lstmDurModelRef: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f,
    lstmSpeechModelRef: (f = jspb.Message.getField(msg, 5)) == null ? undefined : f,
    addSpecificationRef: (f = jspb.Message.getField(msg, 6)) == null ? undefined : f,
    outputGain: jspb.Message.getFloatingPointFieldWithDefault(msg, 7, 1.0),
    voiceName: (f = jspb.Message.getField(msg, 8)) == null ? undefined : f,
    aliasList: (f = jspb.Message.getRepeatedField(msg, 9)) == null ? undefined : f,
    usage: (f = jspb.Message.getField(msg, 10)) == null ? undefined : f,
    launchStatus: (f = jspb.Message.getField(msg, 11)) == null ? undefined : f,
    voiceAttributesList: jspb.Message.toObjectList(msg.getVoiceAttributesList(),
    proto.speech.tts.lucid.VoiceAttribute.toObject, includeInstance)
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of SpeakerParams as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.SpeakerParams.ObjectFormat = function() {
  /** @type {?string|undefined} */
  this.speaker;

  /** @type {?string|undefined} */
  this.runtimeSpeaker;

  /** @type {?string|undefined} */
  this.gender;

  /** @type {?string|undefined} */
  this.wavenetSynthesizerRef;

  /** @type {?string|undefined} */
  this.lstmDurModelRef;

  /** @type {?string|undefined} */
  this.lstmSpeechModelRef;

  /** @type {?string|undefined} */
  this.addSpecificationRef;

  /** @type {?number|undefined} */
  this.outputGain;

  /** @type {?string|undefined} */
  this.voiceName;

  /** @type {?Array<string>|undefined} */
  this.aliasList;

  /** @type {?number|undefined} */
  this.usage;

  /** @type {?number|undefined} */
  this.launchStatus;

  /** @type {?Array<!proto.speech.tts.lucid.VoiceAttribute.ObjectFormat>|undefined} */
  this.voiceAttributesList;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.SpeakerParams.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.SpeakerParams}
 */
proto.speech.tts.SpeakerParams.fromObject = function(obj) {
  const msg = new proto.speech.tts.SpeakerParams();
  obj.speaker != null && jspb.Message.setField(msg, 1, obj.speaker);
  obj.runtimeSpeaker != null && jspb.Message.setField(msg, 13, obj.runtimeSpeaker);
  obj.gender != null && jspb.Message.setField(msg, 2, obj.gender);
  obj.wavenetSynthesizerRef != null && jspb.Message.setField(msg, 3, obj.wavenetSynthesizerRef);
  obj.lstmDurModelRef != null && jspb.Message.setField(msg, 4, obj.lstmDurModelRef);
  obj.lstmSpeechModelRef != null && jspb.Message.setField(msg, 5, obj.lstmSpeechModelRef);
  obj.addSpecificationRef != null && jspb.Message.setField(msg, 6, obj.addSpecificationRef);
  obj.outputGain != null && jspb.Message.setField(msg, 7, obj.outputGain);
  obj.voiceName != null && jspb.Message.setField(msg, 8, obj.voiceName);
  obj.aliasList != null && jspb.Message.setField(msg, 9, obj.aliasList);
  obj.usage != null && jspb.Message.setField(msg, 10, obj.usage);
  obj.launchStatus != null && jspb.Message.setField(msg, 11, obj.launchStatus);
  obj.voiceAttributesList && jspb.Message.setRepeatedWrapperField(
      msg, 12, obj.voiceAttributesList.map(
          proto.speech.tts.lucid.VoiceAttribute.fromObject));
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.SpeakerParams}
 */
proto.speech.tts.SpeakerParams.deserializeBinary = function(bytes) {
  return proto.speech.tts.SpeakerParams.deserializeBinaryFromReader(
      new proto.speech.tts.SpeakerParams(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.SpeakerParams} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.SpeakerParams}
 */
proto.speech.tts.SpeakerParams.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {string} */ (reader.readString());
      msg.setSpeaker(value);
      break;
    case 13:
      value = /** @type {string} */ (reader.readString());
      msg.setRuntimeSpeaker(value);
      break;
    case 2:
      value = /** @type {string} */ (reader.readString());
      msg.setGender(value);
      break;
    case 3:
      value = /** @type {string} */ (reader.readString());
      msg.setWavenetSynthesizerRef(value);
      break;
    case 4:
      value = /** @type {string} */ (reader.readString());
      msg.setLstmDurModelRef(value);
      break;
    case 5:
      value = /** @type {string} */ (reader.readString());
      msg.setLstmSpeechModelRef(value);
      break;
    case 6:
      value = /** @type {string} */ (reader.readString());
      msg.setAddSpecificationRef(value);
      break;
    case 7:
      value = /** @type {number} */ (reader.readFloat());
      msg.setOutputGain(value);
      break;
    case 8:
      value = /** @type {string} */ (reader.readString());
      msg.setVoiceName(value);
      break;
    case 9:
      value = /** @type {string} */ (reader.readString());
      msg.addAlias(value);
      break;
    case 10:
      value = /** @type {!proto.speech.Voice.Usage} */ (reader.readEnum());
      msg.setUsage(value);
      break;
    case 11:
      value = /** @type {!proto.speech.Voice.LaunchStatus} */ (reader.readEnum());
      msg.setLaunchStatus(value);
      break;
    case 12:
      value = new proto.speech.tts.lucid.VoiceAttribute();
      reader.readMessage(value,proto.speech.tts.lucid.VoiceAttribute.deserializeBinaryFromReader);
      msg.addVoiceAttributes(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.SpeakerParams.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.SpeakerParams.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.SpeakerParams} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.SpeakerParams.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {?string} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeString(
      1,
      f
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 13));
  if (f != null) {
    writer.writeString(
      13,
      f
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeString(
      2,
      f
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeString(
      3,
      f
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 4));
  if (f != null) {
    writer.writeString(
      4,
      f
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 5));
  if (f != null) {
    writer.writeString(
      5,
      f
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 6));
  if (f != null) {
    writer.writeString(
      6,
      f
    );
  }
  f = /** @type {number} */ (jspb.Message.getField(message, 7));
  if (f != null) {
    writer.writeFloat(
      7,
      f
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 8));
  if (f != null) {
    writer.writeString(
      8,
      f
    );
  }
  f = message.getAliasList();
  if (f.length > 0) {
    writer.writeRepeatedString(
      9,
      f
    );
  }
  f = /** @type {!proto.speech.Voice.Usage} */ (jspb.Message.getField(message, 10));
  if (f != null) {
    writer.writeEnum(
      10,
      f
    );
  }
  f = /** @type {!proto.speech.Voice.LaunchStatus} */ (jspb.Message.getField(message, 11));
  if (f != null) {
    writer.writeEnum(
      11,
      f
    );
  }
  f = message.getVoiceAttributesList();
  if (f.length > 0) {
    writer.writeRepeatedMessage(
      12,
      f,
      proto.speech.tts.lucid.VoiceAttribute.serializeBinaryToWriter
    );
  }
};


/**
 * optional string speaker = 1;
 * @return {?string}
 */
proto.speech.tts.SpeakerParams.prototype.getSpeaker = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 1));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.SpeakerParams} returns this
 */
proto.speech.tts.SpeakerParams.prototype.setSpeaker = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.SpeakerParams} returns this
 */
proto.speech.tts.SpeakerParams.prototype.clearSpeaker = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.SpeakerParams.prototype.hasSpeaker = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional string runtime_speaker = 13;
 * @return {?string}
 */
proto.speech.tts.SpeakerParams.prototype.getRuntimeSpeaker = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 13));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.SpeakerParams} returns this
 */
proto.speech.tts.SpeakerParams.prototype.setRuntimeSpeaker = function(value) {
  return jspb.Message.setField(this, 13, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.SpeakerParams} returns this
 */
proto.speech.tts.SpeakerParams.prototype.clearRuntimeSpeaker = function() {
  return jspb.Message.clearField(this, 13);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.SpeakerParams.prototype.hasRuntimeSpeaker = function() {
  return jspb.Message.hasField(this, 13);
};


/**
 * optional string gender = 2;
 * @return {?string}
 */
proto.speech.tts.SpeakerParams.prototype.getGender = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 2));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.SpeakerParams} returns this
 */
proto.speech.tts.SpeakerParams.prototype.setGender = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.SpeakerParams} returns this
 */
proto.speech.tts.SpeakerParams.prototype.clearGender = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.SpeakerParams.prototype.hasGender = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional string wavenet_synthesizer_ref = 3;
 * @return {?string}
 */
proto.speech.tts.SpeakerParams.prototype.getWavenetSynthesizerRef = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 3));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.SpeakerParams} returns this
 */
proto.speech.tts.SpeakerParams.prototype.setWavenetSynthesizerRef = function(value) {
  return jspb.Message.setField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.SpeakerParams} returns this
 */
proto.speech.tts.SpeakerParams.prototype.clearWavenetSynthesizerRef = function() {
  return jspb.Message.clearField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.SpeakerParams.prototype.hasWavenetSynthesizerRef = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * optional string lstm_dur_model_ref = 4;
 * @return {?string}
 */
proto.speech.tts.SpeakerParams.prototype.getLstmDurModelRef = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 4));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.SpeakerParams} returns this
 */
proto.speech.tts.SpeakerParams.prototype.setLstmDurModelRef = function(value) {
  return jspb.Message.setField(this, 4, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.SpeakerParams} returns this
 */
proto.speech.tts.SpeakerParams.prototype.clearLstmDurModelRef = function() {
  return jspb.Message.clearField(this, 4);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.SpeakerParams.prototype.hasLstmDurModelRef = function() {
  return jspb.Message.hasField(this, 4);
};


/**
 * optional string lstm_speech_model_ref = 5;
 * @return {?string}
 */
proto.speech.tts.SpeakerParams.prototype.getLstmSpeechModelRef = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 5));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.SpeakerParams} returns this
 */
proto.speech.tts.SpeakerParams.prototype.setLstmSpeechModelRef = function(value) {
  return jspb.Message.setField(this, 5, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.SpeakerParams} returns this
 */
proto.speech.tts.SpeakerParams.prototype.clearLstmSpeechModelRef = function() {
  return jspb.Message.clearField(this, 5);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.SpeakerParams.prototype.hasLstmSpeechModelRef = function() {
  return jspb.Message.hasField(this, 5);
};


/**
 * optional string add_specification_ref = 6;
 * @return {?string}
 */
proto.speech.tts.SpeakerParams.prototype.getAddSpecificationRef = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 6));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.SpeakerParams} returns this
 */
proto.speech.tts.SpeakerParams.prototype.setAddSpecificationRef = function(value) {
  return jspb.Message.setField(this, 6, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.SpeakerParams} returns this
 */
proto.speech.tts.SpeakerParams.prototype.clearAddSpecificationRef = function() {
  return jspb.Message.clearField(this, 6);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.SpeakerParams.prototype.hasAddSpecificationRef = function() {
  return jspb.Message.hasField(this, 6);
};


/**
 * optional float output_gain = 7;
 * @return {number}
 */
proto.speech.tts.SpeakerParams.prototype.getOutputGain = function() {
  return jspb.Message.getFloatingPointFieldWithDefault(this, 7, 1.0);
};


/**
 * @param {?number|undefined} value
 * @return {!proto.speech.tts.SpeakerParams} returns this
 */
proto.speech.tts.SpeakerParams.prototype.setOutputGain = function(value) {
  return jspb.Message.setField(this, 7, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.SpeakerParams} returns this
 */
proto.speech.tts.SpeakerParams.prototype.clearOutputGain = function() {
  return jspb.Message.clearField(this, 7);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.SpeakerParams.prototype.hasOutputGain = function() {
  return jspb.Message.hasField(this, 7);
};


/**
 * optional string voice_name = 8;
 * @return {?string}
 */
proto.speech.tts.SpeakerParams.prototype.getVoiceName = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 8));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.SpeakerParams} returns this
 */
proto.speech.tts.SpeakerParams.prototype.setVoiceName = function(value) {
  return jspb.Message.setField(this, 8, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.SpeakerParams} returns this
 */
proto.speech.tts.SpeakerParams.prototype.clearVoiceName = function() {
  return jspb.Message.clearField(this, 8);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.SpeakerParams.prototype.hasVoiceName = function() {
  return jspb.Message.hasField(this, 8);
};


/**
 * repeated string alias = 9;
 * @return {!Array<string>}
 */
proto.speech.tts.SpeakerParams.prototype.getAliasList = function() {
  return /** @type {!Array<string>} */ (jspb.Message.getRepeatedField(this, 9));
};


/**
 * @param {Array<string>|undefined} value
 * @return {!proto.speech.tts.SpeakerParams} returns this
 */
proto.speech.tts.SpeakerParams.prototype.setAliasList = function(value) {
  return jspb.Message.setField(this, 9, value || []);
};


/**
 * @param {string} value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.SpeakerParams} returns this
 */
proto.speech.tts.SpeakerParams.prototype.addAlias = function(value, opt_index) {
  return jspb.Message.addToRepeatedField(this, 9, value, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.SpeakerParams} returns this
 */
proto.speech.tts.SpeakerParams.prototype.clearAliasList = function() {
  return jspb.Message.clearRepeatedField(this, 9);
};


/**
 * optional speech.Voice.Usage usage = 10;
 * @return {!proto.speech.Voice.Usage}
 */
proto.speech.tts.SpeakerParams.prototype.getUsage = function() {
  return /** @type {!proto.speech.Voice.Usage} */ (jspb.Message.getField(this, 10));
};


/**
 * @param {?proto.speech.Voice.Usage|undefined} value
 * @return {!proto.speech.tts.SpeakerParams} returns this
 */
proto.speech.tts.SpeakerParams.prototype.setUsage = function(value) {
  return jspb.Message.setField(this, 10, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.SpeakerParams} returns this
 */
proto.speech.tts.SpeakerParams.prototype.clearUsage = function() {
  return jspb.Message.clearField(this, 10);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.SpeakerParams.prototype.hasUsage = function() {
  return jspb.Message.hasField(this, 10);
};


/**
 * optional speech.Voice.LaunchStatus launch_status = 11;
 * @return {!proto.speech.Voice.LaunchStatus}
 */
proto.speech.tts.SpeakerParams.prototype.getLaunchStatus = function() {
  return /** @type {!proto.speech.Voice.LaunchStatus} */ (jspb.Message.getField(this, 11));
};


/**
 * @param {?proto.speech.Voice.LaunchStatus|undefined} value
 * @return {!proto.speech.tts.SpeakerParams} returns this
 */
proto.speech.tts.SpeakerParams.prototype.setLaunchStatus = function(value) {
  return jspb.Message.setField(this, 11, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.SpeakerParams} returns this
 */
proto.speech.tts.SpeakerParams.prototype.clearLaunchStatus = function() {
  return jspb.Message.clearField(this, 11);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.SpeakerParams.prototype.hasLaunchStatus = function() {
  return jspb.Message.hasField(this, 11);
};


/**
 * repeated lucid.VoiceAttribute voice_attributes = 12;
 * @return {!Array<!proto.speech.tts.lucid.VoiceAttribute>}
 */
proto.speech.tts.SpeakerParams.prototype.getVoiceAttributesList = function() {
  return /** @type{!Array<!proto.speech.tts.lucid.VoiceAttribute>} */ (
    jspb.Message.getRepeatedWrapperField(this, proto.speech.tts.lucid.VoiceAttribute, 12));
};


/**
 * @param {Array<!proto.speech.tts.lucid.VoiceAttribute>|undefined} value
 * @return {!proto.speech.tts.SpeakerParams} returns this
*/
proto.speech.tts.SpeakerParams.prototype.setVoiceAttributesList = function(value) {
  return jspb.Message.setRepeatedWrapperField(this, 12, value);
};


/**
 * @param {!proto.speech.tts.lucid.VoiceAttribute=} opt_value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.lucid.VoiceAttribute}
 */
proto.speech.tts.SpeakerParams.prototype.addVoiceAttributes = function(opt_value, opt_index) {
  return jspb.Message.addToRepeatedWrapperField(this, 12, opt_value, proto.speech.tts.lucid.VoiceAttribute, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.SpeakerParams} returns this
 */
proto.speech.tts.SpeakerParams.prototype.clearVoiceAttributesList = function() {
  return jspb.Message.clearRepeatedWrapperField(this, 12);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.SpeakerParams}
 */
proto.speech.tts.SpeakerParams.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.SpeakerParams, data);
};



//speech/tts/platforms/web/chrome_extension/sha256.js
goog.loadModule(function(exports) {'use strict';goog.module('SHA256');

// SHA256 in javascript.
//
// SHA256 {
//  SHA256();
//  void reset();
//  void update(byte[] data, opt_length);
//  byte[32] digest();
// }

/** @unrestricted */
class SHA256 {
  constructor() {
    this._buf = new Array(64);
    this._W = new Array(64);
    this._pad = new Array(64);
    this._k = [
      0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1,
      0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
      0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786,
      0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
      0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147,
      0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
      0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b,
      0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
      0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a,
      0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
      0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
    ];

    this._pad[0] = 0x80;
    for (var i = 1; i < 64; ++i) {
      this._pad[i] = 0;
    }

    this.reset();
  }

  /** Reset the hasher */
  reset() {
    this._chain = [
      0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c,
      0x1f83d9ab, 0x5be0cd19
    ];

    this._inbuf = 0;
    this._total = 0;
  }

  /**
   * Hash the next block of 64 bytes
   * @param {!Array<number>} buf A 64 byte buffer
   */
  _compress(buf) {
    var W = this._W;
    var k = this._k;

    var _rotr = function(w, r) {
      return ((w << (32 - r)) | (w >>> r));
    };

    // get 16 big endian words
    for (var i = 0; i < 64; i += 4) {
      var w = (buf[i] << 24) | (buf[i + 1] << 16) | (buf[i + 2] << 8) |
          (buf[i + 3]);
      W[i / 4] = w;
    }

    // expand to 64 words
    for (var i = 16; i < 64; ++i) {
      var s0 = _rotr(W[i - 15], 7) ^ _rotr(W[i - 15], 18) ^ (W[i - 15] >>> 3);
      var s1 = _rotr(W[i - 2], 17) ^ _rotr(W[i - 2], 19) ^ (W[i - 2] >>> 10);
      W[i] = (W[i - 16] + s0 + W[i - 7] + s1) & 0xffffffff;
    }

    var A = this._chain[0];
    var B = this._chain[1];
    var C = this._chain[2];
    var D = this._chain[3];
    var E = this._chain[4];
    var F = this._chain[5];
    var G = this._chain[6];
    var H = this._chain[7];

    for (var i = 0; i < 64; ++i) {
      var S0 = _rotr(A, 2) ^ _rotr(A, 13) ^ _rotr(A, 22);
      var maj = (A & B) ^ (A & C) ^ (B & C);
      var t2 = (S0 + maj) & 0xffffffff;
      var S1 = _rotr(E, 6) ^ _rotr(E, 11) ^ _rotr(E, 25);
      var ch = (E & F) ^ ((~E) & G);
      var t1 = (H + S1 + ch + k[i] + W[i]) & 0xffffffff;

      H = G;
      G = F;
      F = E;
      E = (D + t1) & 0xffffffff;
      D = C;
      C = B;
      B = A;
      A = (t1 + t2) & 0xffffffff;
    }

    this._chain[0] += A;
    this._chain[1] += B;
    this._chain[2] += C;
    this._chain[3] += D;
    this._chain[4] += E;
    this._chain[5] += F;
    this._chain[6] += G;
    this._chain[7] += H;
  }

  /**
   * Update the hash with additional data
   * @param {!Array<number>|!Uint8Array} bytes The data
   * @param {number=} opt_length How many bytes to hash, if not all
   */
  update(bytes, opt_length) {
    if (!opt_length) {
      opt_length = bytes.length;
    }

    this._total += opt_length;
    for (var n = 0; n < opt_length; ++n) {
      this._buf[this._inbuf++] = bytes[n];
      if (this._inbuf == 64) {
        this._compress(this._buf);
        this._inbuf = 0;
      }
    }
  }

  /**
   * Update the hash with a specified range from a data buffer
   * @param {!Array<number>} bytes The data buffer
   * @param {number} start Starting index of the range in bytes
   * @param {number} end End index, will not be included in range
   */
  updateRange(bytes, start, end) {
    this._total += (end - start);
    for (var n = start; n < end; ++n) {
      this._buf[this._inbuf++] = bytes[n];
      if (this._inbuf == 64) {
        this._compress(this._buf);
        this._inbuf = 0;
      }
    }
  }

  /**
   * Optionally update the hash with additional arguments, and return the
   * resulting hash value.
   * @param {...*} var_args Data buffers to hash
   * @return {!Array<number>} the SHA256 hash value.
   */
  digest(var_args) {
    for (var i = 0; i < arguments.length; ++i) {
      this.update(arguments[i]);
    }

    var digest = new Array(32);
    var totalBits = this._total * 8;

    // add pad 0x80 0x00*
    if (this._inbuf < 56) {
      this.update(this._pad, 56 - this._inbuf);
    } else {
      this.update(this._pad, 64 - (this._inbuf - 56));
    }

    // add # bits, big endian
    for (var i = 63; i >= 56; --i) {
      this._buf[i] = totalBits & 255;
      totalBits >>>= 8;
    }

    this._compress(this._buf);

    var n = 0;
    for (var i = 0; i < 8; ++i) {
      for (var j = 24; j >= 0; j -= 8) {
        digest[n++] = (this._chain[i] >> j) & 255;
      }
    }

    return digest;
  }

  /**
   * Returns the string digest.
   * @return {string} the SHA256 hash value.
   */
  stringDigest() {
    var digest = this.digest();
    var ret = '';
    for (var i = 0; i < digest.length; i++) {
      var twoBytes = digest[i];
      ret += Number(twoBytes >> 4).toString(16);
      ret += Number(twoBytes & 0x0f).toString(16);
    }
    return ret;
  }
}



exports = SHA256;

;return exports;});

//speech/tts/public/lucid/annotation_proto_jspb/crosslingual.jspb.js
// source: speech/tts/public/lucid/annotation.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.lucid.CrossLingual');
goog.provide('proto.speech.tts.lucid.CrossLingual.Style');
goog.provide('proto.speech.tts.lucid.CrossLingual.VerbalizationStyle');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.lucid.CrossLingual = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, proto.speech.tts.lucid.CrossLingual.repeatedFields_, null);
};
goog.inherits(proto.speech.tts.lucid.CrossLingual, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.lucid.CrossLingual.displayName = 'proto.speech.tts.lucid.CrossLingual';
}

/**
 * List of repeated fields within this message type.
 * @private {!Array<number>}
 * @const
 */
proto.speech.tts.lucid.CrossLingual.repeatedFields_ = [1];



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.lucid.CrossLingual.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.lucid.CrossLingual.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.lucid.CrossLingual} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.CrossLingual.toObject = function(includeInstance, msg) {
  let f, obj = {
    foreignLanguageHintsList: (f = jspb.Message.getRepeatedField(msg, 1)) == null ? undefined : f,
    style: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f,
    verbalizationStyle: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f,
    targetLanguage: (f = jspb.Message.getField(msg, 5)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of CrossLingual as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.lucid.CrossLingual.ObjectFormat = function() {
  /** @type {?Array<string>|undefined} */
  this.foreignLanguageHintsList;

  /** @type {?number|undefined} */
  this.style;

  /** @type {?number|undefined} */
  this.verbalizationStyle;

  /** @type {?string|undefined} */
  this.targetLanguage;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.lucid.CrossLingual.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.lucid.CrossLingual}
 */
proto.speech.tts.lucid.CrossLingual.fromObject = function(obj) {
  const msg = new proto.speech.tts.lucid.CrossLingual();
  obj.foreignLanguageHintsList != null && jspb.Message.setField(msg, 1, obj.foreignLanguageHintsList);
  obj.style != null && jspb.Message.setField(msg, 3, obj.style);
  obj.verbalizationStyle != null && jspb.Message.setField(msg, 4, obj.verbalizationStyle);
  obj.targetLanguage != null && jspb.Message.setField(msg, 5, obj.targetLanguage);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.lucid.CrossLingual}
 */
proto.speech.tts.lucid.CrossLingual.deserializeBinary = function(bytes) {
  return proto.speech.tts.lucid.CrossLingual.deserializeBinaryFromReader(
      new proto.speech.tts.lucid.CrossLingual(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.lucid.CrossLingual} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.lucid.CrossLingual}
 */
proto.speech.tts.lucid.CrossLingual.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {string} */ (reader.readString());
      msg.addForeignLanguageHints(value);
      break;
    case 3:
      value = /** @type {!proto.speech.tts.lucid.CrossLingual.Style} */ (reader.readEnum());
      msg.setStyle(value);
      break;
    case 4:
      value = /** @type {!proto.speech.tts.lucid.CrossLingual.VerbalizationStyle} */ (reader.readEnum());
      msg.setVerbalizationStyle(value);
      break;
    case 5:
      value = /** @type {string} */ (reader.readString());
      msg.setTargetLanguage(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.lucid.CrossLingual.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.lucid.CrossLingual.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.lucid.CrossLingual} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.CrossLingual.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = message.getForeignLanguageHintsList();
  if (f.length > 0) {
    writer.writeRepeatedString(
      1,
      f
    );
  }
  f = /** @type {!proto.speech.tts.lucid.CrossLingual.Style} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeEnum(
      3,
      f
    );
  }
  f = /** @type {!proto.speech.tts.lucid.CrossLingual.VerbalizationStyle} */ (jspb.Message.getField(message, 4));
  if (f != null) {
    writer.writeEnum(
      4,
      f
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 5));
  if (f != null) {
    writer.writeString(
      5,
      f
    );
  }
};


/**
 * @enum {number}
 */
proto.speech.tts.lucid.CrossLingual.Style = {
  UNSPECIFIED_STYLE: 0,
  NATIVE_PRON_PREFERRED: 1,
  FOREIGN_PRON_PREFERRED: 2,
  /** @deprecated */
  EXACT_FOREIGN_PRON_PREFERRED: 3,
  /** @deprecated */
  VOICE_SWITCH_ALLOWED: 4
};

/**
 * @enum {number}
 */
proto.speech.tts.lucid.CrossLingual.VerbalizationStyle = {
  UNSPECIFIED_VERBALIZATION_STYLE: 0,
  NATIVE_VERBALIZATION: 1,
  FOREIGN_VERBALIZATION: 2
};

/**
 * repeated string foreign_language_hints = 1;
 * @return {!Array<string>}
 */
proto.speech.tts.lucid.CrossLingual.prototype.getForeignLanguageHintsList = function() {
  return /** @type {!Array<string>} */ (jspb.Message.getRepeatedField(this, 1));
};


/**
 * @param {Array<string>|undefined} value
 * @return {!proto.speech.tts.lucid.CrossLingual} returns this
 */
proto.speech.tts.lucid.CrossLingual.prototype.setForeignLanguageHintsList = function(value) {
  return jspb.Message.setField(this, 1, value || []);
};


/**
 * @param {string} value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.lucid.CrossLingual} returns this
 */
proto.speech.tts.lucid.CrossLingual.prototype.addForeignLanguageHints = function(value, opt_index) {
  return jspb.Message.addToRepeatedField(this, 1, value, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.lucid.CrossLingual} returns this
 */
proto.speech.tts.lucid.CrossLingual.prototype.clearForeignLanguageHintsList = function() {
  return jspb.Message.clearRepeatedField(this, 1);
};


/**
 * optional Style style = 3;
 * @return {!proto.speech.tts.lucid.CrossLingual.Style}
 */
proto.speech.tts.lucid.CrossLingual.prototype.getStyle = function() {
  return /** @type {!proto.speech.tts.lucid.CrossLingual.Style} */ (jspb.Message.getField(this, 3));
};


/**
 * @param {?proto.speech.tts.lucid.CrossLingual.Style|undefined} value
 * @return {!proto.speech.tts.lucid.CrossLingual} returns this
 */
proto.speech.tts.lucid.CrossLingual.prototype.setStyle = function(value) {
  return jspb.Message.setField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.CrossLingual} returns this
 */
proto.speech.tts.lucid.CrossLingual.prototype.clearStyle = function() {
  return jspb.Message.clearField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.CrossLingual.prototype.hasStyle = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * optional VerbalizationStyle verbalization_style = 4;
 * @return {!proto.speech.tts.lucid.CrossLingual.VerbalizationStyle}
 */
proto.speech.tts.lucid.CrossLingual.prototype.getVerbalizationStyle = function() {
  return /** @type {!proto.speech.tts.lucid.CrossLingual.VerbalizationStyle} */ (jspb.Message.getField(this, 4));
};


/**
 * @param {?proto.speech.tts.lucid.CrossLingual.VerbalizationStyle|undefined} value
 * @return {!proto.speech.tts.lucid.CrossLingual} returns this
 */
proto.speech.tts.lucid.CrossLingual.prototype.setVerbalizationStyle = function(value) {
  return jspb.Message.setField(this, 4, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.CrossLingual} returns this
 */
proto.speech.tts.lucid.CrossLingual.prototype.clearVerbalizationStyle = function() {
  return jspb.Message.clearField(this, 4);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.CrossLingual.prototype.hasVerbalizationStyle = function() {
  return jspb.Message.hasField(this, 4);
};


/**
 * optional string target_language = 5;
 * @return {?string}
 */
proto.speech.tts.lucid.CrossLingual.prototype.getTargetLanguage = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 5));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.CrossLingual} returns this
 */
proto.speech.tts.lucid.CrossLingual.prototype.setTargetLanguage = function(value) {
  return jspb.Message.setField(this, 5, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.CrossLingual} returns this
 */
proto.speech.tts.lucid.CrossLingual.prototype.clearTargetLanguage = function() {
  return jspb.Message.clearField(this, 5);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.CrossLingual.prototype.hasTargetLanguage = function() {
  return jspb.Message.hasField(this, 5);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.lucid.CrossLingual}
 */
proto.speech.tts.lucid.CrossLingual.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.lucid.CrossLingual, data);
};



//speech/tts/public/lucid/lucid_annotation_client_extensions_proto_jspb/lucidannotationclientextensions.jspb.js
// source: speech/tts/public/lucid/lucid_annotation_client_extensions.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.lucid.LucidAnnotationClientExtensions');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.requireType('jspb.ByteSource');
goog.requireType('jspb.ExtensionFieldBinaryInfo');
goog.requireType('jspb.ExtensionFieldInfo');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.lucid.LucidAnnotationClientExtensions = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, 1, null, null);
};
goog.inherits(proto.speech.tts.lucid.LucidAnnotationClientExtensions, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.lucid.LucidAnnotationClientExtensions.displayName = 'proto.speech.tts.lucid.LucidAnnotationClientExtensions';
}

/**
 * The extensions registered with this message class. This is a map of
 * extension field number to fieldInfo object. This field should be considered
 * a private API (it is public because it is needed by other generated code).
 *
 * For example:
 *     { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} }
 *
 * fieldName contains the JsCompiler renamed field name property so that it
 * works in OPTIMIZED mode.
 *
 * @type {!Object<number, jspb.ExtensionFieldInfo>}
 */
proto.speech.tts.lucid.LucidAnnotationClientExtensions.extensions = {};


/**
 * The extensions registered with this message class. This is a map of
 * extension field number to fieldInfo object. This field should be considered
 * a private API (it is public because it is needed by other generated code).
 *
 * For example:
 *     { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} }
 *
 * fieldName contains the JsCompiler renamed field name property so that it
 * works in OPTIMIZED mode.
 *
 * @type {!Object<number, jspb.ExtensionFieldBinaryInfo>}
 */
proto.speech.tts.lucid.LucidAnnotationClientExtensions.extensionsBinary = {};




if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.lucid.LucidAnnotationClientExtensions.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.lucid.LucidAnnotationClientExtensions.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.lucid.LucidAnnotationClientExtensions} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.LucidAnnotationClientExtensions.toObject = function(includeInstance, msg) {
  let f, obj = {

  };

  jspb.Message.toObjectExtension(/** @type {!jspb.Message} */ (msg), obj,
      proto.speech.tts.lucid.LucidAnnotationClientExtensions.extensions, proto.speech.tts.lucid.LucidAnnotationClientExtensions.prototype.getExtension,
      includeInstance);
  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of LucidAnnotationClientExtensions as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.lucid.LucidAnnotationClientExtensions.ObjectFormat = function() {
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.lucid.LucidAnnotationClientExtensions.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.lucid.LucidAnnotationClientExtensions}
 */
proto.speech.tts.lucid.LucidAnnotationClientExtensions.fromObject = function(obj) {
  const msg = new proto.speech.tts.lucid.LucidAnnotationClientExtensions();
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.lucid.LucidAnnotationClientExtensions}
 */
proto.speech.tts.lucid.LucidAnnotationClientExtensions.deserializeBinary = function(bytes) {
  return proto.speech.tts.lucid.LucidAnnotationClientExtensions.deserializeBinaryFromReader(
      new proto.speech.tts.lucid.LucidAnnotationClientExtensions(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.lucid.LucidAnnotationClientExtensions} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.lucid.LucidAnnotationClientExtensions}
 */
proto.speech.tts.lucid.LucidAnnotationClientExtensions.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    switch (reader.getFieldNumber()) {
    default:
      jspb.Message.readBinaryExtension(msg, reader,
        proto.speech.tts.lucid.LucidAnnotationClientExtensions.extensionsBinary,
        proto.speech.tts.lucid.LucidAnnotationClientExtensions.prototype.getExtension,
        proto.speech.tts.lucid.LucidAnnotationClientExtensions.prototype.setExtension);
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.lucid.LucidAnnotationClientExtensions.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.lucid.LucidAnnotationClientExtensions.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.lucid.LucidAnnotationClientExtensions} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.LucidAnnotationClientExtensions.serializeBinaryToWriter = function(message, writer) {
  let f;
  jspb.Message.serializeBinaryExtensions(message, writer,
    proto.speech.tts.lucid.LucidAnnotationClientExtensions.extensionsBinary, proto.speech.tts.lucid.LucidAnnotationClientExtensions.prototype.getExtension);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.lucid.LucidAnnotationClientExtensions}
 */
proto.speech.tts.lucid.LucidAnnotationClientExtensions.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.lucid.LucidAnnotationClientExtensions, data);
};



//speech/tts/public/lucid/prosody_proto_jspb/novelty.jspb.js
// source: speech/tts/public/lucid/prosody.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.lucid.Novelty');
goog.provide('proto.speech.tts.lucid.Novelty.NoveltyLevel');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.lucid.Novelty = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.speech.tts.lucid.Novelty, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.lucid.Novelty.displayName = 'proto.speech.tts.lucid.Novelty';
}



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.lucid.Novelty.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.lucid.Novelty.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.lucid.Novelty} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.Novelty.toObject = function(includeInstance, msg) {
  let f, obj = {
    level: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of Novelty as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.lucid.Novelty.ObjectFormat = function() {
  /** @type {?number|undefined} */
  this.level;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.lucid.Novelty.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.lucid.Novelty}
 */
proto.speech.tts.lucid.Novelty.fromObject = function(obj) {
  const msg = new proto.speech.tts.lucid.Novelty();
  obj.level != null && jspb.Message.setField(msg, 3, obj.level);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.lucid.Novelty}
 */
proto.speech.tts.lucid.Novelty.deserializeBinary = function(bytes) {
  return proto.speech.tts.lucid.Novelty.deserializeBinaryFromReader(
      new proto.speech.tts.lucid.Novelty(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.lucid.Novelty} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.lucid.Novelty}
 */
proto.speech.tts.lucid.Novelty.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 3:
      value = /** @type {!proto.speech.tts.lucid.Novelty.NoveltyLevel} */ (reader.readEnum());
      msg.setLevel(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.lucid.Novelty.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.lucid.Novelty.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.lucid.Novelty} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.Novelty.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {!proto.speech.tts.lucid.Novelty.NoveltyLevel} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeEnum(
      3,
      f
    );
  }
};


/**
 * @enum {number}
 */
proto.speech.tts.lucid.Novelty.NoveltyLevel = {
  UNSPECIFIED_NOVELTY_LEVEL: 0,
  REPETITION: 1,
  RELATED: 2,
  NOVEL: 3,
  UNEXPECTED: 4
};

/**
 * optional NoveltyLevel level = 3;
 * @return {!proto.speech.tts.lucid.Novelty.NoveltyLevel}
 */
proto.speech.tts.lucid.Novelty.prototype.getLevel = function() {
  return /** @type {!proto.speech.tts.lucid.Novelty.NoveltyLevel} */ (jspb.Message.getField(this, 3));
};


/**
 * @param {?proto.speech.tts.lucid.Novelty.NoveltyLevel|undefined} value
 * @return {!proto.speech.tts.lucid.Novelty} returns this
 */
proto.speech.tts.lucid.Novelty.prototype.setLevel = function(value) {
  return jspb.Message.setField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Novelty} returns this
 */
proto.speech.tts.lucid.Novelty.prototype.clearLevel = function() {
  return jspb.Message.clearField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Novelty.prototype.hasLevel = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.lucid.Novelty}
 */
proto.speech.tts.lucid.Novelty.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.lucid.Novelty, data);
};



//speech/tts/public/lucid/prosody_proto_jspb/partialsentenceprosody.jspb.js
// source: speech/tts/public/lucid/prosody.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.lucid.PartialSentenceProsody');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.lucid.PartialSentenceProsody = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.speech.tts.lucid.PartialSentenceProsody, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.lucid.PartialSentenceProsody.displayName = 'proto.speech.tts.lucid.PartialSentenceProsody';
}



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.lucid.PartialSentenceProsody.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.lucid.PartialSentenceProsody.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.lucid.PartialSentenceProsody} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.PartialSentenceProsody.toObject = function(includeInstance, msg) {
  let f, obj = {
    incompleteAtStart: (f = jspb.Message.getBooleanField(msg, 1)) == null ? undefined : f,
    incompleteAtEnd: (f = jspb.Message.getBooleanField(msg, 2)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of PartialSentenceProsody as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.lucid.PartialSentenceProsody.ObjectFormat = function() {
  /** @type {?boolean|undefined} */
  this.incompleteAtStart;

  /** @type {?boolean|undefined} */
  this.incompleteAtEnd;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.lucid.PartialSentenceProsody.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.lucid.PartialSentenceProsody}
 */
proto.speech.tts.lucid.PartialSentenceProsody.fromObject = function(obj) {
  const msg = new proto.speech.tts.lucid.PartialSentenceProsody();
  obj.incompleteAtStart != null && jspb.Message.setField(msg, 1, obj.incompleteAtStart);
  obj.incompleteAtEnd != null && jspb.Message.setField(msg, 2, obj.incompleteAtEnd);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.lucid.PartialSentenceProsody}
 */
proto.speech.tts.lucid.PartialSentenceProsody.deserializeBinary = function(bytes) {
  return proto.speech.tts.lucid.PartialSentenceProsody.deserializeBinaryFromReader(
      new proto.speech.tts.lucid.PartialSentenceProsody(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.lucid.PartialSentenceProsody} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.lucid.PartialSentenceProsody}
 */
proto.speech.tts.lucid.PartialSentenceProsody.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {boolean} */ (reader.readBool());
      msg.setIncompleteAtStart(value);
      break;
    case 2:
      value = /** @type {boolean} */ (reader.readBool());
      msg.setIncompleteAtEnd(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.lucid.PartialSentenceProsody.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.lucid.PartialSentenceProsody.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.lucid.PartialSentenceProsody} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.PartialSentenceProsody.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {?boolean} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeBool(
      1,
      f
    );
  }
  f = /** @type {?boolean} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeBool(
      2,
      f
    );
  }
};


/**
 * optional bool incomplete_at_start = 1;
 * @return {?boolean}
 */
proto.speech.tts.lucid.PartialSentenceProsody.prototype.getIncompleteAtStart = function() {
  return /** @type {?boolean} */ (jspb.Message.getBooleanField(this, 1));
};


/**
 * @param {?boolean|undefined} value
 * @return {!proto.speech.tts.lucid.PartialSentenceProsody} returns this
 */
proto.speech.tts.lucid.PartialSentenceProsody.prototype.setIncompleteAtStart = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.PartialSentenceProsody} returns this
 */
proto.speech.tts.lucid.PartialSentenceProsody.prototype.clearIncompleteAtStart = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.PartialSentenceProsody.prototype.hasIncompleteAtStart = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional bool incomplete_at_end = 2;
 * @return {?boolean}
 */
proto.speech.tts.lucid.PartialSentenceProsody.prototype.getIncompleteAtEnd = function() {
  return /** @type {?boolean} */ (jspb.Message.getBooleanField(this, 2));
};


/**
 * @param {?boolean|undefined} value
 * @return {!proto.speech.tts.lucid.PartialSentenceProsody} returns this
 */
proto.speech.tts.lucid.PartialSentenceProsody.prototype.setIncompleteAtEnd = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.PartialSentenceProsody} returns this
 */
proto.speech.tts.lucid.PartialSentenceProsody.prototype.clearIncompleteAtEnd = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.PartialSentenceProsody.prototype.hasIncompleteAtEnd = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.lucid.PartialSentenceProsody}
 */
proto.speech.tts.lucid.PartialSentenceProsody.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.lucid.PartialSentenceProsody, data);
};



//speech/tts/public/lucid/prosody_proto_jspb/prominence.jspb.js
// source: speech/tts/public/lucid/prosody.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.lucid.Prominence');
goog.provide('proto.speech.tts.lucid.Prominence.ProminenceLevel');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.lucid.Prominence = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.speech.tts.lucid.Prominence, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.lucid.Prominence.displayName = 'proto.speech.tts.lucid.Prominence';
}



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.lucid.Prominence.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.lucid.Prominence.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.lucid.Prominence} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.Prominence.toObject = function(includeInstance, msg) {
  let f, obj = {
    level: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of Prominence as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.lucid.Prominence.ObjectFormat = function() {
  /** @type {?number|undefined} */
  this.level;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.lucid.Prominence.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.lucid.Prominence}
 */
proto.speech.tts.lucid.Prominence.fromObject = function(obj) {
  const msg = new proto.speech.tts.lucid.Prominence();
  obj.level != null && jspb.Message.setField(msg, 1, obj.level);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.lucid.Prominence}
 */
proto.speech.tts.lucid.Prominence.deserializeBinary = function(bytes) {
  return proto.speech.tts.lucid.Prominence.deserializeBinaryFromReader(
      new proto.speech.tts.lucid.Prominence(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.lucid.Prominence} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.lucid.Prominence}
 */
proto.speech.tts.lucid.Prominence.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {!proto.speech.tts.lucid.Prominence.ProminenceLevel} */ (reader.readEnum());
      msg.setLevel(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.lucid.Prominence.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.lucid.Prominence.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.lucid.Prominence} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.Prominence.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {!proto.speech.tts.lucid.Prominence.ProminenceLevel} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeEnum(
      1,
      f
    );
  }
};


/**
 * @enum {number}
 */
proto.speech.tts.lucid.Prominence.ProminenceLevel = {
  UNSPECIFIED_PROMINENCE_LEVEL: 0,
  REDUCED: 1,
  NONE: 2,
  MODERATE: 3,
  STRONG: 4
};

/**
 * optional ProminenceLevel level = 1;
 * @return {!proto.speech.tts.lucid.Prominence.ProminenceLevel}
 */
proto.speech.tts.lucid.Prominence.prototype.getLevel = function() {
  return /** @type {!proto.speech.tts.lucid.Prominence.ProminenceLevel} */ (jspb.Message.getField(this, 1));
};


/**
 * @param {?proto.speech.tts.lucid.Prominence.ProminenceLevel|undefined} value
 * @return {!proto.speech.tts.lucid.Prominence} returns this
 */
proto.speech.tts.lucid.Prominence.prototype.setLevel = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Prominence} returns this
 */
proto.speech.tts.lucid.Prominence.prototype.clearLevel = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Prominence.prototype.hasLevel = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.lucid.Prominence}
 */
proto.speech.tts.lucid.Prominence.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.lucid.Prominence, data);
};



//speech/tts/public/lucid/prosody_proto_jspb/prosody.jspb.js
// source: speech/tts/public/lucid/prosody.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.lucid.Prosody');
goog.provide('proto.speech.tts.lucid.Prosody.PhonationMode');
goog.provide('proto.speech.tts.lucid.Prosody.SpeechRate');
goog.provide('proto.speech.tts.lucid.Prosody.SpeechRateSpecCase');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.speech.tts.lucid.Novelty');
goog.require('proto.speech.tts.lucid.PartialSentenceProsody');
goog.require('proto.speech.tts.lucid.Prominence');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.lucid.Prosody = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, proto.speech.tts.lucid.Prosody.oneofGroups_);
};
goog.inherits(proto.speech.tts.lucid.Prosody, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.lucid.Prosody.displayName = 'proto.speech.tts.lucid.Prosody';
}

/**
 * Oneof group definitions for this message. Each group defines the field
 * numbers belonging to that group. When of these fields' value is set, all
 * other fields in the group are cleared. During deserialization, if multiple
 * fields are encountered for a group, only the last value seen will be kept.
 * @private {!Array<!Array<number>>}
 * @const
 */
proto.speech.tts.lucid.Prosody.oneofGroups_ = [[1,4]];

/**
 * @enum {number}
 */
proto.speech.tts.lucid.Prosody.SpeechRateSpecCase = {
  SPEECH_RATE_SPEC_NOT_SET: 0,
  SPEECH_RATE: 1,
  SPEECH_RATE_ENUM: 4
};

/**
 * @return {!proto.speech.tts.lucid.Prosody.SpeechRateSpecCase}
 */
proto.speech.tts.lucid.Prosody.prototype.getSpeechRateSpecCase = function() {
  return /** @type {!proto.speech.tts.lucid.Prosody.SpeechRateSpecCase} */(jspb.Message.computeOneofCase(this, proto.speech.tts.lucid.Prosody.oneofGroups_[0]));
};



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.lucid.Prosody.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.lucid.Prosody.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.lucid.Prosody} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.Prosody.toObject = function(includeInstance, msg) {
  let f, obj = {
    speechRate: (f = jspb.Message.getOptionalFloatingPointField(msg, 1)) == null ? undefined : f,
    speechRateEnum: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f,
    prominence: (f = msg.getProminence()) && proto.speech.tts.lucid.Prominence.toObject(includeInstance, f),
    novelty: (f = msg.getNovelty()) && proto.speech.tts.lucid.Novelty.toObject(includeInstance, f),
    partialSentenceProsody: (f = msg.getPartialSentenceProsody()) && proto.speech.tts.lucid.PartialSentenceProsody.toObject(includeInstance, f),
    f0Scale: (f = jspb.Message.getOptionalFloatingPointField(msg, 6)) == null ? undefined : f,
    phonationMode: (f = jspb.Message.getField(msg, 7)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of Prosody as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.lucid.Prosody.ObjectFormat = function() {
  /** @type {?number|undefined} */
  this.speechRate;

  /** @type {?number|undefined} */
  this.speechRateEnum;

  /** @type {?proto.speech.tts.lucid.Prominence.ObjectFormat|undefined} */
  this.prominence;

  /** @type {?proto.speech.tts.lucid.Novelty.ObjectFormat|undefined} */
  this.novelty;

  /** @type {?proto.speech.tts.lucid.PartialSentenceProsody.ObjectFormat|undefined} */
  this.partialSentenceProsody;

  /** @type {?number|undefined} */
  this.f0Scale;

  /** @type {?number|undefined} */
  this.phonationMode;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.lucid.Prosody.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.lucid.Prosody}
 */
proto.speech.tts.lucid.Prosody.fromObject = function(obj) {
  const msg = new proto.speech.tts.lucid.Prosody();
  obj.speechRate != null && jspb.Message.setOneofField(msg, 1, proto.speech.tts.lucid.Prosody.oneofGroups_[0], obj.speechRate);
  obj.speechRateEnum != null && jspb.Message.setOneofField(msg, 4, proto.speech.tts.lucid.Prosody.oneofGroups_[0], obj.speechRateEnum);
  obj.prominence && jspb.Message.setWrapperField(
      msg, 2, proto.speech.tts.lucid.Prominence.fromObject(obj.prominence));
  obj.novelty && jspb.Message.setWrapperField(
      msg, 3, proto.speech.tts.lucid.Novelty.fromObject(obj.novelty));
  obj.partialSentenceProsody && jspb.Message.setWrapperField(
      msg, 5, proto.speech.tts.lucid.PartialSentenceProsody.fromObject(obj.partialSentenceProsody));
  obj.f0Scale != null && jspb.Message.setField(msg, 6, obj.f0Scale);
  obj.phonationMode != null && jspb.Message.setField(msg, 7, obj.phonationMode);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.lucid.Prosody}
 */
proto.speech.tts.lucid.Prosody.deserializeBinary = function(bytes) {
  return proto.speech.tts.lucid.Prosody.deserializeBinaryFromReader(
      new proto.speech.tts.lucid.Prosody(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.lucid.Prosody} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.lucid.Prosody}
 */
proto.speech.tts.lucid.Prosody.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {number} */ (reader.readFloat());
      msg.setSpeechRate(value);
      break;
    case 4:
      value = /** @type {!proto.speech.tts.lucid.Prosody.SpeechRate} */ (reader.readEnum());
      msg.setSpeechRateEnum(value);
      break;
    case 2:
      value = new proto.speech.tts.lucid.Prominence();
      reader.readMessage(value,proto.speech.tts.lucid.Prominence.deserializeBinaryFromReader);
      msg.setProminence(value);
      break;
    case 3:
      value = new proto.speech.tts.lucid.Novelty();
      reader.readMessage(value,proto.speech.tts.lucid.Novelty.deserializeBinaryFromReader);
      msg.setNovelty(value);
      break;
    case 5:
      value = new proto.speech.tts.lucid.PartialSentenceProsody();
      reader.readMessage(value,proto.speech.tts.lucid.PartialSentenceProsody.deserializeBinaryFromReader);
      msg.setPartialSentenceProsody(value);
      break;
    case 6:
      value = /** @type {number} */ (reader.readFloat());
      msg.setF0Scale(value);
      break;
    case 7:
      value = /** @type {!proto.speech.tts.lucid.Prosody.PhonationMode} */ (reader.readEnum());
      msg.setPhonationMode(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.lucid.Prosody.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.lucid.Prosody.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.lucid.Prosody} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.Prosody.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {?number} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeFloat(
      1,
      f
    );
  }
  f = /** @type {!proto.speech.tts.lucid.Prosody.SpeechRate} */ (jspb.Message.getField(message, 4));
  if (f != null) {
    writer.writeEnum(
      4,
      f
    );
  }
  f = message.getProminence();
  if (f != null) {
    writer.writeMessage(
      2,
      f,
      proto.speech.tts.lucid.Prominence.serializeBinaryToWriter
    );
  }
  f = message.getNovelty();
  if (f != null) {
    writer.writeMessage(
      3,
      f,
      proto.speech.tts.lucid.Novelty.serializeBinaryToWriter
    );
  }
  f = message.getPartialSentenceProsody();
  if (f != null) {
    writer.writeMessage(
      5,
      f,
      proto.speech.tts.lucid.PartialSentenceProsody.serializeBinaryToWriter
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 6));
  if (f != null) {
    writer.writeFloat(
      6,
      f
    );
  }
  f = /** @type {!proto.speech.tts.lucid.Prosody.PhonationMode} */ (jspb.Message.getField(message, 7));
  if (f != null) {
    writer.writeEnum(
      7,
      f
    );
  }
};


/**
 * @enum {number}
 */
proto.speech.tts.lucid.Prosody.SpeechRate = {
  UNSPECIFIED_SPEECH_RATE: 0,
  VERY_SLOW: 1,
  SLOW: 2,
  NORMAL: 3,
  FAST: 4,
  VERY_FAST: 5
};

/**
 * @enum {number}
 */
proto.speech.tts.lucid.Prosody.PhonationMode = {
  UNSPECIFIED_PHONATION_MODE: 0,
  WHISPER_PHONATION: 16,
  SOFT_PHONATION: 32,
  STANDARD_PHONATION: 48
};

/**
 * optional float speech_rate = 1;
 * @return {?number}
 */
proto.speech.tts.lucid.Prosody.prototype.getSpeechRate = function() {
  return /** @type {?number} */ (jspb.Message.getOptionalFloatingPointField(this, 1));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.speech.tts.lucid.Prosody} returns this
 */
proto.speech.tts.lucid.Prosody.prototype.setSpeechRate = function(value) {
  return jspb.Message.setOneofField(this, 1, proto.speech.tts.lucid.Prosody.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Prosody} returns this
 */
proto.speech.tts.lucid.Prosody.prototype.clearSpeechRate = function() {
  return jspb.Message.clearOneofField(this, 1, proto.speech.tts.lucid.Prosody.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Prosody.prototype.hasSpeechRate = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional SpeechRate speech_rate_enum = 4;
 * @return {!proto.speech.tts.lucid.Prosody.SpeechRate}
 */
proto.speech.tts.lucid.Prosody.prototype.getSpeechRateEnum = function() {
  return /** @type {!proto.speech.tts.lucid.Prosody.SpeechRate} */ (jspb.Message.getField(this, 4));
};


/**
 * @param {?proto.speech.tts.lucid.Prosody.SpeechRate|undefined} value
 * @return {!proto.speech.tts.lucid.Prosody} returns this
 */
proto.speech.tts.lucid.Prosody.prototype.setSpeechRateEnum = function(value) {
  return jspb.Message.setOneofField(this, 4, proto.speech.tts.lucid.Prosody.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Prosody} returns this
 */
proto.speech.tts.lucid.Prosody.prototype.clearSpeechRateEnum = function() {
  return jspb.Message.clearOneofField(this, 4, proto.speech.tts.lucid.Prosody.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Prosody.prototype.hasSpeechRateEnum = function() {
  return jspb.Message.hasField(this, 4);
};


/**
 * optional Prominence prominence = 2;
 * @return {?proto.speech.tts.lucid.Prominence}
 */
proto.speech.tts.lucid.Prosody.prototype.getProminence = function() {
  return /** @type{?proto.speech.tts.lucid.Prominence} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.lucid.Prominence, 2));
};


/**
 * @param {?proto.speech.tts.lucid.Prominence|undefined} value
 * @return {!proto.speech.tts.lucid.Prosody} returns this
*/
proto.speech.tts.lucid.Prosody.prototype.setProminence = function(value) {
  return jspb.Message.setWrapperField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Prosody} returns this
 */
proto.speech.tts.lucid.Prosody.prototype.clearProminence = function() {
  return jspb.Message.clearWrapperField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Prosody.prototype.hasProminence = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional Novelty novelty = 3;
 * @return {?proto.speech.tts.lucid.Novelty}
 */
proto.speech.tts.lucid.Prosody.prototype.getNovelty = function() {
  return /** @type{?proto.speech.tts.lucid.Novelty} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.lucid.Novelty, 3));
};


/**
 * @param {?proto.speech.tts.lucid.Novelty|undefined} value
 * @return {!proto.speech.tts.lucid.Prosody} returns this
*/
proto.speech.tts.lucid.Prosody.prototype.setNovelty = function(value) {
  return jspb.Message.setWrapperField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Prosody} returns this
 */
proto.speech.tts.lucid.Prosody.prototype.clearNovelty = function() {
  return jspb.Message.clearWrapperField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Prosody.prototype.hasNovelty = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * optional PartialSentenceProsody partial_sentence_prosody = 5;
 * @return {?proto.speech.tts.lucid.PartialSentenceProsody}
 */
proto.speech.tts.lucid.Prosody.prototype.getPartialSentenceProsody = function() {
  return /** @type{?proto.speech.tts.lucid.PartialSentenceProsody} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.lucid.PartialSentenceProsody, 5));
};


/**
 * @param {?proto.speech.tts.lucid.PartialSentenceProsody|undefined} value
 * @return {!proto.speech.tts.lucid.Prosody} returns this
*/
proto.speech.tts.lucid.Prosody.prototype.setPartialSentenceProsody = function(value) {
  return jspb.Message.setWrapperField(this, 5, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Prosody} returns this
 */
proto.speech.tts.lucid.Prosody.prototype.clearPartialSentenceProsody = function() {
  return jspb.Message.clearWrapperField(this, 5);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Prosody.prototype.hasPartialSentenceProsody = function() {
  return jspb.Message.hasField(this, 5);
};


/**
 * optional float f0_scale = 6;
 * @return {?number}
 */
proto.speech.tts.lucid.Prosody.prototype.getF0Scale = function() {
  return /** @type {?number} */ (jspb.Message.getOptionalFloatingPointField(this, 6));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.speech.tts.lucid.Prosody} returns this
 */
proto.speech.tts.lucid.Prosody.prototype.setF0Scale = function(value) {
  return jspb.Message.setField(this, 6, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Prosody} returns this
 */
proto.speech.tts.lucid.Prosody.prototype.clearF0Scale = function() {
  return jspb.Message.clearField(this, 6);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Prosody.prototype.hasF0Scale = function() {
  return jspb.Message.hasField(this, 6);
};


/**
 * optional PhonationMode phonation_mode = 7;
 * @return {!proto.speech.tts.lucid.Prosody.PhonationMode}
 */
proto.speech.tts.lucid.Prosody.prototype.getPhonationMode = function() {
  return /** @type {!proto.speech.tts.lucid.Prosody.PhonationMode} */ (jspb.Message.getField(this, 7));
};


/**
 * @param {?proto.speech.tts.lucid.Prosody.PhonationMode|undefined} value
 * @return {!proto.speech.tts.lucid.Prosody} returns this
 */
proto.speech.tts.lucid.Prosody.prototype.setPhonationMode = function(value) {
  return jspb.Message.setField(this, 7, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Prosody} returns this
 */
proto.speech.tts.lucid.Prosody.prototype.clearPhonationMode = function() {
  return jspb.Message.clearField(this, 7);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Prosody.prototype.hasPhonationMode = function() {
  return jspb.Message.hasField(this, 7);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.lucid.Prosody}
 */
proto.speech.tts.lucid.Prosody.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.lucid.Prosody, data);
};



//speech/tts/public/lucid/semantics_proto_jspb/namedentity.jspb.js
// source: speech/tts/public/lucid/semantics.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.lucid.NamedEntity');
goog.provide('proto.speech.tts.lucid.NamedEntity.Domain');
goog.provide('proto.speech.tts.lucid.NamedEntity.SemanticGender');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.lucid.NamedEntity = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.speech.tts.lucid.NamedEntity, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.lucid.NamedEntity.displayName = 'proto.speech.tts.lucid.NamedEntity';
}



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.lucid.NamedEntity.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.lucid.NamedEntity.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.lucid.NamedEntity} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.NamedEntity.toObject = function(includeInstance, msg) {
  let f, obj = {
    type: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    domain: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f,
    confidenceScore: (f = jspb.Message.getOptionalFloatingPointField(msg, 3)) == null ? undefined : f,
    semanticGender: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of NamedEntity as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.lucid.NamedEntity.ObjectFormat = function() {
  /** @type {?string|undefined} */
  this.type;

  /** @type {?number|undefined} */
  this.domain;

  /** @type {?number|undefined} */
  this.confidenceScore;

  /** @type {?number|undefined} */
  this.semanticGender;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.lucid.NamedEntity.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.lucid.NamedEntity}
 */
proto.speech.tts.lucid.NamedEntity.fromObject = function(obj) {
  const msg = new proto.speech.tts.lucid.NamedEntity();
  obj.type != null && jspb.Message.setField(msg, 1, obj.type);
  obj.domain != null && jspb.Message.setField(msg, 2, obj.domain);
  obj.confidenceScore != null && jspb.Message.setField(msg, 3, obj.confidenceScore);
  obj.semanticGender != null && jspb.Message.setField(msg, 4, obj.semanticGender);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.lucid.NamedEntity}
 */
proto.speech.tts.lucid.NamedEntity.deserializeBinary = function(bytes) {
  return proto.speech.tts.lucid.NamedEntity.deserializeBinaryFromReader(
      new proto.speech.tts.lucid.NamedEntity(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.lucid.NamedEntity} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.lucid.NamedEntity}
 */
proto.speech.tts.lucid.NamedEntity.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {string} */ (reader.readString());
      msg.setType(value);
      break;
    case 2:
      value = /** @type {!proto.speech.tts.lucid.NamedEntity.Domain} */ (reader.readEnum());
      msg.setDomain(value);
      break;
    case 3:
      value = /** @type {number} */ (reader.readFloat());
      msg.setConfidenceScore(value);
      break;
    case 4:
      value = /** @type {!proto.speech.tts.lucid.NamedEntity.SemanticGender} */ (reader.readEnum());
      msg.setSemanticGender(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.lucid.NamedEntity.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.lucid.NamedEntity.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.lucid.NamedEntity} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.NamedEntity.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {?string} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeString(
      1,
      f
    );
  }
  f = /** @type {!proto.speech.tts.lucid.NamedEntity.Domain} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeEnum(
      2,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeFloat(
      3,
      f
    );
  }
  f = /** @type {!proto.speech.tts.lucid.NamedEntity.SemanticGender} */ (jspb.Message.getField(message, 4));
  if (f != null) {
    writer.writeEnum(
      4,
      f
    );
  }
};


/**
 * @enum {number}
 */
proto.speech.tts.lucid.NamedEntity.Domain = {
  UNSPECIFIED_DOMAIN: 0,
  SAFT_COARSE: 1,
  SAFT_FINE: 2,
  COLLECTIONS: 3
};

/**
 * @enum {number}
 */
proto.speech.tts.lucid.NamedEntity.SemanticGender = {
  UNSPECIFIED_GENDER: 0,
  GENDER_FEMALE: 1,
  GENDER_MALE: 2,
  GENDER_OTHER: 3,
  GENDER_NONE: 4
};

/**
 * optional string type = 1;
 * @return {?string}
 */
proto.speech.tts.lucid.NamedEntity.prototype.getType = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 1));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.NamedEntity} returns this
 */
proto.speech.tts.lucid.NamedEntity.prototype.setType = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.NamedEntity} returns this
 */
proto.speech.tts.lucid.NamedEntity.prototype.clearType = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.NamedEntity.prototype.hasType = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional Domain domain = 2;
 * @return {!proto.speech.tts.lucid.NamedEntity.Domain}
 */
proto.speech.tts.lucid.NamedEntity.prototype.getDomain = function() {
  return /** @type {!proto.speech.tts.lucid.NamedEntity.Domain} */ (jspb.Message.getField(this, 2));
};


/**
 * @param {?proto.speech.tts.lucid.NamedEntity.Domain|undefined} value
 * @return {!proto.speech.tts.lucid.NamedEntity} returns this
 */
proto.speech.tts.lucid.NamedEntity.prototype.setDomain = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.NamedEntity} returns this
 */
proto.speech.tts.lucid.NamedEntity.prototype.clearDomain = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.NamedEntity.prototype.hasDomain = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional float confidence_score = 3;
 * @return {?number}
 */
proto.speech.tts.lucid.NamedEntity.prototype.getConfidenceScore = function() {
  return /** @type {?number} */ (jspb.Message.getOptionalFloatingPointField(this, 3));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.speech.tts.lucid.NamedEntity} returns this
 */
proto.speech.tts.lucid.NamedEntity.prototype.setConfidenceScore = function(value) {
  return jspb.Message.setField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.NamedEntity} returns this
 */
proto.speech.tts.lucid.NamedEntity.prototype.clearConfidenceScore = function() {
  return jspb.Message.clearField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.NamedEntity.prototype.hasConfidenceScore = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * optional SemanticGender semantic_gender = 4;
 * @return {!proto.speech.tts.lucid.NamedEntity.SemanticGender}
 */
proto.speech.tts.lucid.NamedEntity.prototype.getSemanticGender = function() {
  return /** @type {!proto.speech.tts.lucid.NamedEntity.SemanticGender} */ (jspb.Message.getField(this, 4));
};


/**
 * @param {?proto.speech.tts.lucid.NamedEntity.SemanticGender|undefined} value
 * @return {!proto.speech.tts.lucid.NamedEntity} returns this
 */
proto.speech.tts.lucid.NamedEntity.prototype.setSemanticGender = function(value) {
  return jspb.Message.setField(this, 4, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.NamedEntity} returns this
 */
proto.speech.tts.lucid.NamedEntity.prototype.clearSemanticGender = function() {
  return jspb.Message.clearField(this, 4);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.NamedEntity.prototype.hasSemanticGender = function() {
  return jspb.Message.hasField(this, 4);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.lucid.NamedEntity}
 */
proto.speech.tts.lucid.NamedEntity.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.lucid.NamedEntity, data);
};



//speech/tts/public/lucid/semantics_proto_jspb/semantics.jspb.js
// source: speech/tts/public/lucid/semantics.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.lucid.Semantics');
goog.provide('proto.speech.tts.lucid.Semantics.ListInfo');
goog.provide('proto.speech.tts.lucid.Semantics.SemioticInfo');
goog.provide('proto.speech.tts.lucid.Semantics.SemioticInfo.HintLevel');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.location.unified.LocationDescriptor');
goog.require('proto.speech.tts.lucid.NamedEntity');
goog.requireType('jspb.ByteSource');
goog.requireType('proto.speech.tts.lucid.SemioticType.Type');
goog.requireType('proto.speech.tts.lucid.SourceInfo.Source');
goog.requireType('proto.speech.tts.lucid.TextnormLevel');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.lucid.Semantics = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, proto.speech.tts.lucid.Semantics.repeatedFields_, null);
};
goog.inherits(proto.speech.tts.lucid.Semantics, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.lucid.Semantics.displayName = 'proto.speech.tts.lucid.Semantics';
}
/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.lucid.Semantics.SemioticInfo = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.speech.tts.lucid.Semantics.SemioticInfo, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.lucid.Semantics.SemioticInfo.displayName = 'proto.speech.tts.lucid.Semantics.SemioticInfo';
}

/**
 * List of repeated fields within this message type.
 * @private {!Array<number>}
 * @const
 */
proto.speech.tts.lucid.Semantics.repeatedFields_ = [1,2,4,5];



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.lucid.Semantics.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.lucid.Semantics.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.lucid.Semantics} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.Semantics.toObject = function(includeInstance, msg) {
  let f, obj = {
    semioticInfoList: jspb.Message.toObjectList(msg.getSemioticInfoList(),
    proto.speech.tts.lucid.Semantics.SemioticInfo.toObject, includeInstance),
    sourceInfoList: (f = jspb.Message.getRepeatedField(msg, 2)) == null ? undefined : f,
    location: (f = msg.getLocation()) && proto.location.unified.LocationDescriptor.toObject(includeInstance, f),
    knowledgeGraphMidsList: (f = jspb.Message.getRepeatedField(msg, 4)) == null ? undefined : f,
    namedEntitiesList: jspb.Message.toObjectList(msg.getNamedEntitiesList(),
    proto.speech.tts.lucid.NamedEntity.toObject, includeInstance),
    textnormLevel: (f = jspb.Message.getField(msg, 7)) == null ? undefined : f,
    listInfo: (f = jspb.Message.getField(msg, 8)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of Semantics as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.lucid.Semantics.ObjectFormat = function() {
  /** @type {?Array<!proto.speech.tts.lucid.Semantics.SemioticInfo.ObjectFormat>|undefined} */
  this.semioticInfoList;

  /** @type {?Array<number>|undefined} */
  this.sourceInfoList;

  /** @type {?proto.location.unified.LocationDescriptor.ObjectFormat|undefined} */
  this.location;

  /** @type {?Array<string>|undefined} */
  this.knowledgeGraphMidsList;

  /** @type {?Array<!proto.speech.tts.lucid.NamedEntity.ObjectFormat>|undefined} */
  this.namedEntitiesList;

  /** @type {?number|undefined} */
  this.textnormLevel;

  /** @type {?number|undefined} */
  this.listInfo;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.lucid.Semantics.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.lucid.Semantics}
 */
proto.speech.tts.lucid.Semantics.fromObject = function(obj) {
  const msg = new proto.speech.tts.lucid.Semantics();
  obj.semioticInfoList && jspb.Message.setRepeatedWrapperField(
      msg, 1, obj.semioticInfoList.map(
          proto.speech.tts.lucid.Semantics.SemioticInfo.fromObject));
  obj.sourceInfoList != null && jspb.Message.setField(msg, 2, obj.sourceInfoList);
  obj.location && jspb.Message.setWrapperField(
      msg, 3, proto.location.unified.LocationDescriptor.fromObject(obj.location));
  obj.knowledgeGraphMidsList != null && jspb.Message.setField(msg, 4, obj.knowledgeGraphMidsList);
  obj.namedEntitiesList && jspb.Message.setRepeatedWrapperField(
      msg, 5, obj.namedEntitiesList.map(
          proto.speech.tts.lucid.NamedEntity.fromObject));
  obj.textnormLevel != null && jspb.Message.setField(msg, 7, obj.textnormLevel);
  obj.listInfo != null && jspb.Message.setField(msg, 8, obj.listInfo);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.lucid.Semantics}
 */
proto.speech.tts.lucid.Semantics.deserializeBinary = function(bytes) {
  return proto.speech.tts.lucid.Semantics.deserializeBinaryFromReader(
      new proto.speech.tts.lucid.Semantics(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.lucid.Semantics} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.lucid.Semantics}
 */
proto.speech.tts.lucid.Semantics.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = new proto.speech.tts.lucid.Semantics.SemioticInfo();
      reader.readMessage(value,proto.speech.tts.lucid.Semantics.SemioticInfo.deserializeBinaryFromReader);
      msg.addSemioticInfo(value);
      break;
    case 2:
      value = /** @type {!Array<!proto.speech.tts.lucid.SourceInfo.Source>} */ (reader.isDelimited() ? reader.readPackedEnum() : [reader.readEnum()]);
      for (let i = 0; i < value.length; i++) {
        msg.addSourceInfo(value[i]);
      }
      break;
    case 3:
      value = new proto.location.unified.LocationDescriptor();
      reader.readMessage(value,proto.location.unified.LocationDescriptor.deserializeBinaryFromReader);
      msg.setLocation(value);
      break;
    case 4:
      value = /** @type {string} */ (reader.readString());
      msg.addKnowledgeGraphMids(value);
      break;
    case 5:
      value = new proto.speech.tts.lucid.NamedEntity();
      reader.readMessage(value,proto.speech.tts.lucid.NamedEntity.deserializeBinaryFromReader);
      msg.addNamedEntities(value);
      break;
    case 7:
      value = /** @type {!proto.speech.tts.lucid.TextnormLevel} */ (reader.readEnum());
      msg.setTextnormLevel(value);
      break;
    case 8:
      value = /** @type {!proto.speech.tts.lucid.Semantics.ListInfo} */ (reader.readEnum());
      msg.setListInfo(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.lucid.Semantics.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.lucid.Semantics.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.lucid.Semantics} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.Semantics.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = message.getSemioticInfoList();
  if (f.length > 0) {
    writer.writeRepeatedMessage(
      1,
      f,
      proto.speech.tts.lucid.Semantics.SemioticInfo.serializeBinaryToWriter
    );
  }
  f = message.getSourceInfoList();
  if (f.length > 0) {
    writer.writeRepeatedEnum(
      2,
      f
    );
  }
  f = message.getLocation();
  if (f != null) {
    writer.writeMessage(
      3,
      f,
      proto.location.unified.LocationDescriptor.serializeBinaryToWriter
    );
  }
  f = message.getKnowledgeGraphMidsList();
  if (f.length > 0) {
    writer.writeRepeatedString(
      4,
      f
    );
  }
  f = message.getNamedEntitiesList();
  if (f.length > 0) {
    writer.writeRepeatedMessage(
      5,
      f,
      proto.speech.tts.lucid.NamedEntity.serializeBinaryToWriter
    );
  }
  f = /** @type {!proto.speech.tts.lucid.TextnormLevel} */ (jspb.Message.getField(message, 7));
  if (f != null) {
    writer.writeEnum(
      7,
      f
    );
  }
  f = /** @type {!proto.speech.tts.lucid.Semantics.ListInfo} */ (jspb.Message.getField(message, 8));
  if (f != null) {
    writer.writeEnum(
      8,
      f
    );
  }
};


/**
 * @enum {number}
 */
proto.speech.tts.lucid.Semantics.ListInfo = {
  UNSPECIFIED_LIST_INFO: 0,
  LIST_ITEM: 1
};




if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.lucid.Semantics.SemioticInfo.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.lucid.Semantics.SemioticInfo.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.lucid.Semantics.SemioticInfo} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.Semantics.SemioticInfo.toObject = function(includeInstance, msg) {
  let f, obj = {
    semioticType: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    hintLevel: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of SemioticInfo as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.lucid.Semantics.SemioticInfo.ObjectFormat = function() {
  /** @type {?number|undefined} */
  this.semioticType;

  /** @type {?number|undefined} */
  this.hintLevel;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.lucid.Semantics.SemioticInfo.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.lucid.Semantics.SemioticInfo}
 */
proto.speech.tts.lucid.Semantics.SemioticInfo.fromObject = function(obj) {
  const msg = new proto.speech.tts.lucid.Semantics.SemioticInfo();
  obj.semioticType != null && jspb.Message.setField(msg, 1, obj.semioticType);
  obj.hintLevel != null && jspb.Message.setField(msg, 3, obj.hintLevel);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.lucid.Semantics.SemioticInfo}
 */
proto.speech.tts.lucid.Semantics.SemioticInfo.deserializeBinary = function(bytes) {
  return proto.speech.tts.lucid.Semantics.SemioticInfo.deserializeBinaryFromReader(
      new proto.speech.tts.lucid.Semantics.SemioticInfo(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.lucid.Semantics.SemioticInfo} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.lucid.Semantics.SemioticInfo}
 */
proto.speech.tts.lucid.Semantics.SemioticInfo.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {!proto.speech.tts.lucid.SemioticType.Type} */ (reader.readEnum());
      msg.setSemioticType(value);
      break;
    case 3:
      value = /** @type {!proto.speech.tts.lucid.Semantics.SemioticInfo.HintLevel} */ (reader.readEnum());
      msg.setHintLevel(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.lucid.Semantics.SemioticInfo.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.lucid.Semantics.SemioticInfo.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.lucid.Semantics.SemioticInfo} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.Semantics.SemioticInfo.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {!proto.speech.tts.lucid.SemioticType.Type} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeEnum(
      1,
      f
    );
  }
  f = /** @type {!proto.speech.tts.lucid.Semantics.SemioticInfo.HintLevel} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeEnum(
      3,
      f
    );
  }
};


/**
 * @enum {number}
 */
proto.speech.tts.lucid.Semantics.SemioticInfo.HintLevel = {
  UNSPECIFIED_HINT_LEVEL: 0,
  POSSIBLY_CONTAINED: 1,
  CERTAINLY_CONTAINED: 2,
  EXACTLY_CONTAINED: 3
};

/**
 * optional SemioticType.Type semiotic_type = 1;
 * @return {!proto.speech.tts.lucid.SemioticType.Type}
 */
proto.speech.tts.lucid.Semantics.SemioticInfo.prototype.getSemioticType = function() {
  return /** @type {!proto.speech.tts.lucid.SemioticType.Type} */ (jspb.Message.getField(this, 1));
};


/**
 * @param {?proto.speech.tts.lucid.SemioticType.Type|undefined} value
 * @return {!proto.speech.tts.lucid.Semantics.SemioticInfo} returns this
 */
proto.speech.tts.lucid.Semantics.SemioticInfo.prototype.setSemioticType = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Semantics.SemioticInfo} returns this
 */
proto.speech.tts.lucid.Semantics.SemioticInfo.prototype.clearSemioticType = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Semantics.SemioticInfo.prototype.hasSemioticType = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional HintLevel hint_level = 3;
 * @return {!proto.speech.tts.lucid.Semantics.SemioticInfo.HintLevel}
 */
proto.speech.tts.lucid.Semantics.SemioticInfo.prototype.getHintLevel = function() {
  return /** @type {!proto.speech.tts.lucid.Semantics.SemioticInfo.HintLevel} */ (jspb.Message.getField(this, 3));
};


/**
 * @param {?proto.speech.tts.lucid.Semantics.SemioticInfo.HintLevel|undefined} value
 * @return {!proto.speech.tts.lucid.Semantics.SemioticInfo} returns this
 */
proto.speech.tts.lucid.Semantics.SemioticInfo.prototype.setHintLevel = function(value) {
  return jspb.Message.setField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Semantics.SemioticInfo} returns this
 */
proto.speech.tts.lucid.Semantics.SemioticInfo.prototype.clearHintLevel = function() {
  return jspb.Message.clearField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Semantics.SemioticInfo.prototype.hasHintLevel = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.lucid.Semantics.SemioticInfo}
 */
proto.speech.tts.lucid.Semantics.SemioticInfo.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.lucid.Semantics.SemioticInfo, data);
};


/**
 * repeated SemioticInfo semiotic_info = 1;
 * @return {!Array<!proto.speech.tts.lucid.Semantics.SemioticInfo>}
 */
proto.speech.tts.lucid.Semantics.prototype.getSemioticInfoList = function() {
  return /** @type{!Array<!proto.speech.tts.lucid.Semantics.SemioticInfo>} */ (
    jspb.Message.getRepeatedWrapperField(this, proto.speech.tts.lucid.Semantics.SemioticInfo, 1));
};


/**
 * @param {Array<!proto.speech.tts.lucid.Semantics.SemioticInfo>|undefined} value
 * @return {!proto.speech.tts.lucid.Semantics} returns this
*/
proto.speech.tts.lucid.Semantics.prototype.setSemioticInfoList = function(value) {
  return jspb.Message.setRepeatedWrapperField(this, 1, value);
};


/**
 * @param {!proto.speech.tts.lucid.Semantics.SemioticInfo=} opt_value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.lucid.Semantics.SemioticInfo}
 */
proto.speech.tts.lucid.Semantics.prototype.addSemioticInfo = function(opt_value, opt_index) {
  return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.speech.tts.lucid.Semantics.SemioticInfo, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.lucid.Semantics} returns this
 */
proto.speech.tts.lucid.Semantics.prototype.clearSemioticInfoList = function() {
  return jspb.Message.clearRepeatedWrapperField(this, 1);
};


/**
 * repeated SourceInfo.Source source_info = 2;
 * @return {!Array<!proto.speech.tts.lucid.SourceInfo.Source>}
 */
proto.speech.tts.lucid.Semantics.prototype.getSourceInfoList = function() {
  return /** @type {!Array<!proto.speech.tts.lucid.SourceInfo.Source>} */ (jspb.Message.getRepeatedField(this, 2));
};


/**
 * @param {Array<!proto.speech.tts.lucid.SourceInfo.Source>|undefined} value
 * @return {!proto.speech.tts.lucid.Semantics} returns this
 */
proto.speech.tts.lucid.Semantics.prototype.setSourceInfoList = function(value) {
  return jspb.Message.setField(this, 2, value || []);
};


/**
 * @param {!proto.speech.tts.lucid.SourceInfo.Source} value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.lucid.Semantics} returns this
 */
proto.speech.tts.lucid.Semantics.prototype.addSourceInfo = function(value, opt_index) {
  return jspb.Message.addToRepeatedField(this, 2, value, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.lucid.Semantics} returns this
 */
proto.speech.tts.lucid.Semantics.prototype.clearSourceInfoList = function() {
  return jspb.Message.clearRepeatedField(this, 2);
};


/**
 * optional location.unified.LocationDescriptor location = 3;
 * @return {?proto.location.unified.LocationDescriptor}
 */
proto.speech.tts.lucid.Semantics.prototype.getLocation = function() {
  return /** @type{?proto.location.unified.LocationDescriptor} */ (
    jspb.Message.getWrapperField(this, proto.location.unified.LocationDescriptor, 3));
};


/**
 * @param {?proto.location.unified.LocationDescriptor|undefined} value
 * @return {!proto.speech.tts.lucid.Semantics} returns this
*/
proto.speech.tts.lucid.Semantics.prototype.setLocation = function(value) {
  return jspb.Message.setWrapperField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Semantics} returns this
 */
proto.speech.tts.lucid.Semantics.prototype.clearLocation = function() {
  return jspb.Message.clearWrapperField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Semantics.prototype.hasLocation = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * repeated string knowledge_graph_mids = 4;
 * @return {!Array<string>}
 */
proto.speech.tts.lucid.Semantics.prototype.getKnowledgeGraphMidsList = function() {
  return /** @type {!Array<string>} */ (jspb.Message.getRepeatedField(this, 4));
};


/**
 * @param {Array<string>|undefined} value
 * @return {!proto.speech.tts.lucid.Semantics} returns this
 */
proto.speech.tts.lucid.Semantics.prototype.setKnowledgeGraphMidsList = function(value) {
  return jspb.Message.setField(this, 4, value || []);
};


/**
 * @param {string} value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.lucid.Semantics} returns this
 */
proto.speech.tts.lucid.Semantics.prototype.addKnowledgeGraphMids = function(value, opt_index) {
  return jspb.Message.addToRepeatedField(this, 4, value, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.lucid.Semantics} returns this
 */
proto.speech.tts.lucid.Semantics.prototype.clearKnowledgeGraphMidsList = function() {
  return jspb.Message.clearRepeatedField(this, 4);
};


/**
 * repeated NamedEntity named_entities = 5;
 * @return {!Array<!proto.speech.tts.lucid.NamedEntity>}
 */
proto.speech.tts.lucid.Semantics.prototype.getNamedEntitiesList = function() {
  return /** @type{!Array<!proto.speech.tts.lucid.NamedEntity>} */ (
    jspb.Message.getRepeatedWrapperField(this, proto.speech.tts.lucid.NamedEntity, 5));
};


/**
 * @param {Array<!proto.speech.tts.lucid.NamedEntity>|undefined} value
 * @return {!proto.speech.tts.lucid.Semantics} returns this
*/
proto.speech.tts.lucid.Semantics.prototype.setNamedEntitiesList = function(value) {
  return jspb.Message.setRepeatedWrapperField(this, 5, value);
};


/**
 * @param {!proto.speech.tts.lucid.NamedEntity=} opt_value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.lucid.NamedEntity}
 */
proto.speech.tts.lucid.Semantics.prototype.addNamedEntities = function(opt_value, opt_index) {
  return jspb.Message.addToRepeatedWrapperField(this, 5, opt_value, proto.speech.tts.lucid.NamedEntity, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.lucid.Semantics} returns this
 */
proto.speech.tts.lucid.Semantics.prototype.clearNamedEntitiesList = function() {
  return jspb.Message.clearRepeatedWrapperField(this, 5);
};


/**
 * optional TextnormLevel textnorm_level = 7;
 * @return {!proto.speech.tts.lucid.TextnormLevel}
 */
proto.speech.tts.lucid.Semantics.prototype.getTextnormLevel = function() {
  return /** @type {!proto.speech.tts.lucid.TextnormLevel} */ (jspb.Message.getField(this, 7));
};


/**
 * @param {?proto.speech.tts.lucid.TextnormLevel|undefined} value
 * @return {!proto.speech.tts.lucid.Semantics} returns this
 */
proto.speech.tts.lucid.Semantics.prototype.setTextnormLevel = function(value) {
  return jspb.Message.setField(this, 7, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Semantics} returns this
 */
proto.speech.tts.lucid.Semantics.prototype.clearTextnormLevel = function() {
  return jspb.Message.clearField(this, 7);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Semantics.prototype.hasTextnormLevel = function() {
  return jspb.Message.hasField(this, 7);
};


/**
 * optional ListInfo list_info = 8;
 * @return {!proto.speech.tts.lucid.Semantics.ListInfo}
 */
proto.speech.tts.lucid.Semantics.prototype.getListInfo = function() {
  return /** @type {!proto.speech.tts.lucid.Semantics.ListInfo} */ (jspb.Message.getField(this, 8));
};


/**
 * @param {?proto.speech.tts.lucid.Semantics.ListInfo|undefined} value
 * @return {!proto.speech.tts.lucid.Semantics} returns this
 */
proto.speech.tts.lucid.Semantics.prototype.setListInfo = function(value) {
  return jspb.Message.setField(this, 8, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Semantics} returns this
 */
proto.speech.tts.lucid.Semantics.prototype.clearListInfo = function() {
  return jspb.Message.clearField(this, 8);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Semantics.prototype.hasListInfo = function() {
  return jspb.Message.hasField(this, 8);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.lucid.Semantics}
 */
proto.speech.tts.lucid.Semantics.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.lucid.Semantics, data);
};



//speech/tts/public/lucid/syntax_proto_jspb/syntax.jspb.js
// source: speech/tts/public/lucid/syntax.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.lucid.Syntax');
goog.provide('proto.speech.tts.lucid.Syntax.DependencyData');
goog.provide('proto.speech.tts.lucid.Syntax.MorphophoneticAttribute');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.requireType('jspb.ByteSource');
goog.requireType('proto.nlp_saft.MorphologyAttrValue.Value');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.lucid.Syntax = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, proto.speech.tts.lucid.Syntax.repeatedFields_, null);
};
goog.inherits(proto.speech.tts.lucid.Syntax, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.lucid.Syntax.displayName = 'proto.speech.tts.lucid.Syntax';
}
/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.lucid.Syntax.DependencyData = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.speech.tts.lucid.Syntax.DependencyData, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.lucid.Syntax.DependencyData.displayName = 'proto.speech.tts.lucid.Syntax.DependencyData';
}

/**
 * List of repeated fields within this message type.
 * @private {!Array<number>}
 * @const
 */
proto.speech.tts.lucid.Syntax.repeatedFields_ = [7,8];



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.lucid.Syntax.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.lucid.Syntax.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.lucid.Syntax} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.Syntax.toObject = function(includeInstance, msg) {
  let f, obj = {
    spelling: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    baseFormSpelling: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f,
    syntacticCategory: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f,
    partOfSpeech: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f,
    partOfSpeechConfidence: (f = jspb.Message.getOptionalFloatingPointField(msg, 5)) == null ? undefined : f,
    dependencyData: (f = msg.getDependencyData()) && proto.speech.tts.lucid.Syntax.DependencyData.toObject(includeInstance, f),
    morphologyAttributesList: (f = jspb.Message.getRepeatedField(msg, 7)) == null ? undefined : f,
    morphophoneticAttributesList: (f = jspb.Message.getRepeatedField(msg, 8)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of Syntax as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.lucid.Syntax.ObjectFormat = function() {
  /** @type {?string|undefined} */
  this.spelling;

  /** @type {?string|undefined} */
  this.baseFormSpelling;

  /** @type {?string|undefined} */
  this.syntacticCategory;

  /** @type {?string|undefined} */
  this.partOfSpeech;

  /** @type {?number|undefined} */
  this.partOfSpeechConfidence;

  /** @type {?proto.speech.tts.lucid.Syntax.DependencyData.ObjectFormat|undefined} */
  this.dependencyData;

  /** @type {?Array<number>|undefined} */
  this.morphologyAttributesList;

  /** @type {?Array<number>|undefined} */
  this.morphophoneticAttributesList;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.lucid.Syntax.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.lucid.Syntax}
 */
proto.speech.tts.lucid.Syntax.fromObject = function(obj) {
  const msg = new proto.speech.tts.lucid.Syntax();
  obj.spelling != null && jspb.Message.setField(msg, 1, obj.spelling);
  obj.baseFormSpelling != null && jspb.Message.setField(msg, 2, obj.baseFormSpelling);
  obj.syntacticCategory != null && jspb.Message.setField(msg, 3, obj.syntacticCategory);
  obj.partOfSpeech != null && jspb.Message.setField(msg, 4, obj.partOfSpeech);
  obj.partOfSpeechConfidence != null && jspb.Message.setField(msg, 5, obj.partOfSpeechConfidence);
  obj.dependencyData && jspb.Message.setWrapperField(
      msg, 6, proto.speech.tts.lucid.Syntax.DependencyData.fromObject(obj.dependencyData));
  obj.morphologyAttributesList != null && jspb.Message.setField(msg, 7, obj.morphologyAttributesList);
  obj.morphophoneticAttributesList != null && jspb.Message.setField(msg, 8, obj.morphophoneticAttributesList);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.lucid.Syntax}
 */
proto.speech.tts.lucid.Syntax.deserializeBinary = function(bytes) {
  return proto.speech.tts.lucid.Syntax.deserializeBinaryFromReader(
      new proto.speech.tts.lucid.Syntax(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.lucid.Syntax} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.lucid.Syntax}
 */
proto.speech.tts.lucid.Syntax.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {string} */ (reader.readString());
      msg.setSpelling(value);
      break;
    case 2:
      value = /** @type {string} */ (reader.readString());
      msg.setBaseFormSpelling(value);
      break;
    case 3:
      value = /** @type {string} */ (reader.readString());
      msg.setSyntacticCategory(value);
      break;
    case 4:
      value = /** @type {string} */ (reader.readString());
      msg.setPartOfSpeech(value);
      break;
    case 5:
      value = /** @type {number} */ (reader.readFloat());
      msg.setPartOfSpeechConfidence(value);
      break;
    case 6:
      value = new proto.speech.tts.lucid.Syntax.DependencyData();
      reader.readMessage(value,proto.speech.tts.lucid.Syntax.DependencyData.deserializeBinaryFromReader);
      msg.setDependencyData(value);
      break;
    case 7:
      value = /** @type {!Array<!proto.nlp_saft.MorphologyAttrValue.Value>} */ (reader.isDelimited() ? reader.readPackedEnum() : [reader.readEnum()]);
      for (let i = 0; i < value.length; i++) {
        msg.addMorphologyAttributes(value[i]);
      }
      break;
    case 8:
      value = /** @type {!Array<!proto.speech.tts.lucid.Syntax.MorphophoneticAttribute>} */ (reader.isDelimited() ? reader.readPackedEnum() : [reader.readEnum()]);
      for (let i = 0; i < value.length; i++) {
        msg.addMorphophoneticAttributes(value[i]);
      }
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.lucid.Syntax.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.lucid.Syntax.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.lucid.Syntax} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.Syntax.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {?string} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeString(
      1,
      f
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeString(
      2,
      f
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeString(
      3,
      f
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 4));
  if (f != null) {
    writer.writeString(
      4,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 5));
  if (f != null) {
    writer.writeFloat(
      5,
      f
    );
  }
  f = message.getDependencyData();
  if (f != null) {
    writer.writeMessage(
      6,
      f,
      proto.speech.tts.lucid.Syntax.DependencyData.serializeBinaryToWriter
    );
  }
  f = message.getMorphologyAttributesList();
  if (f.length > 0) {
    writer.writeRepeatedEnum(
      7,
      f
    );
  }
  f = message.getMorphophoneticAttributesList();
  if (f.length > 0) {
    writer.writeRepeatedEnum(
      8,
      f
    );
  }
};


/**
 * @enum {number}
 */
proto.speech.tts.lucid.Syntax.MorphophoneticAttribute = {
  UNSPECIFIED_MORPHOPHONETIC_ATTRIBUTE: 0,
  APOCOPE: 1,
  SYNCOPE: 2
};




if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.lucid.Syntax.DependencyData.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.lucid.Syntax.DependencyData.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.lucid.Syntax.DependencyData} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.Syntax.DependencyData.toObject = function(includeInstance, msg) {
  let f, obj = {
    head: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    label: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of DependencyData as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.lucid.Syntax.DependencyData.ObjectFormat = function() {
  /** @type {?number|undefined} */
  this.head;

  /** @type {?string|undefined} */
  this.label;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.lucid.Syntax.DependencyData.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.lucid.Syntax.DependencyData}
 */
proto.speech.tts.lucid.Syntax.DependencyData.fromObject = function(obj) {
  const msg = new proto.speech.tts.lucid.Syntax.DependencyData();
  obj.head != null && jspb.Message.setField(msg, 1, obj.head);
  obj.label != null && jspb.Message.setField(msg, 2, obj.label);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.lucid.Syntax.DependencyData}
 */
proto.speech.tts.lucid.Syntax.DependencyData.deserializeBinary = function(bytes) {
  return proto.speech.tts.lucid.Syntax.DependencyData.deserializeBinaryFromReader(
      new proto.speech.tts.lucid.Syntax.DependencyData(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.lucid.Syntax.DependencyData} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.lucid.Syntax.DependencyData}
 */
proto.speech.tts.lucid.Syntax.DependencyData.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {number} */ (reader.readInt32());
      msg.setHead(value);
      break;
    case 2:
      value = /** @type {string} */ (reader.readString());
      msg.setLabel(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.lucid.Syntax.DependencyData.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.lucid.Syntax.DependencyData.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.lucid.Syntax.DependencyData} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.Syntax.DependencyData.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {?number} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeInt32(
      1,
      f
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeString(
      2,
      f
    );
  }
};


/**
 * optional int32 head = 1;
 * @return {?number}
 */
proto.speech.tts.lucid.Syntax.DependencyData.prototype.getHead = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 1));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.speech.tts.lucid.Syntax.DependencyData} returns this
 */
proto.speech.tts.lucid.Syntax.DependencyData.prototype.setHead = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Syntax.DependencyData} returns this
 */
proto.speech.tts.lucid.Syntax.DependencyData.prototype.clearHead = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Syntax.DependencyData.prototype.hasHead = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional string label = 2;
 * @return {?string}
 */
proto.speech.tts.lucid.Syntax.DependencyData.prototype.getLabel = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 2));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.Syntax.DependencyData} returns this
 */
proto.speech.tts.lucid.Syntax.DependencyData.prototype.setLabel = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Syntax.DependencyData} returns this
 */
proto.speech.tts.lucid.Syntax.DependencyData.prototype.clearLabel = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Syntax.DependencyData.prototype.hasLabel = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.lucid.Syntax.DependencyData}
 */
proto.speech.tts.lucid.Syntax.DependencyData.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.lucid.Syntax.DependencyData, data);
};


/**
 * optional string spelling = 1;
 * @return {?string}
 */
proto.speech.tts.lucid.Syntax.prototype.getSpelling = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 1));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.Syntax} returns this
 */
proto.speech.tts.lucid.Syntax.prototype.setSpelling = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Syntax} returns this
 */
proto.speech.tts.lucid.Syntax.prototype.clearSpelling = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Syntax.prototype.hasSpelling = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional string base_form_spelling = 2;
 * @return {?string}
 */
proto.speech.tts.lucid.Syntax.prototype.getBaseFormSpelling = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 2));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.Syntax} returns this
 */
proto.speech.tts.lucid.Syntax.prototype.setBaseFormSpelling = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Syntax} returns this
 */
proto.speech.tts.lucid.Syntax.prototype.clearBaseFormSpelling = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Syntax.prototype.hasBaseFormSpelling = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional string syntactic_category = 3;
 * @return {?string}
 */
proto.speech.tts.lucid.Syntax.prototype.getSyntacticCategory = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 3));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.Syntax} returns this
 */
proto.speech.tts.lucid.Syntax.prototype.setSyntacticCategory = function(value) {
  return jspb.Message.setField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Syntax} returns this
 */
proto.speech.tts.lucid.Syntax.prototype.clearSyntacticCategory = function() {
  return jspb.Message.clearField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Syntax.prototype.hasSyntacticCategory = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * optional string part_of_speech = 4;
 * @return {?string}
 */
proto.speech.tts.lucid.Syntax.prototype.getPartOfSpeech = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 4));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.Syntax} returns this
 */
proto.speech.tts.lucid.Syntax.prototype.setPartOfSpeech = function(value) {
  return jspb.Message.setField(this, 4, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Syntax} returns this
 */
proto.speech.tts.lucid.Syntax.prototype.clearPartOfSpeech = function() {
  return jspb.Message.clearField(this, 4);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Syntax.prototype.hasPartOfSpeech = function() {
  return jspb.Message.hasField(this, 4);
};


/**
 * optional float part_of_speech_confidence = 5;
 * @return {?number}
 */
proto.speech.tts.lucid.Syntax.prototype.getPartOfSpeechConfidence = function() {
  return /** @type {?number} */ (jspb.Message.getOptionalFloatingPointField(this, 5));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.speech.tts.lucid.Syntax} returns this
 */
proto.speech.tts.lucid.Syntax.prototype.setPartOfSpeechConfidence = function(value) {
  return jspb.Message.setField(this, 5, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Syntax} returns this
 */
proto.speech.tts.lucid.Syntax.prototype.clearPartOfSpeechConfidence = function() {
  return jspb.Message.clearField(this, 5);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Syntax.prototype.hasPartOfSpeechConfidence = function() {
  return jspb.Message.hasField(this, 5);
};


/**
 * optional DependencyData dependency_data = 6;
 * @return {?proto.speech.tts.lucid.Syntax.DependencyData}
 */
proto.speech.tts.lucid.Syntax.prototype.getDependencyData = function() {
  return /** @type{?proto.speech.tts.lucid.Syntax.DependencyData} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.lucid.Syntax.DependencyData, 6));
};


/**
 * @param {?proto.speech.tts.lucid.Syntax.DependencyData|undefined} value
 * @return {!proto.speech.tts.lucid.Syntax} returns this
*/
proto.speech.tts.lucid.Syntax.prototype.setDependencyData = function(value) {
  return jspb.Message.setWrapperField(this, 6, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Syntax} returns this
 */
proto.speech.tts.lucid.Syntax.prototype.clearDependencyData = function() {
  return jspb.Message.clearWrapperField(this, 6);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Syntax.prototype.hasDependencyData = function() {
  return jspb.Message.hasField(this, 6);
};


/**
 * repeated nlp_saft.MorphologyAttrValue.Value morphology_attributes = 7;
 * @return {!Array<!proto.nlp_saft.MorphologyAttrValue.Value>}
 */
proto.speech.tts.lucid.Syntax.prototype.getMorphologyAttributesList = function() {
  return /** @type {!Array<!proto.nlp_saft.MorphologyAttrValue.Value>} */ (jspb.Message.getRepeatedField(this, 7));
};


/**
 * @param {Array<!proto.nlp_saft.MorphologyAttrValue.Value>|undefined} value
 * @return {!proto.speech.tts.lucid.Syntax} returns this
 */
proto.speech.tts.lucid.Syntax.prototype.setMorphologyAttributesList = function(value) {
  return jspb.Message.setField(this, 7, value || []);
};


/**
 * @param {!proto.nlp_saft.MorphologyAttrValue.Value} value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.lucid.Syntax} returns this
 */
proto.speech.tts.lucid.Syntax.prototype.addMorphologyAttributes = function(value, opt_index) {
  return jspb.Message.addToRepeatedField(this, 7, value, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.lucid.Syntax} returns this
 */
proto.speech.tts.lucid.Syntax.prototype.clearMorphologyAttributesList = function() {
  return jspb.Message.clearRepeatedField(this, 7);
};


/**
 * repeated MorphophoneticAttribute morphophonetic_attributes = 8;
 * @return {!Array<!proto.speech.tts.lucid.Syntax.MorphophoneticAttribute>}
 */
proto.speech.tts.lucid.Syntax.prototype.getMorphophoneticAttributesList = function() {
  return /** @type {!Array<!proto.speech.tts.lucid.Syntax.MorphophoneticAttribute>} */ (jspb.Message.getRepeatedField(this, 8));
};


/**
 * @param {Array<!proto.speech.tts.lucid.Syntax.MorphophoneticAttribute>|undefined} value
 * @return {!proto.speech.tts.lucid.Syntax} returns this
 */
proto.speech.tts.lucid.Syntax.prototype.setMorphophoneticAttributesList = function(value) {
  return jspb.Message.setField(this, 8, value || []);
};


/**
 * @param {!proto.speech.tts.lucid.Syntax.MorphophoneticAttribute} value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.lucid.Syntax} returns this
 */
proto.speech.tts.lucid.Syntax.prototype.addMorphophoneticAttributes = function(value, opt_index) {
  return jspb.Message.addToRepeatedField(this, 8, value, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.lucid.Syntax} returns this
 */
proto.speech.tts.lucid.Syntax.prototype.clearMorphophoneticAttributesList = function() {
  return jspb.Message.clearRepeatedField(this, 8);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.lucid.Syntax}
 */
proto.speech.tts.lucid.Syntax.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.lucid.Syntax, data);
};



//speech/tts/public/lucid/synthesis_parameters_proto_jspb/audiosource.jspb.js
// source: speech/tts/public/lucid/synthesis_parameters.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.lucid.AudioSource');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.lucid.AudioSource = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.speech.tts.lucid.AudioSource, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.lucid.AudioSource.displayName = 'proto.speech.tts.lucid.AudioSource';
}



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.lucid.AudioSource.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.lucid.AudioSource.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.lucid.AudioSource} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.AudioSource.toObject = function(includeInstance, msg) {
  let f, obj = {
    vuiId: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    stageName: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of AudioSource as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.lucid.AudioSource.ObjectFormat = function() {
  /** @type {?string|undefined} */
  this.vuiId;

  /** @type {?string|undefined} */
  this.stageName;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.lucid.AudioSource.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.lucid.AudioSource}
 */
proto.speech.tts.lucid.AudioSource.fromObject = function(obj) {
  const msg = new proto.speech.tts.lucid.AudioSource();
  obj.vuiId != null && jspb.Message.setField(msg, 1, obj.vuiId);
  obj.stageName != null && jspb.Message.setField(msg, 2, obj.stageName);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.lucid.AudioSource}
 */
proto.speech.tts.lucid.AudioSource.deserializeBinary = function(bytes) {
  return proto.speech.tts.lucid.AudioSource.deserializeBinaryFromReader(
      new proto.speech.tts.lucid.AudioSource(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.lucid.AudioSource} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.lucid.AudioSource}
 */
proto.speech.tts.lucid.AudioSource.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {string} */ (reader.readString());
      msg.setVuiId(value);
      break;
    case 2:
      value = /** @type {string} */ (reader.readString());
      msg.setStageName(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.lucid.AudioSource.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.lucid.AudioSource.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.lucid.AudioSource} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.AudioSource.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {?string} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeString(
      1,
      f
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeString(
      2,
      f
    );
  }
};


/**
 * optional string vui_id = 1;
 * @return {?string}
 */
proto.speech.tts.lucid.AudioSource.prototype.getVuiId = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 1));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.AudioSource} returns this
 */
proto.speech.tts.lucid.AudioSource.prototype.setVuiId = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.AudioSource} returns this
 */
proto.speech.tts.lucid.AudioSource.prototype.clearVuiId = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.AudioSource.prototype.hasVuiId = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional string stage_name = 2;
 * @return {?string}
 */
proto.speech.tts.lucid.AudioSource.prototype.getStageName = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 2));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.AudioSource} returns this
 */
proto.speech.tts.lucid.AudioSource.prototype.setStageName = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.AudioSource} returns this
 */
proto.speech.tts.lucid.AudioSource.prototype.clearStageName = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.AudioSource.prototype.hasStageName = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.lucid.AudioSource}
 */
proto.speech.tts.lucid.AudioSource.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.lucid.AudioSource, data);
};



//speech/tts/public/performance_options_proto_jspb/performancespecification.jspb.js
// source: speech/tts/public/performance_options.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.PerformanceSpecification');
goog.provide('proto.speech.tts.PerformanceSpecification.TextPolicy');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.PerformanceSpecification = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.speech.tts.PerformanceSpecification, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.PerformanceSpecification.displayName = 'proto.speech.tts.PerformanceSpecification';
}



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.PerformanceSpecification.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.PerformanceSpecification.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.PerformanceSpecification} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.PerformanceSpecification.toObject = function(includeInstance, msg) {
  let f, obj = {
    performanceId: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    textPolicy: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f,
    obtainedWithVuiIdMapping: jspb.Message.getBooleanFieldWithDefault(msg, 3, false)
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of PerformanceSpecification as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.PerformanceSpecification.ObjectFormat = function() {
  /** @type {?string|undefined} */
  this.performanceId;

  /** @type {?number|undefined} */
  this.textPolicy;

  /** @type {?boolean|undefined} */
  this.obtainedWithVuiIdMapping;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.PerformanceSpecification.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.PerformanceSpecification}
 */
proto.speech.tts.PerformanceSpecification.fromObject = function(obj) {
  const msg = new proto.speech.tts.PerformanceSpecification();
  obj.performanceId != null && jspb.Message.setField(msg, 1, obj.performanceId);
  obj.textPolicy != null && jspb.Message.setField(msg, 2, obj.textPolicy);
  obj.obtainedWithVuiIdMapping != null && jspb.Message.setField(msg, 3, obj.obtainedWithVuiIdMapping);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.PerformanceSpecification}
 */
proto.speech.tts.PerformanceSpecification.deserializeBinary = function(bytes) {
  return proto.speech.tts.PerformanceSpecification.deserializeBinaryFromReader(
      new proto.speech.tts.PerformanceSpecification(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.PerformanceSpecification} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.PerformanceSpecification}
 */
proto.speech.tts.PerformanceSpecification.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {string} */ (reader.readUint64String());
      msg.setPerformanceId(value);
      break;
    case 2:
      value = /** @type {!proto.speech.tts.PerformanceSpecification.TextPolicy} */ (reader.readEnum());
      msg.setTextPolicy(value);
      break;
    case 3:
      value = /** @type {boolean} */ (reader.readBool());
      msg.setObtainedWithVuiIdMapping(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.PerformanceSpecification.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.PerformanceSpecification.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.PerformanceSpecification} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.PerformanceSpecification.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {string} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeUint64String(
      1,
      f
    );
  }
  f = /** @type {!proto.speech.tts.PerformanceSpecification.TextPolicy} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeEnum(
      2,
      f
    );
  }
  f = /** @type {boolean} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeBool(
      3,
      f
    );
  }
};


/**
 * @enum {number}
 */
proto.speech.tts.PerformanceSpecification.TextPolicy = {
  UNKNOWN_POLICY: 0,
  USE_REQUESTED_TEXT: 1,
  USE_DIRECTOR_TEXT: 2,
  CALCULATE_PROSODY_EMBEDDING: 3
};

/**
 * optional uint64 performance_id = 1;
 * @return {string}
 */
proto.speech.tts.PerformanceSpecification.prototype.getPerformanceId = function() {
  return jspb.Message.getIntegerInStringFieldWithDefault(this, 1);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.PerformanceSpecification} returns this
 */
proto.speech.tts.PerformanceSpecification.prototype.setPerformanceId = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.PerformanceSpecification} returns this
 */
proto.speech.tts.PerformanceSpecification.prototype.clearPerformanceId = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.PerformanceSpecification.prototype.hasPerformanceId = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional TextPolicy text_policy = 2;
 * @return {!proto.speech.tts.PerformanceSpecification.TextPolicy}
 */
proto.speech.tts.PerformanceSpecification.prototype.getTextPolicy = function() {
  return /** @type {!proto.speech.tts.PerformanceSpecification.TextPolicy} */ (jspb.Message.getFieldWithDefault(this, 2, 0));
};


/**
 * @param {!proto.speech.tts.PerformanceSpecification.TextPolicy} value
 * @return {!proto.speech.tts.PerformanceSpecification} returns this
 */
proto.speech.tts.PerformanceSpecification.prototype.setTextPolicy = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.PerformanceSpecification} returns this
 */
proto.speech.tts.PerformanceSpecification.prototype.clearTextPolicy = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.PerformanceSpecification.prototype.hasTextPolicy = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional bool obtained_with_vui_id_mapping = 3;
 * @return {boolean}
 */
proto.speech.tts.PerformanceSpecification.prototype.getObtainedWithVuiIdMapping = function() {
  return jspb.Message.getBooleanFieldWithDefault(this, 3, false);
};


/**
 * @param {boolean} value
 * @return {!proto.speech.tts.PerformanceSpecification} returns this
 */
proto.speech.tts.PerformanceSpecification.prototype.setObtainedWithVuiIdMapping = function(value) {
  return jspb.Message.setField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.PerformanceSpecification} returns this
 */
proto.speech.tts.PerformanceSpecification.prototype.clearObtainedWithVuiIdMapping = function() {
  return jspb.Message.clearField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.PerformanceSpecification.prototype.hasObtainedWithVuiIdMapping = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.PerformanceSpecification}
 */
proto.speech.tts.PerformanceSpecification.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.PerformanceSpecification, data);
};



//speech/tts/public/performance_options_proto_jspb/performanceoptions.jspb.js
// source: speech/tts/public/performance_options.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.PerformanceOptions');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.speech.tts.PerformanceSpecification');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.PerformanceOptions = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.speech.tts.PerformanceOptions, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.PerformanceOptions.displayName = 'proto.speech.tts.PerformanceOptions';
}



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.PerformanceOptions.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.PerformanceOptions.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.PerformanceOptions} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.PerformanceOptions.toObject = function(includeInstance, msg) {
  let f, obj = {
    performanceSpec: (f = msg.getPerformanceSpec()) && proto.speech.tts.PerformanceSpecification.toObject(includeInstance, f)
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of PerformanceOptions as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.PerformanceOptions.ObjectFormat = function() {
  /** @type {?proto.speech.tts.PerformanceSpecification.ObjectFormat|undefined} */
  this.performanceSpec;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.PerformanceOptions.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.PerformanceOptions}
 */
proto.speech.tts.PerformanceOptions.fromObject = function(obj) {
  const msg = new proto.speech.tts.PerformanceOptions();
  obj.performanceSpec && jspb.Message.setWrapperField(
      msg, 1, proto.speech.tts.PerformanceSpecification.fromObject(obj.performanceSpec));
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.PerformanceOptions}
 */
proto.speech.tts.PerformanceOptions.deserializeBinary = function(bytes) {
  return proto.speech.tts.PerformanceOptions.deserializeBinaryFromReader(
      new proto.speech.tts.PerformanceOptions(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.PerformanceOptions} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.PerformanceOptions}
 */
proto.speech.tts.PerformanceOptions.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = new proto.speech.tts.PerformanceSpecification();
      reader.readMessage(value,proto.speech.tts.PerformanceSpecification.deserializeBinaryFromReader);
      msg.setPerformanceSpec(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.PerformanceOptions.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.PerformanceOptions.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.PerformanceOptions} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.PerformanceOptions.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = message.getPerformanceSpec();
  if (f != null) {
    writer.writeMessage(
      1,
      f,
      proto.speech.tts.PerformanceSpecification.serializeBinaryToWriter
    );
  }
};


/**
 * optional PerformanceSpecification performance_spec = 1;
 * @return {?proto.speech.tts.PerformanceSpecification}
 */
proto.speech.tts.PerformanceOptions.prototype.getPerformanceSpec = function() {
  return /** @type{?proto.speech.tts.PerformanceSpecification} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.PerformanceSpecification, 1));
};


/**
 * @param {?proto.speech.tts.PerformanceSpecification|undefined} value
 * @return {!proto.speech.tts.PerformanceOptions} returns this
*/
proto.speech.tts.PerformanceOptions.prototype.setPerformanceSpec = function(value) {
  return jspb.Message.setWrapperField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.PerformanceOptions} returns this
 */
proto.speech.tts.PerformanceOptions.prototype.clearPerformanceSpec = function() {
  return jspb.Message.clearWrapperField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.PerformanceOptions.prototype.hasPerformanceSpec = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.PerformanceOptions}
 */
proto.speech.tts.PerformanceOptions.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.PerformanceOptions, data);
};



//speech/tts/public/speech_morphing_target_proto_jspb/speechmorphingtarget.jspb.js
// source: speech/tts/public/speech_morphing_target.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.SpeechMorphingTarget');
goog.provide('proto.speech.tts.SpeechMorphingTarget.MorphingType');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.SpeechMorphingTarget = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.speech.tts.SpeechMorphingTarget, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.SpeechMorphingTarget.displayName = 'proto.speech.tts.SpeechMorphingTarget';
}



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.SpeechMorphingTarget.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.SpeechMorphingTarget.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.SpeechMorphingTarget} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.SpeechMorphingTarget.toObject = function(includeInstance, msg) {
  let f, obj = {
    type: jspb.Message.getFieldWithDefault(msg, 1, 0),
    reference: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of SpeechMorphingTarget as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.SpeechMorphingTarget.ObjectFormat = function() {
  /** @type {?number|undefined} */
  this.type;

  /** @type {?string|undefined} */
  this.reference;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.SpeechMorphingTarget.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.SpeechMorphingTarget}
 */
proto.speech.tts.SpeechMorphingTarget.fromObject = function(obj) {
  const msg = new proto.speech.tts.SpeechMorphingTarget();
  obj.type != null && jspb.Message.setField(msg, 1, obj.type);
  obj.reference != null && jspb.Message.setField(msg, 2, obj.reference);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.SpeechMorphingTarget}
 */
proto.speech.tts.SpeechMorphingTarget.deserializeBinary = function(bytes) {
  return proto.speech.tts.SpeechMorphingTarget.deserializeBinaryFromReader(
      new proto.speech.tts.SpeechMorphingTarget(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.SpeechMorphingTarget} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.SpeechMorphingTarget}
 */
proto.speech.tts.SpeechMorphingTarget.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {!proto.speech.tts.SpeechMorphingTarget.MorphingType} */ (reader.readEnum());
      msg.setType(value);
      break;
    case 2:
      value = /** @type {string} */ (reader.readString());
      msg.setReference(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.SpeechMorphingTarget.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.SpeechMorphingTarget.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.SpeechMorphingTarget} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.SpeechMorphingTarget.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {!proto.speech.tts.SpeechMorphingTarget.MorphingType} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeEnum(
      1,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeString(
      2,
      f
    );
  }
};


/**
 * @enum {number}
 */
proto.speech.tts.SpeechMorphingTarget.MorphingType = {
  UNKNOWN_MORPHING_TYPE: 0,
  NONE: 1,
  VOICE_TIMBRE_USING_ODFWW: 2
};

/**
 * optional MorphingType type = 1;
 * @return {!proto.speech.tts.SpeechMorphingTarget.MorphingType}
 */
proto.speech.tts.SpeechMorphingTarget.prototype.getType = function() {
  return /** @type {!proto.speech.tts.SpeechMorphingTarget.MorphingType} */ (jspb.Message.getFieldWithDefault(this, 1, 0));
};


/**
 * @param {!proto.speech.tts.SpeechMorphingTarget.MorphingType} value
 * @return {!proto.speech.tts.SpeechMorphingTarget} returns this
 */
proto.speech.tts.SpeechMorphingTarget.prototype.setType = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.SpeechMorphingTarget} returns this
 */
proto.speech.tts.SpeechMorphingTarget.prototype.clearType = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.SpeechMorphingTarget.prototype.hasType = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional string reference = 2;
 * @return {string}
 */
proto.speech.tts.SpeechMorphingTarget.prototype.getReference = function() {
  return jspb.Message.getStringFieldWithDefault(this, 2);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.SpeechMorphingTarget} returns this
 */
proto.speech.tts.SpeechMorphingTarget.prototype.setReference = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.SpeechMorphingTarget} returns this
 */
proto.speech.tts.SpeechMorphingTarget.prototype.clearReference = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.SpeechMorphingTarget.prototype.hasReference = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.SpeechMorphingTarget}
 */
proto.speech.tts.SpeechMorphingTarget.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.SpeechMorphingTarget, data);
};



//speech/tts/public/speech_morphing_target_proto_jspb/speechmorphingtargets.jspb.js
// source: speech/tts/public/speech_morphing_target.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.SpeechMorphingTargets');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.speech.tts.SpeechMorphingTarget');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.SpeechMorphingTargets = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, proto.speech.tts.SpeechMorphingTargets.repeatedFields_, null);
};
goog.inherits(proto.speech.tts.SpeechMorphingTargets, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.SpeechMorphingTargets.displayName = 'proto.speech.tts.SpeechMorphingTargets';
}

/**
 * List of repeated fields within this message type.
 * @private {!Array<number>}
 * @const
 */
proto.speech.tts.SpeechMorphingTargets.repeatedFields_ = [1];



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.SpeechMorphingTargets.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.SpeechMorphingTargets.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.SpeechMorphingTargets} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.SpeechMorphingTargets.toObject = function(includeInstance, msg) {
  let f, obj = {
    targetList: jspb.Message.toObjectList(msg.getTargetList(),
    proto.speech.tts.SpeechMorphingTarget.toObject, includeInstance)
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of SpeechMorphingTargets as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.SpeechMorphingTargets.ObjectFormat = function() {
  /** @type {?Array<!proto.speech.tts.SpeechMorphingTarget.ObjectFormat>|undefined} */
  this.targetList;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.SpeechMorphingTargets.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.SpeechMorphingTargets}
 */
proto.speech.tts.SpeechMorphingTargets.fromObject = function(obj) {
  const msg = new proto.speech.tts.SpeechMorphingTargets();
  obj.targetList && jspb.Message.setRepeatedWrapperField(
      msg, 1, obj.targetList.map(
          proto.speech.tts.SpeechMorphingTarget.fromObject));
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.SpeechMorphingTargets}
 */
proto.speech.tts.SpeechMorphingTargets.deserializeBinary = function(bytes) {
  return proto.speech.tts.SpeechMorphingTargets.deserializeBinaryFromReader(
      new proto.speech.tts.SpeechMorphingTargets(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.SpeechMorphingTargets} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.SpeechMorphingTargets}
 */
proto.speech.tts.SpeechMorphingTargets.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = new proto.speech.tts.SpeechMorphingTarget();
      reader.readMessage(value,proto.speech.tts.SpeechMorphingTarget.deserializeBinaryFromReader);
      msg.addTarget(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.SpeechMorphingTargets.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.SpeechMorphingTargets.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.SpeechMorphingTargets} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.SpeechMorphingTargets.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = message.getTargetList();
  if (f.length > 0) {
    writer.writeRepeatedMessage(
      1,
      f,
      proto.speech.tts.SpeechMorphingTarget.serializeBinaryToWriter
    );
  }
};


/**
 * repeated SpeechMorphingTarget target = 1;
 * @return {!Array<!proto.speech.tts.SpeechMorphingTarget>}
 */
proto.speech.tts.SpeechMorphingTargets.prototype.getTargetList = function() {
  return /** @type{!Array<!proto.speech.tts.SpeechMorphingTarget>} */ (
    jspb.Message.getRepeatedWrapperField(this, proto.speech.tts.SpeechMorphingTarget, 1));
};


/**
 * @param {!Array<!proto.speech.tts.SpeechMorphingTarget>} value
 * @return {!proto.speech.tts.SpeechMorphingTargets} returns this
*/
proto.speech.tts.SpeechMorphingTargets.prototype.setTargetList = function(value) {
  return jspb.Message.setRepeatedWrapperField(this, 1, value);
};


/**
 * @param {!proto.speech.tts.SpeechMorphingTarget=} opt_value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.SpeechMorphingTarget}
 */
proto.speech.tts.SpeechMorphingTargets.prototype.addTarget = function(opt_value, opt_index) {
  return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.speech.tts.SpeechMorphingTarget, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.SpeechMorphingTargets} returns this
 */
proto.speech.tts.SpeechMorphingTargets.prototype.clearTargetList = function() {
  return jspb.Message.clearRepeatedWrapperField(this, 1);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.SpeechMorphingTargets}
 */
proto.speech.tts.SpeechMorphingTargets.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.SpeechMorphingTargets, data);
};



//speech/tts/public/lucid/synthesis_parameters_proto_jspb/synthesisparameters.jspb.js
// source: speech/tts/public/lucid/synthesis_parameters.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.lucid.SynthesisParameters');
goog.provide('proto.speech.tts.lucid.SynthesisParameters.Redaction');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.speech.tts.PerformanceOptions');
goog.require('proto.speech.tts.SpeechMorphingTargets');
goog.require('proto.speech.tts.lucid.AudioSource');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.lucid.SynthesisParameters = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, proto.speech.tts.lucid.SynthesisParameters.repeatedFields_, null);
};
goog.inherits(proto.speech.tts.lucid.SynthesisParameters, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.lucid.SynthesisParameters.displayName = 'proto.speech.tts.lucid.SynthesisParameters';
}

/**
 * List of repeated fields within this message type.
 * @private {!Array<number>}
 * @const
 */
proto.speech.tts.lucid.SynthesisParameters.repeatedFields_ = [3,4];



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.lucid.SynthesisParameters.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.lucid.SynthesisParameters.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.lucid.SynthesisParameters} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.SynthesisParameters.toObject = function(includeInstance, msg) {
  let f, obj = {
    morphing: (f = msg.getMorphing()) && proto.speech.tts.SpeechMorphingTargets.toObject(includeInstance, f),
    outputGain: jspb.Message.getFloatingPointFieldWithDefault(msg, 2, 1.0),
    audioSourcesList: jspb.Message.toObjectList(msg.getAudioSourcesList(),
    proto.speech.tts.lucid.AudioSource.toObject, includeInstance),
    performanceOptions: (f = msg.getPerformanceOptions()) && proto.speech.tts.PerformanceOptions.toObject(includeInstance, f),
    redactionList: (f = jspb.Message.getRepeatedField(msg, 4)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of SynthesisParameters as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.lucid.SynthesisParameters.ObjectFormat = function() {
  /** @type {?proto.speech.tts.SpeechMorphingTargets.ObjectFormat|undefined} */
  this.morphing;

  /** @type {?number|undefined} */
  this.outputGain;

  /** @type {?Array<!proto.speech.tts.lucid.AudioSource.ObjectFormat>|undefined} */
  this.audioSourcesList;

  /** @type {?proto.speech.tts.PerformanceOptions.ObjectFormat|undefined} */
  this.performanceOptions;

  /** @type {?Array<number>|undefined} */
  this.redactionList;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.lucid.SynthesisParameters.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.lucid.SynthesisParameters}
 */
proto.speech.tts.lucid.SynthesisParameters.fromObject = function(obj) {
  const msg = new proto.speech.tts.lucid.SynthesisParameters();
  obj.morphing && jspb.Message.setWrapperField(
      msg, 1, proto.speech.tts.SpeechMorphingTargets.fromObject(obj.morphing));
  obj.outputGain != null && jspb.Message.setField(msg, 2, obj.outputGain);
  obj.audioSourcesList && jspb.Message.setRepeatedWrapperField(
      msg, 3, obj.audioSourcesList.map(
          proto.speech.tts.lucid.AudioSource.fromObject));
  obj.performanceOptions && jspb.Message.setWrapperField(
      msg, 5, proto.speech.tts.PerformanceOptions.fromObject(obj.performanceOptions));
  obj.redactionList != null && jspb.Message.setField(msg, 4, obj.redactionList);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.lucid.SynthesisParameters}
 */
proto.speech.tts.lucid.SynthesisParameters.deserializeBinary = function(bytes) {
  return proto.speech.tts.lucid.SynthesisParameters.deserializeBinaryFromReader(
      new proto.speech.tts.lucid.SynthesisParameters(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.lucid.SynthesisParameters} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.lucid.SynthesisParameters}
 */
proto.speech.tts.lucid.SynthesisParameters.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = new proto.speech.tts.SpeechMorphingTargets();
      reader.readMessage(value,proto.speech.tts.SpeechMorphingTargets.deserializeBinaryFromReader);
      msg.setMorphing(value);
      break;
    case 2:
      value = /** @type {number} */ (reader.readFloat());
      msg.setOutputGain(value);
      break;
    case 3:
      value = new proto.speech.tts.lucid.AudioSource();
      reader.readMessage(value,proto.speech.tts.lucid.AudioSource.deserializeBinaryFromReader);
      msg.addAudioSources(value);
      break;
    case 5:
      value = new proto.speech.tts.PerformanceOptions();
      reader.readMessage(value,proto.speech.tts.PerformanceOptions.deserializeBinaryFromReader);
      msg.setPerformanceOptions(value);
      break;
    case 4:
      value = /** @type {!Array<!proto.speech.tts.lucid.SynthesisParameters.Redaction>} */ (reader.isDelimited() ? reader.readPackedEnum() : [reader.readEnum()]);
      for (let i = 0; i < value.length; i++) {
        msg.addRedaction(value[i]);
      }
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.lucid.SynthesisParameters.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.lucid.SynthesisParameters.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.lucid.SynthesisParameters} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.SynthesisParameters.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = message.getMorphing();
  if (f != null) {
    writer.writeMessage(
      1,
      f,
      proto.speech.tts.SpeechMorphingTargets.serializeBinaryToWriter
    );
  }
  f = /** @type {number} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeFloat(
      2,
      f
    );
  }
  f = message.getAudioSourcesList();
  if (f.length > 0) {
    writer.writeRepeatedMessage(
      3,
      f,
      proto.speech.tts.lucid.AudioSource.serializeBinaryToWriter
    );
  }
  f = message.getPerformanceOptions();
  if (f != null) {
    writer.writeMessage(
      5,
      f,
      proto.speech.tts.PerformanceOptions.serializeBinaryToWriter
    );
  }
  f = message.getRedactionList();
  if (f.length > 0) {
    writer.writeRepeatedEnum(
      4,
      f
    );
  }
};


/**
 * @enum {number}
 */
proto.speech.tts.lucid.SynthesisParameters.Redaction = {
  UNSPECIFIED_REDACTION: 0,
  BLEEP: 1,
  BOWDLERIZE: 2,
  /** @deprecated */
  NO_CELEBRITY: 3
};

/**
 * optional speech.tts.SpeechMorphingTargets morphing = 1;
 * @return {?proto.speech.tts.SpeechMorphingTargets}
 */
proto.speech.tts.lucid.SynthesisParameters.prototype.getMorphing = function() {
  return /** @type{?proto.speech.tts.SpeechMorphingTargets} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.SpeechMorphingTargets, 1));
};


/**
 * @param {?proto.speech.tts.SpeechMorphingTargets|undefined} value
 * @return {!proto.speech.tts.lucid.SynthesisParameters} returns this
*/
proto.speech.tts.lucid.SynthesisParameters.prototype.setMorphing = function(value) {
  return jspb.Message.setWrapperField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.SynthesisParameters} returns this
 */
proto.speech.tts.lucid.SynthesisParameters.prototype.clearMorphing = function() {
  return jspb.Message.clearWrapperField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.SynthesisParameters.prototype.hasMorphing = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional float output_gain = 2;
 * @return {number}
 */
proto.speech.tts.lucid.SynthesisParameters.prototype.getOutputGain = function() {
  return jspb.Message.getFloatingPointFieldWithDefault(this, 2, 1.0);
};


/**
 * @param {?number|undefined} value
 * @return {!proto.speech.tts.lucid.SynthesisParameters} returns this
 */
proto.speech.tts.lucid.SynthesisParameters.prototype.setOutputGain = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.SynthesisParameters} returns this
 */
proto.speech.tts.lucid.SynthesisParameters.prototype.clearOutputGain = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.SynthesisParameters.prototype.hasOutputGain = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * repeated AudioSource audio_sources = 3;
 * @return {!Array<!proto.speech.tts.lucid.AudioSource>}
 */
proto.speech.tts.lucid.SynthesisParameters.prototype.getAudioSourcesList = function() {
  return /** @type{!Array<!proto.speech.tts.lucid.AudioSource>} */ (
    jspb.Message.getRepeatedWrapperField(this, proto.speech.tts.lucid.AudioSource, 3));
};


/**
 * @param {Array<!proto.speech.tts.lucid.AudioSource>|undefined} value
 * @return {!proto.speech.tts.lucid.SynthesisParameters} returns this
*/
proto.speech.tts.lucid.SynthesisParameters.prototype.setAudioSourcesList = function(value) {
  return jspb.Message.setRepeatedWrapperField(this, 3, value);
};


/**
 * @param {!proto.speech.tts.lucid.AudioSource=} opt_value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.lucid.AudioSource}
 */
proto.speech.tts.lucid.SynthesisParameters.prototype.addAudioSources = function(opt_value, opt_index) {
  return jspb.Message.addToRepeatedWrapperField(this, 3, opt_value, proto.speech.tts.lucid.AudioSource, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.lucid.SynthesisParameters} returns this
 */
proto.speech.tts.lucid.SynthesisParameters.prototype.clearAudioSourcesList = function() {
  return jspb.Message.clearRepeatedWrapperField(this, 3);
};


/**
 * optional speech.tts.PerformanceOptions performance_options = 5;
 * @return {?proto.speech.tts.PerformanceOptions}
 */
proto.speech.tts.lucid.SynthesisParameters.prototype.getPerformanceOptions = function() {
  return /** @type{?proto.speech.tts.PerformanceOptions} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.PerformanceOptions, 5));
};


/**
 * @param {?proto.speech.tts.PerformanceOptions|undefined} value
 * @return {!proto.speech.tts.lucid.SynthesisParameters} returns this
*/
proto.speech.tts.lucid.SynthesisParameters.prototype.setPerformanceOptions = function(value) {
  return jspb.Message.setWrapperField(this, 5, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.SynthesisParameters} returns this
 */
proto.speech.tts.lucid.SynthesisParameters.prototype.clearPerformanceOptions = function() {
  return jspb.Message.clearWrapperField(this, 5);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.SynthesisParameters.prototype.hasPerformanceOptions = function() {
  return jspb.Message.hasField(this, 5);
};


/**
 * repeated Redaction redaction = 4;
 * @return {!Array<!proto.speech.tts.lucid.SynthesisParameters.Redaction>}
 */
proto.speech.tts.lucid.SynthesisParameters.prototype.getRedactionList = function() {
  return /** @type {!Array<!proto.speech.tts.lucid.SynthesisParameters.Redaction>} */ (jspb.Message.getRepeatedField(this, 4));
};


/**
 * @param {Array<!proto.speech.tts.lucid.SynthesisParameters.Redaction>|undefined} value
 * @return {!proto.speech.tts.lucid.SynthesisParameters} returns this
 */
proto.speech.tts.lucid.SynthesisParameters.prototype.setRedactionList = function(value) {
  return jspb.Message.setField(this, 4, value || []);
};


/**
 * @param {!proto.speech.tts.lucid.SynthesisParameters.Redaction} value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.lucid.SynthesisParameters} returns this
 */
proto.speech.tts.lucid.SynthesisParameters.prototype.addRedaction = function(value, opt_index) {
  return jspb.Message.addToRepeatedField(this, 4, value, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.lucid.SynthesisParameters} returns this
 */
proto.speech.tts.lucid.SynthesisParameters.prototype.clearRedactionList = function() {
  return jspb.Message.clearRepeatedField(this, 4);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.lucid.SynthesisParameters}
 */
proto.speech.tts.lucid.SynthesisParameters.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.lucid.SynthesisParameters, data);
};



//speech/tts/public/lucid/voice_selection_proto_jspb/voiceattributes.jspb.js
// source: speech/tts/public/lucid/voice_selection.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.lucid.VoiceAttributes');
goog.provide('proto.speech.tts.lucid.VoiceAttributes.TieBreakerCase');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.speech.tts.lucid.VoiceAttribute');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.lucid.VoiceAttributes = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, proto.speech.tts.lucid.VoiceAttributes.repeatedFields_, proto.speech.tts.lucid.VoiceAttributes.oneofGroups_);
};
goog.inherits(proto.speech.tts.lucid.VoiceAttributes, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.lucid.VoiceAttributes.displayName = 'proto.speech.tts.lucid.VoiceAttributes';
}

/**
 * List of repeated fields within this message type.
 * @private {!Array<number>}
 * @const
 */
proto.speech.tts.lucid.VoiceAttributes.repeatedFields_ = [1,2];

/**
 * Oneof group definitions for this message. Each group defines the field
 * numbers belonging to that group. When of these fields' value is set, all
 * other fields in the group are cleared. During deserialization, if multiple
 * fields are encountered for a group, only the last value seen will be kept.
 * @private {!Array<!Array<number>>}
 * @const
 */
proto.speech.tts.lucid.VoiceAttributes.oneofGroups_ = [[3,4]];

/**
 * @enum {number}
 */
proto.speech.tts.lucid.VoiceAttributes.TieBreakerCase = {
  TIE_BREAKER_NOT_SET: 0,
  VARIANT: 3,
  RANDOMIZE: 4
};

/**
 * @return {!proto.speech.tts.lucid.VoiceAttributes.TieBreakerCase}
 */
proto.speech.tts.lucid.VoiceAttributes.prototype.getTieBreakerCase = function() {
  return /** @type {!proto.speech.tts.lucid.VoiceAttributes.TieBreakerCase} */(jspb.Message.computeOneofCase(this, proto.speech.tts.lucid.VoiceAttributes.oneofGroups_[0]));
};



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.lucid.VoiceAttributes.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.lucid.VoiceAttributes.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.lucid.VoiceAttributes} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.VoiceAttributes.toObject = function(includeInstance, msg) {
  let f, obj = {
    requiredAttributesList: jspb.Message.toObjectList(msg.getRequiredAttributesList(),
    proto.speech.tts.lucid.VoiceAttribute.toObject, includeInstance),
    preferredAttributesList: jspb.Message.toObjectList(msg.getPreferredAttributesList(),
    proto.speech.tts.lucid.VoiceAttribute.toObject, includeInstance),
    variant: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f,
    randomize: (f = jspb.Message.getBooleanField(msg, 4)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of VoiceAttributes as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.lucid.VoiceAttributes.ObjectFormat = function() {
  /** @type {?Array<!proto.speech.tts.lucid.VoiceAttribute.ObjectFormat>|undefined} */
  this.requiredAttributesList;

  /** @type {?Array<!proto.speech.tts.lucid.VoiceAttribute.ObjectFormat>|undefined} */
  this.preferredAttributesList;

  /** @type {?number|undefined} */
  this.variant;

  /** @type {?boolean|undefined} */
  this.randomize;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.lucid.VoiceAttributes.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.lucid.VoiceAttributes}
 */
proto.speech.tts.lucid.VoiceAttributes.fromObject = function(obj) {
  const msg = new proto.speech.tts.lucid.VoiceAttributes();
  obj.requiredAttributesList && jspb.Message.setRepeatedWrapperField(
      msg, 1, obj.requiredAttributesList.map(
          proto.speech.tts.lucid.VoiceAttribute.fromObject));
  obj.preferredAttributesList && jspb.Message.setRepeatedWrapperField(
      msg, 2, obj.preferredAttributesList.map(
          proto.speech.tts.lucid.VoiceAttribute.fromObject));
  obj.variant != null && jspb.Message.setOneofField(msg, 3, proto.speech.tts.lucid.VoiceAttributes.oneofGroups_[0], obj.variant);
  obj.randomize != null && jspb.Message.setOneofField(msg, 4, proto.speech.tts.lucid.VoiceAttributes.oneofGroups_[0], obj.randomize);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.lucid.VoiceAttributes}
 */
proto.speech.tts.lucid.VoiceAttributes.deserializeBinary = function(bytes) {
  return proto.speech.tts.lucid.VoiceAttributes.deserializeBinaryFromReader(
      new proto.speech.tts.lucid.VoiceAttributes(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.lucid.VoiceAttributes} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.lucid.VoiceAttributes}
 */
proto.speech.tts.lucid.VoiceAttributes.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = new proto.speech.tts.lucid.VoiceAttribute();
      reader.readMessage(value,proto.speech.tts.lucid.VoiceAttribute.deserializeBinaryFromReader);
      msg.addRequiredAttributes(value);
      break;
    case 2:
      value = new proto.speech.tts.lucid.VoiceAttribute();
      reader.readMessage(value,proto.speech.tts.lucid.VoiceAttribute.deserializeBinaryFromReader);
      msg.addPreferredAttributes(value);
      break;
    case 3:
      value = /** @type {number} */ (reader.readInt32());
      msg.setVariant(value);
      break;
    case 4:
      value = /** @type {boolean} */ (reader.readBool());
      msg.setRandomize(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.lucid.VoiceAttributes.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.lucid.VoiceAttributes.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.lucid.VoiceAttributes} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.VoiceAttributes.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = message.getRequiredAttributesList();
  if (f.length > 0) {
    writer.writeRepeatedMessage(
      1,
      f,
      proto.speech.tts.lucid.VoiceAttribute.serializeBinaryToWriter
    );
  }
  f = message.getPreferredAttributesList();
  if (f.length > 0) {
    writer.writeRepeatedMessage(
      2,
      f,
      proto.speech.tts.lucid.VoiceAttribute.serializeBinaryToWriter
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeInt32(
      3,
      f
    );
  }
  f = /** @type {?boolean} */ (jspb.Message.getField(message, 4));
  if (f != null) {
    writer.writeBool(
      4,
      f
    );
  }
};


/**
 * repeated VoiceAttribute required_attributes = 1;
 * @return {!Array<!proto.speech.tts.lucid.VoiceAttribute>}
 */
proto.speech.tts.lucid.VoiceAttributes.prototype.getRequiredAttributesList = function() {
  return /** @type{!Array<!proto.speech.tts.lucid.VoiceAttribute>} */ (
    jspb.Message.getRepeatedWrapperField(this, proto.speech.tts.lucid.VoiceAttribute, 1));
};


/**
 * @param {Array<!proto.speech.tts.lucid.VoiceAttribute>|undefined} value
 * @return {!proto.speech.tts.lucid.VoiceAttributes} returns this
*/
proto.speech.tts.lucid.VoiceAttributes.prototype.setRequiredAttributesList = function(value) {
  return jspb.Message.setRepeatedWrapperField(this, 1, value);
};


/**
 * @param {!proto.speech.tts.lucid.VoiceAttribute=} opt_value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.lucid.VoiceAttribute}
 */
proto.speech.tts.lucid.VoiceAttributes.prototype.addRequiredAttributes = function(opt_value, opt_index) {
  return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.speech.tts.lucid.VoiceAttribute, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.lucid.VoiceAttributes} returns this
 */
proto.speech.tts.lucid.VoiceAttributes.prototype.clearRequiredAttributesList = function() {
  return jspb.Message.clearRepeatedWrapperField(this, 1);
};


/**
 * repeated VoiceAttribute preferred_attributes = 2;
 * @return {!Array<!proto.speech.tts.lucid.VoiceAttribute>}
 */
proto.speech.tts.lucid.VoiceAttributes.prototype.getPreferredAttributesList = function() {
  return /** @type{!Array<!proto.speech.tts.lucid.VoiceAttribute>} */ (
    jspb.Message.getRepeatedWrapperField(this, proto.speech.tts.lucid.VoiceAttribute, 2));
};


/**
 * @param {Array<!proto.speech.tts.lucid.VoiceAttribute>|undefined} value
 * @return {!proto.speech.tts.lucid.VoiceAttributes} returns this
*/
proto.speech.tts.lucid.VoiceAttributes.prototype.setPreferredAttributesList = function(value) {
  return jspb.Message.setRepeatedWrapperField(this, 2, value);
};


/**
 * @param {!proto.speech.tts.lucid.VoiceAttribute=} opt_value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.lucid.VoiceAttribute}
 */
proto.speech.tts.lucid.VoiceAttributes.prototype.addPreferredAttributes = function(opt_value, opt_index) {
  return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.speech.tts.lucid.VoiceAttribute, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.lucid.VoiceAttributes} returns this
 */
proto.speech.tts.lucid.VoiceAttributes.prototype.clearPreferredAttributesList = function() {
  return jspb.Message.clearRepeatedWrapperField(this, 2);
};


/**
 * optional int32 variant = 3;
 * @return {?number}
 */
proto.speech.tts.lucid.VoiceAttributes.prototype.getVariant = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 3));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.speech.tts.lucid.VoiceAttributes} returns this
 */
proto.speech.tts.lucid.VoiceAttributes.prototype.setVariant = function(value) {
  return jspb.Message.setOneofField(this, 3, proto.speech.tts.lucid.VoiceAttributes.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.VoiceAttributes} returns this
 */
proto.speech.tts.lucid.VoiceAttributes.prototype.clearVariant = function() {
  return jspb.Message.clearOneofField(this, 3, proto.speech.tts.lucid.VoiceAttributes.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.VoiceAttributes.prototype.hasVariant = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * optional bool randomize = 4;
 * @return {?boolean}
 */
proto.speech.tts.lucid.VoiceAttributes.prototype.getRandomize = function() {
  return /** @type {?boolean} */ (jspb.Message.getBooleanField(this, 4));
};


/**
 * @param {?boolean|undefined} value
 * @return {!proto.speech.tts.lucid.VoiceAttributes} returns this
 */
proto.speech.tts.lucid.VoiceAttributes.prototype.setRandomize = function(value) {
  return jspb.Message.setOneofField(this, 4, proto.speech.tts.lucid.VoiceAttributes.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.VoiceAttributes} returns this
 */
proto.speech.tts.lucid.VoiceAttributes.prototype.clearRandomize = function() {
  return jspb.Message.clearOneofField(this, 4, proto.speech.tts.lucid.VoiceAttributes.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.VoiceAttributes.prototype.hasRandomize = function() {
  return jspb.Message.hasField(this, 4);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.lucid.VoiceAttributes}
 */
proto.speech.tts.lucid.VoiceAttributes.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.lucid.VoiceAttributes, data);
};



//speech/tts/public/lucid/voice_selection_proto_jspb/voiceselection.jspb.js
// source: speech/tts/public/lucid/voice_selection.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.lucid.VoiceSelection');
goog.provide('proto.speech.tts.lucid.VoiceSelection.SelectionCase');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.speech.tts.lucid.VoiceAttributes');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.lucid.VoiceSelection = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, proto.speech.tts.lucid.VoiceSelection.oneofGroups_);
};
goog.inherits(proto.speech.tts.lucid.VoiceSelection, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.lucid.VoiceSelection.displayName = 'proto.speech.tts.lucid.VoiceSelection';
}

/**
 * Oneof group definitions for this message. Each group defines the field
 * numbers belonging to that group. When of these fields' value is set, all
 * other fields in the group are cleared. During deserialization, if multiple
 * fields are encountered for a group, only the last value seen will be kept.
 * @private {!Array<!Array<number>>}
 * @const
 */
proto.speech.tts.lucid.VoiceSelection.oneofGroups_ = [[1,3]];

/**
 * @enum {number}
 */
proto.speech.tts.lucid.VoiceSelection.SelectionCase = {
  SELECTION_NOT_SET: 0,
  ATTRIBUTES: 1,
  VOICE_ALIAS: 3
};

/**
 * @return {!proto.speech.tts.lucid.VoiceSelection.SelectionCase}
 */
proto.speech.tts.lucid.VoiceSelection.prototype.getSelectionCase = function() {
  return /** @type {!proto.speech.tts.lucid.VoiceSelection.SelectionCase} */(jspb.Message.computeOneofCase(this, proto.speech.tts.lucid.VoiceSelection.oneofGroups_[0]));
};



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.lucid.VoiceSelection.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.lucid.VoiceSelection.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.lucid.VoiceSelection} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.VoiceSelection.toObject = function(includeInstance, msg) {
  let f, obj = {
    attributes: (f = msg.getAttributes()) && proto.speech.tts.lucid.VoiceAttributes.toObject(includeInstance, f),
    voiceAlias: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f,
    canonicalVoiceName: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of VoiceSelection as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.lucid.VoiceSelection.ObjectFormat = function() {
  /** @type {?proto.speech.tts.lucid.VoiceAttributes.ObjectFormat|undefined} */
  this.attributes;

  /** @type {?string|undefined} */
  this.voiceAlias;

  /** @type {?string|undefined} */
  this.canonicalVoiceName;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.lucid.VoiceSelection.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.lucid.VoiceSelection}
 */
proto.speech.tts.lucid.VoiceSelection.fromObject = function(obj) {
  const msg = new proto.speech.tts.lucid.VoiceSelection();
  obj.attributes && jspb.Message.setOneofWrapperField(
      msg, 1, proto.speech.tts.lucid.VoiceSelection.oneofGroups_[0], proto.speech.tts.lucid.VoiceAttributes.fromObject(obj.attributes));
  obj.voiceAlias != null && jspb.Message.setOneofField(msg, 3, proto.speech.tts.lucid.VoiceSelection.oneofGroups_[0], obj.voiceAlias);
  obj.canonicalVoiceName != null && jspb.Message.setField(msg, 2, obj.canonicalVoiceName);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.lucid.VoiceSelection}
 */
proto.speech.tts.lucid.VoiceSelection.deserializeBinary = function(bytes) {
  return proto.speech.tts.lucid.VoiceSelection.deserializeBinaryFromReader(
      new proto.speech.tts.lucid.VoiceSelection(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.lucid.VoiceSelection} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.lucid.VoiceSelection}
 */
proto.speech.tts.lucid.VoiceSelection.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = new proto.speech.tts.lucid.VoiceAttributes();
      reader.readMessage(value,proto.speech.tts.lucid.VoiceAttributes.deserializeBinaryFromReader);
      msg.setAttributes(value);
      break;
    case 3:
      value = /** @type {string} */ (reader.readString());
      msg.setVoiceAlias(value);
      break;
    case 2:
      value = /** @type {string} */ (reader.readString());
      msg.setCanonicalVoiceName(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.lucid.VoiceSelection.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.lucid.VoiceSelection.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.lucid.VoiceSelection} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.VoiceSelection.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = message.getAttributes();
  if (f != null) {
    writer.writeMessage(
      1,
      f,
      proto.speech.tts.lucid.VoiceAttributes.serializeBinaryToWriter
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeString(
      3,
      f
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeString(
      2,
      f
    );
  }
};


/**
 * optional VoiceAttributes attributes = 1;
 * @return {?proto.speech.tts.lucid.VoiceAttributes}
 */
proto.speech.tts.lucid.VoiceSelection.prototype.getAttributes = function() {
  return /** @type{?proto.speech.tts.lucid.VoiceAttributes} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.lucid.VoiceAttributes, 1));
};


/**
 * @param {?proto.speech.tts.lucid.VoiceAttributes|undefined} value
 * @return {!proto.speech.tts.lucid.VoiceSelection} returns this
*/
proto.speech.tts.lucid.VoiceSelection.prototype.setAttributes = function(value) {
  return jspb.Message.setOneofWrapperField(this, 1, proto.speech.tts.lucid.VoiceSelection.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.VoiceSelection} returns this
 */
proto.speech.tts.lucid.VoiceSelection.prototype.clearAttributes = function() {
  return jspb.Message.clearOneofWrapperField(this, 1, proto.speech.tts.lucid.VoiceSelection.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.VoiceSelection.prototype.hasAttributes = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional string voice_alias = 3;
 * @return {?string}
 */
proto.speech.tts.lucid.VoiceSelection.prototype.getVoiceAlias = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 3));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.VoiceSelection} returns this
 */
proto.speech.tts.lucid.VoiceSelection.prototype.setVoiceAlias = function(value) {
  return jspb.Message.setOneofField(this, 3, proto.speech.tts.lucid.VoiceSelection.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.VoiceSelection} returns this
 */
proto.speech.tts.lucid.VoiceSelection.prototype.clearVoiceAlias = function() {
  return jspb.Message.clearOneofField(this, 3, proto.speech.tts.lucid.VoiceSelection.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.VoiceSelection.prototype.hasVoiceAlias = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * optional string canonical_voice_name = 2;
 * @return {?string}
 */
proto.speech.tts.lucid.VoiceSelection.prototype.getCanonicalVoiceName = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 2));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.VoiceSelection} returns this
 */
proto.speech.tts.lucid.VoiceSelection.prototype.setCanonicalVoiceName = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.VoiceSelection} returns this
 */
proto.speech.tts.lucid.VoiceSelection.prototype.clearCanonicalVoiceName = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.VoiceSelection.prototype.hasCanonicalVoiceName = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.lucid.VoiceSelection}
 */
proto.speech.tts.lucid.VoiceSelection.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.lucid.VoiceSelection, data);
};



//speech/tts/public/lucid/annotation_proto_jspb/annotation.jspb.js
// source: speech/tts/public/lucid/annotation.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.lucid.Annotation');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.speech.tts.lucid.CrossLingual');
goog.require('proto.speech.tts.lucid.LucidAnnotationClientExtensions');
goog.require('proto.speech.tts.lucid.Prosody');
goog.require('proto.speech.tts.lucid.Semantics');
goog.require('proto.speech.tts.lucid.Syntax');
goog.require('proto.speech.tts.lucid.SynthesisParameters');
goog.require('proto.speech.tts.lucid.VoiceSelection');
goog.requireType('jspb.ByteSource');
goog.requireType('jspb.ExtensionFieldBinaryInfo');
goog.requireType('jspb.ExtensionFieldInfo');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.lucid.Annotation = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, 8, null, null);
};
goog.inherits(proto.speech.tts.lucid.Annotation, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.lucid.Annotation.displayName = 'proto.speech.tts.lucid.Annotation';
}

/**
 * The extensions registered with this message class. This is a map of
 * extension field number to fieldInfo object. This field should be considered
 * a private API (it is public because it is needed by other generated code).
 *
 * For example:
 *     { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} }
 *
 * fieldName contains the JsCompiler renamed field name property so that it
 * works in OPTIMIZED mode.
 *
 * @type {!Object<number, jspb.ExtensionFieldInfo>}
 */
proto.speech.tts.lucid.Annotation.extensions = {};


/**
 * The extensions registered with this message class. This is a map of
 * extension field number to fieldInfo object. This field should be considered
 * a private API (it is public because it is needed by other generated code).
 *
 * For example:
 *     { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} }
 *
 * fieldName contains the JsCompiler renamed field name property so that it
 * works in OPTIMIZED mode.
 *
 * @type {!Object<number, jspb.ExtensionFieldBinaryInfo>}
 */
proto.speech.tts.lucid.Annotation.extensionsBinary = {};




if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.lucid.Annotation.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.lucid.Annotation.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.lucid.Annotation} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.Annotation.toObject = function(includeInstance, msg) {
  let f, obj = {
    semantics: (f = msg.getSemantics()) && proto.speech.tts.lucid.Semantics.toObject(includeInstance, f),
    syntax: (f = msg.getSyntax()) && proto.speech.tts.lucid.Syntax.toObject(includeInstance, f),
    prosody: (f = msg.getProsody()) && proto.speech.tts.lucid.Prosody.toObject(includeInstance, f),
    synthesisParameters: (f = msg.getSynthesisParameters()) && proto.speech.tts.lucid.SynthesisParameters.toObject(includeInstance, f),
    crossLingual: (f = msg.getCrossLingual()) && proto.speech.tts.lucid.CrossLingual.toObject(includeInstance, f),
    voiceSelection: (f = msg.getVoiceSelection()) && proto.speech.tts.lucid.VoiceSelection.toObject(includeInstance, f),
    clientExtensions: (f = msg.getClientExtensions()) && proto.speech.tts.lucid.LucidAnnotationClientExtensions.toObject(includeInstance, f)
  };

  jspb.Message.toObjectExtension(/** @type {!jspb.Message} */ (msg), obj,
      proto.speech.tts.lucid.Annotation.extensions, proto.speech.tts.lucid.Annotation.prototype.getExtension,
      includeInstance);
  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of Annotation as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.lucid.Annotation.ObjectFormat = function() {
  /** @type {?proto.speech.tts.lucid.Semantics.ObjectFormat|undefined} */
  this.semantics;

  /** @type {?proto.speech.tts.lucid.Syntax.ObjectFormat|undefined} */
  this.syntax;

  /** @type {?proto.speech.tts.lucid.Prosody.ObjectFormat|undefined} */
  this.prosody;

  /** @type {?proto.speech.tts.lucid.SynthesisParameters.ObjectFormat|undefined} */
  this.synthesisParameters;

  /** @type {?proto.speech.tts.lucid.CrossLingual.ObjectFormat|undefined} */
  this.crossLingual;

  /** @type {?proto.speech.tts.lucid.VoiceSelection.ObjectFormat|undefined} */
  this.voiceSelection;

  /** @type {?proto.speech.tts.lucid.LucidAnnotationClientExtensions.ObjectFormat|undefined} */
  this.clientExtensions;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.lucid.Annotation.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.lucid.Annotation}
 */
proto.speech.tts.lucid.Annotation.fromObject = function(obj) {
  const msg = new proto.speech.tts.lucid.Annotation();
  obj.semantics && jspb.Message.setWrapperField(
      msg, 1, proto.speech.tts.lucid.Semantics.fromObject(obj.semantics));
  obj.syntax && jspb.Message.setWrapperField(
      msg, 2, proto.speech.tts.lucid.Syntax.fromObject(obj.syntax));
  obj.prosody && jspb.Message.setWrapperField(
      msg, 3, proto.speech.tts.lucid.Prosody.fromObject(obj.prosody));
  obj.synthesisParameters && jspb.Message.setWrapperField(
      msg, 4, proto.speech.tts.lucid.SynthesisParameters.fromObject(obj.synthesisParameters));
  obj.crossLingual && jspb.Message.setWrapperField(
      msg, 5, proto.speech.tts.lucid.CrossLingual.fromObject(obj.crossLingual));
  obj.voiceSelection && jspb.Message.setWrapperField(
      msg, 7, proto.speech.tts.lucid.VoiceSelection.fromObject(obj.voiceSelection));
  obj.clientExtensions && jspb.Message.setWrapperField(
      msg, 6, proto.speech.tts.lucid.LucidAnnotationClientExtensions.fromObject(obj.clientExtensions));
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.lucid.Annotation}
 */
proto.speech.tts.lucid.Annotation.deserializeBinary = function(bytes) {
  return proto.speech.tts.lucid.Annotation.deserializeBinaryFromReader(
      new proto.speech.tts.lucid.Annotation(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.lucid.Annotation} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.lucid.Annotation}
 */
proto.speech.tts.lucid.Annotation.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = new proto.speech.tts.lucid.Semantics();
      reader.readMessage(value,proto.speech.tts.lucid.Semantics.deserializeBinaryFromReader);
      msg.setSemantics(value);
      break;
    case 2:
      value = new proto.speech.tts.lucid.Syntax();
      reader.readMessage(value,proto.speech.tts.lucid.Syntax.deserializeBinaryFromReader);
      msg.setSyntax(value);
      break;
    case 3:
      value = new proto.speech.tts.lucid.Prosody();
      reader.readMessage(value,proto.speech.tts.lucid.Prosody.deserializeBinaryFromReader);
      msg.setProsody(value);
      break;
    case 4:
      value = new proto.speech.tts.lucid.SynthesisParameters();
      reader.readMessage(value,proto.speech.tts.lucid.SynthesisParameters.deserializeBinaryFromReader);
      msg.setSynthesisParameters(value);
      break;
    case 5:
      value = new proto.speech.tts.lucid.CrossLingual();
      reader.readMessage(value,proto.speech.tts.lucid.CrossLingual.deserializeBinaryFromReader);
      msg.setCrossLingual(value);
      break;
    case 7:
      value = new proto.speech.tts.lucid.VoiceSelection();
      reader.readMessage(value,proto.speech.tts.lucid.VoiceSelection.deserializeBinaryFromReader);
      msg.setVoiceSelection(value);
      break;
    case 6:
      value = new proto.speech.tts.lucid.LucidAnnotationClientExtensions();
      reader.readMessage(value,proto.speech.tts.lucid.LucidAnnotationClientExtensions.deserializeBinaryFromReader);
      msg.setClientExtensions(value);
      break;
    default:
      jspb.Message.readBinaryExtension(msg, reader,
        proto.speech.tts.lucid.Annotation.extensionsBinary,
        proto.speech.tts.lucid.Annotation.prototype.getExtension,
        proto.speech.tts.lucid.Annotation.prototype.setExtension);
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.lucid.Annotation.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.lucid.Annotation.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.lucid.Annotation} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.Annotation.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = message.getSemantics();
  if (f != null) {
    writer.writeMessage(
      1,
      f,
      proto.speech.tts.lucid.Semantics.serializeBinaryToWriter
    );
  }
  f = message.getSyntax();
  if (f != null) {
    writer.writeMessage(
      2,
      f,
      proto.speech.tts.lucid.Syntax.serializeBinaryToWriter
    );
  }
  f = message.getProsody();
  if (f != null) {
    writer.writeMessage(
      3,
      f,
      proto.speech.tts.lucid.Prosody.serializeBinaryToWriter
    );
  }
  f = message.getSynthesisParameters();
  if (f != null) {
    writer.writeMessage(
      4,
      f,
      proto.speech.tts.lucid.SynthesisParameters.serializeBinaryToWriter
    );
  }
  f = message.getCrossLingual();
  if (f != null) {
    writer.writeMessage(
      5,
      f,
      proto.speech.tts.lucid.CrossLingual.serializeBinaryToWriter
    );
  }
  f = message.getVoiceSelection();
  if (f != null) {
    writer.writeMessage(
      7,
      f,
      proto.speech.tts.lucid.VoiceSelection.serializeBinaryToWriter
    );
  }
  f = message.getClientExtensions();
  if (f != null) {
    writer.writeMessage(
      6,
      f,
      proto.speech.tts.lucid.LucidAnnotationClientExtensions.serializeBinaryToWriter
    );
  }
  jspb.Message.serializeBinaryExtensions(message, writer,
    proto.speech.tts.lucid.Annotation.extensionsBinary, proto.speech.tts.lucid.Annotation.prototype.getExtension);
};


/**
 * optional Semantics semantics = 1;
 * @return {?proto.speech.tts.lucid.Semantics}
 */
proto.speech.tts.lucid.Annotation.prototype.getSemantics = function() {
  return /** @type{?proto.speech.tts.lucid.Semantics} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.lucid.Semantics, 1));
};


/**
 * @param {?proto.speech.tts.lucid.Semantics|undefined} value
 * @return {!proto.speech.tts.lucid.Annotation} returns this
*/
proto.speech.tts.lucid.Annotation.prototype.setSemantics = function(value) {
  return jspb.Message.setWrapperField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Annotation} returns this
 */
proto.speech.tts.lucid.Annotation.prototype.clearSemantics = function() {
  return jspb.Message.clearWrapperField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Annotation.prototype.hasSemantics = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional Syntax syntax = 2;
 * @return {?proto.speech.tts.lucid.Syntax}
 */
proto.speech.tts.lucid.Annotation.prototype.getSyntax = function() {
  return /** @type{?proto.speech.tts.lucid.Syntax} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.lucid.Syntax, 2));
};


/**
 * @param {?proto.speech.tts.lucid.Syntax|undefined} value
 * @return {!proto.speech.tts.lucid.Annotation} returns this
*/
proto.speech.tts.lucid.Annotation.prototype.setSyntax = function(value) {
  return jspb.Message.setWrapperField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Annotation} returns this
 */
proto.speech.tts.lucid.Annotation.prototype.clearSyntax = function() {
  return jspb.Message.clearWrapperField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Annotation.prototype.hasSyntax = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional Prosody prosody = 3;
 * @return {?proto.speech.tts.lucid.Prosody}
 */
proto.speech.tts.lucid.Annotation.prototype.getProsody = function() {
  return /** @type{?proto.speech.tts.lucid.Prosody} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.lucid.Prosody, 3));
};


/**
 * @param {?proto.speech.tts.lucid.Prosody|undefined} value
 * @return {!proto.speech.tts.lucid.Annotation} returns this
*/
proto.speech.tts.lucid.Annotation.prototype.setProsody = function(value) {
  return jspb.Message.setWrapperField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Annotation} returns this
 */
proto.speech.tts.lucid.Annotation.prototype.clearProsody = function() {
  return jspb.Message.clearWrapperField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Annotation.prototype.hasProsody = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * optional SynthesisParameters synthesis_parameters = 4;
 * @return {?proto.speech.tts.lucid.SynthesisParameters}
 */
proto.speech.tts.lucid.Annotation.prototype.getSynthesisParameters = function() {
  return /** @type{?proto.speech.tts.lucid.SynthesisParameters} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.lucid.SynthesisParameters, 4));
};


/**
 * @param {?proto.speech.tts.lucid.SynthesisParameters|undefined} value
 * @return {!proto.speech.tts.lucid.Annotation} returns this
*/
proto.speech.tts.lucid.Annotation.prototype.setSynthesisParameters = function(value) {
  return jspb.Message.setWrapperField(this, 4, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Annotation} returns this
 */
proto.speech.tts.lucid.Annotation.prototype.clearSynthesisParameters = function() {
  return jspb.Message.clearWrapperField(this, 4);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Annotation.prototype.hasSynthesisParameters = function() {
  return jspb.Message.hasField(this, 4);
};


/**
 * optional CrossLingual cross_lingual = 5;
 * @return {?proto.speech.tts.lucid.CrossLingual}
 */
proto.speech.tts.lucid.Annotation.prototype.getCrossLingual = function() {
  return /** @type{?proto.speech.tts.lucid.CrossLingual} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.lucid.CrossLingual, 5));
};


/**
 * @param {?proto.speech.tts.lucid.CrossLingual|undefined} value
 * @return {!proto.speech.tts.lucid.Annotation} returns this
*/
proto.speech.tts.lucid.Annotation.prototype.setCrossLingual = function(value) {
  return jspb.Message.setWrapperField(this, 5, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Annotation} returns this
 */
proto.speech.tts.lucid.Annotation.prototype.clearCrossLingual = function() {
  return jspb.Message.clearWrapperField(this, 5);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Annotation.prototype.hasCrossLingual = function() {
  return jspb.Message.hasField(this, 5);
};


/**
 * optional VoiceSelection voice_selection = 7;
 * @return {?proto.speech.tts.lucid.VoiceSelection}
 */
proto.speech.tts.lucid.Annotation.prototype.getVoiceSelection = function() {
  return /** @type{?proto.speech.tts.lucid.VoiceSelection} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.lucid.VoiceSelection, 7));
};


/**
 * @param {?proto.speech.tts.lucid.VoiceSelection|undefined} value
 * @return {!proto.speech.tts.lucid.Annotation} returns this
*/
proto.speech.tts.lucid.Annotation.prototype.setVoiceSelection = function(value) {
  return jspb.Message.setWrapperField(this, 7, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Annotation} returns this
 */
proto.speech.tts.lucid.Annotation.prototype.clearVoiceSelection = function() {
  return jspb.Message.clearWrapperField(this, 7);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Annotation.prototype.hasVoiceSelection = function() {
  return jspb.Message.hasField(this, 7);
};


/**
 * optional LucidAnnotationClientExtensions client_extensions = 6;
 * @return {?proto.speech.tts.lucid.LucidAnnotationClientExtensions}
 */
proto.speech.tts.lucid.Annotation.prototype.getClientExtensions = function() {
  return /** @type{?proto.speech.tts.lucid.LucidAnnotationClientExtensions} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.lucid.LucidAnnotationClientExtensions, 6));
};


/**
 * @param {?proto.speech.tts.lucid.LucidAnnotationClientExtensions|undefined} value
 * @return {!proto.speech.tts.lucid.Annotation} returns this
*/
proto.speech.tts.lucid.Annotation.prototype.setClientExtensions = function(value) {
  return jspb.Message.setWrapperField(this, 6, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Annotation} returns this
 */
proto.speech.tts.lucid.Annotation.prototype.clearClientExtensions = function() {
  return jspb.Message.clearWrapperField(this, 6);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Annotation.prototype.hasClientExtensions = function() {
  return jspb.Message.hasField(this, 6);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.lucid.Annotation}
 */
proto.speech.tts.lucid.Annotation.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.lucid.Annotation, data);
};



//speech/tts/public/lucid/annotation_proto_jspb/spanannotation.jspb.js
// source: speech/tts/public/lucid/annotation.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.lucid.SpanAnnotation');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.speech.tts.lucid.Annotation');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.lucid.SpanAnnotation = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.speech.tts.lucid.SpanAnnotation, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.lucid.SpanAnnotation.displayName = 'proto.speech.tts.lucid.SpanAnnotation';
}



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.lucid.SpanAnnotation.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.lucid.SpanAnnotation.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.lucid.SpanAnnotation} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.SpanAnnotation.toObject = function(includeInstance, msg) {
  let f, obj = {
    first: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    last: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f,
    annotation: (f = msg.getAnnotation()) && proto.speech.tts.lucid.Annotation.toObject(includeInstance, f)
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of SpanAnnotation as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.lucid.SpanAnnotation.ObjectFormat = function() {
  /** @type {?number|undefined} */
  this.first;

  /** @type {?number|undefined} */
  this.last;

  /** @type {?proto.speech.tts.lucid.Annotation.ObjectFormat|undefined} */
  this.annotation;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.lucid.SpanAnnotation.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.lucid.SpanAnnotation}
 */
proto.speech.tts.lucid.SpanAnnotation.fromObject = function(obj) {
  const msg = new proto.speech.tts.lucid.SpanAnnotation();
  obj.first != null && jspb.Message.setField(msg, 1, obj.first);
  obj.last != null && jspb.Message.setField(msg, 2, obj.last);
  obj.annotation && jspb.Message.setWrapperField(
      msg, 3, proto.speech.tts.lucid.Annotation.fromObject(obj.annotation));
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.lucid.SpanAnnotation}
 */
proto.speech.tts.lucid.SpanAnnotation.deserializeBinary = function(bytes) {
  return proto.speech.tts.lucid.SpanAnnotation.deserializeBinaryFromReader(
      new proto.speech.tts.lucid.SpanAnnotation(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.lucid.SpanAnnotation} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.lucid.SpanAnnotation}
 */
proto.speech.tts.lucid.SpanAnnotation.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {number} */ (reader.readInt32());
      msg.setFirst(value);
      break;
    case 2:
      value = /** @type {number} */ (reader.readInt32());
      msg.setLast(value);
      break;
    case 3:
      value = new proto.speech.tts.lucid.Annotation();
      reader.readMessage(value,proto.speech.tts.lucid.Annotation.deserializeBinaryFromReader);
      msg.setAnnotation(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.lucid.SpanAnnotation.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.lucid.SpanAnnotation.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.lucid.SpanAnnotation} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.SpanAnnotation.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {?number} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeInt32(
      1,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeInt32(
      2,
      f
    );
  }
  f = message.getAnnotation();
  if (f != null) {
    writer.writeMessage(
      3,
      f,
      proto.speech.tts.lucid.Annotation.serializeBinaryToWriter
    );
  }
};


/**
 * optional int32 first = 1;
 * @return {?number}
 */
proto.speech.tts.lucid.SpanAnnotation.prototype.getFirst = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 1));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.speech.tts.lucid.SpanAnnotation} returns this
 */
proto.speech.tts.lucid.SpanAnnotation.prototype.setFirst = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.SpanAnnotation} returns this
 */
proto.speech.tts.lucid.SpanAnnotation.prototype.clearFirst = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.SpanAnnotation.prototype.hasFirst = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional int32 last = 2;
 * @return {?number}
 */
proto.speech.tts.lucid.SpanAnnotation.prototype.getLast = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 2));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.speech.tts.lucid.SpanAnnotation} returns this
 */
proto.speech.tts.lucid.SpanAnnotation.prototype.setLast = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.SpanAnnotation} returns this
 */
proto.speech.tts.lucid.SpanAnnotation.prototype.clearLast = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.SpanAnnotation.prototype.hasLast = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional Annotation annotation = 3;
 * @return {?proto.speech.tts.lucid.Annotation}
 */
proto.speech.tts.lucid.SpanAnnotation.prototype.getAnnotation = function() {
  return /** @type{?proto.speech.tts.lucid.Annotation} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.lucid.Annotation, 3));
};


/**
 * @param {?proto.speech.tts.lucid.Annotation|undefined} value
 * @return {!proto.speech.tts.lucid.SpanAnnotation} returns this
*/
proto.speech.tts.lucid.SpanAnnotation.prototype.setAnnotation = function(value) {
  return jspb.Message.setWrapperField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.SpanAnnotation} returns this
 */
proto.speech.tts.lucid.SpanAnnotation.prototype.clearAnnotation = function() {
  return jspb.Message.clearWrapperField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.SpanAnnotation.prototype.hasAnnotation = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.lucid.SpanAnnotation}
 */
proto.speech.tts.lucid.SpanAnnotation.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.lucid.SpanAnnotation, data);
};



//speech/tts/public/lucid/lucid_markup_proto_jspb/lucidword.jspb.js
// source: speech/tts/public/lucid/lucid_markup.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.lucid.LucidWord');
goog.provide('proto.speech.tts.lucid.LucidWord.PhonologyType');
goog.provide('proto.speech.tts.lucid.LucidWord.PronunciationVariant');
goog.provide('proto.speech.tts.lucid.LucidWord.VariantCase');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.speech.tts.lucid.Annotation');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.lucid.LucidWord = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, proto.speech.tts.lucid.LucidWord.oneofGroups_);
};
goog.inherits(proto.speech.tts.lucid.LucidWord, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.lucid.LucidWord.displayName = 'proto.speech.tts.lucid.LucidWord';
}

/**
 * Oneof group definitions for this message. Each group defines the field
 * numbers belonging to that group. When of these fields' value is set, all
 * other fields in the group are cleared. During deserialization, if multiple
 * fields are encountered for a group, only the last value seen will be kept.
 * @private {!Array<!Array<number>>}
 * @const
 */
proto.speech.tts.lucid.LucidWord.oneofGroups_ = [[4,5]];

/**
 * @enum {number}
 */
proto.speech.tts.lucid.LucidWord.VariantCase = {
  VARIANT_NOT_SET: 0,
  VARIANT_ENUM: 4,
  VARIANT_ID: 5
};

/**
 * @return {!proto.speech.tts.lucid.LucidWord.VariantCase}
 */
proto.speech.tts.lucid.LucidWord.prototype.getVariantCase = function() {
  return /** @type {!proto.speech.tts.lucid.LucidWord.VariantCase} */(jspb.Message.computeOneofCase(this, proto.speech.tts.lucid.LucidWord.oneofGroups_[0]));
};



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.lucid.LucidWord.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.lucid.LucidWord.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.lucid.LucidWord} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.LucidWord.toObject = function(includeInstance, msg) {
  let f, obj = {
    ownIndex: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    spelling: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f,
    wordId: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f,
    variantEnum: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f,
    variantId: (f = jspb.Message.getField(msg, 5)) == null ? undefined : f,
    phonologyType: (f = jspb.Message.getField(msg, 8)) == null ? undefined : f,
    ttsPronunciation: (f = jspb.Message.getField(msg, 6)) == null ? undefined : f,
    annotation: (f = msg.getAnnotation()) && proto.speech.tts.lucid.Annotation.toObject(includeInstance, f)
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of LucidWord as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.lucid.LucidWord.ObjectFormat = function() {
  /** @type {?number|undefined} */
  this.ownIndex;

  /** @type {?string|undefined} */
  this.spelling;

  /** @type {?string|undefined} */
  this.wordId;

  /** @type {?number|undefined} */
  this.variantEnum;

  /** @type {?string|undefined} */
  this.variantId;

  /** @type {?number|undefined} */
  this.phonologyType;

  /** @type {?string|undefined} */
  this.ttsPronunciation;

  /** @type {?proto.speech.tts.lucid.Annotation.ObjectFormat|undefined} */
  this.annotation;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.lucid.LucidWord.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.lucid.LucidWord}
 */
proto.speech.tts.lucid.LucidWord.fromObject = function(obj) {
  const msg = new proto.speech.tts.lucid.LucidWord();
  obj.ownIndex != null && jspb.Message.setField(msg, 1, obj.ownIndex);
  obj.spelling != null && jspb.Message.setField(msg, 2, obj.spelling);
  obj.wordId != null && jspb.Message.setField(msg, 3, obj.wordId);
  obj.variantEnum != null && jspb.Message.setOneofField(msg, 4, proto.speech.tts.lucid.LucidWord.oneofGroups_[0], obj.variantEnum);
  obj.variantId != null && jspb.Message.setOneofField(msg, 5, proto.speech.tts.lucid.LucidWord.oneofGroups_[0], obj.variantId);
  obj.phonologyType != null && jspb.Message.setField(msg, 8, obj.phonologyType);
  obj.ttsPronunciation != null && jspb.Message.setField(msg, 6, obj.ttsPronunciation);
  obj.annotation && jspb.Message.setWrapperField(
      msg, 7, proto.speech.tts.lucid.Annotation.fromObject(obj.annotation));
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.lucid.LucidWord}
 */
proto.speech.tts.lucid.LucidWord.deserializeBinary = function(bytes) {
  return proto.speech.tts.lucid.LucidWord.deserializeBinaryFromReader(
      new proto.speech.tts.lucid.LucidWord(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.lucid.LucidWord} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.lucid.LucidWord}
 */
proto.speech.tts.lucid.LucidWord.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {number} */ (reader.readInt32());
      msg.setOwnIndex(value);
      break;
    case 2:
      value = /** @type {string} */ (reader.readString());
      msg.setSpelling(value);
      break;
    case 3:
      value = /** @type {string} */ (reader.readString());
      msg.setWordId(value);
      break;
    case 4:
      value = /** @type {!proto.speech.tts.lucid.LucidWord.PronunciationVariant} */ (reader.readEnum());
      msg.setVariantEnum(value);
      break;
    case 5:
      value = /** @type {string} */ (reader.readString());
      msg.setVariantId(value);
      break;
    case 8:
      value = /** @type {!proto.speech.tts.lucid.LucidWord.PhonologyType} */ (reader.readEnum());
      msg.setPhonologyType(value);
      break;
    case 6:
      value = /** @type {string} */ (reader.readString());
      msg.setTtsPronunciation(value);
      break;
    case 7:
      value = new proto.speech.tts.lucid.Annotation();
      reader.readMessage(value,proto.speech.tts.lucid.Annotation.deserializeBinaryFromReader);
      msg.setAnnotation(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.lucid.LucidWord.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.lucid.LucidWord.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.lucid.LucidWord} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.LucidWord.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {?number} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeInt32(
      1,
      f
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeString(
      2,
      f
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeString(
      3,
      f
    );
  }
  f = /** @type {!proto.speech.tts.lucid.LucidWord.PronunciationVariant} */ (jspb.Message.getField(message, 4));
  if (f != null) {
    writer.writeEnum(
      4,
      f
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 5));
  if (f != null) {
    writer.writeString(
      5,
      f
    );
  }
  f = /** @type {!proto.speech.tts.lucid.LucidWord.PhonologyType} */ (jspb.Message.getField(message, 8));
  if (f != null) {
    writer.writeEnum(
      8,
      f
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 6));
  if (f != null) {
    writer.writeString(
      6,
      f
    );
  }
  f = message.getAnnotation();
  if (f != null) {
    writer.writeMessage(
      7,
      f,
      proto.speech.tts.lucid.Annotation.serializeBinaryToWriter
    );
  }
};


/**
 * @enum {number}
 */
proto.speech.tts.lucid.LucidWord.PronunciationVariant = {
  UNSPECIFIED_PRONUNCIATION_VARIANT: 0,
  REDUCED: 1,
  CANONICAL: 2
};

/**
 * @enum {number}
 */
proto.speech.tts.lucid.LucidWord.PhonologyType = {
  UNSPECIFIED_PHONOLOGY_TYPE: 0,
  TTS_NATIVE: 1,
  IPA: 2,
  XSAMPA_STANDARD: 3,
  XSAMPA_PRON_BUFFET: 4,
  TTS_LEGACY: 5,
  JAPANESE_YOMIGANA: 6,
  PINYIN: 7,
  JYUTPING: 8
};

/**
 * optional int32 own_index = 1;
 * @return {?number}
 */
proto.speech.tts.lucid.LucidWord.prototype.getOwnIndex = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 1));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.speech.tts.lucid.LucidWord} returns this
 */
proto.speech.tts.lucid.LucidWord.prototype.setOwnIndex = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.LucidWord} returns this
 */
proto.speech.tts.lucid.LucidWord.prototype.clearOwnIndex = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.LucidWord.prototype.hasOwnIndex = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional string spelling = 2;
 * @return {?string}
 */
proto.speech.tts.lucid.LucidWord.prototype.getSpelling = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 2));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.LucidWord} returns this
 */
proto.speech.tts.lucid.LucidWord.prototype.setSpelling = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.LucidWord} returns this
 */
proto.speech.tts.lucid.LucidWord.prototype.clearSpelling = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.LucidWord.prototype.hasSpelling = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional string word_id = 3;
 * @return {?string}
 */
proto.speech.tts.lucid.LucidWord.prototype.getWordId = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 3));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.LucidWord} returns this
 */
proto.speech.tts.lucid.LucidWord.prototype.setWordId = function(value) {
  return jspb.Message.setField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.LucidWord} returns this
 */
proto.speech.tts.lucid.LucidWord.prototype.clearWordId = function() {
  return jspb.Message.clearField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.LucidWord.prototype.hasWordId = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * optional PronunciationVariant variant_enum = 4;
 * @return {!proto.speech.tts.lucid.LucidWord.PronunciationVariant}
 */
proto.speech.tts.lucid.LucidWord.prototype.getVariantEnum = function() {
  return /** @type {!proto.speech.tts.lucid.LucidWord.PronunciationVariant} */ (jspb.Message.getField(this, 4));
};


/**
 * @param {?proto.speech.tts.lucid.LucidWord.PronunciationVariant|undefined} value
 * @return {!proto.speech.tts.lucid.LucidWord} returns this
 */
proto.speech.tts.lucid.LucidWord.prototype.setVariantEnum = function(value) {
  return jspb.Message.setOneofField(this, 4, proto.speech.tts.lucid.LucidWord.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.LucidWord} returns this
 */
proto.speech.tts.lucid.LucidWord.prototype.clearVariantEnum = function() {
  return jspb.Message.clearOneofField(this, 4, proto.speech.tts.lucid.LucidWord.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.LucidWord.prototype.hasVariantEnum = function() {
  return jspb.Message.hasField(this, 4);
};


/**
 * optional string variant_id = 5;
 * @return {?string}
 */
proto.speech.tts.lucid.LucidWord.prototype.getVariantId = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 5));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.LucidWord} returns this
 */
proto.speech.tts.lucid.LucidWord.prototype.setVariantId = function(value) {
  return jspb.Message.setOneofField(this, 5, proto.speech.tts.lucid.LucidWord.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.LucidWord} returns this
 */
proto.speech.tts.lucid.LucidWord.prototype.clearVariantId = function() {
  return jspb.Message.clearOneofField(this, 5, proto.speech.tts.lucid.LucidWord.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.LucidWord.prototype.hasVariantId = function() {
  return jspb.Message.hasField(this, 5);
};


/**
 * optional PhonologyType phonology_type = 8;
 * @return {!proto.speech.tts.lucid.LucidWord.PhonologyType}
 */
proto.speech.tts.lucid.LucidWord.prototype.getPhonologyType = function() {
  return /** @type {!proto.speech.tts.lucid.LucidWord.PhonologyType} */ (jspb.Message.getField(this, 8));
};


/**
 * @param {?proto.speech.tts.lucid.LucidWord.PhonologyType|undefined} value
 * @return {!proto.speech.tts.lucid.LucidWord} returns this
 */
proto.speech.tts.lucid.LucidWord.prototype.setPhonologyType = function(value) {
  return jspb.Message.setField(this, 8, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.LucidWord} returns this
 */
proto.speech.tts.lucid.LucidWord.prototype.clearPhonologyType = function() {
  return jspb.Message.clearField(this, 8);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.LucidWord.prototype.hasPhonologyType = function() {
  return jspb.Message.hasField(this, 8);
};


/**
 * optional string tts_pronunciation = 6;
 * @return {?string}
 */
proto.speech.tts.lucid.LucidWord.prototype.getTtsPronunciation = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 6));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.LucidWord} returns this
 */
proto.speech.tts.lucid.LucidWord.prototype.setTtsPronunciation = function(value) {
  return jspb.Message.setField(this, 6, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.LucidWord} returns this
 */
proto.speech.tts.lucid.LucidWord.prototype.clearTtsPronunciation = function() {
  return jspb.Message.clearField(this, 6);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.LucidWord.prototype.hasTtsPronunciation = function() {
  return jspb.Message.hasField(this, 6);
};


/**
 * optional Annotation annotation = 7;
 * @return {?proto.speech.tts.lucid.Annotation}
 */
proto.speech.tts.lucid.LucidWord.prototype.getAnnotation = function() {
  return /** @type{?proto.speech.tts.lucid.Annotation} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.lucid.Annotation, 7));
};


/**
 * @param {?proto.speech.tts.lucid.Annotation|undefined} value
 * @return {!proto.speech.tts.lucid.LucidWord} returns this
*/
proto.speech.tts.lucid.LucidWord.prototype.setAnnotation = function(value) {
  return jspb.Message.setWrapperField(this, 7, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.LucidWord} returns this
 */
proto.speech.tts.lucid.LucidWord.prototype.clearAnnotation = function() {
  return jspb.Message.clearWrapperField(this, 7);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.LucidWord.prototype.hasAnnotation = function() {
  return jspb.Message.hasField(this, 7);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.lucid.LucidWord}
 */
proto.speech.tts.lucid.LucidWord.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.lucid.LucidWord, data);
};



//speech/tts/public/lucid/structured_token_proto_jspb/abbreviation.jspb.js
// source: speech/tts/public/lucid/structured_token.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.lucid.Abbreviation');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.lucid.Abbreviation = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.speech.tts.lucid.Abbreviation, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.lucid.Abbreviation.displayName = 'proto.speech.tts.lucid.Abbreviation';
}



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.lucid.Abbreviation.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.lucid.Abbreviation.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.lucid.Abbreviation} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.Abbreviation.toObject = function(includeInstance, msg) {
  let f, obj = {
    text: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    expansion: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of Abbreviation as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.lucid.Abbreviation.ObjectFormat = function() {
  /** @type {?string|undefined} */
  this.text;

  /** @type {?string|undefined} */
  this.expansion;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.lucid.Abbreviation.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.lucid.Abbreviation}
 */
proto.speech.tts.lucid.Abbreviation.fromObject = function(obj) {
  const msg = new proto.speech.tts.lucid.Abbreviation();
  obj.text != null && jspb.Message.setField(msg, 1, obj.text);
  obj.expansion != null && jspb.Message.setField(msg, 2, obj.expansion);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.lucid.Abbreviation}
 */
proto.speech.tts.lucid.Abbreviation.deserializeBinary = function(bytes) {
  return proto.speech.tts.lucid.Abbreviation.deserializeBinaryFromReader(
      new proto.speech.tts.lucid.Abbreviation(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.lucid.Abbreviation} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.lucid.Abbreviation}
 */
proto.speech.tts.lucid.Abbreviation.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {string} */ (reader.readString());
      msg.setText(value);
      break;
    case 2:
      value = /** @type {string} */ (reader.readString());
      msg.setExpansion(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.lucid.Abbreviation.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.lucid.Abbreviation.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.lucid.Abbreviation} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.Abbreviation.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {?string} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeString(
      1,
      f
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeString(
      2,
      f
    );
  }
};


/**
 * optional string text = 1;
 * @return {?string}
 */
proto.speech.tts.lucid.Abbreviation.prototype.getText = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 1));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.Abbreviation} returns this
 */
proto.speech.tts.lucid.Abbreviation.prototype.setText = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Abbreviation} returns this
 */
proto.speech.tts.lucid.Abbreviation.prototype.clearText = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Abbreviation.prototype.hasText = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional string expansion = 2;
 * @return {?string}
 */
proto.speech.tts.lucid.Abbreviation.prototype.getExpansion = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 2));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.Abbreviation} returns this
 */
proto.speech.tts.lucid.Abbreviation.prototype.setExpansion = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Abbreviation} returns this
 */
proto.speech.tts.lucid.Abbreviation.prototype.clearExpansion = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Abbreviation.prototype.hasExpansion = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.lucid.Abbreviation}
 */
proto.speech.tts.lucid.Abbreviation.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.lucid.Abbreviation, data);
};



//speech/tts/public/lucid/structured_token_proto_jspb/chemicalformula.jspb.js
// source: speech/tts/public/lucid/structured_token.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.lucid.ChemicalFormula');
goog.provide('proto.speech.tts.lucid.ChemicalFormula.Unit');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.lucid.ChemicalFormula = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, proto.speech.tts.lucid.ChemicalFormula.repeatedFields_, null);
};
goog.inherits(proto.speech.tts.lucid.ChemicalFormula, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.lucid.ChemicalFormula.displayName = 'proto.speech.tts.lucid.ChemicalFormula';
}
/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.lucid.ChemicalFormula.Unit = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.speech.tts.lucid.ChemicalFormula.Unit, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.lucid.ChemicalFormula.Unit.displayName = 'proto.speech.tts.lucid.ChemicalFormula.Unit';
}

/**
 * List of repeated fields within this message type.
 * @private {!Array<number>}
 * @const
 */
proto.speech.tts.lucid.ChemicalFormula.repeatedFields_ = [1];



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.lucid.ChemicalFormula.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.lucid.ChemicalFormula.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.lucid.ChemicalFormula} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.ChemicalFormula.toObject = function(includeInstance, msg) {
  let f, obj = {
    unitsList: jspb.Message.toObjectList(msg.getUnitsList(),
    proto.speech.tts.lucid.ChemicalFormula.Unit.toObject, includeInstance),
    type: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f,
    charge: (f = jspb.Message.getBooleanField(msg, 3)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of ChemicalFormula as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.lucid.ChemicalFormula.ObjectFormat = function() {
  /** @type {?Array<!proto.speech.tts.lucid.ChemicalFormula.Unit.ObjectFormat>|undefined} */
  this.unitsList;

  /** @type {?string|undefined} */
  this.type;

  /** @type {?boolean|undefined} */
  this.charge;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.lucid.ChemicalFormula.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.lucid.ChemicalFormula}
 */
proto.speech.tts.lucid.ChemicalFormula.fromObject = function(obj) {
  const msg = new proto.speech.tts.lucid.ChemicalFormula();
  obj.unitsList && jspb.Message.setRepeatedWrapperField(
      msg, 1, obj.unitsList.map(
          proto.speech.tts.lucid.ChemicalFormula.Unit.fromObject));
  obj.type != null && jspb.Message.setField(msg, 2, obj.type);
  obj.charge != null && jspb.Message.setField(msg, 3, obj.charge);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.lucid.ChemicalFormula}
 */
proto.speech.tts.lucid.ChemicalFormula.deserializeBinary = function(bytes) {
  return proto.speech.tts.lucid.ChemicalFormula.deserializeBinaryFromReader(
      new proto.speech.tts.lucid.ChemicalFormula(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.lucid.ChemicalFormula} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.lucid.ChemicalFormula}
 */
proto.speech.tts.lucid.ChemicalFormula.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = new proto.speech.tts.lucid.ChemicalFormula.Unit();
      reader.readMessage(value,proto.speech.tts.lucid.ChemicalFormula.Unit.deserializeBinaryFromReader);
      msg.addUnits(value);
      break;
    case 2:
      value = /** @type {string} */ (reader.readString());
      msg.setType(value);
      break;
    case 3:
      value = /** @type {boolean} */ (reader.readBool());
      msg.setCharge(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.lucid.ChemicalFormula.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.lucid.ChemicalFormula.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.lucid.ChemicalFormula} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.ChemicalFormula.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = message.getUnitsList();
  if (f.length > 0) {
    writer.writeRepeatedMessage(
      1,
      f,
      proto.speech.tts.lucid.ChemicalFormula.Unit.serializeBinaryToWriter
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeString(
      2,
      f
    );
  }
  f = /** @type {?boolean} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeBool(
      3,
      f
    );
  }
};





if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.lucid.ChemicalFormula.Unit.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.lucid.ChemicalFormula.Unit.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.lucid.ChemicalFormula.Unit} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.ChemicalFormula.Unit.toObject = function(includeInstance, msg) {
  let f, obj = {
    symbol: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    number: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of Unit as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.lucid.ChemicalFormula.Unit.ObjectFormat = function() {
  /** @type {?string|undefined} */
  this.symbol;

  /** @type {?string|undefined} */
  this.number;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.lucid.ChemicalFormula.Unit.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.lucid.ChemicalFormula.Unit}
 */
proto.speech.tts.lucid.ChemicalFormula.Unit.fromObject = function(obj) {
  const msg = new proto.speech.tts.lucid.ChemicalFormula.Unit();
  obj.symbol != null && jspb.Message.setField(msg, 1, obj.symbol);
  obj.number != null && jspb.Message.setField(msg, 2, obj.number);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.lucid.ChemicalFormula.Unit}
 */
proto.speech.tts.lucid.ChemicalFormula.Unit.deserializeBinary = function(bytes) {
  return proto.speech.tts.lucid.ChemicalFormula.Unit.deserializeBinaryFromReader(
      new proto.speech.tts.lucid.ChemicalFormula.Unit(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.lucid.ChemicalFormula.Unit} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.lucid.ChemicalFormula.Unit}
 */
proto.speech.tts.lucid.ChemicalFormula.Unit.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {string} */ (reader.readString());
      msg.setSymbol(value);
      break;
    case 2:
      value = /** @type {string} */ (reader.readString());
      msg.setNumber(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.lucid.ChemicalFormula.Unit.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.lucid.ChemicalFormula.Unit.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.lucid.ChemicalFormula.Unit} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.ChemicalFormula.Unit.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {?string} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeString(
      1,
      f
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeString(
      2,
      f
    );
  }
};


/**
 * optional string symbol = 1;
 * @return {?string}
 */
proto.speech.tts.lucid.ChemicalFormula.Unit.prototype.getSymbol = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 1));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.ChemicalFormula.Unit} returns this
 */
proto.speech.tts.lucid.ChemicalFormula.Unit.prototype.setSymbol = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.ChemicalFormula.Unit} returns this
 */
proto.speech.tts.lucid.ChemicalFormula.Unit.prototype.clearSymbol = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.ChemicalFormula.Unit.prototype.hasSymbol = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional string number = 2;
 * @return {?string}
 */
proto.speech.tts.lucid.ChemicalFormula.Unit.prototype.getNumber = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 2));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.ChemicalFormula.Unit} returns this
 */
proto.speech.tts.lucid.ChemicalFormula.Unit.prototype.setNumber = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.ChemicalFormula.Unit} returns this
 */
proto.speech.tts.lucid.ChemicalFormula.Unit.prototype.clearNumber = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.ChemicalFormula.Unit.prototype.hasNumber = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.lucid.ChemicalFormula.Unit}
 */
proto.speech.tts.lucid.ChemicalFormula.Unit.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.lucid.ChemicalFormula.Unit, data);
};


/**
 * repeated Unit units = 1;
 * @return {!Array<!proto.speech.tts.lucid.ChemicalFormula.Unit>}
 */
proto.speech.tts.lucid.ChemicalFormula.prototype.getUnitsList = function() {
  return /** @type{!Array<!proto.speech.tts.lucid.ChemicalFormula.Unit>} */ (
    jspb.Message.getRepeatedWrapperField(this, proto.speech.tts.lucid.ChemicalFormula.Unit, 1));
};


/**
 * @param {Array<!proto.speech.tts.lucid.ChemicalFormula.Unit>|undefined} value
 * @return {!proto.speech.tts.lucid.ChemicalFormula} returns this
*/
proto.speech.tts.lucid.ChemicalFormula.prototype.setUnitsList = function(value) {
  return jspb.Message.setRepeatedWrapperField(this, 1, value);
};


/**
 * @param {!proto.speech.tts.lucid.ChemicalFormula.Unit=} opt_value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.lucid.ChemicalFormula.Unit}
 */
proto.speech.tts.lucid.ChemicalFormula.prototype.addUnits = function(opt_value, opt_index) {
  return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.speech.tts.lucid.ChemicalFormula.Unit, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.lucid.ChemicalFormula} returns this
 */
proto.speech.tts.lucid.ChemicalFormula.prototype.clearUnitsList = function() {
  return jspb.Message.clearRepeatedWrapperField(this, 1);
};


/**
 * optional string type = 2;
 * @return {?string}
 */
proto.speech.tts.lucid.ChemicalFormula.prototype.getType = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 2));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.ChemicalFormula} returns this
 */
proto.speech.tts.lucid.ChemicalFormula.prototype.setType = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.ChemicalFormula} returns this
 */
proto.speech.tts.lucid.ChemicalFormula.prototype.clearType = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.ChemicalFormula.prototype.hasType = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional bool charge = 3;
 * @return {?boolean}
 */
proto.speech.tts.lucid.ChemicalFormula.prototype.getCharge = function() {
  return /** @type {?boolean} */ (jspb.Message.getBooleanField(this, 3));
};


/**
 * @param {?boolean|undefined} value
 * @return {!proto.speech.tts.lucid.ChemicalFormula} returns this
 */
proto.speech.tts.lucid.ChemicalFormula.prototype.setCharge = function(value) {
  return jspb.Message.setField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.ChemicalFormula} returns this
 */
proto.speech.tts.lucid.ChemicalFormula.prototype.clearCharge = function() {
  return jspb.Message.clearField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.ChemicalFormula.prototype.hasCharge = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.lucid.ChemicalFormula}
 */
proto.speech.tts.lucid.ChemicalFormula.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.lucid.ChemicalFormula, data);
};



//speech/tts/public/lucid/structured_token_proto_jspb/connector.jspb.js
// source: speech/tts/public/lucid/structured_token.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.lucid.Connector');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.lucid.Connector = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.speech.tts.lucid.Connector, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.lucid.Connector.displayName = 'proto.speech.tts.lucid.Connector';
}



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.lucid.Connector.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.lucid.Connector.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.lucid.Connector} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.Connector.toObject = function(includeInstance, msg) {
  let f, obj = {
    text: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    expansion: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of Connector as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.lucid.Connector.ObjectFormat = function() {
  /** @type {?string|undefined} */
  this.text;

  /** @type {?string|undefined} */
  this.expansion;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.lucid.Connector.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.lucid.Connector}
 */
proto.speech.tts.lucid.Connector.fromObject = function(obj) {
  const msg = new proto.speech.tts.lucid.Connector();
  obj.text != null && jspb.Message.setField(msg, 1, obj.text);
  obj.expansion != null && jspb.Message.setField(msg, 2, obj.expansion);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.lucid.Connector}
 */
proto.speech.tts.lucid.Connector.deserializeBinary = function(bytes) {
  return proto.speech.tts.lucid.Connector.deserializeBinaryFromReader(
      new proto.speech.tts.lucid.Connector(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.lucid.Connector} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.lucid.Connector}
 */
proto.speech.tts.lucid.Connector.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {string} */ (reader.readString());
      msg.setText(value);
      break;
    case 2:
      value = /** @type {string} */ (reader.readString());
      msg.setExpansion(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.lucid.Connector.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.lucid.Connector.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.lucid.Connector} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.Connector.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {?string} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeString(
      1,
      f
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeString(
      2,
      f
    );
  }
};


/**
 * optional string text = 1;
 * @return {?string}
 */
proto.speech.tts.lucid.Connector.prototype.getText = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 1));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.Connector} returns this
 */
proto.speech.tts.lucid.Connector.prototype.setText = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Connector} returns this
 */
proto.speech.tts.lucid.Connector.prototype.clearText = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Connector.prototype.hasText = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional string expansion = 2;
 * @return {?string}
 */
proto.speech.tts.lucid.Connector.prototype.getExpansion = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 2));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.Connector} returns this
 */
proto.speech.tts.lucid.Connector.prototype.setExpansion = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Connector} returns this
 */
proto.speech.tts.lucid.Connector.prototype.clearExpansion = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Connector.prototype.hasExpansion = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.lucid.Connector}
 */
proto.speech.tts.lucid.Connector.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.lucid.Connector, data);
};



//speech/tts/public/lucid/structured_token_proto_jspb/date.jspb.js
// source: speech/tts/public/lucid/structured_token.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.lucid.Date');
goog.provide('proto.speech.tts.lucid.Date.Calendar');
goog.provide('proto.speech.tts.lucid.Date.MonthCase');
goog.provide('proto.speech.tts.lucid.Date.Style');
goog.provide('proto.speech.tts.lucid.Date.StyleCase');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.requireType('jspb.ByteSource');
goog.requireType('proto.speech.tts.lucid.CommonVerbalizationStyles.Style');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.lucid.Date = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, proto.speech.tts.lucid.Date.oneofGroups_);
};
goog.inherits(proto.speech.tts.lucid.Date, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.lucid.Date.displayName = 'proto.speech.tts.lucid.Date';
}

/**
 * Oneof group definitions for this message. Each group defines the field
 * numbers belonging to that group. When of these fields' value is set, all
 * other fields in the group are cleared. During deserialization, if multiple
 * fields are encountered for a group, only the last value seen will be kept.
 * @private {!Array<!Array<number>>}
 * @const
 */
proto.speech.tts.lucid.Date.oneofGroups_ = [[3,4],[8,9,10]];

/**
 * @enum {number}
 */
proto.speech.tts.lucid.Date.MonthCase = {
  MONTH_NOT_SET: 0,
  MONTH_NUMBER: 3,
  MONTH_NAME: 4
};

/**
 * @return {!proto.speech.tts.lucid.Date.MonthCase}
 */
proto.speech.tts.lucid.Date.prototype.getMonthCase = function() {
  return /** @type {!proto.speech.tts.lucid.Date.MonthCase} */(jspb.Message.computeOneofCase(this, proto.speech.tts.lucid.Date.oneofGroups_[0]));
};

/**
 * @enum {number}
 */
proto.speech.tts.lucid.Date.StyleCase = {
  STYLE_NOT_SET: 0,
  COMMON_STYLE: 8,
  SPECIFIC_STYLE: 9,
  STYLE_ID: 10
};

/**
 * @return {!proto.speech.tts.lucid.Date.StyleCase}
 */
proto.speech.tts.lucid.Date.prototype.getStyleCase = function() {
  return /** @type {!proto.speech.tts.lucid.Date.StyleCase} */(jspb.Message.computeOneofCase(this, proto.speech.tts.lucid.Date.oneofGroups_[1]));
};



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.lucid.Date.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.lucid.Date.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.lucid.Date} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.Date.toObject = function(includeInstance, msg) {
  let f, obj = {
    weekday: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    day: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f,
    monthNumber: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f,
    monthName: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f,
    year: (f = jspb.Message.getField(msg, 5)) == null ? undefined : f,
    calendar: (f = jspb.Message.getField(msg, 6)) == null ? undefined : f,
    era: (f = jspb.Message.getField(msg, 7)) == null ? undefined : f,
    commonStyle: (f = jspb.Message.getField(msg, 8)) == null ? undefined : f,
    specificStyle: (f = jspb.Message.getField(msg, 9)) == null ? undefined : f,
    styleId: (f = jspb.Message.getField(msg, 10)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of Date as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.lucid.Date.ObjectFormat = function() {
  /** @type {?number|undefined} */
  this.weekday;

  /** @type {?number|undefined} */
  this.day;

  /** @type {?number|undefined} */
  this.monthNumber;

  /** @type {?string|undefined} */
  this.monthName;

  /** @type {?number|undefined} */
  this.year;

  /** @type {?number|undefined} */
  this.calendar;

  /** @type {?string|undefined} */
  this.era;

  /** @type {?number|undefined} */
  this.commonStyle;

  /** @type {?number|undefined} */
  this.specificStyle;

  /** @type {?number|undefined} */
  this.styleId;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.lucid.Date.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.lucid.Date}
 */
proto.speech.tts.lucid.Date.fromObject = function(obj) {
  const msg = new proto.speech.tts.lucid.Date();
  obj.weekday != null && jspb.Message.setField(msg, 1, obj.weekday);
  obj.day != null && jspb.Message.setField(msg, 2, obj.day);
  obj.monthNumber != null && jspb.Message.setOneofField(msg, 3, proto.speech.tts.lucid.Date.oneofGroups_[0], obj.monthNumber);
  obj.monthName != null && jspb.Message.setOneofField(msg, 4, proto.speech.tts.lucid.Date.oneofGroups_[0], obj.monthName);
  obj.year != null && jspb.Message.setField(msg, 5, obj.year);
  obj.calendar != null && jspb.Message.setField(msg, 6, obj.calendar);
  obj.era != null && jspb.Message.setField(msg, 7, obj.era);
  obj.commonStyle != null && jspb.Message.setOneofField(msg, 8, proto.speech.tts.lucid.Date.oneofGroups_[1], obj.commonStyle);
  obj.specificStyle != null && jspb.Message.setOneofField(msg, 9, proto.speech.tts.lucid.Date.oneofGroups_[1], obj.specificStyle);
  obj.styleId != null && jspb.Message.setOneofField(msg, 10, proto.speech.tts.lucid.Date.oneofGroups_[1], obj.styleId);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.lucid.Date}
 */
proto.speech.tts.lucid.Date.deserializeBinary = function(bytes) {
  return proto.speech.tts.lucid.Date.deserializeBinaryFromReader(
      new proto.speech.tts.lucid.Date(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.lucid.Date} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.lucid.Date}
 */
proto.speech.tts.lucid.Date.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {number} */ (reader.readInt32());
      msg.setWeekday(value);
      break;
    case 2:
      value = /** @type {number} */ (reader.readInt32());
      msg.setDay(value);
      break;
    case 3:
      value = /** @type {number} */ (reader.readInt32());
      msg.setMonthNumber(value);
      break;
    case 4:
      value = /** @type {string} */ (reader.readString());
      msg.setMonthName(value);
      break;
    case 5:
      value = /** @type {number} */ (reader.readInt32());
      msg.setYear(value);
      break;
    case 6:
      value = /** @type {!proto.speech.tts.lucid.Date.Calendar} */ (reader.readEnum());
      msg.setCalendar(value);
      break;
    case 7:
      value = /** @type {string} */ (reader.readString());
      msg.setEra(value);
      break;
    case 8:
      value = /** @type {!proto.speech.tts.lucid.CommonVerbalizationStyles.Style} */ (reader.readEnum());
      msg.setCommonStyle(value);
      break;
    case 9:
      value = /** @type {!proto.speech.tts.lucid.Date.Style} */ (reader.readEnum());
      msg.setSpecificStyle(value);
      break;
    case 10:
      value = /** @type {number} */ (reader.readInt32());
      msg.setStyleId(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.lucid.Date.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.lucid.Date.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.lucid.Date} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.Date.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {?number} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeInt32(
      1,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeInt32(
      2,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeInt32(
      3,
      f
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 4));
  if (f != null) {
    writer.writeString(
      4,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 5));
  if (f != null) {
    writer.writeInt32(
      5,
      f
    );
  }
  f = /** @type {!proto.speech.tts.lucid.Date.Calendar} */ (jspb.Message.getField(message, 6));
  if (f != null) {
    writer.writeEnum(
      6,
      f
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 7));
  if (f != null) {
    writer.writeString(
      7,
      f
    );
  }
  f = /** @type {!proto.speech.tts.lucid.CommonVerbalizationStyles.Style} */ (jspb.Message.getField(message, 8));
  if (f != null) {
    writer.writeEnum(
      8,
      f
    );
  }
  f = /** @type {!proto.speech.tts.lucid.Date.Style} */ (jspb.Message.getField(message, 9));
  if (f != null) {
    writer.writeEnum(
      9,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 10));
  if (f != null) {
    writer.writeInt32(
      10,
      f
    );
  }
};


/**
 * @enum {number}
 */
proto.speech.tts.lucid.Date.Calendar = {
  UNSPECIFIED_CALENDAR: 0,
  GREGORIAN: 1
};

/**
 * @enum {number}
 */
proto.speech.tts.lucid.Date.Style = {
  UNSPECIFIED_STYLE: 0,
  DAY_MONTHNAME_YEAR: 1,
  MONTHNAME_DAY_YEAR: 2,
  DAY_MONTHNUMBER_YEAR: 3,
  MONTHNUMBER_DAY_YEAR: 4
};

/**
 * optional int32 weekday = 1;
 * @return {?number}
 */
proto.speech.tts.lucid.Date.prototype.getWeekday = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 1));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.speech.tts.lucid.Date} returns this
 */
proto.speech.tts.lucid.Date.prototype.setWeekday = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Date} returns this
 */
proto.speech.tts.lucid.Date.prototype.clearWeekday = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Date.prototype.hasWeekday = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional int32 day = 2;
 * @return {?number}
 */
proto.speech.tts.lucid.Date.prototype.getDay = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 2));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.speech.tts.lucid.Date} returns this
 */
proto.speech.tts.lucid.Date.prototype.setDay = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Date} returns this
 */
proto.speech.tts.lucid.Date.prototype.clearDay = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Date.prototype.hasDay = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional int32 month_number = 3;
 * @return {?number}
 */
proto.speech.tts.lucid.Date.prototype.getMonthNumber = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 3));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.speech.tts.lucid.Date} returns this
 */
proto.speech.tts.lucid.Date.prototype.setMonthNumber = function(value) {
  return jspb.Message.setOneofField(this, 3, proto.speech.tts.lucid.Date.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Date} returns this
 */
proto.speech.tts.lucid.Date.prototype.clearMonthNumber = function() {
  return jspb.Message.clearOneofField(this, 3, proto.speech.tts.lucid.Date.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Date.prototype.hasMonthNumber = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * optional string month_name = 4;
 * @return {?string}
 */
proto.speech.tts.lucid.Date.prototype.getMonthName = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 4));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.Date} returns this
 */
proto.speech.tts.lucid.Date.prototype.setMonthName = function(value) {
  return jspb.Message.setOneofField(this, 4, proto.speech.tts.lucid.Date.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Date} returns this
 */
proto.speech.tts.lucid.Date.prototype.clearMonthName = function() {
  return jspb.Message.clearOneofField(this, 4, proto.speech.tts.lucid.Date.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Date.prototype.hasMonthName = function() {
  return jspb.Message.hasField(this, 4);
};


/**
 * optional int32 year = 5;
 * @return {?number}
 */
proto.speech.tts.lucid.Date.prototype.getYear = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 5));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.speech.tts.lucid.Date} returns this
 */
proto.speech.tts.lucid.Date.prototype.setYear = function(value) {
  return jspb.Message.setField(this, 5, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Date} returns this
 */
proto.speech.tts.lucid.Date.prototype.clearYear = function() {
  return jspb.Message.clearField(this, 5);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Date.prototype.hasYear = function() {
  return jspb.Message.hasField(this, 5);
};


/**
 * optional Calendar calendar = 6;
 * @return {!proto.speech.tts.lucid.Date.Calendar}
 */
proto.speech.tts.lucid.Date.prototype.getCalendar = function() {
  return /** @type {!proto.speech.tts.lucid.Date.Calendar} */ (jspb.Message.getField(this, 6));
};


/**
 * @param {?proto.speech.tts.lucid.Date.Calendar|undefined} value
 * @return {!proto.speech.tts.lucid.Date} returns this
 */
proto.speech.tts.lucid.Date.prototype.setCalendar = function(value) {
  return jspb.Message.setField(this, 6, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Date} returns this
 */
proto.speech.tts.lucid.Date.prototype.clearCalendar = function() {
  return jspb.Message.clearField(this, 6);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Date.prototype.hasCalendar = function() {
  return jspb.Message.hasField(this, 6);
};


/**
 * optional string era = 7;
 * @return {?string}
 */
proto.speech.tts.lucid.Date.prototype.getEra = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 7));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.Date} returns this
 */
proto.speech.tts.lucid.Date.prototype.setEra = function(value) {
  return jspb.Message.setField(this, 7, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Date} returns this
 */
proto.speech.tts.lucid.Date.prototype.clearEra = function() {
  return jspb.Message.clearField(this, 7);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Date.prototype.hasEra = function() {
  return jspb.Message.hasField(this, 7);
};


/**
 * optional CommonVerbalizationStyles.Style common_style = 8;
 * @return {!proto.speech.tts.lucid.CommonVerbalizationStyles.Style}
 */
proto.speech.tts.lucid.Date.prototype.getCommonStyle = function() {
  return /** @type {!proto.speech.tts.lucid.CommonVerbalizationStyles.Style} */ (jspb.Message.getField(this, 8));
};


/**
 * @param {?proto.speech.tts.lucid.CommonVerbalizationStyles.Style|undefined} value
 * @return {!proto.speech.tts.lucid.Date} returns this
 */
proto.speech.tts.lucid.Date.prototype.setCommonStyle = function(value) {
  return jspb.Message.setOneofField(this, 8, proto.speech.tts.lucid.Date.oneofGroups_[1], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Date} returns this
 */
proto.speech.tts.lucid.Date.prototype.clearCommonStyle = function() {
  return jspb.Message.clearOneofField(this, 8, proto.speech.tts.lucid.Date.oneofGroups_[1]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Date.prototype.hasCommonStyle = function() {
  return jspb.Message.hasField(this, 8);
};


/**
 * optional Style specific_style = 9;
 * @return {!proto.speech.tts.lucid.Date.Style}
 */
proto.speech.tts.lucid.Date.prototype.getSpecificStyle = function() {
  return /** @type {!proto.speech.tts.lucid.Date.Style} */ (jspb.Message.getField(this, 9));
};


/**
 * @param {?proto.speech.tts.lucid.Date.Style|undefined} value
 * @return {!proto.speech.tts.lucid.Date} returns this
 */
proto.speech.tts.lucid.Date.prototype.setSpecificStyle = function(value) {
  return jspb.Message.setOneofField(this, 9, proto.speech.tts.lucid.Date.oneofGroups_[1], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Date} returns this
 */
proto.speech.tts.lucid.Date.prototype.clearSpecificStyle = function() {
  return jspb.Message.clearOneofField(this, 9, proto.speech.tts.lucid.Date.oneofGroups_[1]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Date.prototype.hasSpecificStyle = function() {
  return jspb.Message.hasField(this, 9);
};


/**
 * optional int32 style_id = 10;
 * @return {?number}
 */
proto.speech.tts.lucid.Date.prototype.getStyleId = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 10));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.speech.tts.lucid.Date} returns this
 */
proto.speech.tts.lucid.Date.prototype.setStyleId = function(value) {
  return jspb.Message.setOneofField(this, 10, proto.speech.tts.lucid.Date.oneofGroups_[1], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Date} returns this
 */
proto.speech.tts.lucid.Date.prototype.clearStyleId = function() {
  return jspb.Message.clearOneofField(this, 10, proto.speech.tts.lucid.Date.oneofGroups_[1]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Date.prototype.hasStyleId = function() {
  return jspb.Message.hasField(this, 10);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.lucid.Date}
 */
proto.speech.tts.lucid.Date.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.lucid.Date, data);
};



//speech/tts/public/lucid/structured_token_proto_jspb/digits.jspb.js
// source: speech/tts/public/lucid/structured_token.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.lucid.Digits');
goog.provide('proto.speech.tts.lucid.Digits.Style');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.lucid.Digits = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, proto.speech.tts.lucid.Digits.repeatedFields_, null);
};
goog.inherits(proto.speech.tts.lucid.Digits, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.lucid.Digits.displayName = 'proto.speech.tts.lucid.Digits';
}

/**
 * List of repeated fields within this message type.
 * @private {!Array<number>}
 * @const
 */
proto.speech.tts.lucid.Digits.repeatedFields_ = [1];



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.lucid.Digits.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.lucid.Digits.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.lucid.Digits} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.Digits.toObject = function(includeInstance, msg) {
  let f, obj = {
    chunksList: (f = jspb.Message.getRepeatedField(msg, 1)) == null ? undefined : f,
    style: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of Digits as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.lucid.Digits.ObjectFormat = function() {
  /** @type {?Array<string>|undefined} */
  this.chunksList;

  /** @type {?number|undefined} */
  this.style;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.lucid.Digits.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.lucid.Digits}
 */
proto.speech.tts.lucid.Digits.fromObject = function(obj) {
  const msg = new proto.speech.tts.lucid.Digits();
  obj.chunksList != null && jspb.Message.setField(msg, 1, obj.chunksList);
  obj.style != null && jspb.Message.setField(msg, 2, obj.style);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.lucid.Digits}
 */
proto.speech.tts.lucid.Digits.deserializeBinary = function(bytes) {
  return proto.speech.tts.lucid.Digits.deserializeBinaryFromReader(
      new proto.speech.tts.lucid.Digits(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.lucid.Digits} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.lucid.Digits}
 */
proto.speech.tts.lucid.Digits.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {string} */ (reader.readString());
      msg.addChunks(value);
      break;
    case 2:
      value = /** @type {!proto.speech.tts.lucid.Digits.Style} */ (reader.readEnum());
      msg.setStyle(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.lucid.Digits.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.lucid.Digits.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.lucid.Digits} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.Digits.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = message.getChunksList();
  if (f.length > 0) {
    writer.writeRepeatedString(
      1,
      f
    );
  }
  f = /** @type {!proto.speech.tts.lucid.Digits.Style} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeEnum(
      2,
      f
    );
  }
};


/**
 * @enum {number}
 */
proto.speech.tts.lucid.Digits.Style = {
  UNSPECIFIED_STYLE: 0,
  SEPARATE_DIGITS: 1,
  GROUP_REPETITIONS: 2,
  AS_CARDINAL: 3,
  AS_CARDINAL_GROUPING_ZEROS: 4
};

/**
 * repeated string chunks = 1;
 * @return {!Array<string>}
 */
proto.speech.tts.lucid.Digits.prototype.getChunksList = function() {
  return /** @type {!Array<string>} */ (jspb.Message.getRepeatedField(this, 1));
};


/**
 * @param {Array<string>|undefined} value
 * @return {!proto.speech.tts.lucid.Digits} returns this
 */
proto.speech.tts.lucid.Digits.prototype.setChunksList = function(value) {
  return jspb.Message.setField(this, 1, value || []);
};


/**
 * @param {string} value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.lucid.Digits} returns this
 */
proto.speech.tts.lucid.Digits.prototype.addChunks = function(value, opt_index) {
  return jspb.Message.addToRepeatedField(this, 1, value, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.lucid.Digits} returns this
 */
proto.speech.tts.lucid.Digits.prototype.clearChunksList = function() {
  return jspb.Message.clearRepeatedField(this, 1);
};


/**
 * optional Style style = 2;
 * @return {!proto.speech.tts.lucid.Digits.Style}
 */
proto.speech.tts.lucid.Digits.prototype.getStyle = function() {
  return /** @type {!proto.speech.tts.lucid.Digits.Style} */ (jspb.Message.getField(this, 2));
};


/**
 * @param {?proto.speech.tts.lucid.Digits.Style|undefined} value
 * @return {!proto.speech.tts.lucid.Digits} returns this
 */
proto.speech.tts.lucid.Digits.prototype.setStyle = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Digits} returns this
 */
proto.speech.tts.lucid.Digits.prototype.clearStyle = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Digits.prototype.hasStyle = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.lucid.Digits}
 */
proto.speech.tts.lucid.Digits.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.lucid.Digits, data);
};



//speech/tts/public/lucid/structured_token_proto_jspb/duration.jspb.js
// source: speech/tts/public/lucid/structured_token.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.lucid.Duration');
goog.provide('proto.speech.tts.lucid.Duration.StyleCase');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.requireType('jspb.ByteSource');
goog.requireType('proto.speech.tts.lucid.CommonVerbalizationStyles.Style');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.lucid.Duration = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, proto.speech.tts.lucid.Duration.oneofGroups_);
};
goog.inherits(proto.speech.tts.lucid.Duration, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.lucid.Duration.displayName = 'proto.speech.tts.lucid.Duration';
}

/**
 * Oneof group definitions for this message. Each group defines the field
 * numbers belonging to that group. When of these fields' value is set, all
 * other fields in the group are cleared. During deserialization, if multiple
 * fields are encountered for a group, only the last value seen will be kept.
 * @private {!Array<!Array<number>>}
 * @const
 */
proto.speech.tts.lucid.Duration.oneofGroups_ = [[5,6]];

/**
 * @enum {number}
 */
proto.speech.tts.lucid.Duration.StyleCase = {
  STYLE_NOT_SET: 0,
  COMMON_STYLE: 5,
  STYLE_ID: 6
};

/**
 * @return {!proto.speech.tts.lucid.Duration.StyleCase}
 */
proto.speech.tts.lucid.Duration.prototype.getStyleCase = function() {
  return /** @type {!proto.speech.tts.lucid.Duration.StyleCase} */(jspb.Message.computeOneofCase(this, proto.speech.tts.lucid.Duration.oneofGroups_[0]));
};



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.lucid.Duration.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.lucid.Duration.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.lucid.Duration} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.Duration.toObject = function(includeInstance, msg) {
  let f, obj = {
    hours: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    minutes: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f,
    seconds: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f,
    milliseconds: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f,
    commonStyle: (f = jspb.Message.getField(msg, 5)) == null ? undefined : f,
    styleId: (f = jspb.Message.getField(msg, 6)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of Duration as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.lucid.Duration.ObjectFormat = function() {
  /** @type {?number|undefined} */
  this.hours;

  /** @type {?number|undefined} */
  this.minutes;

  /** @type {?number|undefined} */
  this.seconds;

  /** @type {?number|undefined} */
  this.milliseconds;

  /** @type {?number|undefined} */
  this.commonStyle;

  /** @type {?number|undefined} */
  this.styleId;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.lucid.Duration.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.lucid.Duration}
 */
proto.speech.tts.lucid.Duration.fromObject = function(obj) {
  const msg = new proto.speech.tts.lucid.Duration();
  obj.hours != null && jspb.Message.setField(msg, 1, obj.hours);
  obj.minutes != null && jspb.Message.setField(msg, 2, obj.minutes);
  obj.seconds != null && jspb.Message.setField(msg, 3, obj.seconds);
  obj.milliseconds != null && jspb.Message.setField(msg, 4, obj.milliseconds);
  obj.commonStyle != null && jspb.Message.setOneofField(msg, 5, proto.speech.tts.lucid.Duration.oneofGroups_[0], obj.commonStyle);
  obj.styleId != null && jspb.Message.setOneofField(msg, 6, proto.speech.tts.lucid.Duration.oneofGroups_[0], obj.styleId);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.lucid.Duration}
 */
proto.speech.tts.lucid.Duration.deserializeBinary = function(bytes) {
  return proto.speech.tts.lucid.Duration.deserializeBinaryFromReader(
      new proto.speech.tts.lucid.Duration(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.lucid.Duration} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.lucid.Duration}
 */
proto.speech.tts.lucid.Duration.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {number} */ (reader.readInt32());
      msg.setHours(value);
      break;
    case 2:
      value = /** @type {number} */ (reader.readInt32());
      msg.setMinutes(value);
      break;
    case 3:
      value = /** @type {number} */ (reader.readInt32());
      msg.setSeconds(value);
      break;
    case 4:
      value = /** @type {number} */ (reader.readInt32());
      msg.setMilliseconds(value);
      break;
    case 5:
      value = /** @type {!proto.speech.tts.lucid.CommonVerbalizationStyles.Style} */ (reader.readEnum());
      msg.setCommonStyle(value);
      break;
    case 6:
      value = /** @type {number} */ (reader.readInt32());
      msg.setStyleId(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.lucid.Duration.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.lucid.Duration.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.lucid.Duration} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.Duration.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {?number} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeInt32(
      1,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeInt32(
      2,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeInt32(
      3,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 4));
  if (f != null) {
    writer.writeInt32(
      4,
      f
    );
  }
  f = /** @type {!proto.speech.tts.lucid.CommonVerbalizationStyles.Style} */ (jspb.Message.getField(message, 5));
  if (f != null) {
    writer.writeEnum(
      5,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 6));
  if (f != null) {
    writer.writeInt32(
      6,
      f
    );
  }
};


/**
 * optional int32 hours = 1;
 * @return {?number}
 */
proto.speech.tts.lucid.Duration.prototype.getHours = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 1));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.speech.tts.lucid.Duration} returns this
 */
proto.speech.tts.lucid.Duration.prototype.setHours = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Duration} returns this
 */
proto.speech.tts.lucid.Duration.prototype.clearHours = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Duration.prototype.hasHours = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional int32 minutes = 2;
 * @return {?number}
 */
proto.speech.tts.lucid.Duration.prototype.getMinutes = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 2));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.speech.tts.lucid.Duration} returns this
 */
proto.speech.tts.lucid.Duration.prototype.setMinutes = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Duration} returns this
 */
proto.speech.tts.lucid.Duration.prototype.clearMinutes = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Duration.prototype.hasMinutes = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional int32 seconds = 3;
 * @return {?number}
 */
proto.speech.tts.lucid.Duration.prototype.getSeconds = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 3));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.speech.tts.lucid.Duration} returns this
 */
proto.speech.tts.lucid.Duration.prototype.setSeconds = function(value) {
  return jspb.Message.setField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Duration} returns this
 */
proto.speech.tts.lucid.Duration.prototype.clearSeconds = function() {
  return jspb.Message.clearField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Duration.prototype.hasSeconds = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * optional int32 milliseconds = 4;
 * @return {?number}
 */
proto.speech.tts.lucid.Duration.prototype.getMilliseconds = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 4));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.speech.tts.lucid.Duration} returns this
 */
proto.speech.tts.lucid.Duration.prototype.setMilliseconds = function(value) {
  return jspb.Message.setField(this, 4, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Duration} returns this
 */
proto.speech.tts.lucid.Duration.prototype.clearMilliseconds = function() {
  return jspb.Message.clearField(this, 4);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Duration.prototype.hasMilliseconds = function() {
  return jspb.Message.hasField(this, 4);
};


/**
 * optional CommonVerbalizationStyles.Style common_style = 5;
 * @return {!proto.speech.tts.lucid.CommonVerbalizationStyles.Style}
 */
proto.speech.tts.lucid.Duration.prototype.getCommonStyle = function() {
  return /** @type {!proto.speech.tts.lucid.CommonVerbalizationStyles.Style} */ (jspb.Message.getField(this, 5));
};


/**
 * @param {?proto.speech.tts.lucid.CommonVerbalizationStyles.Style|undefined} value
 * @return {!proto.speech.tts.lucid.Duration} returns this
 */
proto.speech.tts.lucid.Duration.prototype.setCommonStyle = function(value) {
  return jspb.Message.setOneofField(this, 5, proto.speech.tts.lucid.Duration.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Duration} returns this
 */
proto.speech.tts.lucid.Duration.prototype.clearCommonStyle = function() {
  return jspb.Message.clearOneofField(this, 5, proto.speech.tts.lucid.Duration.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Duration.prototype.hasCommonStyle = function() {
  return jspb.Message.hasField(this, 5);
};


/**
 * optional int32 style_id = 6;
 * @return {?number}
 */
proto.speech.tts.lucid.Duration.prototype.getStyleId = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 6));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.speech.tts.lucid.Duration} returns this
 */
proto.speech.tts.lucid.Duration.prototype.setStyleId = function(value) {
  return jspb.Message.setOneofField(this, 6, proto.speech.tts.lucid.Duration.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Duration} returns this
 */
proto.speech.tts.lucid.Duration.prototype.clearStyleId = function() {
  return jspb.Message.clearOneofField(this, 6, proto.speech.tts.lucid.Duration.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Duration.prototype.hasStyleId = function() {
  return jspb.Message.hasField(this, 6);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.lucid.Duration}
 */
proto.speech.tts.lucid.Duration.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.lucid.Duration, data);
};



//speech/tts/public/lucid/structured_token_proto_jspb/electronic.jspb.js
// source: speech/tts/public/lucid/structured_token.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.lucid.Electronic');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.lucid.Electronic = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.speech.tts.lucid.Electronic, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.lucid.Electronic.displayName = 'proto.speech.tts.lucid.Electronic';
}



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.lucid.Electronic.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.lucid.Electronic.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.lucid.Electronic} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.Electronic.toObject = function(includeInstance, msg) {
  let f, obj = {
    protocol: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    username: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f,
    password: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f,
    domain: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f,
    port: (f = jspb.Message.getField(msg, 5)) == null ? undefined : f,
    path: (f = jspb.Message.getField(msg, 6)) == null ? undefined : f,
    queryString: (f = jspb.Message.getField(msg, 7)) == null ? undefined : f,
    fragmentId: (f = jspb.Message.getField(msg, 8)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of Electronic as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.lucid.Electronic.ObjectFormat = function() {
  /** @type {?string|undefined} */
  this.protocol;

  /** @type {?string|undefined} */
  this.username;

  /** @type {?string|undefined} */
  this.password;

  /** @type {?string|undefined} */
  this.domain;

  /** @type {?number|undefined} */
  this.port;

  /** @type {?string|undefined} */
  this.path;

  /** @type {?string|undefined} */
  this.queryString;

  /** @type {?string|undefined} */
  this.fragmentId;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.lucid.Electronic.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.lucid.Electronic}
 */
proto.speech.tts.lucid.Electronic.fromObject = function(obj) {
  const msg = new proto.speech.tts.lucid.Electronic();
  obj.protocol != null && jspb.Message.setField(msg, 1, obj.protocol);
  obj.username != null && jspb.Message.setField(msg, 2, obj.username);
  obj.password != null && jspb.Message.setField(msg, 3, obj.password);
  obj.domain != null && jspb.Message.setField(msg, 4, obj.domain);
  obj.port != null && jspb.Message.setField(msg, 5, obj.port);
  obj.path != null && jspb.Message.setField(msg, 6, obj.path);
  obj.queryString != null && jspb.Message.setField(msg, 7, obj.queryString);
  obj.fragmentId != null && jspb.Message.setField(msg, 8, obj.fragmentId);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.lucid.Electronic}
 */
proto.speech.tts.lucid.Electronic.deserializeBinary = function(bytes) {
  return proto.speech.tts.lucid.Electronic.deserializeBinaryFromReader(
      new proto.speech.tts.lucid.Electronic(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.lucid.Electronic} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.lucid.Electronic}
 */
proto.speech.tts.lucid.Electronic.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {string} */ (reader.readString());
      msg.setProtocol(value);
      break;
    case 2:
      value = /** @type {string} */ (reader.readString());
      msg.setUsername(value);
      break;
    case 3:
      value = /** @type {string} */ (reader.readString());
      msg.setPassword(value);
      break;
    case 4:
      value = /** @type {string} */ (reader.readString());
      msg.setDomain(value);
      break;
    case 5:
      value = /** @type {number} */ (reader.readInt32());
      msg.setPort(value);
      break;
    case 6:
      value = /** @type {string} */ (reader.readString());
      msg.setPath(value);
      break;
    case 7:
      value = /** @type {string} */ (reader.readString());
      msg.setQueryString(value);
      break;
    case 8:
      value = /** @type {string} */ (reader.readString());
      msg.setFragmentId(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.lucid.Electronic.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.lucid.Electronic.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.lucid.Electronic} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.Electronic.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {?string} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeString(
      1,
      f
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeString(
      2,
      f
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeString(
      3,
      f
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 4));
  if (f != null) {
    writer.writeString(
      4,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 5));
  if (f != null) {
    writer.writeInt32(
      5,
      f
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 6));
  if (f != null) {
    writer.writeString(
      6,
      f
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 7));
  if (f != null) {
    writer.writeString(
      7,
      f
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 8));
  if (f != null) {
    writer.writeString(
      8,
      f
    );
  }
};


/**
 * optional string protocol = 1;
 * @return {?string}
 */
proto.speech.tts.lucid.Electronic.prototype.getProtocol = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 1));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.Electronic} returns this
 */
proto.speech.tts.lucid.Electronic.prototype.setProtocol = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Electronic} returns this
 */
proto.speech.tts.lucid.Electronic.prototype.clearProtocol = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Electronic.prototype.hasProtocol = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional string username = 2;
 * @return {?string}
 */
proto.speech.tts.lucid.Electronic.prototype.getUsername = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 2));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.Electronic} returns this
 */
proto.speech.tts.lucid.Electronic.prototype.setUsername = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Electronic} returns this
 */
proto.speech.tts.lucid.Electronic.prototype.clearUsername = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Electronic.prototype.hasUsername = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional string password = 3;
 * @return {?string}
 */
proto.speech.tts.lucid.Electronic.prototype.getPassword = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 3));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.Electronic} returns this
 */
proto.speech.tts.lucid.Electronic.prototype.setPassword = function(value) {
  return jspb.Message.setField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Electronic} returns this
 */
proto.speech.tts.lucid.Electronic.prototype.clearPassword = function() {
  return jspb.Message.clearField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Electronic.prototype.hasPassword = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * optional string domain = 4;
 * @return {?string}
 */
proto.speech.tts.lucid.Electronic.prototype.getDomain = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 4));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.Electronic} returns this
 */
proto.speech.tts.lucid.Electronic.prototype.setDomain = function(value) {
  return jspb.Message.setField(this, 4, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Electronic} returns this
 */
proto.speech.tts.lucid.Electronic.prototype.clearDomain = function() {
  return jspb.Message.clearField(this, 4);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Electronic.prototype.hasDomain = function() {
  return jspb.Message.hasField(this, 4);
};


/**
 * optional int32 port = 5;
 * @return {?number}
 */
proto.speech.tts.lucid.Electronic.prototype.getPort = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 5));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.speech.tts.lucid.Electronic} returns this
 */
proto.speech.tts.lucid.Electronic.prototype.setPort = function(value) {
  return jspb.Message.setField(this, 5, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Electronic} returns this
 */
proto.speech.tts.lucid.Electronic.prototype.clearPort = function() {
  return jspb.Message.clearField(this, 5);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Electronic.prototype.hasPort = function() {
  return jspb.Message.hasField(this, 5);
};


/**
 * optional string path = 6;
 * @return {?string}
 */
proto.speech.tts.lucid.Electronic.prototype.getPath = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 6));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.Electronic} returns this
 */
proto.speech.tts.lucid.Electronic.prototype.setPath = function(value) {
  return jspb.Message.setField(this, 6, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Electronic} returns this
 */
proto.speech.tts.lucid.Electronic.prototype.clearPath = function() {
  return jspb.Message.clearField(this, 6);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Electronic.prototype.hasPath = function() {
  return jspb.Message.hasField(this, 6);
};


/**
 * optional string query_string = 7;
 * @return {?string}
 */
proto.speech.tts.lucid.Electronic.prototype.getQueryString = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 7));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.Electronic} returns this
 */
proto.speech.tts.lucid.Electronic.prototype.setQueryString = function(value) {
  return jspb.Message.setField(this, 7, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Electronic} returns this
 */
proto.speech.tts.lucid.Electronic.prototype.clearQueryString = function() {
  return jspb.Message.clearField(this, 7);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Electronic.prototype.hasQueryString = function() {
  return jspb.Message.hasField(this, 7);
};


/**
 * optional string fragment_id = 8;
 * @return {?string}
 */
proto.speech.tts.lucid.Electronic.prototype.getFragmentId = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 8));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.Electronic} returns this
 */
proto.speech.tts.lucid.Electronic.prototype.setFragmentId = function(value) {
  return jspb.Message.setField(this, 8, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Electronic} returns this
 */
proto.speech.tts.lucid.Electronic.prototype.clearFragmentId = function() {
  return jspb.Message.clearField(this, 8);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Electronic.prototype.hasFragmentId = function() {
  return jspb.Message.hasField(this, 8);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.lucid.Electronic}
 */
proto.speech.tts.lucid.Electronic.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.lucid.Electronic, data);
};



//speech/tts/public/lucid/structured_token_proto_jspb/emoticonemoji.jspb.js
// source: speech/tts/public/lucid/structured_token.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.lucid.EmoticonEmoji');
goog.provide('proto.speech.tts.lucid.EmoticonEmoji.Style');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.lucid.EmoticonEmoji = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.speech.tts.lucid.EmoticonEmoji, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.lucid.EmoticonEmoji.displayName = 'proto.speech.tts.lucid.EmoticonEmoji';
}



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.lucid.EmoticonEmoji.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.lucid.EmoticonEmoji.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.lucid.EmoticonEmoji} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.EmoticonEmoji.toObject = function(includeInstance, msg) {
  let f, obj = {
    text: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    style: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of EmoticonEmoji as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.lucid.EmoticonEmoji.ObjectFormat = function() {
  /** @type {?string|undefined} */
  this.text;

  /** @type {?number|undefined} */
  this.style;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.lucid.EmoticonEmoji.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.lucid.EmoticonEmoji}
 */
proto.speech.tts.lucid.EmoticonEmoji.fromObject = function(obj) {
  const msg = new proto.speech.tts.lucid.EmoticonEmoji();
  obj.text != null && jspb.Message.setField(msg, 1, obj.text);
  obj.style != null && jspb.Message.setField(msg, 2, obj.style);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.lucid.EmoticonEmoji}
 */
proto.speech.tts.lucid.EmoticonEmoji.deserializeBinary = function(bytes) {
  return proto.speech.tts.lucid.EmoticonEmoji.deserializeBinaryFromReader(
      new proto.speech.tts.lucid.EmoticonEmoji(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.lucid.EmoticonEmoji} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.lucid.EmoticonEmoji}
 */
proto.speech.tts.lucid.EmoticonEmoji.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {string} */ (reader.readString());
      msg.setText(value);
      break;
    case 2:
      value = /** @type {!proto.speech.tts.lucid.EmoticonEmoji.Style} */ (reader.readEnum());
      msg.setStyle(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.lucid.EmoticonEmoji.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.lucid.EmoticonEmoji.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.lucid.EmoticonEmoji} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.EmoticonEmoji.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {?string} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeString(
      1,
      f
    );
  }
  f = /** @type {!proto.speech.tts.lucid.EmoticonEmoji.Style} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeEnum(
      2,
      f
    );
  }
};


/**
 * @enum {number}
 */
proto.speech.tts.lucid.EmoticonEmoji.Style = {
  UNSPECIFIED_STYLE: 0,
  CONCISE_STYLE: 1,
  VERBOSE_STYLE: 2
};

/**
 * optional string text = 1;
 * @return {?string}
 */
proto.speech.tts.lucid.EmoticonEmoji.prototype.getText = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 1));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.EmoticonEmoji} returns this
 */
proto.speech.tts.lucid.EmoticonEmoji.prototype.setText = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.EmoticonEmoji} returns this
 */
proto.speech.tts.lucid.EmoticonEmoji.prototype.clearText = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.EmoticonEmoji.prototype.hasText = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional Style style = 2;
 * @return {!proto.speech.tts.lucid.EmoticonEmoji.Style}
 */
proto.speech.tts.lucid.EmoticonEmoji.prototype.getStyle = function() {
  return /** @type {!proto.speech.tts.lucid.EmoticonEmoji.Style} */ (jspb.Message.getField(this, 2));
};


/**
 * @param {?proto.speech.tts.lucid.EmoticonEmoji.Style|undefined} value
 * @return {!proto.speech.tts.lucid.EmoticonEmoji} returns this
 */
proto.speech.tts.lucid.EmoticonEmoji.prototype.setStyle = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.EmoticonEmoji} returns this
 */
proto.speech.tts.lucid.EmoticonEmoji.prototype.clearStyle = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.EmoticonEmoji.prototype.hasStyle = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.lucid.EmoticonEmoji}
 */
proto.speech.tts.lucid.EmoticonEmoji.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.lucid.EmoticonEmoji, data);
};



//speech/tts/public/lucid/structured_token_proto_jspb/fraction.jspb.js
// source: speech/tts/public/lucid/structured_token.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.lucid.Fraction');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.lucid.Fraction = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.speech.tts.lucid.Fraction, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.lucid.Fraction.displayName = 'proto.speech.tts.lucid.Fraction';
}



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.lucid.Fraction.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.lucid.Fraction.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.lucid.Fraction} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.Fraction.toObject = function(includeInstance, msg) {
  let f, obj = {
    integerPart: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    numerator: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f,
    denominator: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of Fraction as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.lucid.Fraction.ObjectFormat = function() {
  /** @type {?string|undefined} */
  this.integerPart;

  /** @type {?string|undefined} */
  this.numerator;

  /** @type {?string|undefined} */
  this.denominator;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.lucid.Fraction.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.lucid.Fraction}
 */
proto.speech.tts.lucid.Fraction.fromObject = function(obj) {
  const msg = new proto.speech.tts.lucid.Fraction();
  obj.integerPart != null && jspb.Message.setField(msg, 1, obj.integerPart);
  obj.numerator != null && jspb.Message.setField(msg, 2, obj.numerator);
  obj.denominator != null && jspb.Message.setField(msg, 3, obj.denominator);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.lucid.Fraction}
 */
proto.speech.tts.lucid.Fraction.deserializeBinary = function(bytes) {
  return proto.speech.tts.lucid.Fraction.deserializeBinaryFromReader(
      new proto.speech.tts.lucid.Fraction(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.lucid.Fraction} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.lucid.Fraction}
 */
proto.speech.tts.lucid.Fraction.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {string} */ (reader.readString());
      msg.setIntegerPart(value);
      break;
    case 2:
      value = /** @type {string} */ (reader.readString());
      msg.setNumerator(value);
      break;
    case 3:
      value = /** @type {string} */ (reader.readString());
      msg.setDenominator(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.lucid.Fraction.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.lucid.Fraction.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.lucid.Fraction} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.Fraction.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {?string} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeString(
      1,
      f
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeString(
      2,
      f
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeString(
      3,
      f
    );
  }
};


/**
 * optional string integer_part = 1;
 * @return {?string}
 */
proto.speech.tts.lucid.Fraction.prototype.getIntegerPart = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 1));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.Fraction} returns this
 */
proto.speech.tts.lucid.Fraction.prototype.setIntegerPart = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Fraction} returns this
 */
proto.speech.tts.lucid.Fraction.prototype.clearIntegerPart = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Fraction.prototype.hasIntegerPart = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional string numerator = 2;
 * @return {?string}
 */
proto.speech.tts.lucid.Fraction.prototype.getNumerator = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 2));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.Fraction} returns this
 */
proto.speech.tts.lucid.Fraction.prototype.setNumerator = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Fraction} returns this
 */
proto.speech.tts.lucid.Fraction.prototype.clearNumerator = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Fraction.prototype.hasNumerator = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional string denominator = 3;
 * @return {?string}
 */
proto.speech.tts.lucid.Fraction.prototype.getDenominator = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 3));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.Fraction} returns this
 */
proto.speech.tts.lucid.Fraction.prototype.setDenominator = function(value) {
  return jspb.Message.setField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Fraction} returns this
 */
proto.speech.tts.lucid.Fraction.prototype.clearDenominator = function() {
  return jspb.Message.clearField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Fraction.prototype.hasDenominator = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.lucid.Fraction}
 */
proto.speech.tts.lucid.Fraction.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.lucid.Fraction, data);
};



//speech/tts/public/lucid/structured_token_proto_jspb/lettersequence.jspb.js
// source: speech/tts/public/lucid/structured_token.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.lucid.LetterSequence');
goog.provide('proto.speech.tts.lucid.LetterSequence.Style');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.lucid.LetterSequence = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.speech.tts.lucid.LetterSequence, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.lucid.LetterSequence.displayName = 'proto.speech.tts.lucid.LetterSequence';
}



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.lucid.LetterSequence.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.lucid.LetterSequence.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.lucid.LetterSequence} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.LetterSequence.toObject = function(includeInstance, msg) {
  let f, obj = {
    text: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    style: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of LetterSequence as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.lucid.LetterSequence.ObjectFormat = function() {
  /** @type {?string|undefined} */
  this.text;

  /** @type {?number|undefined} */
  this.style;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.lucid.LetterSequence.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.lucid.LetterSequence}
 */
proto.speech.tts.lucid.LetterSequence.fromObject = function(obj) {
  const msg = new proto.speech.tts.lucid.LetterSequence();
  obj.text != null && jspb.Message.setField(msg, 1, obj.text);
  obj.style != null && jspb.Message.setField(msg, 2, obj.style);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.lucid.LetterSequence}
 */
proto.speech.tts.lucid.LetterSequence.deserializeBinary = function(bytes) {
  return proto.speech.tts.lucid.LetterSequence.deserializeBinaryFromReader(
      new proto.speech.tts.lucid.LetterSequence(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.lucid.LetterSequence} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.lucid.LetterSequence}
 */
proto.speech.tts.lucid.LetterSequence.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {string} */ (reader.readString());
      msg.setText(value);
      break;
    case 2:
      value = /** @type {!proto.speech.tts.lucid.LetterSequence.Style} */ (reader.readEnum());
      msg.setStyle(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.lucid.LetterSequence.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.lucid.LetterSequence.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.lucid.LetterSequence} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.LetterSequence.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {?string} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeString(
      1,
      f
    );
  }
  f = /** @type {!proto.speech.tts.lucid.LetterSequence.Style} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeEnum(
      2,
      f
    );
  }
};


/**
 * @enum {number}
 */
proto.speech.tts.lucid.LetterSequence.Style = {
  UNSPECIFIED_STYLE: 0,
  SEPARATE_LETTERS: 1,
  AS_WORD: 2
};

/**
 * optional string text = 1;
 * @return {?string}
 */
proto.speech.tts.lucid.LetterSequence.prototype.getText = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 1));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.LetterSequence} returns this
 */
proto.speech.tts.lucid.LetterSequence.prototype.setText = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.LetterSequence} returns this
 */
proto.speech.tts.lucid.LetterSequence.prototype.clearText = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.LetterSequence.prototype.hasText = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional Style style = 2;
 * @return {!proto.speech.tts.lucid.LetterSequence.Style}
 */
proto.speech.tts.lucid.LetterSequence.prototype.getStyle = function() {
  return /** @type {!proto.speech.tts.lucid.LetterSequence.Style} */ (jspb.Message.getField(this, 2));
};


/**
 * @param {?proto.speech.tts.lucid.LetterSequence.Style|undefined} value
 * @return {!proto.speech.tts.lucid.LetterSequence} returns this
 */
proto.speech.tts.lucid.LetterSequence.prototype.setStyle = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.LetterSequence} returns this
 */
proto.speech.tts.lucid.LetterSequence.prototype.clearStyle = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.LetterSequence.prototype.hasStyle = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.lucid.LetterSequence}
 */
proto.speech.tts.lucid.LetterSequence.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.lucid.LetterSequence, data);
};



//speech/tts/public/lucid/structured_token_proto_jspb/number.jspb.js
// source: speech/tts/public/lucid/structured_token.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.lucid.Number');
goog.provide('proto.speech.tts.lucid.Number.ValueCase');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.lucid.Number = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, proto.speech.tts.lucid.Number.oneofGroups_);
};
goog.inherits(proto.speech.tts.lucid.Number, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.lucid.Number.displayName = 'proto.speech.tts.lucid.Number';
}

/**
 * Oneof group definitions for this message. Each group defines the field
 * numbers belonging to that group. When of these fields' value is set, all
 * other fields in the group are cleared. During deserialization, if multiple
 * fields are encountered for a group, only the last value seen will be kept.
 * @private {!Array<!Array<number>>}
 * @const
 */
proto.speech.tts.lucid.Number.oneofGroups_ = [[3,4]];

/**
 * @enum {number}
 */
proto.speech.tts.lucid.Number.ValueCase = {
  VALUE_NOT_SET: 0,
  INTEGER: 3,
  FLOATING_POINT: 4
};

/**
 * @return {!proto.speech.tts.lucid.Number.ValueCase}
 */
proto.speech.tts.lucid.Number.prototype.getValueCase = function() {
  return /** @type {!proto.speech.tts.lucid.Number.ValueCase} */(jspb.Message.computeOneofCase(this, proto.speech.tts.lucid.Number.oneofGroups_[0]));
};



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.lucid.Number.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.lucid.Number.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.lucid.Number} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.Number.toObject = function(includeInstance, msg) {
  let f, obj = {
    integerPart: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    fractionalPart: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f,
    integer: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f,
    floatingPoint: (f = jspb.Message.getOptionalFloatingPointField(msg, 4)) == null ? undefined : f,
    minPrecision: (f = jspb.Message.getField(msg, 5)) == null ? undefined : f,
    maxPrecision: jspb.Message.getIntegerFieldWithDefault(msg, 6, 6),
    exponent: (f = jspb.Message.getField(msg, 7)) == null ? undefined : f,
    quantity: (f = jspb.Message.getField(msg, 8)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of Number as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.lucid.Number.ObjectFormat = function() {
  /** @type {?string|undefined} */
  this.integerPart;

  /** @type {?string|undefined} */
  this.fractionalPart;

  /** @type {?number|undefined} */
  this.integer;

  /** @type {?number|undefined} */
  this.floatingPoint;

  /** @type {?number|undefined} */
  this.minPrecision;

  /** @type {?number|undefined} */
  this.maxPrecision;

  /** @type {?string|undefined} */
  this.exponent;

  /** @type {?string|undefined} */
  this.quantity;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.lucid.Number.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.lucid.Number}
 */
proto.speech.tts.lucid.Number.fromObject = function(obj) {
  const msg = new proto.speech.tts.lucid.Number();
  obj.integerPart != null && jspb.Message.setField(msg, 1, obj.integerPart);
  obj.fractionalPart != null && jspb.Message.setField(msg, 2, obj.fractionalPart);
  obj.integer != null && jspb.Message.setOneofField(msg, 3, proto.speech.tts.lucid.Number.oneofGroups_[0], obj.integer);
  obj.floatingPoint != null && jspb.Message.setOneofField(msg, 4, proto.speech.tts.lucid.Number.oneofGroups_[0], obj.floatingPoint);
  obj.minPrecision != null && jspb.Message.setField(msg, 5, obj.minPrecision);
  obj.maxPrecision != null && jspb.Message.setField(msg, 6, obj.maxPrecision);
  obj.exponent != null && jspb.Message.setField(msg, 7, obj.exponent);
  obj.quantity != null && jspb.Message.setField(msg, 8, obj.quantity);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.lucid.Number}
 */
proto.speech.tts.lucid.Number.deserializeBinary = function(bytes) {
  return proto.speech.tts.lucid.Number.deserializeBinaryFromReader(
      new proto.speech.tts.lucid.Number(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.lucid.Number} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.lucid.Number}
 */
proto.speech.tts.lucid.Number.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {string} */ (reader.readString());
      msg.setIntegerPart(value);
      break;
    case 2:
      value = /** @type {string} */ (reader.readString());
      msg.setFractionalPart(value);
      break;
    case 3:
      value = /** @type {number} */ (reader.readInt64());
      msg.setInteger(value);
      break;
    case 4:
      value = /** @type {number} */ (reader.readDouble());
      msg.setFloatingPoint(value);
      break;
    case 5:
      value = /** @type {number} */ (reader.readInt32());
      msg.setMinPrecision(value);
      break;
    case 6:
      value = /** @type {number} */ (reader.readInt32());
      msg.setMaxPrecision(value);
      break;
    case 7:
      value = /** @type {string} */ (reader.readString());
      msg.setExponent(value);
      break;
    case 8:
      value = /** @type {string} */ (reader.readString());
      msg.setQuantity(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.lucid.Number.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.lucid.Number.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.lucid.Number} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.Number.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {?string} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeString(
      1,
      f
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeString(
      2,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeInt64(
      3,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 4));
  if (f != null) {
    writer.writeDouble(
      4,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 5));
  if (f != null) {
    writer.writeInt32(
      5,
      f
    );
  }
  f = /** @type {number} */ (jspb.Message.getField(message, 6));
  if (f != null) {
    writer.writeInt32(
      6,
      f
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 7));
  if (f != null) {
    writer.writeString(
      7,
      f
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 8));
  if (f != null) {
    writer.writeString(
      8,
      f
    );
  }
};


/**
 * optional string integer_part = 1;
 * @return {?string}
 */
proto.speech.tts.lucid.Number.prototype.getIntegerPart = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 1));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.Number} returns this
 */
proto.speech.tts.lucid.Number.prototype.setIntegerPart = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Number} returns this
 */
proto.speech.tts.lucid.Number.prototype.clearIntegerPart = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Number.prototype.hasIntegerPart = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional string fractional_part = 2;
 * @return {?string}
 */
proto.speech.tts.lucid.Number.prototype.getFractionalPart = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 2));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.Number} returns this
 */
proto.speech.tts.lucid.Number.prototype.setFractionalPart = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Number} returns this
 */
proto.speech.tts.lucid.Number.prototype.clearFractionalPart = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Number.prototype.hasFractionalPart = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional int64 integer = 3;
 * @return {?number}
 */
proto.speech.tts.lucid.Number.prototype.getInteger = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 3));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.speech.tts.lucid.Number} returns this
 */
proto.speech.tts.lucid.Number.prototype.setInteger = function(value) {
  return jspb.Message.setOneofField(this, 3, proto.speech.tts.lucid.Number.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Number} returns this
 */
proto.speech.tts.lucid.Number.prototype.clearInteger = function() {
  return jspb.Message.clearOneofField(this, 3, proto.speech.tts.lucid.Number.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Number.prototype.hasInteger = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * optional double floating_point = 4;
 * @return {?number}
 */
proto.speech.tts.lucid.Number.prototype.getFloatingPoint = function() {
  return /** @type {?number} */ (jspb.Message.getOptionalFloatingPointField(this, 4));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.speech.tts.lucid.Number} returns this
 */
proto.speech.tts.lucid.Number.prototype.setFloatingPoint = function(value) {
  return jspb.Message.setOneofField(this, 4, proto.speech.tts.lucid.Number.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Number} returns this
 */
proto.speech.tts.lucid.Number.prototype.clearFloatingPoint = function() {
  return jspb.Message.clearOneofField(this, 4, proto.speech.tts.lucid.Number.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Number.prototype.hasFloatingPoint = function() {
  return jspb.Message.hasField(this, 4);
};


/**
 * optional int32 min_precision = 5;
 * @return {?number}
 */
proto.speech.tts.lucid.Number.prototype.getMinPrecision = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 5));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.speech.tts.lucid.Number} returns this
 */
proto.speech.tts.lucid.Number.prototype.setMinPrecision = function(value) {
  return jspb.Message.setField(this, 5, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Number} returns this
 */
proto.speech.tts.lucid.Number.prototype.clearMinPrecision = function() {
  return jspb.Message.clearField(this, 5);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Number.prototype.hasMinPrecision = function() {
  return jspb.Message.hasField(this, 5);
};


/**
 * optional int32 max_precision = 6;
 * @return {number}
 */
proto.speech.tts.lucid.Number.prototype.getMaxPrecision = function() {
  return jspb.Message.getIntegerFieldWithDefault(this, 6, 6);
};


/**
 * @param {?number|undefined} value
 * @return {!proto.speech.tts.lucid.Number} returns this
 */
proto.speech.tts.lucid.Number.prototype.setMaxPrecision = function(value) {
  return jspb.Message.setField(this, 6, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Number} returns this
 */
proto.speech.tts.lucid.Number.prototype.clearMaxPrecision = function() {
  return jspb.Message.clearField(this, 6);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Number.prototype.hasMaxPrecision = function() {
  return jspb.Message.hasField(this, 6);
};


/**
 * optional string exponent = 7;
 * @return {?string}
 */
proto.speech.tts.lucid.Number.prototype.getExponent = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 7));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.Number} returns this
 */
proto.speech.tts.lucid.Number.prototype.setExponent = function(value) {
  return jspb.Message.setField(this, 7, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Number} returns this
 */
proto.speech.tts.lucid.Number.prototype.clearExponent = function() {
  return jspb.Message.clearField(this, 7);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Number.prototype.hasExponent = function() {
  return jspb.Message.hasField(this, 7);
};


/**
 * optional string quantity = 8;
 * @return {?string}
 */
proto.speech.tts.lucid.Number.prototype.getQuantity = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 8));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.Number} returns this
 */
proto.speech.tts.lucid.Number.prototype.setQuantity = function(value) {
  return jspb.Message.setField(this, 8, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Number} returns this
 */
proto.speech.tts.lucid.Number.prototype.clearQuantity = function() {
  return jspb.Message.clearField(this, 8);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Number.prototype.hasQuantity = function() {
  return jspb.Message.hasField(this, 8);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.lucid.Number}
 */
proto.speech.tts.lucid.Number.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.lucid.Number, data);
};



//speech/tts/public/lucid/structured_token_proto_jspb/measure.jspb.js
// source: speech/tts/public/lucid/structured_token.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.lucid.Measure');
goog.provide('proto.speech.tts.lucid.Measure.Style');
goog.provide('proto.speech.tts.lucid.Measure.StyleCase');
goog.provide('proto.speech.tts.lucid.Measure.ValueCase');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.speech.tts.lucid.Fraction');
goog.require('proto.speech.tts.lucid.Number');
goog.requireType('jspb.ByteSource');
goog.requireType('proto.speech.tts.lucid.CommonVerbalizationStyles.Style');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.lucid.Measure = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, proto.speech.tts.lucid.Measure.oneofGroups_);
};
goog.inherits(proto.speech.tts.lucid.Measure, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.lucid.Measure.displayName = 'proto.speech.tts.lucid.Measure';
}

/**
 * Oneof group definitions for this message. Each group defines the field
 * numbers belonging to that group. When of these fields' value is set, all
 * other fields in the group are cleared. During deserialization, if multiple
 * fields are encountered for a group, only the last value seen will be kept.
 * @private {!Array<!Array<number>>}
 * @const
 */
proto.speech.tts.lucid.Measure.oneofGroups_ = [[1,2],[4,5,6]];

/**
 * @enum {number}
 */
proto.speech.tts.lucid.Measure.ValueCase = {
  VALUE_NOT_SET: 0,
  DECIMAL: 1,
  FRACTION: 2
};

/**
 * @return {!proto.speech.tts.lucid.Measure.ValueCase}
 */
proto.speech.tts.lucid.Measure.prototype.getValueCase = function() {
  return /** @type {!proto.speech.tts.lucid.Measure.ValueCase} */(jspb.Message.computeOneofCase(this, proto.speech.tts.lucid.Measure.oneofGroups_[0]));
};

/**
 * @enum {number}
 */
proto.speech.tts.lucid.Measure.StyleCase = {
  STYLE_NOT_SET: 0,
  COMMON_STYLE: 4,
  SPECIFIC_STYLE: 5,
  STYLE_ID: 6
};

/**
 * @return {!proto.speech.tts.lucid.Measure.StyleCase}
 */
proto.speech.tts.lucid.Measure.prototype.getStyleCase = function() {
  return /** @type {!proto.speech.tts.lucid.Measure.StyleCase} */(jspb.Message.computeOneofCase(this, proto.speech.tts.lucid.Measure.oneofGroups_[1]));
};



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.lucid.Measure.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.lucid.Measure.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.lucid.Measure} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.Measure.toObject = function(includeInstance, msg) {
  let f, obj = {
    decimal: (f = msg.getDecimal()) && proto.speech.tts.lucid.Number.toObject(includeInstance, f),
    fraction: (f = msg.getFraction()) && proto.speech.tts.lucid.Fraction.toObject(includeInstance, f),
    unit: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f,
    commonStyle: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f,
    specificStyle: (f = jspb.Message.getField(msg, 5)) == null ? undefined : f,
    styleId: (f = jspb.Message.getField(msg, 6)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of Measure as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.lucid.Measure.ObjectFormat = function() {
  /** @type {?proto.speech.tts.lucid.Number.ObjectFormat|undefined} */
  this.decimal;

  /** @type {?proto.speech.tts.lucid.Fraction.ObjectFormat|undefined} */
  this.fraction;

  /** @type {?string|undefined} */
  this.unit;

  /** @type {?number|undefined} */
  this.commonStyle;

  /** @type {?number|undefined} */
  this.specificStyle;

  /** @type {?number|undefined} */
  this.styleId;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.lucid.Measure.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.lucid.Measure}
 */
proto.speech.tts.lucid.Measure.fromObject = function(obj) {
  const msg = new proto.speech.tts.lucid.Measure();
  obj.decimal && jspb.Message.setOneofWrapperField(
      msg, 1, proto.speech.tts.lucid.Measure.oneofGroups_[0], proto.speech.tts.lucid.Number.fromObject(obj.decimal));
  obj.fraction && jspb.Message.setOneofWrapperField(
      msg, 2, proto.speech.tts.lucid.Measure.oneofGroups_[0], proto.speech.tts.lucid.Fraction.fromObject(obj.fraction));
  obj.unit != null && jspb.Message.setField(msg, 3, obj.unit);
  obj.commonStyle != null && jspb.Message.setOneofField(msg, 4, proto.speech.tts.lucid.Measure.oneofGroups_[1], obj.commonStyle);
  obj.specificStyle != null && jspb.Message.setOneofField(msg, 5, proto.speech.tts.lucid.Measure.oneofGroups_[1], obj.specificStyle);
  obj.styleId != null && jspb.Message.setOneofField(msg, 6, proto.speech.tts.lucid.Measure.oneofGroups_[1], obj.styleId);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.lucid.Measure}
 */
proto.speech.tts.lucid.Measure.deserializeBinary = function(bytes) {
  return proto.speech.tts.lucid.Measure.deserializeBinaryFromReader(
      new proto.speech.tts.lucid.Measure(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.lucid.Measure} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.lucid.Measure}
 */
proto.speech.tts.lucid.Measure.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = new proto.speech.tts.lucid.Number();
      reader.readMessage(value,proto.speech.tts.lucid.Number.deserializeBinaryFromReader);
      msg.setDecimal(value);
      break;
    case 2:
      value = new proto.speech.tts.lucid.Fraction();
      reader.readMessage(value,proto.speech.tts.lucid.Fraction.deserializeBinaryFromReader);
      msg.setFraction(value);
      break;
    case 3:
      value = /** @type {string} */ (reader.readString());
      msg.setUnit(value);
      break;
    case 4:
      value = /** @type {!proto.speech.tts.lucid.CommonVerbalizationStyles.Style} */ (reader.readEnum());
      msg.setCommonStyle(value);
      break;
    case 5:
      value = /** @type {!proto.speech.tts.lucid.Measure.Style} */ (reader.readEnum());
      msg.setSpecificStyle(value);
      break;
    case 6:
      value = /** @type {number} */ (reader.readInt32());
      msg.setStyleId(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.lucid.Measure.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.lucid.Measure.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.lucid.Measure} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.Measure.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = message.getDecimal();
  if (f != null) {
    writer.writeMessage(
      1,
      f,
      proto.speech.tts.lucid.Number.serializeBinaryToWriter
    );
  }
  f = message.getFraction();
  if (f != null) {
    writer.writeMessage(
      2,
      f,
      proto.speech.tts.lucid.Fraction.serializeBinaryToWriter
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeString(
      3,
      f
    );
  }
  f = /** @type {!proto.speech.tts.lucid.CommonVerbalizationStyles.Style} */ (jspb.Message.getField(message, 4));
  if (f != null) {
    writer.writeEnum(
      4,
      f
    );
  }
  f = /** @type {!proto.speech.tts.lucid.Measure.Style} */ (jspb.Message.getField(message, 5));
  if (f != null) {
    writer.writeEnum(
      5,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 6));
  if (f != null) {
    writer.writeInt32(
      6,
      f
    );
  }
};


/**
 * @enum {number}
 */
proto.speech.tts.lucid.Measure.Style = {
  UNSPECIFIED_STYLE: 0
};

/**
 * optional Number decimal = 1;
 * @return {?proto.speech.tts.lucid.Number}
 */
proto.speech.tts.lucid.Measure.prototype.getDecimal = function() {
  return /** @type{?proto.speech.tts.lucid.Number} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.lucid.Number, 1));
};


/**
 * @param {?proto.speech.tts.lucid.Number|undefined} value
 * @return {!proto.speech.tts.lucid.Measure} returns this
*/
proto.speech.tts.lucid.Measure.prototype.setDecimal = function(value) {
  return jspb.Message.setOneofWrapperField(this, 1, proto.speech.tts.lucid.Measure.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Measure} returns this
 */
proto.speech.tts.lucid.Measure.prototype.clearDecimal = function() {
  return jspb.Message.clearOneofWrapperField(this, 1, proto.speech.tts.lucid.Measure.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Measure.prototype.hasDecimal = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional Fraction fraction = 2;
 * @return {?proto.speech.tts.lucid.Fraction}
 */
proto.speech.tts.lucid.Measure.prototype.getFraction = function() {
  return /** @type{?proto.speech.tts.lucid.Fraction} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.lucid.Fraction, 2));
};


/**
 * @param {?proto.speech.tts.lucid.Fraction|undefined} value
 * @return {!proto.speech.tts.lucid.Measure} returns this
*/
proto.speech.tts.lucid.Measure.prototype.setFraction = function(value) {
  return jspb.Message.setOneofWrapperField(this, 2, proto.speech.tts.lucid.Measure.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Measure} returns this
 */
proto.speech.tts.lucid.Measure.prototype.clearFraction = function() {
  return jspb.Message.clearOneofWrapperField(this, 2, proto.speech.tts.lucid.Measure.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Measure.prototype.hasFraction = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional string unit = 3;
 * @return {?string}
 */
proto.speech.tts.lucid.Measure.prototype.getUnit = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 3));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.Measure} returns this
 */
proto.speech.tts.lucid.Measure.prototype.setUnit = function(value) {
  return jspb.Message.setField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Measure} returns this
 */
proto.speech.tts.lucid.Measure.prototype.clearUnit = function() {
  return jspb.Message.clearField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Measure.prototype.hasUnit = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * optional CommonVerbalizationStyles.Style common_style = 4;
 * @return {!proto.speech.tts.lucid.CommonVerbalizationStyles.Style}
 */
proto.speech.tts.lucid.Measure.prototype.getCommonStyle = function() {
  return /** @type {!proto.speech.tts.lucid.CommonVerbalizationStyles.Style} */ (jspb.Message.getField(this, 4));
};


/**
 * @param {?proto.speech.tts.lucid.CommonVerbalizationStyles.Style|undefined} value
 * @return {!proto.speech.tts.lucid.Measure} returns this
 */
proto.speech.tts.lucid.Measure.prototype.setCommonStyle = function(value) {
  return jspb.Message.setOneofField(this, 4, proto.speech.tts.lucid.Measure.oneofGroups_[1], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Measure} returns this
 */
proto.speech.tts.lucid.Measure.prototype.clearCommonStyle = function() {
  return jspb.Message.clearOneofField(this, 4, proto.speech.tts.lucid.Measure.oneofGroups_[1]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Measure.prototype.hasCommonStyle = function() {
  return jspb.Message.hasField(this, 4);
};


/**
 * optional Style specific_style = 5;
 * @return {!proto.speech.tts.lucid.Measure.Style}
 */
proto.speech.tts.lucid.Measure.prototype.getSpecificStyle = function() {
  return /** @type {!proto.speech.tts.lucid.Measure.Style} */ (jspb.Message.getField(this, 5));
};


/**
 * @param {?proto.speech.tts.lucid.Measure.Style|undefined} value
 * @return {!proto.speech.tts.lucid.Measure} returns this
 */
proto.speech.tts.lucid.Measure.prototype.setSpecificStyle = function(value) {
  return jspb.Message.setOneofField(this, 5, proto.speech.tts.lucid.Measure.oneofGroups_[1], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Measure} returns this
 */
proto.speech.tts.lucid.Measure.prototype.clearSpecificStyle = function() {
  return jspb.Message.clearOneofField(this, 5, proto.speech.tts.lucid.Measure.oneofGroups_[1]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Measure.prototype.hasSpecificStyle = function() {
  return jspb.Message.hasField(this, 5);
};


/**
 * optional int32 style_id = 6;
 * @return {?number}
 */
proto.speech.tts.lucid.Measure.prototype.getStyleId = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 6));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.speech.tts.lucid.Measure} returns this
 */
proto.speech.tts.lucid.Measure.prototype.setStyleId = function(value) {
  return jspb.Message.setOneofField(this, 6, proto.speech.tts.lucid.Measure.oneofGroups_[1], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Measure} returns this
 */
proto.speech.tts.lucid.Measure.prototype.clearStyleId = function() {
  return jspb.Message.clearOneofField(this, 6, proto.speech.tts.lucid.Measure.oneofGroups_[1]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Measure.prototype.hasStyleId = function() {
  return jspb.Message.hasField(this, 6);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.lucid.Measure}
 */
proto.speech.tts.lucid.Measure.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.lucid.Measure, data);
};



//speech/tts/public/lucid/structured_token_proto_jspb/money.jspb.js
// source: speech/tts/public/lucid/structured_token.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.lucid.Money');
goog.provide('proto.speech.tts.lucid.Money.Style');
goog.provide('proto.speech.tts.lucid.Money.StyleCase');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.speech.tts.lucid.Number');
goog.requireType('jspb.ByteSource');
goog.requireType('proto.speech.tts.lucid.CommonVerbalizationStyles.Style');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.lucid.Money = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, proto.speech.tts.lucid.Money.oneofGroups_);
};
goog.inherits(proto.speech.tts.lucid.Money, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.lucid.Money.displayName = 'proto.speech.tts.lucid.Money';
}

/**
 * Oneof group definitions for this message. Each group defines the field
 * numbers belonging to that group. When of these fields' value is set, all
 * other fields in the group are cleared. During deserialization, if multiple
 * fields are encountered for a group, only the last value seen will be kept.
 * @private {!Array<!Array<number>>}
 * @const
 */
proto.speech.tts.lucid.Money.oneofGroups_ = [[4,5,6]];

/**
 * @enum {number}
 */
proto.speech.tts.lucid.Money.StyleCase = {
  STYLE_NOT_SET: 0,
  COMMON_STYLE: 4,
  SPECIFIC_STYLE: 5,
  STYLE_ID: 6
};

/**
 * @return {!proto.speech.tts.lucid.Money.StyleCase}
 */
proto.speech.tts.lucid.Money.prototype.getStyleCase = function() {
  return /** @type {!proto.speech.tts.lucid.Money.StyleCase} */(jspb.Message.computeOneofCase(this, proto.speech.tts.lucid.Money.oneofGroups_[0]));
};



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.lucid.Money.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.lucid.Money.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.lucid.Money} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.Money.toObject = function(includeInstance, msg) {
  let f, obj = {
    amount: (f = msg.getAmount()) && proto.speech.tts.lucid.Number.toObject(includeInstance, f),
    currency: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f,
    commonStyle: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f,
    specificStyle: (f = jspb.Message.getField(msg, 5)) == null ? undefined : f,
    styleId: (f = jspb.Message.getField(msg, 6)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of Money as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.lucid.Money.ObjectFormat = function() {
  /** @type {?proto.speech.tts.lucid.Number.ObjectFormat|undefined} */
  this.amount;

  /** @type {?string|undefined} */
  this.currency;

  /** @type {?number|undefined} */
  this.commonStyle;

  /** @type {?number|undefined} */
  this.specificStyle;

  /** @type {?number|undefined} */
  this.styleId;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.lucid.Money.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.lucid.Money}
 */
proto.speech.tts.lucid.Money.fromObject = function(obj) {
  const msg = new proto.speech.tts.lucid.Money();
  obj.amount && jspb.Message.setWrapperField(
      msg, 1, proto.speech.tts.lucid.Number.fromObject(obj.amount));
  obj.currency != null && jspb.Message.setField(msg, 2, obj.currency);
  obj.commonStyle != null && jspb.Message.setOneofField(msg, 4, proto.speech.tts.lucid.Money.oneofGroups_[0], obj.commonStyle);
  obj.specificStyle != null && jspb.Message.setOneofField(msg, 5, proto.speech.tts.lucid.Money.oneofGroups_[0], obj.specificStyle);
  obj.styleId != null && jspb.Message.setOneofField(msg, 6, proto.speech.tts.lucid.Money.oneofGroups_[0], obj.styleId);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.lucid.Money}
 */
proto.speech.tts.lucid.Money.deserializeBinary = function(bytes) {
  return proto.speech.tts.lucid.Money.deserializeBinaryFromReader(
      new proto.speech.tts.lucid.Money(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.lucid.Money} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.lucid.Money}
 */
proto.speech.tts.lucid.Money.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = new proto.speech.tts.lucid.Number();
      reader.readMessage(value,proto.speech.tts.lucid.Number.deserializeBinaryFromReader);
      msg.setAmount(value);
      break;
    case 2:
      value = /** @type {string} */ (reader.readString());
      msg.setCurrency(value);
      break;
    case 4:
      value = /** @type {!proto.speech.tts.lucid.CommonVerbalizationStyles.Style} */ (reader.readEnum());
      msg.setCommonStyle(value);
      break;
    case 5:
      value = /** @type {!proto.speech.tts.lucid.Money.Style} */ (reader.readEnum());
      msg.setSpecificStyle(value);
      break;
    case 6:
      value = /** @type {number} */ (reader.readInt32());
      msg.setStyleId(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.lucid.Money.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.lucid.Money.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.lucid.Money} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.Money.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = message.getAmount();
  if (f != null) {
    writer.writeMessage(
      1,
      f,
      proto.speech.tts.lucid.Number.serializeBinaryToWriter
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeString(
      2,
      f
    );
  }
  f = /** @type {!proto.speech.tts.lucid.CommonVerbalizationStyles.Style} */ (jspb.Message.getField(message, 4));
  if (f != null) {
    writer.writeEnum(
      4,
      f
    );
  }
  f = /** @type {!proto.speech.tts.lucid.Money.Style} */ (jspb.Message.getField(message, 5));
  if (f != null) {
    writer.writeEnum(
      5,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 6));
  if (f != null) {
    writer.writeInt32(
      6,
      f
    );
  }
};


/**
 * @enum {number}
 */
proto.speech.tts.lucid.Money.Style = {
  UNSPECIFIED_STYLE: 0,
  SAY_FULL_UNAMBIGUOUS_CURRENCY: 1,
  SAY_MAJOR_AND_MINOR_CURRENCY: 2,
  OMIT_MINOR_CURRENCY: 3,
  OMIT_CURRENCY: 4
};

/**
 * optional Number amount = 1;
 * @return {?proto.speech.tts.lucid.Number}
 */
proto.speech.tts.lucid.Money.prototype.getAmount = function() {
  return /** @type{?proto.speech.tts.lucid.Number} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.lucid.Number, 1));
};


/**
 * @param {?proto.speech.tts.lucid.Number|undefined} value
 * @return {!proto.speech.tts.lucid.Money} returns this
*/
proto.speech.tts.lucid.Money.prototype.setAmount = function(value) {
  return jspb.Message.setWrapperField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Money} returns this
 */
proto.speech.tts.lucid.Money.prototype.clearAmount = function() {
  return jspb.Message.clearWrapperField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Money.prototype.hasAmount = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional string currency = 2;
 * @return {?string}
 */
proto.speech.tts.lucid.Money.prototype.getCurrency = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 2));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.Money} returns this
 */
proto.speech.tts.lucid.Money.prototype.setCurrency = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Money} returns this
 */
proto.speech.tts.lucid.Money.prototype.clearCurrency = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Money.prototype.hasCurrency = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional CommonVerbalizationStyles.Style common_style = 4;
 * @return {!proto.speech.tts.lucid.CommonVerbalizationStyles.Style}
 */
proto.speech.tts.lucid.Money.prototype.getCommonStyle = function() {
  return /** @type {!proto.speech.tts.lucid.CommonVerbalizationStyles.Style} */ (jspb.Message.getField(this, 4));
};


/**
 * @param {?proto.speech.tts.lucid.CommonVerbalizationStyles.Style|undefined} value
 * @return {!proto.speech.tts.lucid.Money} returns this
 */
proto.speech.tts.lucid.Money.prototype.setCommonStyle = function(value) {
  return jspb.Message.setOneofField(this, 4, proto.speech.tts.lucid.Money.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Money} returns this
 */
proto.speech.tts.lucid.Money.prototype.clearCommonStyle = function() {
  return jspb.Message.clearOneofField(this, 4, proto.speech.tts.lucid.Money.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Money.prototype.hasCommonStyle = function() {
  return jspb.Message.hasField(this, 4);
};


/**
 * optional Style specific_style = 5;
 * @return {!proto.speech.tts.lucid.Money.Style}
 */
proto.speech.tts.lucid.Money.prototype.getSpecificStyle = function() {
  return /** @type {!proto.speech.tts.lucid.Money.Style} */ (jspb.Message.getField(this, 5));
};


/**
 * @param {?proto.speech.tts.lucid.Money.Style|undefined} value
 * @return {!proto.speech.tts.lucid.Money} returns this
 */
proto.speech.tts.lucid.Money.prototype.setSpecificStyle = function(value) {
  return jspb.Message.setOneofField(this, 5, proto.speech.tts.lucid.Money.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Money} returns this
 */
proto.speech.tts.lucid.Money.prototype.clearSpecificStyle = function() {
  return jspb.Message.clearOneofField(this, 5, proto.speech.tts.lucid.Money.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Money.prototype.hasSpecificStyle = function() {
  return jspb.Message.hasField(this, 5);
};


/**
 * optional int32 style_id = 6;
 * @return {?number}
 */
proto.speech.tts.lucid.Money.prototype.getStyleId = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 6));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.speech.tts.lucid.Money} returns this
 */
proto.speech.tts.lucid.Money.prototype.setStyleId = function(value) {
  return jspb.Message.setOneofField(this, 6, proto.speech.tts.lucid.Money.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Money} returns this
 */
proto.speech.tts.lucid.Money.prototype.clearStyleId = function() {
  return jspb.Message.clearOneofField(this, 6, proto.speech.tts.lucid.Money.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Money.prototype.hasStyleId = function() {
  return jspb.Message.hasField(this, 6);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.lucid.Money}
 */
proto.speech.tts.lucid.Money.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.lucid.Money, data);
};



//speech/tts/public/lucid/structured_token_proto_jspb/ordinal.jspb.js
// source: speech/tts/public/lucid/structured_token.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.lucid.Ordinal');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.lucid.Ordinal = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.speech.tts.lucid.Ordinal, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.lucid.Ordinal.displayName = 'proto.speech.tts.lucid.Ordinal';
}



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.lucid.Ordinal.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.lucid.Ordinal.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.lucid.Ordinal} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.Ordinal.toObject = function(includeInstance, msg) {
  let f, obj = {
    integer: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of Ordinal as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.lucid.Ordinal.ObjectFormat = function() {
  /** @type {?string|undefined} */
  this.integer;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.lucid.Ordinal.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.lucid.Ordinal}
 */
proto.speech.tts.lucid.Ordinal.fromObject = function(obj) {
  const msg = new proto.speech.tts.lucid.Ordinal();
  obj.integer != null && jspb.Message.setField(msg, 2, obj.integer);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.lucid.Ordinal}
 */
proto.speech.tts.lucid.Ordinal.deserializeBinary = function(bytes) {
  return proto.speech.tts.lucid.Ordinal.deserializeBinaryFromReader(
      new proto.speech.tts.lucid.Ordinal(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.lucid.Ordinal} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.lucid.Ordinal}
 */
proto.speech.tts.lucid.Ordinal.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 2:
      value = /** @type {string} */ (reader.readString());
      msg.setInteger(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.lucid.Ordinal.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.lucid.Ordinal.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.lucid.Ordinal} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.Ordinal.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {?string} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeString(
      2,
      f
    );
  }
};


/**
 * optional string integer = 2;
 * @return {?string}
 */
proto.speech.tts.lucid.Ordinal.prototype.getInteger = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 2));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.Ordinal} returns this
 */
proto.speech.tts.lucid.Ordinal.prototype.setInteger = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Ordinal} returns this
 */
proto.speech.tts.lucid.Ordinal.prototype.clearInteger = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Ordinal.prototype.hasInteger = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.lucid.Ordinal}
 */
proto.speech.tts.lucid.Ordinal.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.lucid.Ordinal, data);
};



//speech/tts/public/lucid/structured_token_proto_jspb/punctuationorpause.jspb.js
// source: speech/tts/public/lucid/structured_token.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.lucid.PunctuationOrPause');
goog.provide('proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak');
goog.provide('proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak.BreakStrength');
goog.provide('proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak.BreakType');
goog.provide('proto.speech.tts.lucid.PunctuationOrPause.PunctuationStyle');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.lucid.PunctuationOrPause = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.speech.tts.lucid.PunctuationOrPause, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.lucid.PunctuationOrPause.displayName = 'proto.speech.tts.lucid.PunctuationOrPause';
}
/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak.displayName = 'proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak';
}



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.lucid.PunctuationOrPause.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.lucid.PunctuationOrPause.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.lucid.PunctuationOrPause} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.PunctuationOrPause.toObject = function(includeInstance, msg) {
  let f, obj = {
    text: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    punctuationStyle: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f,
    phraseBreak: (f = msg.getPhraseBreak()) && proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak.toObject(includeInstance, f)
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of PunctuationOrPause as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.lucid.PunctuationOrPause.ObjectFormat = function() {
  /** @type {?string|undefined} */
  this.text;

  /** @type {?number|undefined} */
  this.punctuationStyle;

  /** @type {?proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak.ObjectFormat|undefined} */
  this.phraseBreak;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.lucid.PunctuationOrPause.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.lucid.PunctuationOrPause}
 */
proto.speech.tts.lucid.PunctuationOrPause.fromObject = function(obj) {
  const msg = new proto.speech.tts.lucid.PunctuationOrPause();
  obj.text != null && jspb.Message.setField(msg, 1, obj.text);
  obj.punctuationStyle != null && jspb.Message.setField(msg, 2, obj.punctuationStyle);
  obj.phraseBreak && jspb.Message.setWrapperField(
      msg, 3, proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak.fromObject(obj.phraseBreak));
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.lucid.PunctuationOrPause}
 */
proto.speech.tts.lucid.PunctuationOrPause.deserializeBinary = function(bytes) {
  return proto.speech.tts.lucid.PunctuationOrPause.deserializeBinaryFromReader(
      new proto.speech.tts.lucid.PunctuationOrPause(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.lucid.PunctuationOrPause} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.lucid.PunctuationOrPause}
 */
proto.speech.tts.lucid.PunctuationOrPause.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {string} */ (reader.readString());
      msg.setText(value);
      break;
    case 2:
      value = /** @type {!proto.speech.tts.lucid.PunctuationOrPause.PunctuationStyle} */ (reader.readEnum());
      msg.setPunctuationStyle(value);
      break;
    case 3:
      value = new proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak();
      reader.readMessage(value,proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak.deserializeBinaryFromReader);
      msg.setPhraseBreak(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.lucid.PunctuationOrPause.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.lucid.PunctuationOrPause.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.lucid.PunctuationOrPause} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.PunctuationOrPause.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {?string} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeString(
      1,
      f
    );
  }
  f = /** @type {!proto.speech.tts.lucid.PunctuationOrPause.PunctuationStyle} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeEnum(
      2,
      f
    );
  }
  f = message.getPhraseBreak();
  if (f != null) {
    writer.writeMessage(
      3,
      f,
      proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak.serializeBinaryToWriter
    );
  }
};


/**
 * @enum {number}
 */
proto.speech.tts.lucid.PunctuationOrPause.PunctuationStyle = {
  UNSPECIFIED_STYLE: 0,
  SILENT: 1,
  SPOKEN: 2
};




if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak.toObject = function(includeInstance, msg) {
  let f, obj = {
    strength: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    durationSeconds: (f = jspb.Message.getOptionalFloatingPointField(msg, 2)) == null ? undefined : f,
    type: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of PhraseBreak as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak.ObjectFormat = function() {
  /** @type {?number|undefined} */
  this.strength;

  /** @type {?number|undefined} */
  this.durationSeconds;

  /** @type {?number|undefined} */
  this.type;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak}
 */
proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak.fromObject = function(obj) {
  const msg = new proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak();
  obj.strength != null && jspb.Message.setField(msg, 1, obj.strength);
  obj.durationSeconds != null && jspb.Message.setField(msg, 2, obj.durationSeconds);
  obj.type != null && jspb.Message.setField(msg, 3, obj.type);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak}
 */
proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak.deserializeBinary = function(bytes) {
  return proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak.deserializeBinaryFromReader(
      new proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak}
 */
proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {!proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak.BreakStrength} */ (reader.readEnum());
      msg.setStrength(value);
      break;
    case 2:
      value = /** @type {number} */ (reader.readFloat());
      msg.setDurationSeconds(value);
      break;
    case 3:
      value = /** @type {!proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak.BreakType} */ (reader.readEnum());
      msg.setType(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {!proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak.BreakStrength} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeEnum(
      1,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeFloat(
      2,
      f
    );
  }
  f = /** @type {!proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak.BreakType} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeEnum(
      3,
      f
    );
  }
};


/**
 * @enum {number}
 */
proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak.BreakStrength = {
  UNSPECIFIED_BREAK_STRENGTH: 0,
  NO_BREAK: 1,
  MILD_BREAK: 2,
  MODERATE_BREAK: 3,
  STRONG_BREAK: 4,
  EXTRA_STRONG_BREAK: 5,
  PARAGRAPH_BREAK: 6
};

/**
 * @enum {number}
 */
proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak.BreakType = {
  UNSPECIFIED_BREAK_TYPE: 0,
  TONALITY_ONLY: 1,
  DURATION_ONLY: 2,
  DURATION_AND_TONALITY: 3
};

/**
 * optional BreakStrength strength = 1;
 * @return {!proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak.BreakStrength}
 */
proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak.prototype.getStrength = function() {
  return /** @type {!proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak.BreakStrength} */ (jspb.Message.getField(this, 1));
};


/**
 * @param {?proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak.BreakStrength|undefined} value
 * @return {!proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak} returns this
 */
proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak.prototype.setStrength = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak} returns this
 */
proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak.prototype.clearStrength = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak.prototype.hasStrength = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional float duration_seconds = 2;
 * @return {?number}
 */
proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak.prototype.getDurationSeconds = function() {
  return /** @type {?number} */ (jspb.Message.getOptionalFloatingPointField(this, 2));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak} returns this
 */
proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak.prototype.setDurationSeconds = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak} returns this
 */
proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak.prototype.clearDurationSeconds = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak.prototype.hasDurationSeconds = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional BreakType type = 3;
 * @return {!proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak.BreakType}
 */
proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak.prototype.getType = function() {
  return /** @type {!proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak.BreakType} */ (jspb.Message.getField(this, 3));
};


/**
 * @param {?proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak.BreakType|undefined} value
 * @return {!proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak} returns this
 */
proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak.prototype.setType = function(value) {
  return jspb.Message.setField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak} returns this
 */
proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak.prototype.clearType = function() {
  return jspb.Message.clearField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak.prototype.hasType = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak}
 */
proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak, data);
};


/**
 * optional string text = 1;
 * @return {?string}
 */
proto.speech.tts.lucid.PunctuationOrPause.prototype.getText = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 1));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.PunctuationOrPause} returns this
 */
proto.speech.tts.lucid.PunctuationOrPause.prototype.setText = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.PunctuationOrPause} returns this
 */
proto.speech.tts.lucid.PunctuationOrPause.prototype.clearText = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.PunctuationOrPause.prototype.hasText = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional PunctuationStyle punctuation_style = 2;
 * @return {!proto.speech.tts.lucid.PunctuationOrPause.PunctuationStyle}
 */
proto.speech.tts.lucid.PunctuationOrPause.prototype.getPunctuationStyle = function() {
  return /** @type {!proto.speech.tts.lucid.PunctuationOrPause.PunctuationStyle} */ (jspb.Message.getField(this, 2));
};


/**
 * @param {?proto.speech.tts.lucid.PunctuationOrPause.PunctuationStyle|undefined} value
 * @return {!proto.speech.tts.lucid.PunctuationOrPause} returns this
 */
proto.speech.tts.lucid.PunctuationOrPause.prototype.setPunctuationStyle = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.PunctuationOrPause} returns this
 */
proto.speech.tts.lucid.PunctuationOrPause.prototype.clearPunctuationStyle = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.PunctuationOrPause.prototype.hasPunctuationStyle = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional PhraseBreak phrase_break = 3;
 * @return {?proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak}
 */
proto.speech.tts.lucid.PunctuationOrPause.prototype.getPhraseBreak = function() {
  return /** @type{?proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak, 3));
};


/**
 * @param {?proto.speech.tts.lucid.PunctuationOrPause.PhraseBreak|undefined} value
 * @return {!proto.speech.tts.lucid.PunctuationOrPause} returns this
*/
proto.speech.tts.lucid.PunctuationOrPause.prototype.setPhraseBreak = function(value) {
  return jspb.Message.setWrapperField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.PunctuationOrPause} returns this
 */
proto.speech.tts.lucid.PunctuationOrPause.prototype.clearPhraseBreak = function() {
  return jspb.Message.clearWrapperField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.PunctuationOrPause.prototype.hasPhraseBreak = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.lucid.PunctuationOrPause}
 */
proto.speech.tts.lucid.PunctuationOrPause.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.lucid.PunctuationOrPause, data);
};



//speech/tts/public/lucid/structured_token_proto_jspb/romannumeral.jspb.js
// source: speech/tts/public/lucid/structured_token.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.lucid.RomanNumeral');
goog.provide('proto.speech.tts.lucid.RomanNumeral.Style');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.lucid.RomanNumeral = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.speech.tts.lucid.RomanNumeral, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.lucid.RomanNumeral.displayName = 'proto.speech.tts.lucid.RomanNumeral';
}



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.lucid.RomanNumeral.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.lucid.RomanNumeral.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.lucid.RomanNumeral} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.RomanNumeral.toObject = function(includeInstance, msg) {
  let f, obj = {
    text: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    style: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of RomanNumeral as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.lucid.RomanNumeral.ObjectFormat = function() {
  /** @type {?string|undefined} */
  this.text;

  /** @type {?number|undefined} */
  this.style;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.lucid.RomanNumeral.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.lucid.RomanNumeral}
 */
proto.speech.tts.lucid.RomanNumeral.fromObject = function(obj) {
  const msg = new proto.speech.tts.lucid.RomanNumeral();
  obj.text != null && jspb.Message.setField(msg, 1, obj.text);
  obj.style != null && jspb.Message.setField(msg, 2, obj.style);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.lucid.RomanNumeral}
 */
proto.speech.tts.lucid.RomanNumeral.deserializeBinary = function(bytes) {
  return proto.speech.tts.lucid.RomanNumeral.deserializeBinaryFromReader(
      new proto.speech.tts.lucid.RomanNumeral(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.lucid.RomanNumeral} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.lucid.RomanNumeral}
 */
proto.speech.tts.lucid.RomanNumeral.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {string} */ (reader.readString());
      msg.setText(value);
      break;
    case 2:
      value = /** @type {!proto.speech.tts.lucid.RomanNumeral.Style} */ (reader.readEnum());
      msg.setStyle(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.lucid.RomanNumeral.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.lucid.RomanNumeral.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.lucid.RomanNumeral} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.RomanNumeral.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {?string} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeString(
      1,
      f
    );
  }
  f = /** @type {!proto.speech.tts.lucid.RomanNumeral.Style} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeEnum(
      2,
      f
    );
  }
};


/**
 * @enum {number}
 */
proto.speech.tts.lucid.RomanNumeral.Style = {
  UNSPECIFIED_STYLE: 0,
  AS_CARDINAL: 1,
  AS_ORDINAL: 2,
  AS_DEFINITE_ORDINAL: 3
};

/**
 * optional string text = 1;
 * @return {?string}
 */
proto.speech.tts.lucid.RomanNumeral.prototype.getText = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 1));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.RomanNumeral} returns this
 */
proto.speech.tts.lucid.RomanNumeral.prototype.setText = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.RomanNumeral} returns this
 */
proto.speech.tts.lucid.RomanNumeral.prototype.clearText = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.RomanNumeral.prototype.hasText = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional Style style = 2;
 * @return {!proto.speech.tts.lucid.RomanNumeral.Style}
 */
proto.speech.tts.lucid.RomanNumeral.prototype.getStyle = function() {
  return /** @type {!proto.speech.tts.lucid.RomanNumeral.Style} */ (jspb.Message.getField(this, 2));
};


/**
 * @param {?proto.speech.tts.lucid.RomanNumeral.Style|undefined} value
 * @return {!proto.speech.tts.lucid.RomanNumeral} returns this
 */
proto.speech.tts.lucid.RomanNumeral.prototype.setStyle = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.RomanNumeral} returns this
 */
proto.speech.tts.lucid.RomanNumeral.prototype.clearStyle = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.RomanNumeral.prototype.hasStyle = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.lucid.RomanNumeral}
 */
proto.speech.tts.lucid.RomanNumeral.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.lucid.RomanNumeral, data);
};



//speech/tts/public/lucid/structured_token_proto_jspb/spelling.jspb.js
// source: speech/tts/public/lucid/structured_token.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.lucid.Spelling');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.lucid.Spelling = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.speech.tts.lucid.Spelling, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.lucid.Spelling.displayName = 'proto.speech.tts.lucid.Spelling';
}



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.lucid.Spelling.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.lucid.Spelling.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.lucid.Spelling} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.Spelling.toObject = function(includeInstance, msg) {
  let f, obj = {
    graphemes: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    chunkSize: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of Spelling as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.lucid.Spelling.ObjectFormat = function() {
  /** @type {?string|undefined} */
  this.graphemes;

  /** @type {?number|undefined} */
  this.chunkSize;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.lucid.Spelling.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.lucid.Spelling}
 */
proto.speech.tts.lucid.Spelling.fromObject = function(obj) {
  const msg = new proto.speech.tts.lucid.Spelling();
  obj.graphemes != null && jspb.Message.setField(msg, 1, obj.graphemes);
  obj.chunkSize != null && jspb.Message.setField(msg, 2, obj.chunkSize);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.lucid.Spelling}
 */
proto.speech.tts.lucid.Spelling.deserializeBinary = function(bytes) {
  return proto.speech.tts.lucid.Spelling.deserializeBinaryFromReader(
      new proto.speech.tts.lucid.Spelling(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.lucid.Spelling} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.lucid.Spelling}
 */
proto.speech.tts.lucid.Spelling.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {string} */ (reader.readString());
      msg.setGraphemes(value);
      break;
    case 2:
      value = /** @type {number} */ (reader.readInt32());
      msg.setChunkSize(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.lucid.Spelling.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.lucid.Spelling.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.lucid.Spelling} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.Spelling.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {?string} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeString(
      1,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeInt32(
      2,
      f
    );
  }
};


/**
 * optional string graphemes = 1;
 * @return {?string}
 */
proto.speech.tts.lucid.Spelling.prototype.getGraphemes = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 1));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.Spelling} returns this
 */
proto.speech.tts.lucid.Spelling.prototype.setGraphemes = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Spelling} returns this
 */
proto.speech.tts.lucid.Spelling.prototype.clearGraphemes = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Spelling.prototype.hasGraphemes = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional int32 chunk_size = 2;
 * @return {?number}
 */
proto.speech.tts.lucid.Spelling.prototype.getChunkSize = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 2));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.speech.tts.lucid.Spelling} returns this
 */
proto.speech.tts.lucid.Spelling.prototype.setChunkSize = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Spelling} returns this
 */
proto.speech.tts.lucid.Spelling.prototype.clearChunkSize = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Spelling.prototype.hasChunkSize = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.lucid.Spelling}
 */
proto.speech.tts.lucid.Spelling.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.lucid.Spelling, data);
};



//speech/tts/public/lucid/structured_token_proto_jspb/telephone.jspb.js
// source: speech/tts/public/lucid/structured_token.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.lucid.Telephone');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.lucid.Telephone = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, proto.speech.tts.lucid.Telephone.repeatedFields_, null);
};
goog.inherits(proto.speech.tts.lucid.Telephone, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.lucid.Telephone.displayName = 'proto.speech.tts.lucid.Telephone';
}

/**
 * List of repeated fields within this message type.
 * @private {!Array<number>}
 * @const
 */
proto.speech.tts.lucid.Telephone.repeatedFields_ = [2];



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.lucid.Telephone.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.lucid.Telephone.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.lucid.Telephone} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.Telephone.toObject = function(includeInstance, msg) {
  let f, obj = {
    countryCode: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    numberPartsList: (f = jspb.Message.getRepeatedField(msg, 2)) == null ? undefined : f,
    extension: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of Telephone as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.lucid.Telephone.ObjectFormat = function() {
  /** @type {?string|undefined} */
  this.countryCode;

  /** @type {?Array<string>|undefined} */
  this.numberPartsList;

  /** @type {?string|undefined} */
  this.extension;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.lucid.Telephone.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.lucid.Telephone}
 */
proto.speech.tts.lucid.Telephone.fromObject = function(obj) {
  const msg = new proto.speech.tts.lucid.Telephone();
  obj.countryCode != null && jspb.Message.setField(msg, 1, obj.countryCode);
  obj.numberPartsList != null && jspb.Message.setField(msg, 2, obj.numberPartsList);
  obj.extension != null && jspb.Message.setField(msg, 3, obj.extension);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.lucid.Telephone}
 */
proto.speech.tts.lucid.Telephone.deserializeBinary = function(bytes) {
  return proto.speech.tts.lucid.Telephone.deserializeBinaryFromReader(
      new proto.speech.tts.lucid.Telephone(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.lucid.Telephone} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.lucid.Telephone}
 */
proto.speech.tts.lucid.Telephone.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {string} */ (reader.readString());
      msg.setCountryCode(value);
      break;
    case 2:
      value = /** @type {string} */ (reader.readString());
      msg.addNumberParts(value);
      break;
    case 3:
      value = /** @type {string} */ (reader.readString());
      msg.setExtension$(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.lucid.Telephone.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.lucid.Telephone.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.lucid.Telephone} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.Telephone.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {?string} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeString(
      1,
      f
    );
  }
  f = message.getNumberPartsList();
  if (f.length > 0) {
    writer.writeRepeatedString(
      2,
      f
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeString(
      3,
      f
    );
  }
};


/**
 * optional string country_code = 1;
 * @return {?string}
 */
proto.speech.tts.lucid.Telephone.prototype.getCountryCode = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 1));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.Telephone} returns this
 */
proto.speech.tts.lucid.Telephone.prototype.setCountryCode = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Telephone} returns this
 */
proto.speech.tts.lucid.Telephone.prototype.clearCountryCode = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Telephone.prototype.hasCountryCode = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * repeated string number_parts = 2;
 * @return {!Array<string>}
 */
proto.speech.tts.lucid.Telephone.prototype.getNumberPartsList = function() {
  return /** @type {!Array<string>} */ (jspb.Message.getRepeatedField(this, 2));
};


/**
 * @param {Array<string>|undefined} value
 * @return {!proto.speech.tts.lucid.Telephone} returns this
 */
proto.speech.tts.lucid.Telephone.prototype.setNumberPartsList = function(value) {
  return jspb.Message.setField(this, 2, value || []);
};


/**
 * @param {string} value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.lucid.Telephone} returns this
 */
proto.speech.tts.lucid.Telephone.prototype.addNumberParts = function(value, opt_index) {
  return jspb.Message.addToRepeatedField(this, 2, value, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.lucid.Telephone} returns this
 */
proto.speech.tts.lucid.Telephone.prototype.clearNumberPartsList = function() {
  return jspb.Message.clearRepeatedField(this, 2);
};


/**
 * optional string extension = 3;
 * @return {?string}
 */
proto.speech.tts.lucid.Telephone.prototype.getExtension$ = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 3));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.Telephone} returns this
 */
proto.speech.tts.lucid.Telephone.prototype.setExtension$ = function(value) {
  return jspb.Message.setField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Telephone} returns this
 */
proto.speech.tts.lucid.Telephone.prototype.clearExtension$ = function() {
  return jspb.Message.clearField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Telephone.prototype.hasExtension$ = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.lucid.Telephone}
 */
proto.speech.tts.lucid.Telephone.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.lucid.Telephone, data);
};



//speech/tts/public/lucid/structured_token_proto_jspb/time.jspb.js
// source: speech/tts/public/lucid/structured_token.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.lucid.Time');
goog.provide('proto.speech.tts.lucid.Time.Style');
goog.provide('proto.speech.tts.lucid.Time.StyleCase');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.requireType('jspb.ByteSource');
goog.requireType('proto.speech.tts.lucid.CommonVerbalizationStyles.Style');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.lucid.Time = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, proto.speech.tts.lucid.Time.oneofGroups_);
};
goog.inherits(proto.speech.tts.lucid.Time, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.lucid.Time.displayName = 'proto.speech.tts.lucid.Time';
}

/**
 * Oneof group definitions for this message. Each group defines the field
 * numbers belonging to that group. When of these fields' value is set, all
 * other fields in the group are cleared. During deserialization, if multiple
 * fields are encountered for a group, only the last value seen will be kept.
 * @private {!Array<!Array<number>>}
 * @const
 */
proto.speech.tts.lucid.Time.oneofGroups_ = [[5,6,7]];

/**
 * @enum {number}
 */
proto.speech.tts.lucid.Time.StyleCase = {
  STYLE_NOT_SET: 0,
  COMMON_STYLE: 5,
  SPECIFIC_STYLE: 6,
  STYLE_ID: 7
};

/**
 * @return {!proto.speech.tts.lucid.Time.StyleCase}
 */
proto.speech.tts.lucid.Time.prototype.getStyleCase = function() {
  return /** @type {!proto.speech.tts.lucid.Time.StyleCase} */(jspb.Message.computeOneofCase(this, proto.speech.tts.lucid.Time.oneofGroups_[0]));
};



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.lucid.Time.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.lucid.Time.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.lucid.Time} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.Time.toObject = function(includeInstance, msg) {
  let f, obj = {
    hours: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    minutes: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f,
    seconds: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f,
    zone: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f,
    commonStyle: (f = jspb.Message.getField(msg, 5)) == null ? undefined : f,
    specificStyle: (f = jspb.Message.getField(msg, 6)) == null ? undefined : f,
    styleId: (f = jspb.Message.getField(msg, 7)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of Time as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.lucid.Time.ObjectFormat = function() {
  /** @type {?number|undefined} */
  this.hours;

  /** @type {?number|undefined} */
  this.minutes;

  /** @type {?number|undefined} */
  this.seconds;

  /** @type {?string|undefined} */
  this.zone;

  /** @type {?number|undefined} */
  this.commonStyle;

  /** @type {?number|undefined} */
  this.specificStyle;

  /** @type {?number|undefined} */
  this.styleId;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.lucid.Time.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.lucid.Time}
 */
proto.speech.tts.lucid.Time.fromObject = function(obj) {
  const msg = new proto.speech.tts.lucid.Time();
  obj.hours != null && jspb.Message.setField(msg, 1, obj.hours);
  obj.minutes != null && jspb.Message.setField(msg, 2, obj.minutes);
  obj.seconds != null && jspb.Message.setField(msg, 3, obj.seconds);
  obj.zone != null && jspb.Message.setField(msg, 4, obj.zone);
  obj.commonStyle != null && jspb.Message.setOneofField(msg, 5, proto.speech.tts.lucid.Time.oneofGroups_[0], obj.commonStyle);
  obj.specificStyle != null && jspb.Message.setOneofField(msg, 6, proto.speech.tts.lucid.Time.oneofGroups_[0], obj.specificStyle);
  obj.styleId != null && jspb.Message.setOneofField(msg, 7, proto.speech.tts.lucid.Time.oneofGroups_[0], obj.styleId);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.lucid.Time}
 */
proto.speech.tts.lucid.Time.deserializeBinary = function(bytes) {
  return proto.speech.tts.lucid.Time.deserializeBinaryFromReader(
      new proto.speech.tts.lucid.Time(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.lucid.Time} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.lucid.Time}
 */
proto.speech.tts.lucid.Time.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {number} */ (reader.readInt32());
      msg.setHours(value);
      break;
    case 2:
      value = /** @type {number} */ (reader.readInt32());
      msg.setMinutes(value);
      break;
    case 3:
      value = /** @type {number} */ (reader.readInt32());
      msg.setSeconds(value);
      break;
    case 4:
      value = /** @type {string} */ (reader.readString());
      msg.setZone(value);
      break;
    case 5:
      value = /** @type {!proto.speech.tts.lucid.CommonVerbalizationStyles.Style} */ (reader.readEnum());
      msg.setCommonStyle(value);
      break;
    case 6:
      value = /** @type {!proto.speech.tts.lucid.Time.Style} */ (reader.readEnum());
      msg.setSpecificStyle(value);
      break;
    case 7:
      value = /** @type {number} */ (reader.readInt32());
      msg.setStyleId(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.lucid.Time.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.lucid.Time.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.lucid.Time} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.Time.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {?number} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeInt32(
      1,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeInt32(
      2,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeInt32(
      3,
      f
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 4));
  if (f != null) {
    writer.writeString(
      4,
      f
    );
  }
  f = /** @type {!proto.speech.tts.lucid.CommonVerbalizationStyles.Style} */ (jspb.Message.getField(message, 5));
  if (f != null) {
    writer.writeEnum(
      5,
      f
    );
  }
  f = /** @type {!proto.speech.tts.lucid.Time.Style} */ (jspb.Message.getField(message, 6));
  if (f != null) {
    writer.writeEnum(
      6,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 7));
  if (f != null) {
    writer.writeInt32(
      7,
      f
    );
  }
};


/**
 * @enum {number}
 */
proto.speech.tts.lucid.Time.Style = {
  UNSPECIFIED_STYLE: 0,
  TWENTY_FOUR_HOUR_STYLE: 1,
  TWELVE_HOUR_STYLE_NO_PERIOD: 2,
  TWELVE_HOUR_STYLE_WITH_ABBREVIATED_PERIOD: 3,
  TWELVE_HOUR_STYLE_WITH_VERBOSE_PERIOD: 4
};

/**
 * optional int32 hours = 1;
 * @return {?number}
 */
proto.speech.tts.lucid.Time.prototype.getHours = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 1));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.speech.tts.lucid.Time} returns this
 */
proto.speech.tts.lucid.Time.prototype.setHours = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Time} returns this
 */
proto.speech.tts.lucid.Time.prototype.clearHours = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Time.prototype.hasHours = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional int32 minutes = 2;
 * @return {?number}
 */
proto.speech.tts.lucid.Time.prototype.getMinutes = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 2));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.speech.tts.lucid.Time} returns this
 */
proto.speech.tts.lucid.Time.prototype.setMinutes = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Time} returns this
 */
proto.speech.tts.lucid.Time.prototype.clearMinutes = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Time.prototype.hasMinutes = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional int32 seconds = 3;
 * @return {?number}
 */
proto.speech.tts.lucid.Time.prototype.getSeconds = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 3));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.speech.tts.lucid.Time} returns this
 */
proto.speech.tts.lucid.Time.prototype.setSeconds = function(value) {
  return jspb.Message.setField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Time} returns this
 */
proto.speech.tts.lucid.Time.prototype.clearSeconds = function() {
  return jspb.Message.clearField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Time.prototype.hasSeconds = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * optional string zone = 4;
 * @return {?string}
 */
proto.speech.tts.lucid.Time.prototype.getZone = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 4));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.Time} returns this
 */
proto.speech.tts.lucid.Time.prototype.setZone = function(value) {
  return jspb.Message.setField(this, 4, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Time} returns this
 */
proto.speech.tts.lucid.Time.prototype.clearZone = function() {
  return jspb.Message.clearField(this, 4);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Time.prototype.hasZone = function() {
  return jspb.Message.hasField(this, 4);
};


/**
 * optional CommonVerbalizationStyles.Style common_style = 5;
 * @return {!proto.speech.tts.lucid.CommonVerbalizationStyles.Style}
 */
proto.speech.tts.lucid.Time.prototype.getCommonStyle = function() {
  return /** @type {!proto.speech.tts.lucid.CommonVerbalizationStyles.Style} */ (jspb.Message.getField(this, 5));
};


/**
 * @param {?proto.speech.tts.lucid.CommonVerbalizationStyles.Style|undefined} value
 * @return {!proto.speech.tts.lucid.Time} returns this
 */
proto.speech.tts.lucid.Time.prototype.setCommonStyle = function(value) {
  return jspb.Message.setOneofField(this, 5, proto.speech.tts.lucid.Time.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Time} returns this
 */
proto.speech.tts.lucid.Time.prototype.clearCommonStyle = function() {
  return jspb.Message.clearOneofField(this, 5, proto.speech.tts.lucid.Time.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Time.prototype.hasCommonStyle = function() {
  return jspb.Message.hasField(this, 5);
};


/**
 * optional Style specific_style = 6;
 * @return {!proto.speech.tts.lucid.Time.Style}
 */
proto.speech.tts.lucid.Time.prototype.getSpecificStyle = function() {
  return /** @type {!proto.speech.tts.lucid.Time.Style} */ (jspb.Message.getField(this, 6));
};


/**
 * @param {?proto.speech.tts.lucid.Time.Style|undefined} value
 * @return {!proto.speech.tts.lucid.Time} returns this
 */
proto.speech.tts.lucid.Time.prototype.setSpecificStyle = function(value) {
  return jspb.Message.setOneofField(this, 6, proto.speech.tts.lucid.Time.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Time} returns this
 */
proto.speech.tts.lucid.Time.prototype.clearSpecificStyle = function() {
  return jspb.Message.clearOneofField(this, 6, proto.speech.tts.lucid.Time.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Time.prototype.hasSpecificStyle = function() {
  return jspb.Message.hasField(this, 6);
};


/**
 * optional int32 style_id = 7;
 * @return {?number}
 */
proto.speech.tts.lucid.Time.prototype.getStyleId = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 7));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.speech.tts.lucid.Time} returns this
 */
proto.speech.tts.lucid.Time.prototype.setStyleId = function(value) {
  return jspb.Message.setOneofField(this, 7, proto.speech.tts.lucid.Time.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Time} returns this
 */
proto.speech.tts.lucid.Time.prototype.clearStyleId = function() {
  return jspb.Message.clearOneofField(this, 7, proto.speech.tts.lucid.Time.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Time.prototype.hasStyleId = function() {
  return jspb.Message.hasField(this, 7);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.lucid.Time}
 */
proto.speech.tts.lucid.Time.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.lucid.Time, data);
};



//speech/tts/public/lucid/structured_token_proto_jspb/verbatim.jspb.js
// source: speech/tts/public/lucid/structured_token.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.lucid.Verbatim');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.lucid.Verbatim = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.speech.tts.lucid.Verbatim, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.lucid.Verbatim.displayName = 'proto.speech.tts.lucid.Verbatim';
}



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.lucid.Verbatim.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.lucid.Verbatim.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.lucid.Verbatim} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.Verbatim.toObject = function(includeInstance, msg) {
  let f, obj = {
    text: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of Verbatim as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.lucid.Verbatim.ObjectFormat = function() {
  /** @type {?string|undefined} */
  this.text;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.lucid.Verbatim.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.lucid.Verbatim}
 */
proto.speech.tts.lucid.Verbatim.fromObject = function(obj) {
  const msg = new proto.speech.tts.lucid.Verbatim();
  obj.text != null && jspb.Message.setField(msg, 1, obj.text);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.lucid.Verbatim}
 */
proto.speech.tts.lucid.Verbatim.deserializeBinary = function(bytes) {
  return proto.speech.tts.lucid.Verbatim.deserializeBinaryFromReader(
      new proto.speech.tts.lucid.Verbatim(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.lucid.Verbatim} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.lucid.Verbatim}
 */
proto.speech.tts.lucid.Verbatim.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {string} */ (reader.readString());
      msg.setText(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.lucid.Verbatim.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.lucid.Verbatim.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.lucid.Verbatim} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.Verbatim.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {?string} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeString(
      1,
      f
    );
  }
};


/**
 * optional string text = 1;
 * @return {?string}
 */
proto.speech.tts.lucid.Verbatim.prototype.getText = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 1));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.Verbatim} returns this
 */
proto.speech.tts.lucid.Verbatim.prototype.setText = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.Verbatim} returns this
 */
proto.speech.tts.lucid.Verbatim.prototype.clearText = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.Verbatim.prototype.hasText = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.lucid.Verbatim}
 */
proto.speech.tts.lucid.Verbatim.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.lucid.Verbatim, data);
};



//speech/tts/public/lucid/lucid_markup_proto_jspb/lucidpiece.jspb.js
// source: speech/tts/public/lucid/lucid_markup.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.lucid.LucidPiece');
goog.provide('proto.speech.tts.lucid.LucidPiece.OriginalPosition');
goog.provide('proto.speech.tts.lucid.LucidPiece.TokenCase');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.speech.tts.lucid.Abbreviation');
goog.require('proto.speech.tts.lucid.Annotation');
goog.require('proto.speech.tts.lucid.ChemicalFormula');
goog.require('proto.speech.tts.lucid.Connector');
goog.require('proto.speech.tts.lucid.Date');
goog.require('proto.speech.tts.lucid.Digits');
goog.require('proto.speech.tts.lucid.Duration');
goog.require('proto.speech.tts.lucid.Electronic');
goog.require('proto.speech.tts.lucid.EmoticonEmoji');
goog.require('proto.speech.tts.lucid.Fraction');
goog.require('proto.speech.tts.lucid.LetterSequence');
goog.require('proto.speech.tts.lucid.LucidWord');
goog.require('proto.speech.tts.lucid.Measure');
goog.require('proto.speech.tts.lucid.Money');
goog.require('proto.speech.tts.lucid.Number');
goog.require('proto.speech.tts.lucid.Ordinal');
goog.require('proto.speech.tts.lucid.PunctuationOrPause');
goog.require('proto.speech.tts.lucid.RomanNumeral');
goog.require('proto.speech.tts.lucid.Spelling');
goog.require('proto.speech.tts.lucid.Telephone');
goog.require('proto.speech.tts.lucid.Time');
goog.require('proto.speech.tts.lucid.Verbatim');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.lucid.LucidPiece = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, proto.speech.tts.lucid.LucidPiece.repeatedFields_, proto.speech.tts.lucid.LucidPiece.oneofGroups_);
};
goog.inherits(proto.speech.tts.lucid.LucidPiece, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.lucid.LucidPiece.displayName = 'proto.speech.tts.lucid.LucidPiece';
}
/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.lucid.LucidPiece.OriginalPosition = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.speech.tts.lucid.LucidPiece.OriginalPosition, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.lucid.LucidPiece.OriginalPosition.displayName = 'proto.speech.tts.lucid.LucidPiece.OriginalPosition';
}

/**
 * List of repeated fields within this message type.
 * @private {!Array<number>}
 * @const
 */
proto.speech.tts.lucid.LucidPiece.repeatedFields_ = [5];

/**
 * Oneof group definitions for this message. Each group defines the field
 * numbers belonging to that group. When of these fields' value is set, all
 * other fields in the group are cleared. During deserialization, if multiple
 * fields are encountered for a group, only the last value seen will be kept.
 * @private {!Array<!Array<number>>}
 * @const
 */
proto.speech.tts.lucid.LucidPiece.oneofGroups_ = [[100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120]];

/**
 * @enum {number}
 */
proto.speech.tts.lucid.LucidPiece.TokenCase = {
  TOKEN_NOT_SET: 0,
  WORD: 100,
  PUNCTUATION_OR_PAUSE: 101,
  VERBATIM: 102,
  SPELLING: 103,
  LETTERS: 104,
  ABBREVIATION: 105,
  ROMAN_NUMERAL: 106,
  NUMBER: 107,
  ORDINAL: 108,
  FRACTION: 109,
  DIGITS: 110,
  TIME: 111,
  DURATION: 112,
  MEASURE: 113,
  DATE: 114,
  TELEPHONE: 115,
  MONEY: 116,
  ELECTRONIC: 117,
  EMOTICON_EMOJI: 118,
  CHEMICAL_FORMULA: 119,
  CONNECTOR: 120
};

/**
 * @return {!proto.speech.tts.lucid.LucidPiece.TokenCase}
 */
proto.speech.tts.lucid.LucidPiece.prototype.getTokenCase = function() {
  return /** @type {!proto.speech.tts.lucid.LucidPiece.TokenCase} */(jspb.Message.computeOneofCase(this, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0]));
};



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.lucid.LucidPiece.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.lucid.LucidPiece.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.lucid.LucidPiece} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.LucidPiece.toObject = function(includeInstance, msg) {
  let f, obj = {
    ownIndex: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    inputTextConnector: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f,
    inputText: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f,
    annotation: (f = msg.getAnnotation()) && proto.speech.tts.lucid.Annotation.toObject(includeInstance, f),
    verbalizedWordsList: jspb.Message.toObjectList(msg.getVerbalizedWordsList(),
    proto.speech.tts.lucid.LucidWord.toObject, includeInstance),
    tokenPrefix: (f = jspb.Message.getField(msg, 6)) == null ? undefined : f,
    tokenSuffix: (f = jspb.Message.getField(msg, 7)) == null ? undefined : f,
    originalStartPosition: (f = msg.getOriginalStartPosition()) && proto.speech.tts.lucid.LucidPiece.OriginalPosition.toObject(includeInstance, f),
    word: (f = jspb.Message.getField(msg, 100)) == null ? undefined : f,
    punctuationOrPause: (f = msg.getPunctuationOrPause()) && proto.speech.tts.lucid.PunctuationOrPause.toObject(includeInstance, f),
    verbatim: (f = msg.getVerbatim()) && proto.speech.tts.lucid.Verbatim.toObject(includeInstance, f),
    spelling: (f = msg.getSpelling()) && proto.speech.tts.lucid.Spelling.toObject(includeInstance, f),
    letters: (f = msg.getLetters()) && proto.speech.tts.lucid.LetterSequence.toObject(includeInstance, f),
    abbreviation: (f = msg.getAbbreviation()) && proto.speech.tts.lucid.Abbreviation.toObject(includeInstance, f),
    romanNumeral: (f = msg.getRomanNumeral()) && proto.speech.tts.lucid.RomanNumeral.toObject(includeInstance, f),
    number: (f = msg.getNumber()) && proto.speech.tts.lucid.Number.toObject(includeInstance, f),
    ordinal: (f = msg.getOrdinal()) && proto.speech.tts.lucid.Ordinal.toObject(includeInstance, f),
    fraction: (f = msg.getFraction()) && proto.speech.tts.lucid.Fraction.toObject(includeInstance, f),
    digits: (f = msg.getDigits()) && proto.speech.tts.lucid.Digits.toObject(includeInstance, f),
    time: (f = msg.getTime()) && proto.speech.tts.lucid.Time.toObject(includeInstance, f),
    duration: (f = msg.getDuration()) && proto.speech.tts.lucid.Duration.toObject(includeInstance, f),
    measure: (f = msg.getMeasure()) && proto.speech.tts.lucid.Measure.toObject(includeInstance, f),
    date: (f = msg.getDate()) && proto.speech.tts.lucid.Date.toObject(includeInstance, f),
    telephone: (f = msg.getTelephone()) && proto.speech.tts.lucid.Telephone.toObject(includeInstance, f),
    money: (f = msg.getMoney()) && proto.speech.tts.lucid.Money.toObject(includeInstance, f),
    electronic: (f = msg.getElectronic()) && proto.speech.tts.lucid.Electronic.toObject(includeInstance, f),
    emoticonEmoji: (f = msg.getEmoticonEmoji()) && proto.speech.tts.lucid.EmoticonEmoji.toObject(includeInstance, f),
    chemicalFormula: (f = msg.getChemicalFormula()) && proto.speech.tts.lucid.ChemicalFormula.toObject(includeInstance, f),
    connector: (f = msg.getConnector()) && proto.speech.tts.lucid.Connector.toObject(includeInstance, f)
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of LucidPiece as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.lucid.LucidPiece.ObjectFormat = function() {
  /** @type {?number|undefined} */
  this.ownIndex;

  /** @type {?string|undefined} */
  this.inputTextConnector;

  /** @type {?string|undefined} */
  this.inputText;

  /** @type {?proto.speech.tts.lucid.Annotation.ObjectFormat|undefined} */
  this.annotation;

  /** @type {?Array<!proto.speech.tts.lucid.LucidWord.ObjectFormat>|undefined} */
  this.verbalizedWordsList;

  /** @type {?string|undefined} */
  this.tokenPrefix;

  /** @type {?string|undefined} */
  this.tokenSuffix;

  /** @type {?proto.speech.tts.lucid.LucidPiece.OriginalPosition.ObjectFormat|undefined} */
  this.originalStartPosition;

  /** @type {?string|undefined} */
  this.word;

  /** @type {?proto.speech.tts.lucid.PunctuationOrPause.ObjectFormat|undefined} */
  this.punctuationOrPause;

  /** @type {?proto.speech.tts.lucid.Verbatim.ObjectFormat|undefined} */
  this.verbatim;

  /** @type {?proto.speech.tts.lucid.Spelling.ObjectFormat|undefined} */
  this.spelling;

  /** @type {?proto.speech.tts.lucid.LetterSequence.ObjectFormat|undefined} */
  this.letters;

  /** @type {?proto.speech.tts.lucid.Abbreviation.ObjectFormat|undefined} */
  this.abbreviation;

  /** @type {?proto.speech.tts.lucid.RomanNumeral.ObjectFormat|undefined} */
  this.romanNumeral;

  /** @type {?proto.speech.tts.lucid.Number.ObjectFormat|undefined} */
  this.number;

  /** @type {?proto.speech.tts.lucid.Ordinal.ObjectFormat|undefined} */
  this.ordinal;

  /** @type {?proto.speech.tts.lucid.Fraction.ObjectFormat|undefined} */
  this.fraction;

  /** @type {?proto.speech.tts.lucid.Digits.ObjectFormat|undefined} */
  this.digits;

  /** @type {?proto.speech.tts.lucid.Time.ObjectFormat|undefined} */
  this.time;

  /** @type {?proto.speech.tts.lucid.Duration.ObjectFormat|undefined} */
  this.duration;

  /** @type {?proto.speech.tts.lucid.Measure.ObjectFormat|undefined} */
  this.measure;

  /** @type {?proto.speech.tts.lucid.Date.ObjectFormat|undefined} */
  this.date;

  /** @type {?proto.speech.tts.lucid.Telephone.ObjectFormat|undefined} */
  this.telephone;

  /** @type {?proto.speech.tts.lucid.Money.ObjectFormat|undefined} */
  this.money;

  /** @type {?proto.speech.tts.lucid.Electronic.ObjectFormat|undefined} */
  this.electronic;

  /** @type {?proto.speech.tts.lucid.EmoticonEmoji.ObjectFormat|undefined} */
  this.emoticonEmoji;

  /** @type {?proto.speech.tts.lucid.ChemicalFormula.ObjectFormat|undefined} */
  this.chemicalFormula;

  /** @type {?proto.speech.tts.lucid.Connector.ObjectFormat|undefined} */
  this.connector;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.lucid.LucidPiece.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.lucid.LucidPiece}
 */
proto.speech.tts.lucid.LucidPiece.fromObject = function(obj) {
  const msg = new proto.speech.tts.lucid.LucidPiece();
  obj.ownIndex != null && jspb.Message.setField(msg, 1, obj.ownIndex);
  obj.inputTextConnector != null && jspb.Message.setField(msg, 3, obj.inputTextConnector);
  obj.inputText != null && jspb.Message.setField(msg, 2, obj.inputText);
  obj.annotation && jspb.Message.setWrapperField(
      msg, 4, proto.speech.tts.lucid.Annotation.fromObject(obj.annotation));
  obj.verbalizedWordsList && jspb.Message.setRepeatedWrapperField(
      msg, 5, obj.verbalizedWordsList.map(
          proto.speech.tts.lucid.LucidWord.fromObject));
  obj.tokenPrefix != null && jspb.Message.setField(msg, 6, obj.tokenPrefix);
  obj.tokenSuffix != null && jspb.Message.setField(msg, 7, obj.tokenSuffix);
  obj.originalStartPosition && jspb.Message.setWrapperField(
      msg, 8, proto.speech.tts.lucid.LucidPiece.OriginalPosition.fromObject(obj.originalStartPosition));
  obj.word != null && jspb.Message.setOneofField(msg, 100, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0], obj.word);
  obj.punctuationOrPause && jspb.Message.setOneofWrapperField(
      msg, 101, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0], proto.speech.tts.lucid.PunctuationOrPause.fromObject(obj.punctuationOrPause));
  obj.verbatim && jspb.Message.setOneofWrapperField(
      msg, 102, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0], proto.speech.tts.lucid.Verbatim.fromObject(obj.verbatim));
  obj.spelling && jspb.Message.setOneofWrapperField(
      msg, 103, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0], proto.speech.tts.lucid.Spelling.fromObject(obj.spelling));
  obj.letters && jspb.Message.setOneofWrapperField(
      msg, 104, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0], proto.speech.tts.lucid.LetterSequence.fromObject(obj.letters));
  obj.abbreviation && jspb.Message.setOneofWrapperField(
      msg, 105, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0], proto.speech.tts.lucid.Abbreviation.fromObject(obj.abbreviation));
  obj.romanNumeral && jspb.Message.setOneofWrapperField(
      msg, 106, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0], proto.speech.tts.lucid.RomanNumeral.fromObject(obj.romanNumeral));
  obj.number && jspb.Message.setOneofWrapperField(
      msg, 107, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0], proto.speech.tts.lucid.Number.fromObject(obj.number));
  obj.ordinal && jspb.Message.setOneofWrapperField(
      msg, 108, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0], proto.speech.tts.lucid.Ordinal.fromObject(obj.ordinal));
  obj.fraction && jspb.Message.setOneofWrapperField(
      msg, 109, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0], proto.speech.tts.lucid.Fraction.fromObject(obj.fraction));
  obj.digits && jspb.Message.setOneofWrapperField(
      msg, 110, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0], proto.speech.tts.lucid.Digits.fromObject(obj.digits));
  obj.time && jspb.Message.setOneofWrapperField(
      msg, 111, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0], proto.speech.tts.lucid.Time.fromObject(obj.time));
  obj.duration && jspb.Message.setOneofWrapperField(
      msg, 112, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0], proto.speech.tts.lucid.Duration.fromObject(obj.duration));
  obj.measure && jspb.Message.setOneofWrapperField(
      msg, 113, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0], proto.speech.tts.lucid.Measure.fromObject(obj.measure));
  obj.date && jspb.Message.setOneofWrapperField(
      msg, 114, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0], proto.speech.tts.lucid.Date.fromObject(obj.date));
  obj.telephone && jspb.Message.setOneofWrapperField(
      msg, 115, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0], proto.speech.tts.lucid.Telephone.fromObject(obj.telephone));
  obj.money && jspb.Message.setOneofWrapperField(
      msg, 116, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0], proto.speech.tts.lucid.Money.fromObject(obj.money));
  obj.electronic && jspb.Message.setOneofWrapperField(
      msg, 117, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0], proto.speech.tts.lucid.Electronic.fromObject(obj.electronic));
  obj.emoticonEmoji && jspb.Message.setOneofWrapperField(
      msg, 118, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0], proto.speech.tts.lucid.EmoticonEmoji.fromObject(obj.emoticonEmoji));
  obj.chemicalFormula && jspb.Message.setOneofWrapperField(
      msg, 119, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0], proto.speech.tts.lucid.ChemicalFormula.fromObject(obj.chemicalFormula));
  obj.connector && jspb.Message.setOneofWrapperField(
      msg, 120, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0], proto.speech.tts.lucid.Connector.fromObject(obj.connector));
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.lucid.LucidPiece}
 */
proto.speech.tts.lucid.LucidPiece.deserializeBinary = function(bytes) {
  return proto.speech.tts.lucid.LucidPiece.deserializeBinaryFromReader(
      new proto.speech.tts.lucid.LucidPiece(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.lucid.LucidPiece} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.lucid.LucidPiece}
 */
proto.speech.tts.lucid.LucidPiece.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {number} */ (reader.readInt32());
      msg.setOwnIndex(value);
      break;
    case 3:
      value = /** @type {string} */ (reader.readString());
      msg.setInputTextConnector(value);
      break;
    case 2:
      value = /** @type {string} */ (reader.readString());
      msg.setInputText(value);
      break;
    case 4:
      value = new proto.speech.tts.lucid.Annotation();
      reader.readMessage(value,proto.speech.tts.lucid.Annotation.deserializeBinaryFromReader);
      msg.setAnnotation(value);
      break;
    case 5:
      value = new proto.speech.tts.lucid.LucidWord();
      reader.readMessage(value,proto.speech.tts.lucid.LucidWord.deserializeBinaryFromReader);
      msg.addVerbalizedWords(value);
      break;
    case 6:
      value = /** @type {string} */ (reader.readString());
      msg.setTokenPrefix(value);
      break;
    case 7:
      value = /** @type {string} */ (reader.readString());
      msg.setTokenSuffix(value);
      break;
    case 8:
      value = new proto.speech.tts.lucid.LucidPiece.OriginalPosition();
      reader.readMessage(value,proto.speech.tts.lucid.LucidPiece.OriginalPosition.deserializeBinaryFromReader);
      msg.setOriginalStartPosition(value);
      break;
    case 100:
      value = /** @type {string} */ (reader.readString());
      msg.setWord(value);
      break;
    case 101:
      value = new proto.speech.tts.lucid.PunctuationOrPause();
      reader.readMessage(value,proto.speech.tts.lucid.PunctuationOrPause.deserializeBinaryFromReader);
      msg.setPunctuationOrPause(value);
      break;
    case 102:
      value = new proto.speech.tts.lucid.Verbatim();
      reader.readMessage(value,proto.speech.tts.lucid.Verbatim.deserializeBinaryFromReader);
      msg.setVerbatim(value);
      break;
    case 103:
      value = new proto.speech.tts.lucid.Spelling();
      reader.readMessage(value,proto.speech.tts.lucid.Spelling.deserializeBinaryFromReader);
      msg.setSpelling(value);
      break;
    case 104:
      value = new proto.speech.tts.lucid.LetterSequence();
      reader.readMessage(value,proto.speech.tts.lucid.LetterSequence.deserializeBinaryFromReader);
      msg.setLetters(value);
      break;
    case 105:
      value = new proto.speech.tts.lucid.Abbreviation();
      reader.readMessage(value,proto.speech.tts.lucid.Abbreviation.deserializeBinaryFromReader);
      msg.setAbbreviation(value);
      break;
    case 106:
      value = new proto.speech.tts.lucid.RomanNumeral();
      reader.readMessage(value,proto.speech.tts.lucid.RomanNumeral.deserializeBinaryFromReader);
      msg.setRomanNumeral(value);
      break;
    case 107:
      value = new proto.speech.tts.lucid.Number();
      reader.readMessage(value,proto.speech.tts.lucid.Number.deserializeBinaryFromReader);
      msg.setNumber(value);
      break;
    case 108:
      value = new proto.speech.tts.lucid.Ordinal();
      reader.readMessage(value,proto.speech.tts.lucid.Ordinal.deserializeBinaryFromReader);
      msg.setOrdinal(value);
      break;
    case 109:
      value = new proto.speech.tts.lucid.Fraction();
      reader.readMessage(value,proto.speech.tts.lucid.Fraction.deserializeBinaryFromReader);
      msg.setFraction(value);
      break;
    case 110:
      value = new proto.speech.tts.lucid.Digits();
      reader.readMessage(value,proto.speech.tts.lucid.Digits.deserializeBinaryFromReader);
      msg.setDigits(value);
      break;
    case 111:
      value = new proto.speech.tts.lucid.Time();
      reader.readMessage(value,proto.speech.tts.lucid.Time.deserializeBinaryFromReader);
      msg.setTime(value);
      break;
    case 112:
      value = new proto.speech.tts.lucid.Duration();
      reader.readMessage(value,proto.speech.tts.lucid.Duration.deserializeBinaryFromReader);
      msg.setDuration(value);
      break;
    case 113:
      value = new proto.speech.tts.lucid.Measure();
      reader.readMessage(value,proto.speech.tts.lucid.Measure.deserializeBinaryFromReader);
      msg.setMeasure(value);
      break;
    case 114:
      value = new proto.speech.tts.lucid.Date();
      reader.readMessage(value,proto.speech.tts.lucid.Date.deserializeBinaryFromReader);
      msg.setDate(value);
      break;
    case 115:
      value = new proto.speech.tts.lucid.Telephone();
      reader.readMessage(value,proto.speech.tts.lucid.Telephone.deserializeBinaryFromReader);
      msg.setTelephone(value);
      break;
    case 116:
      value = new proto.speech.tts.lucid.Money();
      reader.readMessage(value,proto.speech.tts.lucid.Money.deserializeBinaryFromReader);
      msg.setMoney(value);
      break;
    case 117:
      value = new proto.speech.tts.lucid.Electronic();
      reader.readMessage(value,proto.speech.tts.lucid.Electronic.deserializeBinaryFromReader);
      msg.setElectronic(value);
      break;
    case 118:
      value = new proto.speech.tts.lucid.EmoticonEmoji();
      reader.readMessage(value,proto.speech.tts.lucid.EmoticonEmoji.deserializeBinaryFromReader);
      msg.setEmoticonEmoji(value);
      break;
    case 119:
      value = new proto.speech.tts.lucid.ChemicalFormula();
      reader.readMessage(value,proto.speech.tts.lucid.ChemicalFormula.deserializeBinaryFromReader);
      msg.setChemicalFormula(value);
      break;
    case 120:
      value = new proto.speech.tts.lucid.Connector();
      reader.readMessage(value,proto.speech.tts.lucid.Connector.deserializeBinaryFromReader);
      msg.setConnector(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.lucid.LucidPiece.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.lucid.LucidPiece.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.lucid.LucidPiece} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.LucidPiece.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {?number} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeInt32(
      1,
      f
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeString(
      3,
      f
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeString(
      2,
      f
    );
  }
  f = message.getAnnotation();
  if (f != null) {
    writer.writeMessage(
      4,
      f,
      proto.speech.tts.lucid.Annotation.serializeBinaryToWriter
    );
  }
  f = message.getVerbalizedWordsList();
  if (f.length > 0) {
    writer.writeRepeatedMessage(
      5,
      f,
      proto.speech.tts.lucid.LucidWord.serializeBinaryToWriter
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 6));
  if (f != null) {
    writer.writeString(
      6,
      f
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 7));
  if (f != null) {
    writer.writeString(
      7,
      f
    );
  }
  f = message.getOriginalStartPosition();
  if (f != null) {
    writer.writeMessage(
      8,
      f,
      proto.speech.tts.lucid.LucidPiece.OriginalPosition.serializeBinaryToWriter
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 100));
  if (f != null) {
    writer.writeString(
      100,
      f
    );
  }
  f = message.getPunctuationOrPause();
  if (f != null) {
    writer.writeMessage(
      101,
      f,
      proto.speech.tts.lucid.PunctuationOrPause.serializeBinaryToWriter
    );
  }
  f = message.getVerbatim();
  if (f != null) {
    writer.writeMessage(
      102,
      f,
      proto.speech.tts.lucid.Verbatim.serializeBinaryToWriter
    );
  }
  f = message.getSpelling();
  if (f != null) {
    writer.writeMessage(
      103,
      f,
      proto.speech.tts.lucid.Spelling.serializeBinaryToWriter
    );
  }
  f = message.getLetters();
  if (f != null) {
    writer.writeMessage(
      104,
      f,
      proto.speech.tts.lucid.LetterSequence.serializeBinaryToWriter
    );
  }
  f = message.getAbbreviation();
  if (f != null) {
    writer.writeMessage(
      105,
      f,
      proto.speech.tts.lucid.Abbreviation.serializeBinaryToWriter
    );
  }
  f = message.getRomanNumeral();
  if (f != null) {
    writer.writeMessage(
      106,
      f,
      proto.speech.tts.lucid.RomanNumeral.serializeBinaryToWriter
    );
  }
  f = message.getNumber();
  if (f != null) {
    writer.writeMessage(
      107,
      f,
      proto.speech.tts.lucid.Number.serializeBinaryToWriter
    );
  }
  f = message.getOrdinal();
  if (f != null) {
    writer.writeMessage(
      108,
      f,
      proto.speech.tts.lucid.Ordinal.serializeBinaryToWriter
    );
  }
  f = message.getFraction();
  if (f != null) {
    writer.writeMessage(
      109,
      f,
      proto.speech.tts.lucid.Fraction.serializeBinaryToWriter
    );
  }
  f = message.getDigits();
  if (f != null) {
    writer.writeMessage(
      110,
      f,
      proto.speech.tts.lucid.Digits.serializeBinaryToWriter
    );
  }
  f = message.getTime();
  if (f != null) {
    writer.writeMessage(
      111,
      f,
      proto.speech.tts.lucid.Time.serializeBinaryToWriter
    );
  }
  f = message.getDuration();
  if (f != null) {
    writer.writeMessage(
      112,
      f,
      proto.speech.tts.lucid.Duration.serializeBinaryToWriter
    );
  }
  f = message.getMeasure();
  if (f != null) {
    writer.writeMessage(
      113,
      f,
      proto.speech.tts.lucid.Measure.serializeBinaryToWriter
    );
  }
  f = message.getDate();
  if (f != null) {
    writer.writeMessage(
      114,
      f,
      proto.speech.tts.lucid.Date.serializeBinaryToWriter
    );
  }
  f = message.getTelephone();
  if (f != null) {
    writer.writeMessage(
      115,
      f,
      proto.speech.tts.lucid.Telephone.serializeBinaryToWriter
    );
  }
  f = message.getMoney();
  if (f != null) {
    writer.writeMessage(
      116,
      f,
      proto.speech.tts.lucid.Money.serializeBinaryToWriter
    );
  }
  f = message.getElectronic();
  if (f != null) {
    writer.writeMessage(
      117,
      f,
      proto.speech.tts.lucid.Electronic.serializeBinaryToWriter
    );
  }
  f = message.getEmoticonEmoji();
  if (f != null) {
    writer.writeMessage(
      118,
      f,
      proto.speech.tts.lucid.EmoticonEmoji.serializeBinaryToWriter
    );
  }
  f = message.getChemicalFormula();
  if (f != null) {
    writer.writeMessage(
      119,
      f,
      proto.speech.tts.lucid.ChemicalFormula.serializeBinaryToWriter
    );
  }
  f = message.getConnector();
  if (f != null) {
    writer.writeMessage(
      120,
      f,
      proto.speech.tts.lucid.Connector.serializeBinaryToWriter
    );
  }
};





if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.lucid.LucidPiece.OriginalPosition.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.lucid.LucidPiece.OriginalPosition.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.lucid.LucidPiece.OriginalPosition} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.LucidPiece.OriginalPosition.toObject = function(includeInstance, msg) {
  let f, obj = {
    contentIndex: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    pieceIndex: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f,
    byteIndex: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f,
    timepointName: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of OriginalPosition as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.lucid.LucidPiece.OriginalPosition.ObjectFormat = function() {
  /** @type {?number|undefined} */
  this.contentIndex;

  /** @type {?number|undefined} */
  this.pieceIndex;

  /** @type {?number|undefined} */
  this.byteIndex;

  /** @type {?string|undefined} */
  this.timepointName;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.lucid.LucidPiece.OriginalPosition.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.lucid.LucidPiece.OriginalPosition}
 */
proto.speech.tts.lucid.LucidPiece.OriginalPosition.fromObject = function(obj) {
  const msg = new proto.speech.tts.lucid.LucidPiece.OriginalPosition();
  obj.contentIndex != null && jspb.Message.setField(msg, 1, obj.contentIndex);
  obj.pieceIndex != null && jspb.Message.setField(msg, 2, obj.pieceIndex);
  obj.byteIndex != null && jspb.Message.setField(msg, 3, obj.byteIndex);
  obj.timepointName != null && jspb.Message.setField(msg, 4, obj.timepointName);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.lucid.LucidPiece.OriginalPosition}
 */
proto.speech.tts.lucid.LucidPiece.OriginalPosition.deserializeBinary = function(bytes) {
  return proto.speech.tts.lucid.LucidPiece.OriginalPosition.deserializeBinaryFromReader(
      new proto.speech.tts.lucid.LucidPiece.OriginalPosition(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.lucid.LucidPiece.OriginalPosition} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.lucid.LucidPiece.OriginalPosition}
 */
proto.speech.tts.lucid.LucidPiece.OriginalPosition.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {number} */ (reader.readInt32());
      msg.setContentIndex(value);
      break;
    case 2:
      value = /** @type {number} */ (reader.readInt32());
      msg.setPieceIndex(value);
      break;
    case 3:
      value = /** @type {number} */ (reader.readInt32());
      msg.setByteIndex(value);
      break;
    case 4:
      value = /** @type {string} */ (reader.readString());
      msg.setTimepointName(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.lucid.LucidPiece.OriginalPosition.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.lucid.LucidPiece.OriginalPosition.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.lucid.LucidPiece.OriginalPosition} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.LucidPiece.OriginalPosition.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {?number} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeInt32(
      1,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeInt32(
      2,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeInt32(
      3,
      f
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 4));
  if (f != null) {
    writer.writeString(
      4,
      f
    );
  }
};


/**
 * optional int32 content_index = 1;
 * @return {?number}
 */
proto.speech.tts.lucid.LucidPiece.OriginalPosition.prototype.getContentIndex = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 1));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.speech.tts.lucid.LucidPiece.OriginalPosition} returns this
 */
proto.speech.tts.lucid.LucidPiece.OriginalPosition.prototype.setContentIndex = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.LucidPiece.OriginalPosition} returns this
 */
proto.speech.tts.lucid.LucidPiece.OriginalPosition.prototype.clearContentIndex = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.LucidPiece.OriginalPosition.prototype.hasContentIndex = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional int32 piece_index = 2;
 * @return {?number}
 */
proto.speech.tts.lucid.LucidPiece.OriginalPosition.prototype.getPieceIndex = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 2));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.speech.tts.lucid.LucidPiece.OriginalPosition} returns this
 */
proto.speech.tts.lucid.LucidPiece.OriginalPosition.prototype.setPieceIndex = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.LucidPiece.OriginalPosition} returns this
 */
proto.speech.tts.lucid.LucidPiece.OriginalPosition.prototype.clearPieceIndex = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.LucidPiece.OriginalPosition.prototype.hasPieceIndex = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional int32 byte_index = 3;
 * @return {?number}
 */
proto.speech.tts.lucid.LucidPiece.OriginalPosition.prototype.getByteIndex = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 3));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.speech.tts.lucid.LucidPiece.OriginalPosition} returns this
 */
proto.speech.tts.lucid.LucidPiece.OriginalPosition.prototype.setByteIndex = function(value) {
  return jspb.Message.setField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.LucidPiece.OriginalPosition} returns this
 */
proto.speech.tts.lucid.LucidPiece.OriginalPosition.prototype.clearByteIndex = function() {
  return jspb.Message.clearField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.LucidPiece.OriginalPosition.prototype.hasByteIndex = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * optional string timepoint_name = 4;
 * @return {?string}
 */
proto.speech.tts.lucid.LucidPiece.OriginalPosition.prototype.getTimepointName = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 4));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.LucidPiece.OriginalPosition} returns this
 */
proto.speech.tts.lucid.LucidPiece.OriginalPosition.prototype.setTimepointName = function(value) {
  return jspb.Message.setField(this, 4, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.LucidPiece.OriginalPosition} returns this
 */
proto.speech.tts.lucid.LucidPiece.OriginalPosition.prototype.clearTimepointName = function() {
  return jspb.Message.clearField(this, 4);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.LucidPiece.OriginalPosition.prototype.hasTimepointName = function() {
  return jspb.Message.hasField(this, 4);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.lucid.LucidPiece.OriginalPosition}
 */
proto.speech.tts.lucid.LucidPiece.OriginalPosition.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.lucid.LucidPiece.OriginalPosition, data);
};


/**
 * optional int32 own_index = 1;
 * @return {?number}
 */
proto.speech.tts.lucid.LucidPiece.prototype.getOwnIndex = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 1));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
 */
proto.speech.tts.lucid.LucidPiece.prototype.setOwnIndex = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
 */
proto.speech.tts.lucid.LucidPiece.prototype.clearOwnIndex = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.LucidPiece.prototype.hasOwnIndex = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional string input_text_connector = 3;
 * @return {?string}
 */
proto.speech.tts.lucid.LucidPiece.prototype.getInputTextConnector = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 3));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
 */
proto.speech.tts.lucid.LucidPiece.prototype.setInputTextConnector = function(value) {
  return jspb.Message.setField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
 */
proto.speech.tts.lucid.LucidPiece.prototype.clearInputTextConnector = function() {
  return jspb.Message.clearField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.LucidPiece.prototype.hasInputTextConnector = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * optional string input_text = 2;
 * @return {?string}
 */
proto.speech.tts.lucid.LucidPiece.prototype.getInputText = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 2));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
 */
proto.speech.tts.lucid.LucidPiece.prototype.setInputText = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
 */
proto.speech.tts.lucid.LucidPiece.prototype.clearInputText = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.LucidPiece.prototype.hasInputText = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional Annotation annotation = 4;
 * @return {?proto.speech.tts.lucid.Annotation}
 */
proto.speech.tts.lucid.LucidPiece.prototype.getAnnotation = function() {
  return /** @type{?proto.speech.tts.lucid.Annotation} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.lucid.Annotation, 4));
};


/**
 * @param {?proto.speech.tts.lucid.Annotation|undefined} value
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
*/
proto.speech.tts.lucid.LucidPiece.prototype.setAnnotation = function(value) {
  return jspb.Message.setWrapperField(this, 4, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
 */
proto.speech.tts.lucid.LucidPiece.prototype.clearAnnotation = function() {
  return jspb.Message.clearWrapperField(this, 4);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.LucidPiece.prototype.hasAnnotation = function() {
  return jspb.Message.hasField(this, 4);
};


/**
 * repeated LucidWord verbalized_words = 5;
 * @return {!Array<!proto.speech.tts.lucid.LucidWord>}
 */
proto.speech.tts.lucid.LucidPiece.prototype.getVerbalizedWordsList = function() {
  return /** @type{!Array<!proto.speech.tts.lucid.LucidWord>} */ (
    jspb.Message.getRepeatedWrapperField(this, proto.speech.tts.lucid.LucidWord, 5));
};


/**
 * @param {Array<!proto.speech.tts.lucid.LucidWord>|undefined} value
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
*/
proto.speech.tts.lucid.LucidPiece.prototype.setVerbalizedWordsList = function(value) {
  return jspb.Message.setRepeatedWrapperField(this, 5, value);
};


/**
 * @param {!proto.speech.tts.lucid.LucidWord=} opt_value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.lucid.LucidWord}
 */
proto.speech.tts.lucid.LucidPiece.prototype.addVerbalizedWords = function(opt_value, opt_index) {
  return jspb.Message.addToRepeatedWrapperField(this, 5, opt_value, proto.speech.tts.lucid.LucidWord, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
 */
proto.speech.tts.lucid.LucidPiece.prototype.clearVerbalizedWordsList = function() {
  return jspb.Message.clearRepeatedWrapperField(this, 5);
};


/**
 * optional string token_prefix = 6;
 * @return {?string}
 */
proto.speech.tts.lucid.LucidPiece.prototype.getTokenPrefix = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 6));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
 */
proto.speech.tts.lucid.LucidPiece.prototype.setTokenPrefix = function(value) {
  return jspb.Message.setField(this, 6, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
 */
proto.speech.tts.lucid.LucidPiece.prototype.clearTokenPrefix = function() {
  return jspb.Message.clearField(this, 6);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.LucidPiece.prototype.hasTokenPrefix = function() {
  return jspb.Message.hasField(this, 6);
};


/**
 * optional string token_suffix = 7;
 * @return {?string}
 */
proto.speech.tts.lucid.LucidPiece.prototype.getTokenSuffix = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 7));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
 */
proto.speech.tts.lucid.LucidPiece.prototype.setTokenSuffix = function(value) {
  return jspb.Message.setField(this, 7, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
 */
proto.speech.tts.lucid.LucidPiece.prototype.clearTokenSuffix = function() {
  return jspb.Message.clearField(this, 7);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.LucidPiece.prototype.hasTokenSuffix = function() {
  return jspb.Message.hasField(this, 7);
};


/**
 * optional OriginalPosition original_start_position = 8;
 * @return {?proto.speech.tts.lucid.LucidPiece.OriginalPosition}
 */
proto.speech.tts.lucid.LucidPiece.prototype.getOriginalStartPosition = function() {
  return /** @type{?proto.speech.tts.lucid.LucidPiece.OriginalPosition} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.lucid.LucidPiece.OriginalPosition, 8));
};


/**
 * @param {?proto.speech.tts.lucid.LucidPiece.OriginalPosition|undefined} value
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
*/
proto.speech.tts.lucid.LucidPiece.prototype.setOriginalStartPosition = function(value) {
  return jspb.Message.setWrapperField(this, 8, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
 */
proto.speech.tts.lucid.LucidPiece.prototype.clearOriginalStartPosition = function() {
  return jspb.Message.clearWrapperField(this, 8);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.LucidPiece.prototype.hasOriginalStartPosition = function() {
  return jspb.Message.hasField(this, 8);
};


/**
 * optional string word = 100;
 * @return {?string}
 */
proto.speech.tts.lucid.LucidPiece.prototype.getWord = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 100));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
 */
proto.speech.tts.lucid.LucidPiece.prototype.setWord = function(value) {
  return jspb.Message.setOneofField(this, 100, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
 */
proto.speech.tts.lucid.LucidPiece.prototype.clearWord = function() {
  return jspb.Message.clearOneofField(this, 100, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.LucidPiece.prototype.hasWord = function() {
  return jspb.Message.hasField(this, 100);
};


/**
 * optional PunctuationOrPause punctuation_or_pause = 101;
 * @return {?proto.speech.tts.lucid.PunctuationOrPause}
 */
proto.speech.tts.lucid.LucidPiece.prototype.getPunctuationOrPause = function() {
  return /** @type{?proto.speech.tts.lucid.PunctuationOrPause} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.lucid.PunctuationOrPause, 101));
};


/**
 * @param {?proto.speech.tts.lucid.PunctuationOrPause|undefined} value
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
*/
proto.speech.tts.lucid.LucidPiece.prototype.setPunctuationOrPause = function(value) {
  return jspb.Message.setOneofWrapperField(this, 101, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
 */
proto.speech.tts.lucid.LucidPiece.prototype.clearPunctuationOrPause = function() {
  return jspb.Message.clearOneofWrapperField(this, 101, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.LucidPiece.prototype.hasPunctuationOrPause = function() {
  return jspb.Message.hasField(this, 101);
};


/**
 * optional Verbatim verbatim = 102;
 * @return {?proto.speech.tts.lucid.Verbatim}
 */
proto.speech.tts.lucid.LucidPiece.prototype.getVerbatim = function() {
  return /** @type{?proto.speech.tts.lucid.Verbatim} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.lucid.Verbatim, 102));
};


/**
 * @param {?proto.speech.tts.lucid.Verbatim|undefined} value
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
*/
proto.speech.tts.lucid.LucidPiece.prototype.setVerbatim = function(value) {
  return jspb.Message.setOneofWrapperField(this, 102, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
 */
proto.speech.tts.lucid.LucidPiece.prototype.clearVerbatim = function() {
  return jspb.Message.clearOneofWrapperField(this, 102, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.LucidPiece.prototype.hasVerbatim = function() {
  return jspb.Message.hasField(this, 102);
};


/**
 * optional Spelling spelling = 103;
 * @return {?proto.speech.tts.lucid.Spelling}
 */
proto.speech.tts.lucid.LucidPiece.prototype.getSpelling = function() {
  return /** @type{?proto.speech.tts.lucid.Spelling} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.lucid.Spelling, 103));
};


/**
 * @param {?proto.speech.tts.lucid.Spelling|undefined} value
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
*/
proto.speech.tts.lucid.LucidPiece.prototype.setSpelling = function(value) {
  return jspb.Message.setOneofWrapperField(this, 103, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
 */
proto.speech.tts.lucid.LucidPiece.prototype.clearSpelling = function() {
  return jspb.Message.clearOneofWrapperField(this, 103, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.LucidPiece.prototype.hasSpelling = function() {
  return jspb.Message.hasField(this, 103);
};


/**
 * optional LetterSequence letters = 104;
 * @return {?proto.speech.tts.lucid.LetterSequence}
 */
proto.speech.tts.lucid.LucidPiece.prototype.getLetters = function() {
  return /** @type{?proto.speech.tts.lucid.LetterSequence} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.lucid.LetterSequence, 104));
};


/**
 * @param {?proto.speech.tts.lucid.LetterSequence|undefined} value
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
*/
proto.speech.tts.lucid.LucidPiece.prototype.setLetters = function(value) {
  return jspb.Message.setOneofWrapperField(this, 104, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
 */
proto.speech.tts.lucid.LucidPiece.prototype.clearLetters = function() {
  return jspb.Message.clearOneofWrapperField(this, 104, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.LucidPiece.prototype.hasLetters = function() {
  return jspb.Message.hasField(this, 104);
};


/**
 * optional Abbreviation abbreviation = 105;
 * @return {?proto.speech.tts.lucid.Abbreviation}
 */
proto.speech.tts.lucid.LucidPiece.prototype.getAbbreviation = function() {
  return /** @type{?proto.speech.tts.lucid.Abbreviation} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.lucid.Abbreviation, 105));
};


/**
 * @param {?proto.speech.tts.lucid.Abbreviation|undefined} value
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
*/
proto.speech.tts.lucid.LucidPiece.prototype.setAbbreviation = function(value) {
  return jspb.Message.setOneofWrapperField(this, 105, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
 */
proto.speech.tts.lucid.LucidPiece.prototype.clearAbbreviation = function() {
  return jspb.Message.clearOneofWrapperField(this, 105, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.LucidPiece.prototype.hasAbbreviation = function() {
  return jspb.Message.hasField(this, 105);
};


/**
 * optional RomanNumeral roman_numeral = 106;
 * @return {?proto.speech.tts.lucid.RomanNumeral}
 */
proto.speech.tts.lucid.LucidPiece.prototype.getRomanNumeral = function() {
  return /** @type{?proto.speech.tts.lucid.RomanNumeral} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.lucid.RomanNumeral, 106));
};


/**
 * @param {?proto.speech.tts.lucid.RomanNumeral|undefined} value
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
*/
proto.speech.tts.lucid.LucidPiece.prototype.setRomanNumeral = function(value) {
  return jspb.Message.setOneofWrapperField(this, 106, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
 */
proto.speech.tts.lucid.LucidPiece.prototype.clearRomanNumeral = function() {
  return jspb.Message.clearOneofWrapperField(this, 106, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.LucidPiece.prototype.hasRomanNumeral = function() {
  return jspb.Message.hasField(this, 106);
};


/**
 * optional Number number = 107;
 * @return {?proto.speech.tts.lucid.Number}
 */
proto.speech.tts.lucid.LucidPiece.prototype.getNumber = function() {
  return /** @type{?proto.speech.tts.lucid.Number} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.lucid.Number, 107));
};


/**
 * @param {?proto.speech.tts.lucid.Number|undefined} value
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
*/
proto.speech.tts.lucid.LucidPiece.prototype.setNumber = function(value) {
  return jspb.Message.setOneofWrapperField(this, 107, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
 */
proto.speech.tts.lucid.LucidPiece.prototype.clearNumber = function() {
  return jspb.Message.clearOneofWrapperField(this, 107, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.LucidPiece.prototype.hasNumber = function() {
  return jspb.Message.hasField(this, 107);
};


/**
 * optional Ordinal ordinal = 108;
 * @return {?proto.speech.tts.lucid.Ordinal}
 */
proto.speech.tts.lucid.LucidPiece.prototype.getOrdinal = function() {
  return /** @type{?proto.speech.tts.lucid.Ordinal} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.lucid.Ordinal, 108));
};


/**
 * @param {?proto.speech.tts.lucid.Ordinal|undefined} value
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
*/
proto.speech.tts.lucid.LucidPiece.prototype.setOrdinal = function(value) {
  return jspb.Message.setOneofWrapperField(this, 108, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
 */
proto.speech.tts.lucid.LucidPiece.prototype.clearOrdinal = function() {
  return jspb.Message.clearOneofWrapperField(this, 108, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.LucidPiece.prototype.hasOrdinal = function() {
  return jspb.Message.hasField(this, 108);
};


/**
 * optional Fraction fraction = 109;
 * @return {?proto.speech.tts.lucid.Fraction}
 */
proto.speech.tts.lucid.LucidPiece.prototype.getFraction = function() {
  return /** @type{?proto.speech.tts.lucid.Fraction} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.lucid.Fraction, 109));
};


/**
 * @param {?proto.speech.tts.lucid.Fraction|undefined} value
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
*/
proto.speech.tts.lucid.LucidPiece.prototype.setFraction = function(value) {
  return jspb.Message.setOneofWrapperField(this, 109, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
 */
proto.speech.tts.lucid.LucidPiece.prototype.clearFraction = function() {
  return jspb.Message.clearOneofWrapperField(this, 109, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.LucidPiece.prototype.hasFraction = function() {
  return jspb.Message.hasField(this, 109);
};


/**
 * optional Digits digits = 110;
 * @return {?proto.speech.tts.lucid.Digits}
 */
proto.speech.tts.lucid.LucidPiece.prototype.getDigits = function() {
  return /** @type{?proto.speech.tts.lucid.Digits} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.lucid.Digits, 110));
};


/**
 * @param {?proto.speech.tts.lucid.Digits|undefined} value
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
*/
proto.speech.tts.lucid.LucidPiece.prototype.setDigits = function(value) {
  return jspb.Message.setOneofWrapperField(this, 110, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
 */
proto.speech.tts.lucid.LucidPiece.prototype.clearDigits = function() {
  return jspb.Message.clearOneofWrapperField(this, 110, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.LucidPiece.prototype.hasDigits = function() {
  return jspb.Message.hasField(this, 110);
};


/**
 * optional Time time = 111;
 * @return {?proto.speech.tts.lucid.Time}
 */
proto.speech.tts.lucid.LucidPiece.prototype.getTime = function() {
  return /** @type{?proto.speech.tts.lucid.Time} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.lucid.Time, 111));
};


/**
 * @param {?proto.speech.tts.lucid.Time|undefined} value
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
*/
proto.speech.tts.lucid.LucidPiece.prototype.setTime = function(value) {
  return jspb.Message.setOneofWrapperField(this, 111, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
 */
proto.speech.tts.lucid.LucidPiece.prototype.clearTime = function() {
  return jspb.Message.clearOneofWrapperField(this, 111, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.LucidPiece.prototype.hasTime = function() {
  return jspb.Message.hasField(this, 111);
};


/**
 * optional Duration duration = 112;
 * @return {?proto.speech.tts.lucid.Duration}
 */
proto.speech.tts.lucid.LucidPiece.prototype.getDuration = function() {
  return /** @type{?proto.speech.tts.lucid.Duration} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.lucid.Duration, 112));
};


/**
 * @param {?proto.speech.tts.lucid.Duration|undefined} value
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
*/
proto.speech.tts.lucid.LucidPiece.prototype.setDuration = function(value) {
  return jspb.Message.setOneofWrapperField(this, 112, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
 */
proto.speech.tts.lucid.LucidPiece.prototype.clearDuration = function() {
  return jspb.Message.clearOneofWrapperField(this, 112, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.LucidPiece.prototype.hasDuration = function() {
  return jspb.Message.hasField(this, 112);
};


/**
 * optional Measure measure = 113;
 * @return {?proto.speech.tts.lucid.Measure}
 */
proto.speech.tts.lucid.LucidPiece.prototype.getMeasure = function() {
  return /** @type{?proto.speech.tts.lucid.Measure} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.lucid.Measure, 113));
};


/**
 * @param {?proto.speech.tts.lucid.Measure|undefined} value
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
*/
proto.speech.tts.lucid.LucidPiece.prototype.setMeasure = function(value) {
  return jspb.Message.setOneofWrapperField(this, 113, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
 */
proto.speech.tts.lucid.LucidPiece.prototype.clearMeasure = function() {
  return jspb.Message.clearOneofWrapperField(this, 113, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.LucidPiece.prototype.hasMeasure = function() {
  return jspb.Message.hasField(this, 113);
};


/**
 * optional Date date = 114;
 * @return {?proto.speech.tts.lucid.Date}
 */
proto.speech.tts.lucid.LucidPiece.prototype.getDate = function() {
  return /** @type{?proto.speech.tts.lucid.Date} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.lucid.Date, 114));
};


/**
 * @param {?proto.speech.tts.lucid.Date|undefined} value
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
*/
proto.speech.tts.lucid.LucidPiece.prototype.setDate = function(value) {
  return jspb.Message.setOneofWrapperField(this, 114, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
 */
proto.speech.tts.lucid.LucidPiece.prototype.clearDate = function() {
  return jspb.Message.clearOneofWrapperField(this, 114, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.LucidPiece.prototype.hasDate = function() {
  return jspb.Message.hasField(this, 114);
};


/**
 * optional Telephone telephone = 115;
 * @return {?proto.speech.tts.lucid.Telephone}
 */
proto.speech.tts.lucid.LucidPiece.prototype.getTelephone = function() {
  return /** @type{?proto.speech.tts.lucid.Telephone} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.lucid.Telephone, 115));
};


/**
 * @param {?proto.speech.tts.lucid.Telephone|undefined} value
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
*/
proto.speech.tts.lucid.LucidPiece.prototype.setTelephone = function(value) {
  return jspb.Message.setOneofWrapperField(this, 115, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
 */
proto.speech.tts.lucid.LucidPiece.prototype.clearTelephone = function() {
  return jspb.Message.clearOneofWrapperField(this, 115, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.LucidPiece.prototype.hasTelephone = function() {
  return jspb.Message.hasField(this, 115);
};


/**
 * optional Money money = 116;
 * @return {?proto.speech.tts.lucid.Money}
 */
proto.speech.tts.lucid.LucidPiece.prototype.getMoney = function() {
  return /** @type{?proto.speech.tts.lucid.Money} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.lucid.Money, 116));
};


/**
 * @param {?proto.speech.tts.lucid.Money|undefined} value
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
*/
proto.speech.tts.lucid.LucidPiece.prototype.setMoney = function(value) {
  return jspb.Message.setOneofWrapperField(this, 116, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
 */
proto.speech.tts.lucid.LucidPiece.prototype.clearMoney = function() {
  return jspb.Message.clearOneofWrapperField(this, 116, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.LucidPiece.prototype.hasMoney = function() {
  return jspb.Message.hasField(this, 116);
};


/**
 * optional Electronic electronic = 117;
 * @return {?proto.speech.tts.lucid.Electronic}
 */
proto.speech.tts.lucid.LucidPiece.prototype.getElectronic = function() {
  return /** @type{?proto.speech.tts.lucid.Electronic} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.lucid.Electronic, 117));
};


/**
 * @param {?proto.speech.tts.lucid.Electronic|undefined} value
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
*/
proto.speech.tts.lucid.LucidPiece.prototype.setElectronic = function(value) {
  return jspb.Message.setOneofWrapperField(this, 117, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
 */
proto.speech.tts.lucid.LucidPiece.prototype.clearElectronic = function() {
  return jspb.Message.clearOneofWrapperField(this, 117, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.LucidPiece.prototype.hasElectronic = function() {
  return jspb.Message.hasField(this, 117);
};


/**
 * optional EmoticonEmoji emoticon_emoji = 118;
 * @return {?proto.speech.tts.lucid.EmoticonEmoji}
 */
proto.speech.tts.lucid.LucidPiece.prototype.getEmoticonEmoji = function() {
  return /** @type{?proto.speech.tts.lucid.EmoticonEmoji} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.lucid.EmoticonEmoji, 118));
};


/**
 * @param {?proto.speech.tts.lucid.EmoticonEmoji|undefined} value
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
*/
proto.speech.tts.lucid.LucidPiece.prototype.setEmoticonEmoji = function(value) {
  return jspb.Message.setOneofWrapperField(this, 118, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
 */
proto.speech.tts.lucid.LucidPiece.prototype.clearEmoticonEmoji = function() {
  return jspb.Message.clearOneofWrapperField(this, 118, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.LucidPiece.prototype.hasEmoticonEmoji = function() {
  return jspb.Message.hasField(this, 118);
};


/**
 * optional ChemicalFormula chemical_formula = 119;
 * @return {?proto.speech.tts.lucid.ChemicalFormula}
 */
proto.speech.tts.lucid.LucidPiece.prototype.getChemicalFormula = function() {
  return /** @type{?proto.speech.tts.lucid.ChemicalFormula} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.lucid.ChemicalFormula, 119));
};


/**
 * @param {?proto.speech.tts.lucid.ChemicalFormula|undefined} value
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
*/
proto.speech.tts.lucid.LucidPiece.prototype.setChemicalFormula = function(value) {
  return jspb.Message.setOneofWrapperField(this, 119, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
 */
proto.speech.tts.lucid.LucidPiece.prototype.clearChemicalFormula = function() {
  return jspb.Message.clearOneofWrapperField(this, 119, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.LucidPiece.prototype.hasChemicalFormula = function() {
  return jspb.Message.hasField(this, 119);
};


/**
 * optional Connector connector = 120;
 * @return {?proto.speech.tts.lucid.Connector}
 */
proto.speech.tts.lucid.LucidPiece.prototype.getConnector = function() {
  return /** @type{?proto.speech.tts.lucid.Connector} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.lucid.Connector, 120));
};


/**
 * @param {?proto.speech.tts.lucid.Connector|undefined} value
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
*/
proto.speech.tts.lucid.LucidPiece.prototype.setConnector = function(value) {
  return jspb.Message.setOneofWrapperField(this, 120, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.LucidPiece} returns this
 */
proto.speech.tts.lucid.LucidPiece.prototype.clearConnector = function() {
  return jspb.Message.clearOneofWrapperField(this, 120, proto.speech.tts.lucid.LucidPiece.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.LucidPiece.prototype.hasConnector = function() {
  return jspb.Message.hasField(this, 120);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.lucid.LucidPiece}
 */
proto.speech.tts.lucid.LucidPiece.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.lucid.LucidPiece, data);
};



//speech/tts/public/lucid/lucid_markup_proto_jspb/lucidutterance.jspb.js
// source: speech/tts/public/lucid/lucid_markup.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.lucid.LucidUtterance');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.speech.tts.lucid.Annotation');
goog.require('proto.speech.tts.lucid.LucidPiece');
goog.require('proto.speech.tts.lucid.SpanAnnotation');
goog.requireType('jspb.ByteSource');
goog.requireType('jspb.ExtensionFieldBinaryInfo');
goog.requireType('jspb.ExtensionFieldInfo');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.lucid.LucidUtterance = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, 5, proto.speech.tts.lucid.LucidUtterance.repeatedFields_, null);
};
goog.inherits(proto.speech.tts.lucid.LucidUtterance, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.lucid.LucidUtterance.displayName = 'proto.speech.tts.lucid.LucidUtterance';
}

/**
 * The extensions registered with this message class. This is a map of
 * extension field number to fieldInfo object. This field should be considered
 * a private API (it is public because it is needed by other generated code).
 *
 * For example:
 *     { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} }
 *
 * fieldName contains the JsCompiler renamed field name property so that it
 * works in OPTIMIZED mode.
 *
 * @type {!Object<number, jspb.ExtensionFieldInfo>}
 */
proto.speech.tts.lucid.LucidUtterance.extensions = {};


/**
 * The extensions registered with this message class. This is a map of
 * extension field number to fieldInfo object. This field should be considered
 * a private API (it is public because it is needed by other generated code).
 *
 * For example:
 *     { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} }
 *
 * fieldName contains the JsCompiler renamed field name property so that it
 * works in OPTIMIZED mode.
 *
 * @type {!Object<number, jspb.ExtensionFieldBinaryInfo>}
 */
proto.speech.tts.lucid.LucidUtterance.extensionsBinary = {};


/**
 * List of repeated fields within this message type.
 * @private {!Array<number>}
 * @const
 */
proto.speech.tts.lucid.LucidUtterance.repeatedFields_ = [1,3];



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.lucid.LucidUtterance.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.lucid.LucidUtterance.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.lucid.LucidUtterance} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.LucidUtterance.toObject = function(includeInstance, msg) {
  let f, obj = {
    piecesList: jspb.Message.toObjectList(msg.getPiecesList(),
    proto.speech.tts.lucid.LucidPiece.toObject, includeInstance),
    annotation: (f = msg.getAnnotation()) && proto.speech.tts.lucid.Annotation.toObject(includeInstance, f),
    spanAnnotationsList: jspb.Message.toObjectList(msg.getSpanAnnotationsList(),
    proto.speech.tts.lucid.SpanAnnotation.toObject, includeInstance),
    attemptSentenceSplitting: (f = jspb.Message.getBooleanField(msg, 4)) == null ? undefined : f
  };

  jspb.Message.toObjectExtension(/** @type {!jspb.Message} */ (msg), obj,
      proto.speech.tts.lucid.LucidUtterance.extensions, proto.speech.tts.lucid.LucidUtterance.prototype.getExtension,
      includeInstance);
  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of LucidUtterance as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.lucid.LucidUtterance.ObjectFormat = function() {
  /** @type {?Array<!proto.speech.tts.lucid.LucidPiece.ObjectFormat>|undefined} */
  this.piecesList;

  /** @type {?proto.speech.tts.lucid.Annotation.ObjectFormat|undefined} */
  this.annotation;

  /** @type {?Array<!proto.speech.tts.lucid.SpanAnnotation.ObjectFormat>|undefined} */
  this.spanAnnotationsList;

  /** @type {?boolean|undefined} */
  this.attemptSentenceSplitting;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.lucid.LucidUtterance.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.lucid.LucidUtterance}
 */
proto.speech.tts.lucid.LucidUtterance.fromObject = function(obj) {
  const msg = new proto.speech.tts.lucid.LucidUtterance();
  obj.piecesList && jspb.Message.setRepeatedWrapperField(
      msg, 1, obj.piecesList.map(
          proto.speech.tts.lucid.LucidPiece.fromObject));
  obj.annotation && jspb.Message.setWrapperField(
      msg, 2, proto.speech.tts.lucid.Annotation.fromObject(obj.annotation));
  obj.spanAnnotationsList && jspb.Message.setRepeatedWrapperField(
      msg, 3, obj.spanAnnotationsList.map(
          proto.speech.tts.lucid.SpanAnnotation.fromObject));
  obj.attemptSentenceSplitting != null && jspb.Message.setField(msg, 4, obj.attemptSentenceSplitting);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.lucid.LucidUtterance}
 */
proto.speech.tts.lucid.LucidUtterance.deserializeBinary = function(bytes) {
  return proto.speech.tts.lucid.LucidUtterance.deserializeBinaryFromReader(
      new proto.speech.tts.lucid.LucidUtterance(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.lucid.LucidUtterance} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.lucid.LucidUtterance}
 */
proto.speech.tts.lucid.LucidUtterance.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = new proto.speech.tts.lucid.LucidPiece();
      reader.readMessage(value,proto.speech.tts.lucid.LucidPiece.deserializeBinaryFromReader);
      msg.addPieces(value);
      break;
    case 2:
      value = new proto.speech.tts.lucid.Annotation();
      reader.readMessage(value,proto.speech.tts.lucid.Annotation.deserializeBinaryFromReader);
      msg.setAnnotation(value);
      break;
    case 3:
      value = new proto.speech.tts.lucid.SpanAnnotation();
      reader.readMessage(value,proto.speech.tts.lucid.SpanAnnotation.deserializeBinaryFromReader);
      msg.addSpanAnnotations(value);
      break;
    case 4:
      value = /** @type {boolean} */ (reader.readBool());
      msg.setAttemptSentenceSplitting(value);
      break;
    default:
      jspb.Message.readBinaryExtension(msg, reader,
        proto.speech.tts.lucid.LucidUtterance.extensionsBinary,
        proto.speech.tts.lucid.LucidUtterance.prototype.getExtension,
        proto.speech.tts.lucid.LucidUtterance.prototype.setExtension);
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.lucid.LucidUtterance.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.lucid.LucidUtterance.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.lucid.LucidUtterance} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.LucidUtterance.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = message.getPiecesList();
  if (f.length > 0) {
    writer.writeRepeatedMessage(
      1,
      f,
      proto.speech.tts.lucid.LucidPiece.serializeBinaryToWriter
    );
  }
  f = message.getAnnotation();
  if (f != null) {
    writer.writeMessage(
      2,
      f,
      proto.speech.tts.lucid.Annotation.serializeBinaryToWriter
    );
  }
  f = message.getSpanAnnotationsList();
  if (f.length > 0) {
    writer.writeRepeatedMessage(
      3,
      f,
      proto.speech.tts.lucid.SpanAnnotation.serializeBinaryToWriter
    );
  }
  f = /** @type {?boolean} */ (jspb.Message.getField(message, 4));
  if (f != null) {
    writer.writeBool(
      4,
      f
    );
  }
  jspb.Message.serializeBinaryExtensions(message, writer,
    proto.speech.tts.lucid.LucidUtterance.extensionsBinary, proto.speech.tts.lucid.LucidUtterance.prototype.getExtension);
};


/**
 * repeated LucidPiece pieces = 1;
 * @return {!Array<!proto.speech.tts.lucid.LucidPiece>}
 */
proto.speech.tts.lucid.LucidUtterance.prototype.getPiecesList = function() {
  return /** @type{!Array<!proto.speech.tts.lucid.LucidPiece>} */ (
    jspb.Message.getRepeatedWrapperField(this, proto.speech.tts.lucid.LucidPiece, 1));
};


/**
 * @param {Array<!proto.speech.tts.lucid.LucidPiece>|undefined} value
 * @return {!proto.speech.tts.lucid.LucidUtterance} returns this
*/
proto.speech.tts.lucid.LucidUtterance.prototype.setPiecesList = function(value) {
  return jspb.Message.setRepeatedWrapperField(this, 1, value);
};


/**
 * @param {!proto.speech.tts.lucid.LucidPiece=} opt_value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.lucid.LucidPiece}
 */
proto.speech.tts.lucid.LucidUtterance.prototype.addPieces = function(opt_value, opt_index) {
  return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.speech.tts.lucid.LucidPiece, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.lucid.LucidUtterance} returns this
 */
proto.speech.tts.lucid.LucidUtterance.prototype.clearPiecesList = function() {
  return jspb.Message.clearRepeatedWrapperField(this, 1);
};


/**
 * optional Annotation annotation = 2;
 * @return {?proto.speech.tts.lucid.Annotation}
 */
proto.speech.tts.lucid.LucidUtterance.prototype.getAnnotation = function() {
  return /** @type{?proto.speech.tts.lucid.Annotation} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.lucid.Annotation, 2));
};


/**
 * @param {?proto.speech.tts.lucid.Annotation|undefined} value
 * @return {!proto.speech.tts.lucid.LucidUtterance} returns this
*/
proto.speech.tts.lucid.LucidUtterance.prototype.setAnnotation = function(value) {
  return jspb.Message.setWrapperField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.LucidUtterance} returns this
 */
proto.speech.tts.lucid.LucidUtterance.prototype.clearAnnotation = function() {
  return jspb.Message.clearWrapperField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.LucidUtterance.prototype.hasAnnotation = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * repeated SpanAnnotation span_annotations = 3;
 * @return {!Array<!proto.speech.tts.lucid.SpanAnnotation>}
 */
proto.speech.tts.lucid.LucidUtterance.prototype.getSpanAnnotationsList = function() {
  return /** @type{!Array<!proto.speech.tts.lucid.SpanAnnotation>} */ (
    jspb.Message.getRepeatedWrapperField(this, proto.speech.tts.lucid.SpanAnnotation, 3));
};


/**
 * @param {Array<!proto.speech.tts.lucid.SpanAnnotation>|undefined} value
 * @return {!proto.speech.tts.lucid.LucidUtterance} returns this
*/
proto.speech.tts.lucid.LucidUtterance.prototype.setSpanAnnotationsList = function(value) {
  return jspb.Message.setRepeatedWrapperField(this, 3, value);
};


/**
 * @param {!proto.speech.tts.lucid.SpanAnnotation=} opt_value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.lucid.SpanAnnotation}
 */
proto.speech.tts.lucid.LucidUtterance.prototype.addSpanAnnotations = function(opt_value, opt_index) {
  return jspb.Message.addToRepeatedWrapperField(this, 3, opt_value, proto.speech.tts.lucid.SpanAnnotation, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.lucid.LucidUtterance} returns this
 */
proto.speech.tts.lucid.LucidUtterance.prototype.clearSpanAnnotationsList = function() {
  return jspb.Message.clearRepeatedWrapperField(this, 3);
};


/**
 * optional bool attempt_sentence_splitting = 4;
 * @return {?boolean}
 */
proto.speech.tts.lucid.LucidUtterance.prototype.getAttemptSentenceSplitting = function() {
  return /** @type {?boolean} */ (jspb.Message.getBooleanField(this, 4));
};


/**
 * @param {?boolean|undefined} value
 * @return {!proto.speech.tts.lucid.LucidUtterance} returns this
 */
proto.speech.tts.lucid.LucidUtterance.prototype.setAttemptSentenceSplitting = function(value) {
  return jspb.Message.setField(this, 4, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.LucidUtterance} returns this
 */
proto.speech.tts.lucid.LucidUtterance.prototype.clearAttemptSentenceSplitting = function() {
  return jspb.Message.clearField(this, 4);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.LucidUtterance.prototype.hasAttemptSentenceSplitting = function() {
  return jspb.Message.hasField(this, 4);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.lucid.LucidUtterance}
 */
proto.speech.tts.lucid.LucidUtterance.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.lucid.LucidUtterance, data);
};



//speech/tts/public/lucid/lucid_markup_proto_jspb/multisentencetext.jspb.js
// source: speech/tts/public/lucid/lucid_markup.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.lucid.MultiSentenceText');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.speech.tts.lucid.Annotation');
goog.requireType('jspb.ByteSource');
goog.requireType('jspb.ExtensionFieldBinaryInfo');
goog.requireType('jspb.ExtensionFieldInfo');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.lucid.MultiSentenceText = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, 3, null, null);
};
goog.inherits(proto.speech.tts.lucid.MultiSentenceText, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.lucid.MultiSentenceText.displayName = 'proto.speech.tts.lucid.MultiSentenceText';
}

/**
 * The extensions registered with this message class. This is a map of
 * extension field number to fieldInfo object. This field should be considered
 * a private API (it is public because it is needed by other generated code).
 *
 * For example:
 *     { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} }
 *
 * fieldName contains the JsCompiler renamed field name property so that it
 * works in OPTIMIZED mode.
 *
 * @type {!Object<number, jspb.ExtensionFieldInfo>}
 */
proto.speech.tts.lucid.MultiSentenceText.extensions = {};


/**
 * The extensions registered with this message class. This is a map of
 * extension field number to fieldInfo object. This field should be considered
 * a private API (it is public because it is needed by other generated code).
 *
 * For example:
 *     { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} }
 *
 * fieldName contains the JsCompiler renamed field name property so that it
 * works in OPTIMIZED mode.
 *
 * @type {!Object<number, jspb.ExtensionFieldBinaryInfo>}
 */
proto.speech.tts.lucid.MultiSentenceText.extensionsBinary = {};




if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.lucid.MultiSentenceText.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.lucid.MultiSentenceText.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.lucid.MultiSentenceText} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.MultiSentenceText.toObject = function(includeInstance, msg) {
  let f, obj = {
    text: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    annotation: (f = msg.getAnnotation()) && proto.speech.tts.lucid.Annotation.toObject(includeInstance, f)
  };

  jspb.Message.toObjectExtension(/** @type {!jspb.Message} */ (msg), obj,
      proto.speech.tts.lucid.MultiSentenceText.extensions, proto.speech.tts.lucid.MultiSentenceText.prototype.getExtension,
      includeInstance);
  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of MultiSentenceText as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.lucid.MultiSentenceText.ObjectFormat = function() {
  /** @type {?string|undefined} */
  this.text;

  /** @type {?proto.speech.tts.lucid.Annotation.ObjectFormat|undefined} */
  this.annotation;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.lucid.MultiSentenceText.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.lucid.MultiSentenceText}
 */
proto.speech.tts.lucid.MultiSentenceText.fromObject = function(obj) {
  const msg = new proto.speech.tts.lucid.MultiSentenceText();
  obj.text != null && jspb.Message.setField(msg, 1, obj.text);
  obj.annotation && jspb.Message.setWrapperField(
      msg, 2, proto.speech.tts.lucid.Annotation.fromObject(obj.annotation));
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.lucid.MultiSentenceText}
 */
proto.speech.tts.lucid.MultiSentenceText.deserializeBinary = function(bytes) {
  return proto.speech.tts.lucid.MultiSentenceText.deserializeBinaryFromReader(
      new proto.speech.tts.lucid.MultiSentenceText(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.lucid.MultiSentenceText} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.lucid.MultiSentenceText}
 */
proto.speech.tts.lucid.MultiSentenceText.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {string} */ (reader.readString());
      msg.setText(value);
      break;
    case 2:
      value = new proto.speech.tts.lucid.Annotation();
      reader.readMessage(value,proto.speech.tts.lucid.Annotation.deserializeBinaryFromReader);
      msg.setAnnotation(value);
      break;
    default:
      jspb.Message.readBinaryExtension(msg, reader,
        proto.speech.tts.lucid.MultiSentenceText.extensionsBinary,
        proto.speech.tts.lucid.MultiSentenceText.prototype.getExtension,
        proto.speech.tts.lucid.MultiSentenceText.prototype.setExtension);
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.lucid.MultiSentenceText.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.lucid.MultiSentenceText.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.lucid.MultiSentenceText} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.MultiSentenceText.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {?string} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeString(
      1,
      f
    );
  }
  f = message.getAnnotation();
  if (f != null) {
    writer.writeMessage(
      2,
      f,
      proto.speech.tts.lucid.Annotation.serializeBinaryToWriter
    );
  }
  jspb.Message.serializeBinaryExtensions(message, writer,
    proto.speech.tts.lucid.MultiSentenceText.extensionsBinary, proto.speech.tts.lucid.MultiSentenceText.prototype.getExtension);
};


/**
 * optional string text = 1;
 * @return {?string}
 */
proto.speech.tts.lucid.MultiSentenceText.prototype.getText = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 1));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.lucid.MultiSentenceText} returns this
 */
proto.speech.tts.lucid.MultiSentenceText.prototype.setText = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.MultiSentenceText} returns this
 */
proto.speech.tts.lucid.MultiSentenceText.prototype.clearText = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.MultiSentenceText.prototype.hasText = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional Annotation annotation = 2;
 * @return {?proto.speech.tts.lucid.Annotation}
 */
proto.speech.tts.lucid.MultiSentenceText.prototype.getAnnotation = function() {
  return /** @type{?proto.speech.tts.lucid.Annotation} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.lucid.Annotation, 2));
};


/**
 * @param {?proto.speech.tts.lucid.Annotation|undefined} value
 * @return {!proto.speech.tts.lucid.MultiSentenceText} returns this
*/
proto.speech.tts.lucid.MultiSentenceText.prototype.setAnnotation = function(value) {
  return jspb.Message.setWrapperField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.MultiSentenceText} returns this
 */
proto.speech.tts.lucid.MultiSentenceText.prototype.clearAnnotation = function() {
  return jspb.Message.clearWrapperField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.MultiSentenceText.prototype.hasAnnotation = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.lucid.MultiSentenceText}
 */
proto.speech.tts.lucid.MultiSentenceText.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.lucid.MultiSentenceText, data);
};



//speech/tts/public/lucid/lucid_markup_proto_jspb/lucidmarkup.jspb.js
// source: speech/tts/public/lucid/lucid_markup.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.lucid.LucidMarkup');
goog.provide('proto.speech.tts.lucid.LucidMarkup.Content');
goog.provide('proto.speech.tts.lucid.LucidMarkup.Content.ItemCase');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.speech.tts.lucid.Annotation');
goog.require('proto.speech.tts.lucid.LucidUtterance');
goog.require('proto.speech.tts.lucid.MultiSentenceText');
goog.requireType('jspb.ByteSource');
goog.requireType('jspb.ExtensionFieldBinaryInfo');
goog.requireType('jspb.ExtensionFieldInfo');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.lucid.LucidMarkup = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, 3, proto.speech.tts.lucid.LucidMarkup.repeatedFields_, null);
};
goog.inherits(proto.speech.tts.lucid.LucidMarkup, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.lucid.LucidMarkup.displayName = 'proto.speech.tts.lucid.LucidMarkup';
}

/**
 * The extensions registered with this message class. This is a map of
 * extension field number to fieldInfo object. This field should be considered
 * a private API (it is public because it is needed by other generated code).
 *
 * For example:
 *     { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} }
 *
 * fieldName contains the JsCompiler renamed field name property so that it
 * works in OPTIMIZED mode.
 *
 * @type {!Object<number, jspb.ExtensionFieldInfo>}
 */
proto.speech.tts.lucid.LucidMarkup.extensions = {};


/**
 * The extensions registered with this message class. This is a map of
 * extension field number to fieldInfo object. This field should be considered
 * a private API (it is public because it is needed by other generated code).
 *
 * For example:
 *     { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} }
 *
 * fieldName contains the JsCompiler renamed field name property so that it
 * works in OPTIMIZED mode.
 *
 * @type {!Object<number, jspb.ExtensionFieldBinaryInfo>}
 */
proto.speech.tts.lucid.LucidMarkup.extensionsBinary = {};

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.lucid.LucidMarkup.Content = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, proto.speech.tts.lucid.LucidMarkup.Content.oneofGroups_);
};
goog.inherits(proto.speech.tts.lucid.LucidMarkup.Content, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.lucid.LucidMarkup.Content.displayName = 'proto.speech.tts.lucid.LucidMarkup.Content';
}

/**
 * List of repeated fields within this message type.
 * @private {!Array<number>}
 * @const
 */
proto.speech.tts.lucid.LucidMarkup.repeatedFields_ = [1];



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.lucid.LucidMarkup.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.lucid.LucidMarkup.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.lucid.LucidMarkup} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.LucidMarkup.toObject = function(includeInstance, msg) {
  let f, obj = {
    contentsList: jspb.Message.toObjectList(msg.getContentsList(),
    proto.speech.tts.lucid.LucidMarkup.Content.toObject, includeInstance),
    annotation: (f = msg.getAnnotation()) && proto.speech.tts.lucid.Annotation.toObject(includeInstance, f)
  };

  jspb.Message.toObjectExtension(/** @type {!jspb.Message} */ (msg), obj,
      proto.speech.tts.lucid.LucidMarkup.extensions, proto.speech.tts.lucid.LucidMarkup.prototype.getExtension,
      includeInstance);
  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of LucidMarkup as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.lucid.LucidMarkup.ObjectFormat = function() {
  /** @type {?Array<!proto.speech.tts.lucid.LucidMarkup.Content.ObjectFormat>|undefined} */
  this.contentsList;

  /** @type {?proto.speech.tts.lucid.Annotation.ObjectFormat|undefined} */
  this.annotation;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.lucid.LucidMarkup.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.lucid.LucidMarkup}
 */
proto.speech.tts.lucid.LucidMarkup.fromObject = function(obj) {
  const msg = new proto.speech.tts.lucid.LucidMarkup();
  obj.contentsList && jspb.Message.setRepeatedWrapperField(
      msg, 1, obj.contentsList.map(
          proto.speech.tts.lucid.LucidMarkup.Content.fromObject));
  obj.annotation && jspb.Message.setWrapperField(
      msg, 2, proto.speech.tts.lucid.Annotation.fromObject(obj.annotation));
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.lucid.LucidMarkup}
 */
proto.speech.tts.lucid.LucidMarkup.deserializeBinary = function(bytes) {
  return proto.speech.tts.lucid.LucidMarkup.deserializeBinaryFromReader(
      new proto.speech.tts.lucid.LucidMarkup(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.lucid.LucidMarkup} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.lucid.LucidMarkup}
 */
proto.speech.tts.lucid.LucidMarkup.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = new proto.speech.tts.lucid.LucidMarkup.Content();
      reader.readMessage(value,proto.speech.tts.lucid.LucidMarkup.Content.deserializeBinaryFromReader);
      msg.addContents(value);
      break;
    case 2:
      value = new proto.speech.tts.lucid.Annotation();
      reader.readMessage(value,proto.speech.tts.lucid.Annotation.deserializeBinaryFromReader);
      msg.setAnnotation(value);
      break;
    default:
      jspb.Message.readBinaryExtension(msg, reader,
        proto.speech.tts.lucid.LucidMarkup.extensionsBinary,
        proto.speech.tts.lucid.LucidMarkup.prototype.getExtension,
        proto.speech.tts.lucid.LucidMarkup.prototype.setExtension);
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.lucid.LucidMarkup.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.lucid.LucidMarkup.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.lucid.LucidMarkup} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.LucidMarkup.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = message.getContentsList();
  if (f.length > 0) {
    writer.writeRepeatedMessage(
      1,
      f,
      proto.speech.tts.lucid.LucidMarkup.Content.serializeBinaryToWriter
    );
  }
  f = message.getAnnotation();
  if (f != null) {
    writer.writeMessage(
      2,
      f,
      proto.speech.tts.lucid.Annotation.serializeBinaryToWriter
    );
  }
  jspb.Message.serializeBinaryExtensions(message, writer,
    proto.speech.tts.lucid.LucidMarkup.extensionsBinary, proto.speech.tts.lucid.LucidMarkup.prototype.getExtension);
};



/**
 * Oneof group definitions for this message. Each group defines the field
 * numbers belonging to that group. When of these fields' value is set, all
 * other fields in the group are cleared. During deserialization, if multiple
 * fields are encountered for a group, only the last value seen will be kept.
 * @private {!Array<!Array<number>>}
 * @const
 */
proto.speech.tts.lucid.LucidMarkup.Content.oneofGroups_ = [[2,3]];

/**
 * @enum {number}
 */
proto.speech.tts.lucid.LucidMarkup.Content.ItemCase = {
  ITEM_NOT_SET: 0,
  UTTERANCE: 2,
  MAYBE_MULTI_SENTENCE: 3
};

/**
 * @return {!proto.speech.tts.lucid.LucidMarkup.Content.ItemCase}
 */
proto.speech.tts.lucid.LucidMarkup.Content.prototype.getItemCase = function() {
  return /** @type {!proto.speech.tts.lucid.LucidMarkup.Content.ItemCase} */(jspb.Message.computeOneofCase(this, proto.speech.tts.lucid.LucidMarkup.Content.oneofGroups_[0]));
};



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.lucid.LucidMarkup.Content.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.lucid.LucidMarkup.Content.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.lucid.LucidMarkup.Content} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.LucidMarkup.Content.toObject = function(includeInstance, msg) {
  let f, obj = {
    ownIndex: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    utterance: (f = msg.getUtterance()) && proto.speech.tts.lucid.LucidUtterance.toObject(includeInstance, f),
    maybeMultiSentence: (f = msg.getMaybeMultiSentence()) && proto.speech.tts.lucid.MultiSentenceText.toObject(includeInstance, f)
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of Content as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.lucid.LucidMarkup.Content.ObjectFormat = function() {
  /** @type {?number|undefined} */
  this.ownIndex;

  /** @type {?proto.speech.tts.lucid.LucidUtterance.ObjectFormat|undefined} */
  this.utterance;

  /** @type {?proto.speech.tts.lucid.MultiSentenceText.ObjectFormat|undefined} */
  this.maybeMultiSentence;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.lucid.LucidMarkup.Content.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.lucid.LucidMarkup.Content}
 */
proto.speech.tts.lucid.LucidMarkup.Content.fromObject = function(obj) {
  const msg = new proto.speech.tts.lucid.LucidMarkup.Content();
  obj.ownIndex != null && jspb.Message.setField(msg, 1, obj.ownIndex);
  obj.utterance && jspb.Message.setOneofWrapperField(
      msg, 2, proto.speech.tts.lucid.LucidMarkup.Content.oneofGroups_[0], proto.speech.tts.lucid.LucidUtterance.fromObject(obj.utterance));
  obj.maybeMultiSentence && jspb.Message.setOneofWrapperField(
      msg, 3, proto.speech.tts.lucid.LucidMarkup.Content.oneofGroups_[0], proto.speech.tts.lucid.MultiSentenceText.fromObject(obj.maybeMultiSentence));
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.lucid.LucidMarkup.Content}
 */
proto.speech.tts.lucid.LucidMarkup.Content.deserializeBinary = function(bytes) {
  return proto.speech.tts.lucid.LucidMarkup.Content.deserializeBinaryFromReader(
      new proto.speech.tts.lucid.LucidMarkup.Content(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.lucid.LucidMarkup.Content} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.lucid.LucidMarkup.Content}
 */
proto.speech.tts.lucid.LucidMarkup.Content.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {number} */ (reader.readInt32());
      msg.setOwnIndex(value);
      break;
    case 2:
      value = new proto.speech.tts.lucid.LucidUtterance();
      reader.readMessage(value,proto.speech.tts.lucid.LucidUtterance.deserializeBinaryFromReader);
      msg.setUtterance(value);
      break;
    case 3:
      value = new proto.speech.tts.lucid.MultiSentenceText();
      reader.readMessage(value,proto.speech.tts.lucid.MultiSentenceText.deserializeBinaryFromReader);
      msg.setMaybeMultiSentence(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.lucid.LucidMarkup.Content.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.lucid.LucidMarkup.Content.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.lucid.LucidMarkup.Content} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.lucid.LucidMarkup.Content.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {?number} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeInt32(
      1,
      f
    );
  }
  f = message.getUtterance();
  if (f != null) {
    writer.writeMessage(
      2,
      f,
      proto.speech.tts.lucid.LucidUtterance.serializeBinaryToWriter
    );
  }
  f = message.getMaybeMultiSentence();
  if (f != null) {
    writer.writeMessage(
      3,
      f,
      proto.speech.tts.lucid.MultiSentenceText.serializeBinaryToWriter
    );
  }
};


/**
 * optional int32 own_index = 1;
 * @return {?number}
 */
proto.speech.tts.lucid.LucidMarkup.Content.prototype.getOwnIndex = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 1));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.speech.tts.lucid.LucidMarkup.Content} returns this
 */
proto.speech.tts.lucid.LucidMarkup.Content.prototype.setOwnIndex = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.LucidMarkup.Content} returns this
 */
proto.speech.tts.lucid.LucidMarkup.Content.prototype.clearOwnIndex = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.LucidMarkup.Content.prototype.hasOwnIndex = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional LucidUtterance utterance = 2;
 * @return {?proto.speech.tts.lucid.LucidUtterance}
 */
proto.speech.tts.lucid.LucidMarkup.Content.prototype.getUtterance = function() {
  return /** @type{?proto.speech.tts.lucid.LucidUtterance} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.lucid.LucidUtterance, 2));
};


/**
 * @param {?proto.speech.tts.lucid.LucidUtterance|undefined} value
 * @return {!proto.speech.tts.lucid.LucidMarkup.Content} returns this
*/
proto.speech.tts.lucid.LucidMarkup.Content.prototype.setUtterance = function(value) {
  return jspb.Message.setOneofWrapperField(this, 2, proto.speech.tts.lucid.LucidMarkup.Content.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.LucidMarkup.Content} returns this
 */
proto.speech.tts.lucid.LucidMarkup.Content.prototype.clearUtterance = function() {
  return jspb.Message.clearOneofWrapperField(this, 2, proto.speech.tts.lucid.LucidMarkup.Content.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.LucidMarkup.Content.prototype.hasUtterance = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional MultiSentenceText maybe_multi_sentence = 3;
 * @return {?proto.speech.tts.lucid.MultiSentenceText}
 * @deprecated
 */
proto.speech.tts.lucid.LucidMarkup.Content.prototype.getMaybeMultiSentence = function() {
  return /** @type{?proto.speech.tts.lucid.MultiSentenceText} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.lucid.MultiSentenceText, 3));
};


/**
 * @param {?proto.speech.tts.lucid.MultiSentenceText|undefined} value
 * @return {!proto.speech.tts.lucid.LucidMarkup.Content} returns this
 * @deprecated
*/
proto.speech.tts.lucid.LucidMarkup.Content.prototype.setMaybeMultiSentence = function(value) {
  return jspb.Message.setOneofWrapperField(this, 3, proto.speech.tts.lucid.LucidMarkup.Content.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.LucidMarkup.Content} returns this
 * @deprecated
 */
proto.speech.tts.lucid.LucidMarkup.Content.prototype.clearMaybeMultiSentence = function() {
  return jspb.Message.clearOneofWrapperField(this, 3, proto.speech.tts.lucid.LucidMarkup.Content.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 * @deprecated
 */
proto.speech.tts.lucid.LucidMarkup.Content.prototype.hasMaybeMultiSentence = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.lucid.LucidMarkup.Content}
 */
proto.speech.tts.lucid.LucidMarkup.Content.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.lucid.LucidMarkup.Content, data);
};


/**
 * repeated Content contents = 1;
 * @return {!Array<!proto.speech.tts.lucid.LucidMarkup.Content>}
 */
proto.speech.tts.lucid.LucidMarkup.prototype.getContentsList = function() {
  return /** @type{!Array<!proto.speech.tts.lucid.LucidMarkup.Content>} */ (
    jspb.Message.getRepeatedWrapperField(this, proto.speech.tts.lucid.LucidMarkup.Content, 1));
};


/**
 * @param {Array<!proto.speech.tts.lucid.LucidMarkup.Content>|undefined} value
 * @return {!proto.speech.tts.lucid.LucidMarkup} returns this
*/
proto.speech.tts.lucid.LucidMarkup.prototype.setContentsList = function(value) {
  return jspb.Message.setRepeatedWrapperField(this, 1, value);
};


/**
 * @param {!proto.speech.tts.lucid.LucidMarkup.Content=} opt_value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.lucid.LucidMarkup.Content}
 */
proto.speech.tts.lucid.LucidMarkup.prototype.addContents = function(opt_value, opt_index) {
  return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.speech.tts.lucid.LucidMarkup.Content, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.lucid.LucidMarkup} returns this
 */
proto.speech.tts.lucid.LucidMarkup.prototype.clearContentsList = function() {
  return jspb.Message.clearRepeatedWrapperField(this, 1);
};


/**
 * optional Annotation annotation = 2;
 * @return {?proto.speech.tts.lucid.Annotation}
 */
proto.speech.tts.lucid.LucidMarkup.prototype.getAnnotation = function() {
  return /** @type{?proto.speech.tts.lucid.Annotation} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.lucid.Annotation, 2));
};


/**
 * @param {?proto.speech.tts.lucid.Annotation|undefined} value
 * @return {!proto.speech.tts.lucid.LucidMarkup} returns this
*/
proto.speech.tts.lucid.LucidMarkup.prototype.setAnnotation = function(value) {
  return jspb.Message.setWrapperField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.lucid.LucidMarkup} returns this
 */
proto.speech.tts.lucid.LucidMarkup.prototype.clearAnnotation = function() {
  return jspb.Message.clearWrapperField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.lucid.LucidMarkup.prototype.hasAnnotation = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.lucid.LucidMarkup}
 */
proto.speech.tts.lucid.LucidMarkup.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.lucid.LucidMarkup, data);
};



//speech/tts/public/lexicon_proto_jspb/lexiconproto.jspb.js
// source: speech/tts/public/lexicon.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.LexiconProto');
goog.provide('proto.speech.tts.LexiconProto.CrossLingualInfo');
goog.provide('proto.speech.tts.LexiconProto.Entry');
goog.provide('proto.speech.tts.LexiconProto.Entry.Syntax');
goog.provide('proto.speech.tts.LexiconProto.ExpandedPronunciation');
goog.provide('proto.speech.tts.LexiconProto.Morphology');
goog.provide('proto.speech.tts.LexiconProto.Morphology.Animacy');
goog.provide('proto.speech.tts.LexiconProto.Morphology.Gender');
goog.provide('proto.speech.tts.LexiconProto.Morphology.Number');
goog.provide('proto.speech.tts.LexiconProto.Morphology.PartOfSpeech');
goog.provide('proto.speech.tts.LexiconProto.Pronunciation');
goog.provide('proto.speech.tts.LexiconProto.Pronunciation.PronunciationType');
goog.provide('proto.speech.tts.LexiconProto.Spelling');
goog.provide('proto.speech.tts.LexiconProto.Syllable');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.LexiconProto = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, proto.speech.tts.LexiconProto.repeatedFields_, null);
};
goog.inherits(proto.speech.tts.LexiconProto, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.LexiconProto.displayName = 'proto.speech.tts.LexiconProto';
}
/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.LexiconProto.Pronunciation = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.speech.tts.LexiconProto.Pronunciation, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.LexiconProto.Pronunciation.displayName = 'proto.speech.tts.LexiconProto.Pronunciation';
}
/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.LexiconProto.Spelling = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.speech.tts.LexiconProto.Spelling, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.LexiconProto.Spelling.displayName = 'proto.speech.tts.LexiconProto.Spelling';
}
/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.LexiconProto.ExpandedPronunciation = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, proto.speech.tts.LexiconProto.ExpandedPronunciation.repeatedFields_, null);
};
goog.inherits(proto.speech.tts.LexiconProto.ExpandedPronunciation, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.LexiconProto.ExpandedPronunciation.displayName = 'proto.speech.tts.LexiconProto.ExpandedPronunciation';
}
/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.LexiconProto.Syllable = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, proto.speech.tts.LexiconProto.Syllable.repeatedFields_, null);
};
goog.inherits(proto.speech.tts.LexiconProto.Syllable, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.LexiconProto.Syllable.displayName = 'proto.speech.tts.LexiconProto.Syllable';
}
/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.LexiconProto.Morphology = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.speech.tts.LexiconProto.Morphology, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.LexiconProto.Morphology.displayName = 'proto.speech.tts.LexiconProto.Morphology';
}
/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.LexiconProto.Entry = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, proto.speech.tts.LexiconProto.Entry.repeatedFields_, null);
};
goog.inherits(proto.speech.tts.LexiconProto.Entry, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.LexiconProto.Entry.displayName = 'proto.speech.tts.LexiconProto.Entry';
}
/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.LexiconProto.CrossLingualInfo = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.speech.tts.LexiconProto.CrossLingualInfo, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.LexiconProto.CrossLingualInfo.displayName = 'proto.speech.tts.LexiconProto.CrossLingualInfo';
}

/**
 * List of repeated fields within this message type.
 * @private {!Array<number>}
 * @const
 */
proto.speech.tts.LexiconProto.repeatedFields_ = [2];



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.LexiconProto.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.LexiconProto.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.LexiconProto} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.LexiconProto.toObject = function(includeInstance, msg) {
  let f, obj = {
    header: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    wList: jspb.Message.toObjectList(msg.getWList(),
    proto.speech.tts.LexiconProto.Entry.toObject, includeInstance),
    legalVowels: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f,
    crossLingual: (f = msg.getCrossLingual()) && proto.speech.tts.LexiconProto.CrossLingualInfo.toObject(includeInstance, f),
    isTsampa: (f = jspb.Message.getBooleanField(msg, 5)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of LexiconProto as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.LexiconProto.ObjectFormat = function() {
  /** @type {?string|undefined} */
  this.header;

  /** @type {?Array<!proto.speech.tts.LexiconProto.Entry.ObjectFormat>|undefined} */
  this.wList;

  /** @type {?string|undefined} */
  this.legalVowels;

  /** @type {?proto.speech.tts.LexiconProto.CrossLingualInfo.ObjectFormat|undefined} */
  this.crossLingual;

  /** @type {?boolean|undefined} */
  this.isTsampa;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.LexiconProto.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.LexiconProto}
 */
proto.speech.tts.LexiconProto.fromObject = function(obj) {
  const msg = new proto.speech.tts.LexiconProto();
  obj.header != null && jspb.Message.setField(msg, 1, obj.header);
  obj.wList && jspb.Message.setRepeatedWrapperField(
      msg, 2, obj.wList.map(
          proto.speech.tts.LexiconProto.Entry.fromObject));
  obj.legalVowels != null && jspb.Message.setField(msg, 3, obj.legalVowels);
  obj.crossLingual && jspb.Message.setWrapperField(
      msg, 4, proto.speech.tts.LexiconProto.CrossLingualInfo.fromObject(obj.crossLingual));
  obj.isTsampa != null && jspb.Message.setField(msg, 5, obj.isTsampa);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.LexiconProto}
 */
proto.speech.tts.LexiconProto.deserializeBinary = function(bytes) {
  return proto.speech.tts.LexiconProto.deserializeBinaryFromReader(
      new proto.speech.tts.LexiconProto(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.LexiconProto} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.LexiconProto}
 */
proto.speech.tts.LexiconProto.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {string} */ (reader.readString());
      msg.setHeader(value);
      break;
    case 2:
      value = new proto.speech.tts.LexiconProto.Entry();
      reader.readMessage(value,proto.speech.tts.LexiconProto.Entry.deserializeBinaryFromReader);
      msg.addW(value);
      break;
    case 3:
      value = /** @type {string} */ (reader.readString());
      msg.setLegalVowels(value);
      break;
    case 4:
      value = new proto.speech.tts.LexiconProto.CrossLingualInfo();
      reader.readMessage(value,proto.speech.tts.LexiconProto.CrossLingualInfo.deserializeBinaryFromReader);
      msg.setCrossLingual(value);
      break;
    case 5:
      value = /** @type {boolean} */ (reader.readBool());
      msg.setIsTsampa(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.LexiconProto.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.LexiconProto.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.LexiconProto} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.LexiconProto.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {string} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeString(
      1,
      f
    );
  }
  f = message.getWList();
  if (f.length > 0) {
    writer.writeRepeatedMessage(
      2,
      f,
      proto.speech.tts.LexiconProto.Entry.serializeBinaryToWriter
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeString(
      3,
      f
    );
  }
  f = message.getCrossLingual();
  if (f != null) {
    writer.writeMessage(
      4,
      f,
      proto.speech.tts.LexiconProto.CrossLingualInfo.serializeBinaryToWriter
    );
  }
  f = /** @type {boolean} */ (jspb.Message.getField(message, 5));
  if (f != null) {
    writer.writeBool(
      5,
      f
    );
  }
};





if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.LexiconProto.Pronunciation.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.LexiconProto.Pronunciation.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.LexiconProto.Pronunciation} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.LexiconProto.Pronunciation.toObject = function(includeInstance, msg) {
  let f, obj = {
    id: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    v: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f,
    t: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of Pronunciation as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.LexiconProto.Pronunciation.ObjectFormat = function() {
  /** @type {?string|undefined} */
  this.id;

  /** @type {?string|undefined} */
  this.v;

  /** @type {?number|undefined} */
  this.t;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.LexiconProto.Pronunciation.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.LexiconProto.Pronunciation}
 */
proto.speech.tts.LexiconProto.Pronunciation.fromObject = function(obj) {
  const msg = new proto.speech.tts.LexiconProto.Pronunciation();
  obj.id != null && jspb.Message.setField(msg, 1, obj.id);
  obj.v != null && jspb.Message.setField(msg, 2, obj.v);
  obj.t != null && jspb.Message.setField(msg, 3, obj.t);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.LexiconProto.Pronunciation}
 */
proto.speech.tts.LexiconProto.Pronunciation.deserializeBinary = function(bytes) {
  return proto.speech.tts.LexiconProto.Pronunciation.deserializeBinaryFromReader(
      new proto.speech.tts.LexiconProto.Pronunciation(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.LexiconProto.Pronunciation} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.LexiconProto.Pronunciation}
 */
proto.speech.tts.LexiconProto.Pronunciation.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {string} */ (reader.readString());
      msg.setId(value);
      break;
    case 2:
      value = /** @type {string} */ (reader.readString());
      msg.setV(value);
      break;
    case 3:
      value = /** @type {!proto.speech.tts.LexiconProto.Pronunciation.PronunciationType} */ (reader.readEnum());
      msg.setT(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.LexiconProto.Pronunciation.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.LexiconProto.Pronunciation.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.LexiconProto.Pronunciation} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.LexiconProto.Pronunciation.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {string} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeString(
      1,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeString(
      2,
      f
    );
  }
  f = /** @type {!proto.speech.tts.LexiconProto.Pronunciation.PronunciationType} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeEnum(
      3,
      f
    );
  }
};


/**
 * @enum {number}
 */
proto.speech.tts.LexiconProto.Pronunciation.PronunciationType = {
  UNKNOWN: 0,
  CANONICAL: 1,
  REDUCED: 2,
  ALT1: 3,
  ALT2: 4,
  NOT_SUITABLE_FOR_TTS: 5,
  CANONICAL_FROM_PRON_LEARNING: 6
};

/**
 * required string id = 1;
 * @return {string}
 */
proto.speech.tts.LexiconProto.Pronunciation.prototype.getId = function() {
  return jspb.Message.getStringFieldWithDefault(this, 1);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.LexiconProto.Pronunciation} returns this
 */
proto.speech.tts.LexiconProto.Pronunciation.prototype.setId = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.LexiconProto.Pronunciation} returns this
 */
proto.speech.tts.LexiconProto.Pronunciation.prototype.clearId = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.LexiconProto.Pronunciation.prototype.hasId = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * required string v = 2;
 * @return {string}
 */
proto.speech.tts.LexiconProto.Pronunciation.prototype.getV = function() {
  return jspb.Message.getStringFieldWithDefault(this, 2);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.LexiconProto.Pronunciation} returns this
 */
proto.speech.tts.LexiconProto.Pronunciation.prototype.setV = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.LexiconProto.Pronunciation} returns this
 */
proto.speech.tts.LexiconProto.Pronunciation.prototype.clearV = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.LexiconProto.Pronunciation.prototype.hasV = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional PronunciationType t = 3;
 * @return {!proto.speech.tts.LexiconProto.Pronunciation.PronunciationType}
 */
proto.speech.tts.LexiconProto.Pronunciation.prototype.getT = function() {
  return /** @type {!proto.speech.tts.LexiconProto.Pronunciation.PronunciationType} */ (jspb.Message.getFieldWithDefault(this, 3, 0));
};


/**
 * @param {!proto.speech.tts.LexiconProto.Pronunciation.PronunciationType} value
 * @return {!proto.speech.tts.LexiconProto.Pronunciation} returns this
 */
proto.speech.tts.LexiconProto.Pronunciation.prototype.setT = function(value) {
  return jspb.Message.setField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.LexiconProto.Pronunciation} returns this
 */
proto.speech.tts.LexiconProto.Pronunciation.prototype.clearT = function() {
  return jspb.Message.clearField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.LexiconProto.Pronunciation.prototype.hasT = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.LexiconProto.Pronunciation}
 */
proto.speech.tts.LexiconProto.Pronunciation.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.LexiconProto.Pronunciation, data);
};





if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.LexiconProto.Spelling.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.LexiconProto.Spelling.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.LexiconProto.Spelling} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.LexiconProto.Spelling.toObject = function(includeInstance, msg) {
  let f, obj = {
    id: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    v: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of Spelling as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.LexiconProto.Spelling.ObjectFormat = function() {
  /** @type {?string|undefined} */
  this.id;

  /** @type {?string|undefined} */
  this.v;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.LexiconProto.Spelling.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.LexiconProto.Spelling}
 */
proto.speech.tts.LexiconProto.Spelling.fromObject = function(obj) {
  const msg = new proto.speech.tts.LexiconProto.Spelling();
  obj.id != null && jspb.Message.setField(msg, 1, obj.id);
  obj.v != null && jspb.Message.setField(msg, 2, obj.v);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.LexiconProto.Spelling}
 */
proto.speech.tts.LexiconProto.Spelling.deserializeBinary = function(bytes) {
  return proto.speech.tts.LexiconProto.Spelling.deserializeBinaryFromReader(
      new proto.speech.tts.LexiconProto.Spelling(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.LexiconProto.Spelling} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.LexiconProto.Spelling}
 */
proto.speech.tts.LexiconProto.Spelling.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {string} */ (reader.readString());
      msg.setId(value);
      break;
    case 2:
      value = /** @type {string} */ (reader.readString());
      msg.setV(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.LexiconProto.Spelling.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.LexiconProto.Spelling.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.LexiconProto.Spelling} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.LexiconProto.Spelling.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {string} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeString(
      1,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeString(
      2,
      f
    );
  }
};


/**
 * required string id = 1;
 * @return {string}
 */
proto.speech.tts.LexiconProto.Spelling.prototype.getId = function() {
  return jspb.Message.getStringFieldWithDefault(this, 1);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.LexiconProto.Spelling} returns this
 */
proto.speech.tts.LexiconProto.Spelling.prototype.setId = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.LexiconProto.Spelling} returns this
 */
proto.speech.tts.LexiconProto.Spelling.prototype.clearId = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.LexiconProto.Spelling.prototype.hasId = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * required string v = 2;
 * @return {string}
 */
proto.speech.tts.LexiconProto.Spelling.prototype.getV = function() {
  return jspb.Message.getStringFieldWithDefault(this, 2);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.LexiconProto.Spelling} returns this
 */
proto.speech.tts.LexiconProto.Spelling.prototype.setV = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.LexiconProto.Spelling} returns this
 */
proto.speech.tts.LexiconProto.Spelling.prototype.clearV = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.LexiconProto.Spelling.prototype.hasV = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.LexiconProto.Spelling}
 */
proto.speech.tts.LexiconProto.Spelling.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.LexiconProto.Spelling, data);
};



/**
 * List of repeated fields within this message type.
 * @private {!Array<number>}
 * @const
 */
proto.speech.tts.LexiconProto.ExpandedPronunciation.repeatedFields_ = [1];



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.LexiconProto.ExpandedPronunciation.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.LexiconProto.ExpandedPronunciation.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.LexiconProto.ExpandedPronunciation} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.LexiconProto.ExpandedPronunciation.toObject = function(includeInstance, msg) {
  let f, obj = {
    syllableList: jspb.Message.toObjectList(msg.getSyllableList(),
    proto.speech.tts.LexiconProto.Syllable.toObject, includeInstance)
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of ExpandedPronunciation as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.LexiconProto.ExpandedPronunciation.ObjectFormat = function() {
  /** @type {?Array<!proto.speech.tts.LexiconProto.Syllable.ObjectFormat>|undefined} */
  this.syllableList;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.LexiconProto.ExpandedPronunciation.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.LexiconProto.ExpandedPronunciation}
 */
proto.speech.tts.LexiconProto.ExpandedPronunciation.fromObject = function(obj) {
  const msg = new proto.speech.tts.LexiconProto.ExpandedPronunciation();
  obj.syllableList && jspb.Message.setRepeatedWrapperField(
      msg, 1, obj.syllableList.map(
          proto.speech.tts.LexiconProto.Syllable.fromObject));
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.LexiconProto.ExpandedPronunciation}
 */
proto.speech.tts.LexiconProto.ExpandedPronunciation.deserializeBinary = function(bytes) {
  return proto.speech.tts.LexiconProto.ExpandedPronunciation.deserializeBinaryFromReader(
      new proto.speech.tts.LexiconProto.ExpandedPronunciation(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.LexiconProto.ExpandedPronunciation} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.LexiconProto.ExpandedPronunciation}
 */
proto.speech.tts.LexiconProto.ExpandedPronunciation.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = new proto.speech.tts.LexiconProto.Syllable();
      reader.readMessage(value,proto.speech.tts.LexiconProto.Syllable.deserializeBinaryFromReader);
      msg.addSyllable(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.LexiconProto.ExpandedPronunciation.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.LexiconProto.ExpandedPronunciation.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.LexiconProto.ExpandedPronunciation} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.LexiconProto.ExpandedPronunciation.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = message.getSyllableList();
  if (f.length > 0) {
    writer.writeRepeatedMessage(
      1,
      f,
      proto.speech.tts.LexiconProto.Syllable.serializeBinaryToWriter
    );
  }
};


/**
 * repeated Syllable syllable = 1;
 * @return {!Array<!proto.speech.tts.LexiconProto.Syllable>}
 */
proto.speech.tts.LexiconProto.ExpandedPronunciation.prototype.getSyllableList = function() {
  return /** @type{!Array<!proto.speech.tts.LexiconProto.Syllable>} */ (
    jspb.Message.getRepeatedWrapperField(this, proto.speech.tts.LexiconProto.Syllable, 1));
};


/**
 * @param {!Array<!proto.speech.tts.LexiconProto.Syllable>} value
 * @return {!proto.speech.tts.LexiconProto.ExpandedPronunciation} returns this
*/
proto.speech.tts.LexiconProto.ExpandedPronunciation.prototype.setSyllableList = function(value) {
  return jspb.Message.setRepeatedWrapperField(this, 1, value);
};


/**
 * @param {!proto.speech.tts.LexiconProto.Syllable=} opt_value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.LexiconProto.Syllable}
 */
proto.speech.tts.LexiconProto.ExpandedPronunciation.prototype.addSyllable = function(opt_value, opt_index) {
  return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.speech.tts.LexiconProto.Syllable, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.LexiconProto.ExpandedPronunciation} returns this
 */
proto.speech.tts.LexiconProto.ExpandedPronunciation.prototype.clearSyllableList = function() {
  return jspb.Message.clearRepeatedWrapperField(this, 1);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.LexiconProto.ExpandedPronunciation}
 */
proto.speech.tts.LexiconProto.ExpandedPronunciation.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.LexiconProto.ExpandedPronunciation, data);
};



/**
 * List of repeated fields within this message type.
 * @private {!Array<number>}
 * @const
 */
proto.speech.tts.LexiconProto.Syllable.repeatedFields_ = [3,4];



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.LexiconProto.Syllable.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.LexiconProto.Syllable.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.LexiconProto.Syllable} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.LexiconProto.Syllable.toObject = function(includeInstance, msg) {
  let f, obj = {
    stress: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    vowel: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f,
    onsetList: (f = jspb.Message.getRepeatedField(msg, 3)) == null ? undefined : f,
    codaList: (f = jspb.Message.getRepeatedField(msg, 4)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of Syllable as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.LexiconProto.Syllable.ObjectFormat = function() {
  /** @type {?number|undefined} */
  this.stress;

  /** @type {?string|undefined} */
  this.vowel;

  /** @type {?Array<string>|undefined} */
  this.onsetList;

  /** @type {?Array<string>|undefined} */
  this.codaList;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.LexiconProto.Syllable.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.LexiconProto.Syllable}
 */
proto.speech.tts.LexiconProto.Syllable.fromObject = function(obj) {
  const msg = new proto.speech.tts.LexiconProto.Syllable();
  obj.stress != null && jspb.Message.setField(msg, 1, obj.stress);
  obj.vowel != null && jspb.Message.setField(msg, 2, obj.vowel);
  obj.onsetList != null && jspb.Message.setField(msg, 3, obj.onsetList);
  obj.codaList != null && jspb.Message.setField(msg, 4, obj.codaList);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.LexiconProto.Syllable}
 */
proto.speech.tts.LexiconProto.Syllable.deserializeBinary = function(bytes) {
  return proto.speech.tts.LexiconProto.Syllable.deserializeBinaryFromReader(
      new proto.speech.tts.LexiconProto.Syllable(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.LexiconProto.Syllable} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.LexiconProto.Syllable}
 */
proto.speech.tts.LexiconProto.Syllable.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {number} */ (reader.readInt32());
      msg.setStress(value);
      break;
    case 2:
      value = /** @type {string} */ (reader.readString());
      msg.setVowel(value);
      break;
    case 3:
      value = /** @type {string} */ (reader.readString());
      msg.addOnset(value);
      break;
    case 4:
      value = /** @type {string} */ (reader.readString());
      msg.addCoda(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.LexiconProto.Syllable.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.LexiconProto.Syllable.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.LexiconProto.Syllable} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.LexiconProto.Syllable.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {number} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeInt32(
      1,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeString(
      2,
      f
    );
  }
  f = message.getOnsetList();
  if (f.length > 0) {
    writer.writeRepeatedString(
      3,
      f
    );
  }
  f = message.getCodaList();
  if (f.length > 0) {
    writer.writeRepeatedString(
      4,
      f
    );
  }
};


/**
 * required int32 stress = 1;
 * @return {number}
 */
proto.speech.tts.LexiconProto.Syllable.prototype.getStress = function() {
  return jspb.Message.getIntegerFieldWithDefault(this, 1);
};


/**
 * @param {number} value
 * @return {!proto.speech.tts.LexiconProto.Syllable} returns this
 */
proto.speech.tts.LexiconProto.Syllable.prototype.setStress = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.LexiconProto.Syllable} returns this
 */
proto.speech.tts.LexiconProto.Syllable.prototype.clearStress = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.LexiconProto.Syllable.prototype.hasStress = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * required string vowel = 2;
 * @return {string}
 */
proto.speech.tts.LexiconProto.Syllable.prototype.getVowel = function() {
  return jspb.Message.getStringFieldWithDefault(this, 2);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.LexiconProto.Syllable} returns this
 */
proto.speech.tts.LexiconProto.Syllable.prototype.setVowel = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.LexiconProto.Syllable} returns this
 */
proto.speech.tts.LexiconProto.Syllable.prototype.clearVowel = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.LexiconProto.Syllable.prototype.hasVowel = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * repeated string onset = 3;
 * @return {!Array<string>}
 */
proto.speech.tts.LexiconProto.Syllable.prototype.getOnsetList = function() {
  return /** @type {!Array<string>} */ (jspb.Message.getRepeatedField(this, 3));
};


/**
 * @param {!Array<string>} value
 * @return {!proto.speech.tts.LexiconProto.Syllable} returns this
 */
proto.speech.tts.LexiconProto.Syllable.prototype.setOnsetList = function(value) {
  return jspb.Message.setField(this, 3, value || []);
};


/**
 * @param {string} value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.LexiconProto.Syllable} returns this
 */
proto.speech.tts.LexiconProto.Syllable.prototype.addOnset = function(value, opt_index) {
  return jspb.Message.addToRepeatedField(this, 3, value, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.LexiconProto.Syllable} returns this
 */
proto.speech.tts.LexiconProto.Syllable.prototype.clearOnsetList = function() {
  return jspb.Message.clearRepeatedField(this, 3);
};


/**
 * repeated string coda = 4;
 * @return {!Array<string>}
 */
proto.speech.tts.LexiconProto.Syllable.prototype.getCodaList = function() {
  return /** @type {!Array<string>} */ (jspb.Message.getRepeatedField(this, 4));
};


/**
 * @param {!Array<string>} value
 * @return {!proto.speech.tts.LexiconProto.Syllable} returns this
 */
proto.speech.tts.LexiconProto.Syllable.prototype.setCodaList = function(value) {
  return jspb.Message.setField(this, 4, value || []);
};


/**
 * @param {string} value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.LexiconProto.Syllable} returns this
 */
proto.speech.tts.LexiconProto.Syllable.prototype.addCoda = function(value, opt_index) {
  return jspb.Message.addToRepeatedField(this, 4, value, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.LexiconProto.Syllable} returns this
 */
proto.speech.tts.LexiconProto.Syllable.prototype.clearCodaList = function() {
  return jspb.Message.clearRepeatedField(this, 4);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.LexiconProto.Syllable}
 */
proto.speech.tts.LexiconProto.Syllable.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.LexiconProto.Syllable, data);
};





if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.LexiconProto.Morphology.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.LexiconProto.Morphology.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.LexiconProto.Morphology} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.LexiconProto.Morphology.toObject = function(includeInstance, msg) {
  let f, obj = {
    pos: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    gender: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f,
    animacy: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f,
    number: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of Morphology as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.LexiconProto.Morphology.ObjectFormat = function() {
  /** @type {?number|undefined} */
  this.pos;

  /** @type {?number|undefined} */
  this.gender;

  /** @type {?number|undefined} */
  this.animacy;

  /** @type {?number|undefined} */
  this.number;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.LexiconProto.Morphology.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.LexiconProto.Morphology}
 */
proto.speech.tts.LexiconProto.Morphology.fromObject = function(obj) {
  const msg = new proto.speech.tts.LexiconProto.Morphology();
  obj.pos != null && jspb.Message.setField(msg, 1, obj.pos);
  obj.gender != null && jspb.Message.setField(msg, 2, obj.gender);
  obj.animacy != null && jspb.Message.setField(msg, 3, obj.animacy);
  obj.number != null && jspb.Message.setField(msg, 4, obj.number);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.LexiconProto.Morphology}
 */
proto.speech.tts.LexiconProto.Morphology.deserializeBinary = function(bytes) {
  return proto.speech.tts.LexiconProto.Morphology.deserializeBinaryFromReader(
      new proto.speech.tts.LexiconProto.Morphology(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.LexiconProto.Morphology} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.LexiconProto.Morphology}
 */
proto.speech.tts.LexiconProto.Morphology.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {!proto.speech.tts.LexiconProto.Morphology.PartOfSpeech} */ (reader.readEnum());
      msg.setPos(value);
      break;
    case 2:
      value = /** @type {!proto.speech.tts.LexiconProto.Morphology.Gender} */ (reader.readEnum());
      msg.setGender(value);
      break;
    case 3:
      value = /** @type {!proto.speech.tts.LexiconProto.Morphology.Animacy} */ (reader.readEnum());
      msg.setAnimacy(value);
      break;
    case 4:
      value = /** @type {!proto.speech.tts.LexiconProto.Morphology.Number} */ (reader.readEnum());
      msg.setNumber(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.LexiconProto.Morphology.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.LexiconProto.Morphology.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.LexiconProto.Morphology} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.LexiconProto.Morphology.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {!proto.speech.tts.LexiconProto.Morphology.PartOfSpeech} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeEnum(
      1,
      f
    );
  }
  f = /** @type {!proto.speech.tts.LexiconProto.Morphology.Gender} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeEnum(
      2,
      f
    );
  }
  f = /** @type {!proto.speech.tts.LexiconProto.Morphology.Animacy} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeEnum(
      3,
      f
    );
  }
  f = /** @type {!proto.speech.tts.LexiconProto.Morphology.Number} */ (jspb.Message.getField(message, 4));
  if (f != null) {
    writer.writeEnum(
      4,
      f
    );
  }
};


/**
 * @enum {number}
 */
proto.speech.tts.LexiconProto.Morphology.PartOfSpeech = {
  UNKNOWN_POS: 0,
  NOUN: 1,
  PRONOUN: 2,
  ADJECTIVE: 3,
  VERB: 4,
  ADVERB: 5,
  PREPOSITION: 6,
  CONJUNCTION: 7,
  INTERJECTION: 8
};

/**
 * @enum {number}
 */
proto.speech.tts.LexiconProto.Morphology.Gender = {
  UNKNOWN_GENDER: 0,
  NEU: 1,
  MAS: 2,
  FEM: 3
};

/**
 * @enum {number}
 */
proto.speech.tts.LexiconProto.Morphology.Animacy = {
  UNKNOWN_ANIMACY: 0,
  ANIMATE: 1,
  INANIMATE: 2
};

/**
 * @enum {number}
 */
proto.speech.tts.LexiconProto.Morphology.Number = {
  UNKNOWN_NUMBER: 0,
  SINGLE: 1,
  DUAL: 2,
  PLU: 3
};

/**
 * optional PartOfSpeech pos = 1;
 * @return {!proto.speech.tts.LexiconProto.Morphology.PartOfSpeech}
 */
proto.speech.tts.LexiconProto.Morphology.prototype.getPos = function() {
  return /** @type {!proto.speech.tts.LexiconProto.Morphology.PartOfSpeech} */ (jspb.Message.getFieldWithDefault(this, 1, 0));
};


/**
 * @param {!proto.speech.tts.LexiconProto.Morphology.PartOfSpeech} value
 * @return {!proto.speech.tts.LexiconProto.Morphology} returns this
 */
proto.speech.tts.LexiconProto.Morphology.prototype.setPos = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.LexiconProto.Morphology} returns this
 */
proto.speech.tts.LexiconProto.Morphology.prototype.clearPos = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.LexiconProto.Morphology.prototype.hasPos = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional Gender gender = 2;
 * @return {!proto.speech.tts.LexiconProto.Morphology.Gender}
 */
proto.speech.tts.LexiconProto.Morphology.prototype.getGender = function() {
  return /** @type {!proto.speech.tts.LexiconProto.Morphology.Gender} */ (jspb.Message.getFieldWithDefault(this, 2, 0));
};


/**
 * @param {!proto.speech.tts.LexiconProto.Morphology.Gender} value
 * @return {!proto.speech.tts.LexiconProto.Morphology} returns this
 */
proto.speech.tts.LexiconProto.Morphology.prototype.setGender = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.LexiconProto.Morphology} returns this
 */
proto.speech.tts.LexiconProto.Morphology.prototype.clearGender = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.LexiconProto.Morphology.prototype.hasGender = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional Animacy animacy = 3;
 * @return {!proto.speech.tts.LexiconProto.Morphology.Animacy}
 */
proto.speech.tts.LexiconProto.Morphology.prototype.getAnimacy = function() {
  return /** @type {!proto.speech.tts.LexiconProto.Morphology.Animacy} */ (jspb.Message.getFieldWithDefault(this, 3, 0));
};


/**
 * @param {!proto.speech.tts.LexiconProto.Morphology.Animacy} value
 * @return {!proto.speech.tts.LexiconProto.Morphology} returns this
 */
proto.speech.tts.LexiconProto.Morphology.prototype.setAnimacy = function(value) {
  return jspb.Message.setField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.LexiconProto.Morphology} returns this
 */
proto.speech.tts.LexiconProto.Morphology.prototype.clearAnimacy = function() {
  return jspb.Message.clearField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.LexiconProto.Morphology.prototype.hasAnimacy = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * optional Number number = 4;
 * @return {!proto.speech.tts.LexiconProto.Morphology.Number}
 */
proto.speech.tts.LexiconProto.Morphology.prototype.getNumber = function() {
  return /** @type {!proto.speech.tts.LexiconProto.Morphology.Number} */ (jspb.Message.getFieldWithDefault(this, 4, 0));
};


/**
 * @param {!proto.speech.tts.LexiconProto.Morphology.Number} value
 * @return {!proto.speech.tts.LexiconProto.Morphology} returns this
 */
proto.speech.tts.LexiconProto.Morphology.prototype.setNumber = function(value) {
  return jspb.Message.setField(this, 4, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.LexiconProto.Morphology} returns this
 */
proto.speech.tts.LexiconProto.Morphology.prototype.clearNumber = function() {
  return jspb.Message.clearField(this, 4);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.LexiconProto.Morphology.prototype.hasNumber = function() {
  return jspb.Message.hasField(this, 4);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.LexiconProto.Morphology}
 */
proto.speech.tts.LexiconProto.Morphology.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.LexiconProto.Morphology, data);
};



/**
 * List of repeated fields within this message type.
 * @private {!Array<number>}
 * @const
 */
proto.speech.tts.LexiconProto.Entry.repeatedFields_ = [2,3,7];



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.LexiconProto.Entry.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.LexiconProto.Entry.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.LexiconProto.Entry} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.LexiconProto.Entry.toObject = function(includeInstance, msg) {
  let f, obj = {
    id: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    pList: jspb.Message.toObjectList(msg.getPList(),
    proto.speech.tts.LexiconProto.Pronunciation.toObject, includeInstance),
    sList: jspb.Message.toObjectList(msg.getSList(),
    proto.speech.tts.LexiconProto.Spelling.toObject, includeInstance),
    c: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f,
    syn: jspb.Message.getFieldWithDefault(msg, 5, 0),
    m: (f = msg.getM()) && proto.speech.tts.LexiconProto.Morphology.toObject(includeInstance, f),
    altList: (f = jspb.Message.getRepeatedField(msg, 7)) == null ? undefined : f,
    obs: (f = jspb.Message.getBooleanField(msg, 8)) == null ? undefined : f,
    languageOfOrigin: (f = jspb.Message.getField(msg, 9)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of Entry as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.LexiconProto.Entry.ObjectFormat = function() {
  /** @type {?string|undefined} */
  this.id;

  /** @type {?Array<!proto.speech.tts.LexiconProto.Pronunciation.ObjectFormat>|undefined} */
  this.pList;

  /** @type {?Array<!proto.speech.tts.LexiconProto.Spelling.ObjectFormat>|undefined} */
  this.sList;

  /** @type {?string|undefined} */
  this.c;

  /** @type {?number|undefined} */
  this.syn;

  /** @type {?proto.speech.tts.LexiconProto.Morphology.ObjectFormat|undefined} */
  this.m;

  /** @type {?Array<string>|undefined} */
  this.altList;

  /** @type {?boolean|undefined} */
  this.obs;

  /** @type {?string|undefined} */
  this.languageOfOrigin;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.LexiconProto.Entry.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.LexiconProto.Entry}
 */
proto.speech.tts.LexiconProto.Entry.fromObject = function(obj) {
  const msg = new proto.speech.tts.LexiconProto.Entry();
  obj.id != null && jspb.Message.setField(msg, 1, obj.id);
  obj.pList && jspb.Message.setRepeatedWrapperField(
      msg, 2, obj.pList.map(
          proto.speech.tts.LexiconProto.Pronunciation.fromObject));
  obj.sList && jspb.Message.setRepeatedWrapperField(
      msg, 3, obj.sList.map(
          proto.speech.tts.LexiconProto.Spelling.fromObject));
  obj.c != null && jspb.Message.setField(msg, 4, obj.c);
  obj.syn != null && jspb.Message.setField(msg, 5, obj.syn);
  obj.m && jspb.Message.setWrapperField(
      msg, 6, proto.speech.tts.LexiconProto.Morphology.fromObject(obj.m));
  obj.altList != null && jspb.Message.setField(msg, 7, obj.altList);
  obj.obs != null && jspb.Message.setField(msg, 8, obj.obs);
  obj.languageOfOrigin != null && jspb.Message.setField(msg, 9, obj.languageOfOrigin);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.LexiconProto.Entry}
 */
proto.speech.tts.LexiconProto.Entry.deserializeBinary = function(bytes) {
  return proto.speech.tts.LexiconProto.Entry.deserializeBinaryFromReader(
      new proto.speech.tts.LexiconProto.Entry(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.LexiconProto.Entry} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.LexiconProto.Entry}
 */
proto.speech.tts.LexiconProto.Entry.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {string} */ (reader.readString());
      msg.setId(value);
      break;
    case 2:
      value = new proto.speech.tts.LexiconProto.Pronunciation();
      reader.readMessage(value,proto.speech.tts.LexiconProto.Pronunciation.deserializeBinaryFromReader);
      msg.addP(value);
      break;
    case 3:
      value = new proto.speech.tts.LexiconProto.Spelling();
      reader.readMessage(value,proto.speech.tts.LexiconProto.Spelling.deserializeBinaryFromReader);
      msg.addS(value);
      break;
    case 4:
      value = /** @type {string} */ (reader.readString());
      msg.setC(value);
      break;
    case 5:
      value = /** @type {!proto.speech.tts.LexiconProto.Entry.Syntax} */ (reader.readEnum());
      msg.setSyn(value);
      break;
    case 6:
      value = new proto.speech.tts.LexiconProto.Morphology();
      reader.readMessage(value,proto.speech.tts.LexiconProto.Morphology.deserializeBinaryFromReader);
      msg.setM(value);
      break;
    case 7:
      value = /** @type {string} */ (reader.readString());
      msg.addAlt(value);
      break;
    case 8:
      value = /** @type {boolean} */ (reader.readBool());
      msg.setObs(value);
      break;
    case 9:
      value = /** @type {string} */ (reader.readString());
      msg.setLanguageOfOrigin(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.LexiconProto.Entry.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.LexiconProto.Entry.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.LexiconProto.Entry} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.LexiconProto.Entry.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {string} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeString(
      1,
      f
    );
  }
  f = message.getPList();
  if (f.length > 0) {
    writer.writeRepeatedMessage(
      2,
      f,
      proto.speech.tts.LexiconProto.Pronunciation.serializeBinaryToWriter
    );
  }
  f = message.getSList();
  if (f.length > 0) {
    writer.writeRepeatedMessage(
      3,
      f,
      proto.speech.tts.LexiconProto.Spelling.serializeBinaryToWriter
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 4));
  if (f != null) {
    writer.writeString(
      4,
      f
    );
  }
  f = /** @type {!proto.speech.tts.LexiconProto.Entry.Syntax} */ (jspb.Message.getField(message, 5));
  if (f != null) {
    writer.writeEnum(
      5,
      f
    );
  }
  f = message.getM();
  if (f != null) {
    writer.writeMessage(
      6,
      f,
      proto.speech.tts.LexiconProto.Morphology.serializeBinaryToWriter
    );
  }
  f = message.getAltList();
  if (f.length > 0) {
    writer.writeRepeatedString(
      7,
      f
    );
  }
  f = /** @type {boolean} */ (jspb.Message.getField(message, 8));
  if (f != null) {
    writer.writeBool(
      8,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 9));
  if (f != null) {
    writer.writeString(
      9,
      f
    );
  }
};


/**
 * @enum {number}
 */
proto.speech.tts.LexiconProto.Entry.Syntax = {
  UNSPECIFIED: 0,
  FUNCTION: 1,
  CONTENT: 2,
  NAME: 3,
  PLACE: 4,
  FOREIGN: 5,
  FIRST_NAME: 6,
  LAST_NAME: 7,
  FUNCTION_NR: 8,
  FUNCTION_AR: 9,
  FOREIGN_FUNCTION_AR: 10,
  SILENCE: 11,
  SPELLING_EXCEPTION: 12,
  /** @deprecated */
  LSEQ_EXCEPTION: 13,
  LETTER: 14,
  FOREIGN_LETTER: 15,
  NON_PHONOTACTIC: 16
};

/**
 * required string id = 1;
 * @return {string}
 */
proto.speech.tts.LexiconProto.Entry.prototype.getId = function() {
  return jspb.Message.getStringFieldWithDefault(this, 1);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.LexiconProto.Entry} returns this
 */
proto.speech.tts.LexiconProto.Entry.prototype.setId = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.LexiconProto.Entry} returns this
 */
proto.speech.tts.LexiconProto.Entry.prototype.clearId = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.LexiconProto.Entry.prototype.hasId = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * repeated Pronunciation p = 2;
 * @return {!Array<!proto.speech.tts.LexiconProto.Pronunciation>}
 */
proto.speech.tts.LexiconProto.Entry.prototype.getPList = function() {
  return /** @type{!Array<!proto.speech.tts.LexiconProto.Pronunciation>} */ (
    jspb.Message.getRepeatedWrapperField(this, proto.speech.tts.LexiconProto.Pronunciation, 2));
};


/**
 * @param {!Array<!proto.speech.tts.LexiconProto.Pronunciation>} value
 * @return {!proto.speech.tts.LexiconProto.Entry} returns this
*/
proto.speech.tts.LexiconProto.Entry.prototype.setPList = function(value) {
  return jspb.Message.setRepeatedWrapperField(this, 2, value);
};


/**
 * @param {!proto.speech.tts.LexiconProto.Pronunciation=} opt_value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.LexiconProto.Pronunciation}
 */
proto.speech.tts.LexiconProto.Entry.prototype.addP = function(opt_value, opt_index) {
  return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.speech.tts.LexiconProto.Pronunciation, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.LexiconProto.Entry} returns this
 */
proto.speech.tts.LexiconProto.Entry.prototype.clearPList = function() {
  return jspb.Message.clearRepeatedWrapperField(this, 2);
};


/**
 * repeated Spelling s = 3;
 * @return {!Array<!proto.speech.tts.LexiconProto.Spelling>}
 */
proto.speech.tts.LexiconProto.Entry.prototype.getSList = function() {
  return /** @type{!Array<!proto.speech.tts.LexiconProto.Spelling>} */ (
    jspb.Message.getRepeatedWrapperField(this, proto.speech.tts.LexiconProto.Spelling, 3));
};


/**
 * @param {!Array<!proto.speech.tts.LexiconProto.Spelling>} value
 * @return {!proto.speech.tts.LexiconProto.Entry} returns this
*/
proto.speech.tts.LexiconProto.Entry.prototype.setSList = function(value) {
  return jspb.Message.setRepeatedWrapperField(this, 3, value);
};


/**
 * @param {!proto.speech.tts.LexiconProto.Spelling=} opt_value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.LexiconProto.Spelling}
 */
proto.speech.tts.LexiconProto.Entry.prototype.addS = function(opt_value, opt_index) {
  return jspb.Message.addToRepeatedWrapperField(this, 3, opt_value, proto.speech.tts.LexiconProto.Spelling, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.LexiconProto.Entry} returns this
 */
proto.speech.tts.LexiconProto.Entry.prototype.clearSList = function() {
  return jspb.Message.clearRepeatedWrapperField(this, 3);
};


/**
 * required string c = 4;
 * @return {string}
 */
proto.speech.tts.LexiconProto.Entry.prototype.getC = function() {
  return jspb.Message.getStringFieldWithDefault(this, 4);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.LexiconProto.Entry} returns this
 */
proto.speech.tts.LexiconProto.Entry.prototype.setC = function(value) {
  return jspb.Message.setField(this, 4, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.LexiconProto.Entry} returns this
 */
proto.speech.tts.LexiconProto.Entry.prototype.clearC = function() {
  return jspb.Message.clearField(this, 4);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.LexiconProto.Entry.prototype.hasC = function() {
  return jspb.Message.hasField(this, 4);
};


/**
 * optional Syntax syn = 5;
 * @return {!proto.speech.tts.LexiconProto.Entry.Syntax}
 */
proto.speech.tts.LexiconProto.Entry.prototype.getSyn = function() {
  return /** @type {!proto.speech.tts.LexiconProto.Entry.Syntax} */ (jspb.Message.getFieldWithDefault(this, 5, 0));
};


/**
 * @param {!proto.speech.tts.LexiconProto.Entry.Syntax} value
 * @return {!proto.speech.tts.LexiconProto.Entry} returns this
 */
proto.speech.tts.LexiconProto.Entry.prototype.setSyn = function(value) {
  return jspb.Message.setField(this, 5, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.LexiconProto.Entry} returns this
 */
proto.speech.tts.LexiconProto.Entry.prototype.clearSyn = function() {
  return jspb.Message.clearField(this, 5);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.LexiconProto.Entry.prototype.hasSyn = function() {
  return jspb.Message.hasField(this, 5);
};


/**
 * optional Morphology m = 6;
 * @return {?proto.speech.tts.LexiconProto.Morphology}
 */
proto.speech.tts.LexiconProto.Entry.prototype.getM = function() {
  return /** @type{?proto.speech.tts.LexiconProto.Morphology} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.LexiconProto.Morphology, 6));
};


/**
 * @param {?proto.speech.tts.LexiconProto.Morphology|undefined} value
 * @return {!proto.speech.tts.LexiconProto.Entry} returns this
*/
proto.speech.tts.LexiconProto.Entry.prototype.setM = function(value) {
  return jspb.Message.setWrapperField(this, 6, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.LexiconProto.Entry} returns this
 */
proto.speech.tts.LexiconProto.Entry.prototype.clearM = function() {
  return jspb.Message.clearWrapperField(this, 6);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.LexiconProto.Entry.prototype.hasM = function() {
  return jspb.Message.hasField(this, 6);
};


/**
 * repeated string alt = 7;
 * @return {!Array<string>}
 */
proto.speech.tts.LexiconProto.Entry.prototype.getAltList = function() {
  return /** @type {!Array<string>} */ (jspb.Message.getRepeatedField(this, 7));
};


/**
 * @param {!Array<string>} value
 * @return {!proto.speech.tts.LexiconProto.Entry} returns this
 */
proto.speech.tts.LexiconProto.Entry.prototype.setAltList = function(value) {
  return jspb.Message.setField(this, 7, value || []);
};


/**
 * @param {string} value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.LexiconProto.Entry} returns this
 */
proto.speech.tts.LexiconProto.Entry.prototype.addAlt = function(value, opt_index) {
  return jspb.Message.addToRepeatedField(this, 7, value, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.LexiconProto.Entry} returns this
 */
proto.speech.tts.LexiconProto.Entry.prototype.clearAltList = function() {
  return jspb.Message.clearRepeatedField(this, 7);
};


/**
 * optional bool obs = 8;
 * @return {boolean}
 */
proto.speech.tts.LexiconProto.Entry.prototype.getObs = function() {
  return jspb.Message.getBooleanFieldWithDefault(this, 8);
};


/**
 * @param {boolean} value
 * @return {!proto.speech.tts.LexiconProto.Entry} returns this
 */
proto.speech.tts.LexiconProto.Entry.prototype.setObs = function(value) {
  return jspb.Message.setField(this, 8, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.LexiconProto.Entry} returns this
 */
proto.speech.tts.LexiconProto.Entry.prototype.clearObs = function() {
  return jspb.Message.clearField(this, 8);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.LexiconProto.Entry.prototype.hasObs = function() {
  return jspb.Message.hasField(this, 8);
};


/**
 * optional string language_of_origin = 9;
 * @return {string}
 */
proto.speech.tts.LexiconProto.Entry.prototype.getLanguageOfOrigin = function() {
  return jspb.Message.getStringFieldWithDefault(this, 9);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.LexiconProto.Entry} returns this
 */
proto.speech.tts.LexiconProto.Entry.prototype.setLanguageOfOrigin = function(value) {
  return jspb.Message.setField(this, 9, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.LexiconProto.Entry} returns this
 */
proto.speech.tts.LexiconProto.Entry.prototype.clearLanguageOfOrigin = function() {
  return jspb.Message.clearField(this, 9);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.LexiconProto.Entry.prototype.hasLanguageOfOrigin = function() {
  return jspb.Message.hasField(this, 9);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.LexiconProto.Entry}
 */
proto.speech.tts.LexiconProto.Entry.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.LexiconProto.Entry, data);
};





if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.LexiconProto.CrossLingualInfo.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.LexiconProto.CrossLingualInfo.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.LexiconProto.CrossLingualInfo} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.LexiconProto.CrossLingualInfo.toObject = function(includeInstance, msg) {
  let f, obj = {
    foreignLanguage: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    foreignRegion: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f,
    nativeLanguage: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f,
    nativeRegion: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of CrossLingualInfo as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.LexiconProto.CrossLingualInfo.ObjectFormat = function() {
  /** @type {?string|undefined} */
  this.foreignLanguage;

  /** @type {?string|undefined} */
  this.foreignRegion;

  /** @type {?string|undefined} */
  this.nativeLanguage;

  /** @type {?string|undefined} */
  this.nativeRegion;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.LexiconProto.CrossLingualInfo.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.LexiconProto.CrossLingualInfo}
 */
proto.speech.tts.LexiconProto.CrossLingualInfo.fromObject = function(obj) {
  const msg = new proto.speech.tts.LexiconProto.CrossLingualInfo();
  obj.foreignLanguage != null && jspb.Message.setField(msg, 1, obj.foreignLanguage);
  obj.foreignRegion != null && jspb.Message.setField(msg, 2, obj.foreignRegion);
  obj.nativeLanguage != null && jspb.Message.setField(msg, 3, obj.nativeLanguage);
  obj.nativeRegion != null && jspb.Message.setField(msg, 4, obj.nativeRegion);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.LexiconProto.CrossLingualInfo}
 */
proto.speech.tts.LexiconProto.CrossLingualInfo.deserializeBinary = function(bytes) {
  return proto.speech.tts.LexiconProto.CrossLingualInfo.deserializeBinaryFromReader(
      new proto.speech.tts.LexiconProto.CrossLingualInfo(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.LexiconProto.CrossLingualInfo} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.LexiconProto.CrossLingualInfo}
 */
proto.speech.tts.LexiconProto.CrossLingualInfo.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {string} */ (reader.readString());
      msg.setForeignLanguage(value);
      break;
    case 2:
      value = /** @type {string} */ (reader.readString());
      msg.setForeignRegion(value);
      break;
    case 3:
      value = /** @type {string} */ (reader.readString());
      msg.setNativeLanguage(value);
      break;
    case 4:
      value = /** @type {string} */ (reader.readString());
      msg.setNativeRegion(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.LexiconProto.CrossLingualInfo.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.LexiconProto.CrossLingualInfo.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.LexiconProto.CrossLingualInfo} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.LexiconProto.CrossLingualInfo.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {string} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeString(
      1,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeString(
      2,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeString(
      3,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 4));
  if (f != null) {
    writer.writeString(
      4,
      f
    );
  }
};


/**
 * optional string foreign_language = 1;
 * @return {string}
 */
proto.speech.tts.LexiconProto.CrossLingualInfo.prototype.getForeignLanguage = function() {
  return jspb.Message.getStringFieldWithDefault(this, 1);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.LexiconProto.CrossLingualInfo} returns this
 */
proto.speech.tts.LexiconProto.CrossLingualInfo.prototype.setForeignLanguage = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.LexiconProto.CrossLingualInfo} returns this
 */
proto.speech.tts.LexiconProto.CrossLingualInfo.prototype.clearForeignLanguage = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.LexiconProto.CrossLingualInfo.prototype.hasForeignLanguage = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional string foreign_region = 2;
 * @return {string}
 */
proto.speech.tts.LexiconProto.CrossLingualInfo.prototype.getForeignRegion = function() {
  return jspb.Message.getStringFieldWithDefault(this, 2);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.LexiconProto.CrossLingualInfo} returns this
 */
proto.speech.tts.LexiconProto.CrossLingualInfo.prototype.setForeignRegion = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.LexiconProto.CrossLingualInfo} returns this
 */
proto.speech.tts.LexiconProto.CrossLingualInfo.prototype.clearForeignRegion = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.LexiconProto.CrossLingualInfo.prototype.hasForeignRegion = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional string native_language = 3;
 * @return {string}
 */
proto.speech.tts.LexiconProto.CrossLingualInfo.prototype.getNativeLanguage = function() {
  return jspb.Message.getStringFieldWithDefault(this, 3);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.LexiconProto.CrossLingualInfo} returns this
 */
proto.speech.tts.LexiconProto.CrossLingualInfo.prototype.setNativeLanguage = function(value) {
  return jspb.Message.setField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.LexiconProto.CrossLingualInfo} returns this
 */
proto.speech.tts.LexiconProto.CrossLingualInfo.prototype.clearNativeLanguage = function() {
  return jspb.Message.clearField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.LexiconProto.CrossLingualInfo.prototype.hasNativeLanguage = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * optional string native_region = 4;
 * @return {string}
 */
proto.speech.tts.LexiconProto.CrossLingualInfo.prototype.getNativeRegion = function() {
  return jspb.Message.getStringFieldWithDefault(this, 4);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.LexiconProto.CrossLingualInfo} returns this
 */
proto.speech.tts.LexiconProto.CrossLingualInfo.prototype.setNativeRegion = function(value) {
  return jspb.Message.setField(this, 4, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.LexiconProto.CrossLingualInfo} returns this
 */
proto.speech.tts.LexiconProto.CrossLingualInfo.prototype.clearNativeRegion = function() {
  return jspb.Message.clearField(this, 4);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.LexiconProto.CrossLingualInfo.prototype.hasNativeRegion = function() {
  return jspb.Message.hasField(this, 4);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.LexiconProto.CrossLingualInfo}
 */
proto.speech.tts.LexiconProto.CrossLingualInfo.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.LexiconProto.CrossLingualInfo, data);
};


/**
 * required string header = 1;
 * @return {string}
 */
proto.speech.tts.LexiconProto.prototype.getHeader = function() {
  return jspb.Message.getStringFieldWithDefault(this, 1);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.LexiconProto} returns this
 */
proto.speech.tts.LexiconProto.prototype.setHeader = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.LexiconProto} returns this
 */
proto.speech.tts.LexiconProto.prototype.clearHeader = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.LexiconProto.prototype.hasHeader = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * repeated Entry w = 2;
 * @return {!Array<!proto.speech.tts.LexiconProto.Entry>}
 */
proto.speech.tts.LexiconProto.prototype.getWList = function() {
  return /** @type{!Array<!proto.speech.tts.LexiconProto.Entry>} */ (
    jspb.Message.getRepeatedWrapperField(this, proto.speech.tts.LexiconProto.Entry, 2));
};


/**
 * @param {!Array<!proto.speech.tts.LexiconProto.Entry>} value
 * @return {!proto.speech.tts.LexiconProto} returns this
*/
proto.speech.tts.LexiconProto.prototype.setWList = function(value) {
  return jspb.Message.setRepeatedWrapperField(this, 2, value);
};


/**
 * @param {!proto.speech.tts.LexiconProto.Entry=} opt_value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.LexiconProto.Entry}
 */
proto.speech.tts.LexiconProto.prototype.addW = function(opt_value, opt_index) {
  return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.speech.tts.LexiconProto.Entry, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.LexiconProto} returns this
 */
proto.speech.tts.LexiconProto.prototype.clearWList = function() {
  return jspb.Message.clearRepeatedWrapperField(this, 2);
};


/**
 * optional string legal_vowels = 3;
 * @return {string}
 */
proto.speech.tts.LexiconProto.prototype.getLegalVowels = function() {
  return jspb.Message.getStringFieldWithDefault(this, 3);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.LexiconProto} returns this
 */
proto.speech.tts.LexiconProto.prototype.setLegalVowels = function(value) {
  return jspb.Message.setField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.LexiconProto} returns this
 */
proto.speech.tts.LexiconProto.prototype.clearLegalVowels = function() {
  return jspb.Message.clearField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.LexiconProto.prototype.hasLegalVowels = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * optional CrossLingualInfo cross_lingual = 4;
 * @return {?proto.speech.tts.LexiconProto.CrossLingualInfo}
 */
proto.speech.tts.LexiconProto.prototype.getCrossLingual = function() {
  return /** @type{?proto.speech.tts.LexiconProto.CrossLingualInfo} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.LexiconProto.CrossLingualInfo, 4));
};


/**
 * @param {?proto.speech.tts.LexiconProto.CrossLingualInfo|undefined} value
 * @return {!proto.speech.tts.LexiconProto} returns this
*/
proto.speech.tts.LexiconProto.prototype.setCrossLingual = function(value) {
  return jspb.Message.setWrapperField(this, 4, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.LexiconProto} returns this
 */
proto.speech.tts.LexiconProto.prototype.clearCrossLingual = function() {
  return jspb.Message.clearWrapperField(this, 4);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.LexiconProto.prototype.hasCrossLingual = function() {
  return jspb.Message.hasField(this, 4);
};


/**
 * optional bool is_tsampa = 5;
 * @return {boolean}
 */
proto.speech.tts.LexiconProto.prototype.getIsTsampa = function() {
  return jspb.Message.getBooleanFieldWithDefault(this, 5);
};


/**
 * @param {boolean} value
 * @return {!proto.speech.tts.LexiconProto} returns this
 */
proto.speech.tts.LexiconProto.prototype.setIsTsampa = function(value) {
  return jspb.Message.setField(this, 5, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.LexiconProto} returns this
 */
proto.speech.tts.LexiconProto.prototype.clearIsTsampa = function() {
  return jspb.Message.clearField(this, 5);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.LexiconProto.prototype.hasIsTsampa = function() {
  return jspb.Message.hasField(this, 5);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.LexiconProto}
 */
proto.speech.tts.LexiconProto.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.LexiconProto, data);
};



//speech/tts/public/tts_markup_proto_jspb/partialsentenceprosody.jspb.js
// source: speech/tts/public/tts_markup.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.PartialSentenceProsody');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.PartialSentenceProsody = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.speech.tts.PartialSentenceProsody, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.PartialSentenceProsody.displayName = 'proto.speech.tts.PartialSentenceProsody';
}



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.PartialSentenceProsody.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.PartialSentenceProsody.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.PartialSentenceProsody} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.PartialSentenceProsody.toObject = function(includeInstance, msg) {
  let f, obj = {
    incompleteAtStart: (f = jspb.Message.getBooleanField(msg, 1)) == null ? undefined : f,
    incompleteAtEnd: (f = jspb.Message.getBooleanField(msg, 2)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of PartialSentenceProsody as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.PartialSentenceProsody.ObjectFormat = function() {
  /** @type {?boolean|undefined} */
  this.incompleteAtStart;

  /** @type {?boolean|undefined} */
  this.incompleteAtEnd;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.PartialSentenceProsody.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.PartialSentenceProsody}
 */
proto.speech.tts.PartialSentenceProsody.fromObject = function(obj) {
  const msg = new proto.speech.tts.PartialSentenceProsody();
  obj.incompleteAtStart != null && jspb.Message.setField(msg, 1, obj.incompleteAtStart);
  obj.incompleteAtEnd != null && jspb.Message.setField(msg, 2, obj.incompleteAtEnd);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.PartialSentenceProsody}
 */
proto.speech.tts.PartialSentenceProsody.deserializeBinary = function(bytes) {
  return proto.speech.tts.PartialSentenceProsody.deserializeBinaryFromReader(
      new proto.speech.tts.PartialSentenceProsody(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.PartialSentenceProsody} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.PartialSentenceProsody}
 */
proto.speech.tts.PartialSentenceProsody.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {boolean} */ (reader.readBool());
      msg.setIncompleteAtStart(value);
      break;
    case 2:
      value = /** @type {boolean} */ (reader.readBool());
      msg.setIncompleteAtEnd(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.PartialSentenceProsody.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.PartialSentenceProsody.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.PartialSentenceProsody} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.PartialSentenceProsody.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {?boolean} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeBool(
      1,
      f
    );
  }
  f = /** @type {?boolean} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeBool(
      2,
      f
    );
  }
};


/**
 * optional bool incomplete_at_start = 1;
 * @return {?boolean}
 */
proto.speech.tts.PartialSentenceProsody.prototype.getIncompleteAtStart = function() {
  return /** @type {?boolean} */ (jspb.Message.getBooleanField(this, 1));
};


/**
 * @param {?boolean|undefined} value
 * @return {!proto.speech.tts.PartialSentenceProsody} returns this
 */
proto.speech.tts.PartialSentenceProsody.prototype.setIncompleteAtStart = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.PartialSentenceProsody} returns this
 */
proto.speech.tts.PartialSentenceProsody.prototype.clearIncompleteAtStart = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.PartialSentenceProsody.prototype.hasIncompleteAtStart = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional bool incomplete_at_end = 2;
 * @return {?boolean}
 */
proto.speech.tts.PartialSentenceProsody.prototype.getIncompleteAtEnd = function() {
  return /** @type {?boolean} */ (jspb.Message.getBooleanField(this, 2));
};


/**
 * @param {?boolean|undefined} value
 * @return {!proto.speech.tts.PartialSentenceProsody} returns this
 */
proto.speech.tts.PartialSentenceProsody.prototype.setIncompleteAtEnd = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.PartialSentenceProsody} returns this
 */
proto.speech.tts.PartialSentenceProsody.prototype.clearIncompleteAtEnd = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.PartialSentenceProsody.prototype.hasIncompleteAtEnd = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.PartialSentenceProsody}
 */
proto.speech.tts.PartialSentenceProsody.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.PartialSentenceProsody, data);
};



//speech/tts/public/morphosyntactic_feature_vector_proto_jspb/morphosyntacticfeaturevector.jspb.js
// source: speech/tts/public/morphosyntactic_feature_vector.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.MorphosyntacticFeatureVector');
goog.provide('proto.speech.tts.MorphosyntacticFeatureVector.Case');
goog.provide('proto.speech.tts.MorphosyntacticFeatureVector.DeclensionType');
goog.provide('proto.speech.tts.MorphosyntacticFeatureVector.Definiteness');
goog.provide('proto.speech.tts.MorphosyntacticFeatureVector.Gender');
goog.provide('proto.speech.tts.MorphosyntacticFeatureVector.Number');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.MorphosyntacticFeatureVector = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.speech.tts.MorphosyntacticFeatureVector, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.MorphosyntacticFeatureVector.displayName = 'proto.speech.tts.MorphosyntacticFeatureVector';
}



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.MorphosyntacticFeatureVector.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.MorphosyntacticFeatureVector.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.MorphosyntacticFeatureVector} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.MorphosyntacticFeatureVector.toObject = function(includeInstance, msg) {
  let f, obj = {
    caseMarker: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    number: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f,
    gender: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f,
    declension: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f,
    definiteness: (f = jspb.Message.getField(msg, 5)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of MorphosyntacticFeatureVector as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.MorphosyntacticFeatureVector.ObjectFormat = function() {
  /** @type {?number|undefined} */
  this.caseMarker;

  /** @type {?number|undefined} */
  this.number;

  /** @type {?number|undefined} */
  this.gender;

  /** @type {?number|undefined} */
  this.declension;

  /** @type {?number|undefined} */
  this.definiteness;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.MorphosyntacticFeatureVector.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.MorphosyntacticFeatureVector}
 */
proto.speech.tts.MorphosyntacticFeatureVector.fromObject = function(obj) {
  const msg = new proto.speech.tts.MorphosyntacticFeatureVector();
  obj.caseMarker != null && jspb.Message.setField(msg, 1, obj.caseMarker);
  obj.number != null && jspb.Message.setField(msg, 2, obj.number);
  obj.gender != null && jspb.Message.setField(msg, 3, obj.gender);
  obj.declension != null && jspb.Message.setField(msg, 4, obj.declension);
  obj.definiteness != null && jspb.Message.setField(msg, 5, obj.definiteness);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.MorphosyntacticFeatureVector}
 */
proto.speech.tts.MorphosyntacticFeatureVector.deserializeBinary = function(bytes) {
  return proto.speech.tts.MorphosyntacticFeatureVector.deserializeBinaryFromReader(
      new proto.speech.tts.MorphosyntacticFeatureVector(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.MorphosyntacticFeatureVector} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.MorphosyntacticFeatureVector}
 */
proto.speech.tts.MorphosyntacticFeatureVector.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {!proto.speech.tts.MorphosyntacticFeatureVector.Case} */ (reader.readEnum());
      msg.setCaseMarker(value);
      break;
    case 2:
      value = /** @type {!proto.speech.tts.MorphosyntacticFeatureVector.Number} */ (reader.readEnum());
      msg.setNumber(value);
      break;
    case 3:
      value = /** @type {!proto.speech.tts.MorphosyntacticFeatureVector.Gender} */ (reader.readEnum());
      msg.setGender(value);
      break;
    case 4:
      value = /** @type {!proto.speech.tts.MorphosyntacticFeatureVector.DeclensionType} */ (reader.readEnum());
      msg.setDeclension(value);
      break;
    case 5:
      value = /** @type {!proto.speech.tts.MorphosyntacticFeatureVector.Definiteness} */ (reader.readEnum());
      msg.setDefiniteness(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.MorphosyntacticFeatureVector.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.MorphosyntacticFeatureVector.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.MorphosyntacticFeatureVector} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.MorphosyntacticFeatureVector.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {!proto.speech.tts.MorphosyntacticFeatureVector.Case} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeEnum(
      1,
      f
    );
  }
  f = /** @type {!proto.speech.tts.MorphosyntacticFeatureVector.Number} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeEnum(
      2,
      f
    );
  }
  f = /** @type {!proto.speech.tts.MorphosyntacticFeatureVector.Gender} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeEnum(
      3,
      f
    );
  }
  f = /** @type {!proto.speech.tts.MorphosyntacticFeatureVector.DeclensionType} */ (jspb.Message.getField(message, 4));
  if (f != null) {
    writer.writeEnum(
      4,
      f
    );
  }
  f = /** @type {!proto.speech.tts.MorphosyntacticFeatureVector.Definiteness} */ (jspb.Message.getField(message, 5));
  if (f != null) {
    writer.writeEnum(
      5,
      f
    );
  }
};


/**
 * @enum {number}
 */
proto.speech.tts.MorphosyntacticFeatureVector.Case = {
  UNKNOWN_CASE: 0,
  NOMINATIVE: 1,
  ERGATIVE: 2,
  ABSOLUTIVE: 3,
  ACCUSATIVE: 4,
  BENEFACTIVE: 5,
  DATIVE: 6,
  MALEFACTIVE: 7,
  GENITIVE: 8,
  POSSESSED: 9,
  LOCATIVE: 10,
  PREPOSITIONAL: 10,
  ALLATIVE: 11,
  CONTALLATIVE: 12,
  ILLATIVE: 13,
  INALLATIVE: 14,
  INTERALLATIVE: 15,
  SUBALLATIVE: 16,
  SUPERALLATIVE: 17,
  ABLATIVE: 18,
  CONTABLATIVE: 19,
  DELATIVE: 20,
  ELATIVE: 21,
  INABLATIVE: 22,
  INTERABLATIVE: 23,
  SUBABLATIVE: 24,
  SUPERABLATIVE: 25,
  CONTLATIVE: 26,
  INTERLATIVE: 27,
  INTERTRANSLATIVE: 28,
  INTRANSLATIVE: 29,
  LATIVE: 30,
  PERLATIVE: 31,
  SUBLATIVE: 32,
  SUBTRANSLATIVE: 33,
  SUPERLATIVE: 34,
  SUPERTRANSLATIVE: 35,
  TRANSLATIVE: 36,
  CONTERMINATIVE: 37,
  INTERMINATIVE: 38,
  INTERTERMINATIVE: 39,
  SUBTERMINATIVE: 40,
  SUPERTERMINATIVE: 41,
  ABESSIVE: 42,
  ADESSIVE: 43,
  ESSIVE: 44,
  INESSIVE: 45,
  INTERESSIVE: 46,
  SUBESSIVE: 47,
  SUPERESSIVE: 48,
  INSTRUMENTAL: 49,
  COMITATIVE: 50,
  PARTITIVE: 51,
  VOCATIVE: 52,
  AVERSIVE: 53
};

/**
 * @enum {number}
 */
proto.speech.tts.MorphosyntacticFeatureVector.Number = {
  UNKNOWN_NUMBER: 0,
  SINGULAR: 1,
  DUAL: 2,
  GREATER_PAUCAL: 3,
  GREATER_PLURAL: 4,
  MULTAL: 5,
  PLURAL: 6,
  TRIAL: 7,
  GENERAL: 8,
  PAUCAL: 9
};

/**
 * @enum {number}
 */
proto.speech.tts.MorphosyntacticFeatureVector.Gender = {
  UNKNOWN_GENDER: 0,
  MASCULINE: 1,
  FEMININE: 2,
  NEUTER: 3,
  HUMAN: 4,
  ANIMATE: 5,
  INANIMATE: 6,
  VEGETABLE: 7,
  COMMON: 8,
  APOCOPE: 9
};

/**
 * @enum {number}
 */
proto.speech.tts.MorphosyntacticFeatureVector.DeclensionType = {
  UNKNOWN_DECLENSION: 0,
  WEAK: 1,
  STRONG: 2,
  MIXED: 3
};

/**
 * @enum {number}
 */
proto.speech.tts.MorphosyntacticFeatureVector.Definiteness = {
  UNKNOWN_DEFINITENESS: 0,
  DEFINITE: 1,
  INDEFINITE: 2
};

/**
 * optional Case case_marker = 1;
 * @return {!proto.speech.tts.MorphosyntacticFeatureVector.Case}
 */
proto.speech.tts.MorphosyntacticFeatureVector.prototype.getCaseMarker = function() {
  return /** @type {!proto.speech.tts.MorphosyntacticFeatureVector.Case} */ (jspb.Message.getFieldWithDefault(this, 1, 0));
};


/**
 * @param {!proto.speech.tts.MorphosyntacticFeatureVector.Case} value
 * @return {!proto.speech.tts.MorphosyntacticFeatureVector} returns this
 */
proto.speech.tts.MorphosyntacticFeatureVector.prototype.setCaseMarker = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.MorphosyntacticFeatureVector} returns this
 */
proto.speech.tts.MorphosyntacticFeatureVector.prototype.clearCaseMarker = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.MorphosyntacticFeatureVector.prototype.hasCaseMarker = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional Number number = 2;
 * @return {!proto.speech.tts.MorphosyntacticFeatureVector.Number}
 */
proto.speech.tts.MorphosyntacticFeatureVector.prototype.getNumber = function() {
  return /** @type {!proto.speech.tts.MorphosyntacticFeatureVector.Number} */ (jspb.Message.getFieldWithDefault(this, 2, 0));
};


/**
 * @param {!proto.speech.tts.MorphosyntacticFeatureVector.Number} value
 * @return {!proto.speech.tts.MorphosyntacticFeatureVector} returns this
 */
proto.speech.tts.MorphosyntacticFeatureVector.prototype.setNumber = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.MorphosyntacticFeatureVector} returns this
 */
proto.speech.tts.MorphosyntacticFeatureVector.prototype.clearNumber = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.MorphosyntacticFeatureVector.prototype.hasNumber = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional Gender gender = 3;
 * @return {!proto.speech.tts.MorphosyntacticFeatureVector.Gender}
 */
proto.speech.tts.MorphosyntacticFeatureVector.prototype.getGender = function() {
  return /** @type {!proto.speech.tts.MorphosyntacticFeatureVector.Gender} */ (jspb.Message.getFieldWithDefault(this, 3, 0));
};


/**
 * @param {!proto.speech.tts.MorphosyntacticFeatureVector.Gender} value
 * @return {!proto.speech.tts.MorphosyntacticFeatureVector} returns this
 */
proto.speech.tts.MorphosyntacticFeatureVector.prototype.setGender = function(value) {
  return jspb.Message.setField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.MorphosyntacticFeatureVector} returns this
 */
proto.speech.tts.MorphosyntacticFeatureVector.prototype.clearGender = function() {
  return jspb.Message.clearField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.MorphosyntacticFeatureVector.prototype.hasGender = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * optional DeclensionType declension = 4;
 * @return {!proto.speech.tts.MorphosyntacticFeatureVector.DeclensionType}
 */
proto.speech.tts.MorphosyntacticFeatureVector.prototype.getDeclension = function() {
  return /** @type {!proto.speech.tts.MorphosyntacticFeatureVector.DeclensionType} */ (jspb.Message.getFieldWithDefault(this, 4, 0));
};


/**
 * @param {!proto.speech.tts.MorphosyntacticFeatureVector.DeclensionType} value
 * @return {!proto.speech.tts.MorphosyntacticFeatureVector} returns this
 */
proto.speech.tts.MorphosyntacticFeatureVector.prototype.setDeclension = function(value) {
  return jspb.Message.setField(this, 4, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.MorphosyntacticFeatureVector} returns this
 */
proto.speech.tts.MorphosyntacticFeatureVector.prototype.clearDeclension = function() {
  return jspb.Message.clearField(this, 4);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.MorphosyntacticFeatureVector.prototype.hasDeclension = function() {
  return jspb.Message.hasField(this, 4);
};


/**
 * optional Definiteness definiteness = 5;
 * @return {!proto.speech.tts.MorphosyntacticFeatureVector.Definiteness}
 */
proto.speech.tts.MorphosyntacticFeatureVector.prototype.getDefiniteness = function() {
  return /** @type {!proto.speech.tts.MorphosyntacticFeatureVector.Definiteness} */ (jspb.Message.getFieldWithDefault(this, 5, 0));
};


/**
 * @param {!proto.speech.tts.MorphosyntacticFeatureVector.Definiteness} value
 * @return {!proto.speech.tts.MorphosyntacticFeatureVector} returns this
 */
proto.speech.tts.MorphosyntacticFeatureVector.prototype.setDefiniteness = function(value) {
  return jspb.Message.setField(this, 5, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.MorphosyntacticFeatureVector} returns this
 */
proto.speech.tts.MorphosyntacticFeatureVector.prototype.clearDefiniteness = function() {
  return jspb.Message.clearField(this, 5);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.MorphosyntacticFeatureVector.prototype.hasDefiniteness = function() {
  return jspb.Message.hasField(this, 5);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.MorphosyntacticFeatureVector}
 */
proto.speech.tts.MorphosyntacticFeatureVector.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.MorphosyntacticFeatureVector, data);
};



//speech/tts/public/address_proto_jspb/thoroughfare.jspb.js
// source: speech/tts/public/address.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.Thoroughfare');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.speech.tts.MorphosyntacticFeatureVector');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.Thoroughfare = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, proto.speech.tts.Thoroughfare.repeatedFields_, null);
};
goog.inherits(proto.speech.tts.Thoroughfare, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.Thoroughfare.displayName = 'proto.speech.tts.Thoroughfare';
}

/**
 * List of repeated fields within this message type.
 * @private {!Array<number>}
 * @const
 */
proto.speech.tts.Thoroughfare.repeatedFields_ = [8];



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.Thoroughfare.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.Thoroughfare.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.Thoroughfare} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.Thoroughfare.toObject = function(includeInstance, msg) {
  let f, obj = {
    number: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    dependentName: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f,
    name: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f,
    premises: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f,
    subpremises: (f = jspb.Message.getField(msg, 5)) == null ? undefined : f,
    morphosyntacticFeatures: (f = jspb.Message.getField(msg, 6)) == null ? undefined : f,
    structuredFeatures: (f = msg.getStructuredFeatures()) && proto.speech.tts.MorphosyntacticFeatureVector.toObject(includeInstance, f),
    preserveOrder: jspb.Message.getBooleanFieldWithDefault(msg, 7, true),
    fieldOrderList: (f = jspb.Message.getRepeatedField(msg, 8)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of Thoroughfare as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.Thoroughfare.ObjectFormat = function() {
  /** @type {?string|undefined} */
  this.number;

  /** @type {?string|undefined} */
  this.dependentName;

  /** @type {?string|undefined} */
  this.name;

  /** @type {?string|undefined} */
  this.premises;

  /** @type {?string|undefined} */
  this.subpremises;

  /** @type {?string|undefined} */
  this.morphosyntacticFeatures;

  /** @type {?proto.speech.tts.MorphosyntacticFeatureVector.ObjectFormat|undefined} */
  this.structuredFeatures;

  /** @type {?boolean|undefined} */
  this.preserveOrder;

  /** @type {?Array<string>|undefined} */
  this.fieldOrderList;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.Thoroughfare.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.Thoroughfare}
 */
proto.speech.tts.Thoroughfare.fromObject = function(obj) {
  const msg = new proto.speech.tts.Thoroughfare();
  obj.number != null && jspb.Message.setField(msg, 1, obj.number);
  obj.dependentName != null && jspb.Message.setField(msg, 2, obj.dependentName);
  obj.name != null && jspb.Message.setField(msg, 3, obj.name);
  obj.premises != null && jspb.Message.setField(msg, 4, obj.premises);
  obj.subpremises != null && jspb.Message.setField(msg, 5, obj.subpremises);
  obj.morphosyntacticFeatures != null && jspb.Message.setField(msg, 6, obj.morphosyntacticFeatures);
  obj.structuredFeatures && jspb.Message.setWrapperField(
      msg, 9, proto.speech.tts.MorphosyntacticFeatureVector.fromObject(obj.structuredFeatures));
  obj.preserveOrder != null && jspb.Message.setField(msg, 7, obj.preserveOrder);
  obj.fieldOrderList != null && jspb.Message.setField(msg, 8, obj.fieldOrderList);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.Thoroughfare}
 */
proto.speech.tts.Thoroughfare.deserializeBinary = function(bytes) {
  return proto.speech.tts.Thoroughfare.deserializeBinaryFromReader(
      new proto.speech.tts.Thoroughfare(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.Thoroughfare} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.Thoroughfare}
 */
proto.speech.tts.Thoroughfare.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {string} */ (reader.readString());
      msg.setNumber(value);
      break;
    case 2:
      value = /** @type {string} */ (reader.readString());
      msg.setDependentName(value);
      break;
    case 3:
      value = /** @type {string} */ (reader.readString());
      msg.setName(value);
      break;
    case 4:
      value = /** @type {string} */ (reader.readString());
      msg.setPremises(value);
      break;
    case 5:
      value = /** @type {string} */ (reader.readString());
      msg.setSubpremises(value);
      break;
    case 6:
      value = /** @type {string} */ (reader.readString());
      msg.setMorphosyntacticFeatures(value);
      break;
    case 9:
      value = new proto.speech.tts.MorphosyntacticFeatureVector();
      reader.readMessage(value,proto.speech.tts.MorphosyntacticFeatureVector.deserializeBinaryFromReader);
      msg.setStructuredFeatures(value);
      break;
    case 7:
      value = /** @type {boolean} */ (reader.readBool());
      msg.setPreserveOrder(value);
      break;
    case 8:
      value = /** @type {string} */ (reader.readString());
      msg.addFieldOrder(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.Thoroughfare.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.Thoroughfare.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.Thoroughfare} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.Thoroughfare.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {string} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeString(
      1,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeString(
      2,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeString(
      3,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 4));
  if (f != null) {
    writer.writeString(
      4,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 5));
  if (f != null) {
    writer.writeString(
      5,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 6));
  if (f != null) {
    writer.writeString(
      6,
      f
    );
  }
  f = message.getStructuredFeatures();
  if (f != null) {
    writer.writeMessage(
      9,
      f,
      proto.speech.tts.MorphosyntacticFeatureVector.serializeBinaryToWriter
    );
  }
  f = /** @type {boolean} */ (jspb.Message.getField(message, 7));
  if (f != null) {
    writer.writeBool(
      7,
      f
    );
  }
  f = message.getFieldOrderList();
  if (f.length > 0) {
    writer.writeRepeatedString(
      8,
      f
    );
  }
};


/**
 * optional string number = 1;
 * @return {string}
 */
proto.speech.tts.Thoroughfare.prototype.getNumber = function() {
  return jspb.Message.getStringFieldWithDefault(this, 1);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Thoroughfare} returns this
 */
proto.speech.tts.Thoroughfare.prototype.setNumber = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Thoroughfare} returns this
 */
proto.speech.tts.Thoroughfare.prototype.clearNumber = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Thoroughfare.prototype.hasNumber = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional string dependent_name = 2;
 * @return {string}
 */
proto.speech.tts.Thoroughfare.prototype.getDependentName = function() {
  return jspb.Message.getStringFieldWithDefault(this, 2);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Thoroughfare} returns this
 */
proto.speech.tts.Thoroughfare.prototype.setDependentName = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Thoroughfare} returns this
 */
proto.speech.tts.Thoroughfare.prototype.clearDependentName = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Thoroughfare.prototype.hasDependentName = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional string name = 3;
 * @return {string}
 */
proto.speech.tts.Thoroughfare.prototype.getName = function() {
  return jspb.Message.getStringFieldWithDefault(this, 3);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Thoroughfare} returns this
 */
proto.speech.tts.Thoroughfare.prototype.setName = function(value) {
  return jspb.Message.setField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Thoroughfare} returns this
 */
proto.speech.tts.Thoroughfare.prototype.clearName = function() {
  return jspb.Message.clearField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Thoroughfare.prototype.hasName = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * optional string premises = 4;
 * @return {string}
 */
proto.speech.tts.Thoroughfare.prototype.getPremises = function() {
  return jspb.Message.getStringFieldWithDefault(this, 4);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Thoroughfare} returns this
 */
proto.speech.tts.Thoroughfare.prototype.setPremises = function(value) {
  return jspb.Message.setField(this, 4, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Thoroughfare} returns this
 */
proto.speech.tts.Thoroughfare.prototype.clearPremises = function() {
  return jspb.Message.clearField(this, 4);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Thoroughfare.prototype.hasPremises = function() {
  return jspb.Message.hasField(this, 4);
};


/**
 * optional string subpremises = 5;
 * @return {string}
 */
proto.speech.tts.Thoroughfare.prototype.getSubpremises = function() {
  return jspb.Message.getStringFieldWithDefault(this, 5);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Thoroughfare} returns this
 */
proto.speech.tts.Thoroughfare.prototype.setSubpremises = function(value) {
  return jspb.Message.setField(this, 5, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Thoroughfare} returns this
 */
proto.speech.tts.Thoroughfare.prototype.clearSubpremises = function() {
  return jspb.Message.clearField(this, 5);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Thoroughfare.prototype.hasSubpremises = function() {
  return jspb.Message.hasField(this, 5);
};


/**
 * optional string morphosyntactic_features = 6;
 * @return {string}
 */
proto.speech.tts.Thoroughfare.prototype.getMorphosyntacticFeatures = function() {
  return jspb.Message.getStringFieldWithDefault(this, 6);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Thoroughfare} returns this
 */
proto.speech.tts.Thoroughfare.prototype.setMorphosyntacticFeatures = function(value) {
  return jspb.Message.setField(this, 6, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Thoroughfare} returns this
 */
proto.speech.tts.Thoroughfare.prototype.clearMorphosyntacticFeatures = function() {
  return jspb.Message.clearField(this, 6);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Thoroughfare.prototype.hasMorphosyntacticFeatures = function() {
  return jspb.Message.hasField(this, 6);
};


/**
 * optional MorphosyntacticFeatureVector structured_features = 9;
 * @return {?proto.speech.tts.MorphosyntacticFeatureVector}
 */
proto.speech.tts.Thoroughfare.prototype.getStructuredFeatures = function() {
  return /** @type{?proto.speech.tts.MorphosyntacticFeatureVector} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.MorphosyntacticFeatureVector, 9));
};


/**
 * @param {?proto.speech.tts.MorphosyntacticFeatureVector|undefined} value
 * @return {!proto.speech.tts.Thoroughfare} returns this
*/
proto.speech.tts.Thoroughfare.prototype.setStructuredFeatures = function(value) {
  return jspb.Message.setWrapperField(this, 9, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Thoroughfare} returns this
 */
proto.speech.tts.Thoroughfare.prototype.clearStructuredFeatures = function() {
  return jspb.Message.clearWrapperField(this, 9);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Thoroughfare.prototype.hasStructuredFeatures = function() {
  return jspb.Message.hasField(this, 9);
};


/**
 * optional bool preserve_order = 7;
 * @return {boolean}
 */
proto.speech.tts.Thoroughfare.prototype.getPreserveOrder = function() {
  return jspb.Message.getBooleanFieldWithDefault(this, 7, true);
};


/**
 * @param {boolean} value
 * @return {!proto.speech.tts.Thoroughfare} returns this
 */
proto.speech.tts.Thoroughfare.prototype.setPreserveOrder = function(value) {
  return jspb.Message.setField(this, 7, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Thoroughfare} returns this
 */
proto.speech.tts.Thoroughfare.prototype.clearPreserveOrder = function() {
  return jspb.Message.clearField(this, 7);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Thoroughfare.prototype.hasPreserveOrder = function() {
  return jspb.Message.hasField(this, 7);
};


/**
 * repeated string field_order = 8;
 * @return {!Array<string>}
 */
proto.speech.tts.Thoroughfare.prototype.getFieldOrderList = function() {
  return /** @type {!Array<string>} */ (jspb.Message.getRepeatedField(this, 8));
};


/**
 * @param {!Array<string>} value
 * @return {!proto.speech.tts.Thoroughfare} returns this
 */
proto.speech.tts.Thoroughfare.prototype.setFieldOrderList = function(value) {
  return jspb.Message.setField(this, 8, value || []);
};


/**
 * @param {string} value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.Thoroughfare} returns this
 */
proto.speech.tts.Thoroughfare.prototype.addFieldOrder = function(value, opt_index) {
  return jspb.Message.addToRepeatedField(this, 8, value, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.Thoroughfare} returns this
 */
proto.speech.tts.Thoroughfare.prototype.clearFieldOrderList = function() {
  return jspb.Message.clearRepeatedField(this, 8);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.Thoroughfare}
 */
proto.speech.tts.Thoroughfare.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.Thoroughfare, data);
};



//speech/tts/public/address_proto_jspb/address.jspb.js
// source: speech/tts/public/address.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.Address');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.speech.tts.MorphosyntacticFeatureVector');
goog.require('proto.speech.tts.Thoroughfare');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.Address = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, proto.speech.tts.Address.repeatedFields_, null);
};
goog.inherits(proto.speech.tts.Address, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.Address.displayName = 'proto.speech.tts.Address';
}

/**
 * List of repeated fields within this message type.
 * @private {!Array<number>}
 * @const
 */
proto.speech.tts.Address.repeatedFields_ = [12];



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.Address.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.Address.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.Address} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.Address.toObject = function(includeInstance, msg) {
  let f, obj = {
    thoroughfare: (f = msg.getThoroughfare()) && proto.speech.tts.Thoroughfare.toObject(includeInstance, f),
    dependentLocality: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f,
    locality: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f,
    subadminArea: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f,
    adminArea: (f = jspb.Message.getField(msg, 5)) == null ? undefined : f,
    countryName: (f = jspb.Message.getField(msg, 6)) == null ? undefined : f,
    postCode: (f = jspb.Message.getField(msg, 7)) == null ? undefined : f,
    poBox: (f = jspb.Message.getField(msg, 8)) == null ? undefined : f,
    morphosyntacticFeatures: (f = jspb.Message.getField(msg, 9)) == null ? undefined : f,
    structuredFeatures: (f = msg.getStructuredFeatures()) && proto.speech.tts.MorphosyntacticFeatureVector.toObject(includeInstance, f),
    preserveOrder: jspb.Message.getBooleanFieldWithDefault(msg, 10, true),
    codeSwitch: (f = jspb.Message.getField(msg, 11)) == null ? undefined : f,
    fieldOrderList: (f = jspb.Message.getRepeatedField(msg, 12)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of Address as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.Address.ObjectFormat = function() {
  /** @type {?proto.speech.tts.Thoroughfare.ObjectFormat|undefined} */
  this.thoroughfare;

  /** @type {?string|undefined} */
  this.dependentLocality;

  /** @type {?string|undefined} */
  this.locality;

  /** @type {?string|undefined} */
  this.subadminArea;

  /** @type {?string|undefined} */
  this.adminArea;

  /** @type {?string|undefined} */
  this.countryName;

  /** @type {?string|undefined} */
  this.postCode;

  /** @type {?string|undefined} */
  this.poBox;

  /** @type {?string|undefined} */
  this.morphosyntacticFeatures;

  /** @type {?proto.speech.tts.MorphosyntacticFeatureVector.ObjectFormat|undefined} */
  this.structuredFeatures;

  /** @type {?boolean|undefined} */
  this.preserveOrder;

  /** @type {?string|undefined} */
  this.codeSwitch;

  /** @type {?Array<string>|undefined} */
  this.fieldOrderList;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.Address.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.Address}
 */
proto.speech.tts.Address.fromObject = function(obj) {
  const msg = new proto.speech.tts.Address();
  obj.thoroughfare && jspb.Message.setWrapperField(
      msg, 1, proto.speech.tts.Thoroughfare.fromObject(obj.thoroughfare));
  obj.dependentLocality != null && jspb.Message.setField(msg, 2, obj.dependentLocality);
  obj.locality != null && jspb.Message.setField(msg, 3, obj.locality);
  obj.subadminArea != null && jspb.Message.setField(msg, 4, obj.subadminArea);
  obj.adminArea != null && jspb.Message.setField(msg, 5, obj.adminArea);
  obj.countryName != null && jspb.Message.setField(msg, 6, obj.countryName);
  obj.postCode != null && jspb.Message.setField(msg, 7, obj.postCode);
  obj.poBox != null && jspb.Message.setField(msg, 8, obj.poBox);
  obj.morphosyntacticFeatures != null && jspb.Message.setField(msg, 9, obj.morphosyntacticFeatures);
  obj.structuredFeatures && jspb.Message.setWrapperField(
      msg, 13, proto.speech.tts.MorphosyntacticFeatureVector.fromObject(obj.structuredFeatures));
  obj.preserveOrder != null && jspb.Message.setField(msg, 10, obj.preserveOrder);
  obj.codeSwitch != null && jspb.Message.setField(msg, 11, obj.codeSwitch);
  obj.fieldOrderList != null && jspb.Message.setField(msg, 12, obj.fieldOrderList);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.Address}
 */
proto.speech.tts.Address.deserializeBinary = function(bytes) {
  return proto.speech.tts.Address.deserializeBinaryFromReader(
      new proto.speech.tts.Address(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.Address} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.Address}
 */
proto.speech.tts.Address.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = new proto.speech.tts.Thoroughfare();
      reader.readMessage(value,proto.speech.tts.Thoroughfare.deserializeBinaryFromReader);
      msg.setThoroughfare(value);
      break;
    case 2:
      value = /** @type {string} */ (reader.readString());
      msg.setDependentLocality(value);
      break;
    case 3:
      value = /** @type {string} */ (reader.readString());
      msg.setLocality(value);
      break;
    case 4:
      value = /** @type {string} */ (reader.readString());
      msg.setSubadminArea(value);
      break;
    case 5:
      value = /** @type {string} */ (reader.readString());
      msg.setAdminArea(value);
      break;
    case 6:
      value = /** @type {string} */ (reader.readString());
      msg.setCountryName(value);
      break;
    case 7:
      value = /** @type {string} */ (reader.readString());
      msg.setPostCode(value);
      break;
    case 8:
      value = /** @type {string} */ (reader.readString());
      msg.setPoBox(value);
      break;
    case 9:
      value = /** @type {string} */ (reader.readString());
      msg.setMorphosyntacticFeatures(value);
      break;
    case 13:
      value = new proto.speech.tts.MorphosyntacticFeatureVector();
      reader.readMessage(value,proto.speech.tts.MorphosyntacticFeatureVector.deserializeBinaryFromReader);
      msg.setStructuredFeatures(value);
      break;
    case 10:
      value = /** @type {boolean} */ (reader.readBool());
      msg.setPreserveOrder(value);
      break;
    case 11:
      value = /** @type {string} */ (reader.readString());
      msg.setCodeSwitch(value);
      break;
    case 12:
      value = /** @type {string} */ (reader.readString());
      msg.addFieldOrder(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.Address.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.Address.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.Address} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.Address.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = message.getThoroughfare();
  if (f != null) {
    writer.writeMessage(
      1,
      f,
      proto.speech.tts.Thoroughfare.serializeBinaryToWriter
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeString(
      2,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeString(
      3,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 4));
  if (f != null) {
    writer.writeString(
      4,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 5));
  if (f != null) {
    writer.writeString(
      5,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 6));
  if (f != null) {
    writer.writeString(
      6,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 7));
  if (f != null) {
    writer.writeString(
      7,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 8));
  if (f != null) {
    writer.writeString(
      8,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 9));
  if (f != null) {
    writer.writeString(
      9,
      f
    );
  }
  f = message.getStructuredFeatures();
  if (f != null) {
    writer.writeMessage(
      13,
      f,
      proto.speech.tts.MorphosyntacticFeatureVector.serializeBinaryToWriter
    );
  }
  f = /** @type {boolean} */ (jspb.Message.getField(message, 10));
  if (f != null) {
    writer.writeBool(
      10,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 11));
  if (f != null) {
    writer.writeString(
      11,
      f
    );
  }
  f = message.getFieldOrderList();
  if (f.length > 0) {
    writer.writeRepeatedString(
      12,
      f
    );
  }
};


/**
 * optional Thoroughfare thoroughfare = 1;
 * @return {?proto.speech.tts.Thoroughfare}
 */
proto.speech.tts.Address.prototype.getThoroughfare = function() {
  return /** @type{?proto.speech.tts.Thoroughfare} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.Thoroughfare, 1));
};


/**
 * @param {?proto.speech.tts.Thoroughfare|undefined} value
 * @return {!proto.speech.tts.Address} returns this
*/
proto.speech.tts.Address.prototype.setThoroughfare = function(value) {
  return jspb.Message.setWrapperField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Address} returns this
 */
proto.speech.tts.Address.prototype.clearThoroughfare = function() {
  return jspb.Message.clearWrapperField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Address.prototype.hasThoroughfare = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional string dependent_locality = 2;
 * @return {string}
 */
proto.speech.tts.Address.prototype.getDependentLocality = function() {
  return jspb.Message.getStringFieldWithDefault(this, 2);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Address} returns this
 */
proto.speech.tts.Address.prototype.setDependentLocality = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Address} returns this
 */
proto.speech.tts.Address.prototype.clearDependentLocality = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Address.prototype.hasDependentLocality = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional string locality = 3;
 * @return {string}
 */
proto.speech.tts.Address.prototype.getLocality = function() {
  return jspb.Message.getStringFieldWithDefault(this, 3);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Address} returns this
 */
proto.speech.tts.Address.prototype.setLocality = function(value) {
  return jspb.Message.setField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Address} returns this
 */
proto.speech.tts.Address.prototype.clearLocality = function() {
  return jspb.Message.clearField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Address.prototype.hasLocality = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * optional string subadmin_area = 4;
 * @return {string}
 */
proto.speech.tts.Address.prototype.getSubadminArea = function() {
  return jspb.Message.getStringFieldWithDefault(this, 4);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Address} returns this
 */
proto.speech.tts.Address.prototype.setSubadminArea = function(value) {
  return jspb.Message.setField(this, 4, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Address} returns this
 */
proto.speech.tts.Address.prototype.clearSubadminArea = function() {
  return jspb.Message.clearField(this, 4);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Address.prototype.hasSubadminArea = function() {
  return jspb.Message.hasField(this, 4);
};


/**
 * optional string admin_area = 5;
 * @return {string}
 */
proto.speech.tts.Address.prototype.getAdminArea = function() {
  return jspb.Message.getStringFieldWithDefault(this, 5);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Address} returns this
 */
proto.speech.tts.Address.prototype.setAdminArea = function(value) {
  return jspb.Message.setField(this, 5, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Address} returns this
 */
proto.speech.tts.Address.prototype.clearAdminArea = function() {
  return jspb.Message.clearField(this, 5);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Address.prototype.hasAdminArea = function() {
  return jspb.Message.hasField(this, 5);
};


/**
 * optional string country_name = 6;
 * @return {string}
 */
proto.speech.tts.Address.prototype.getCountryName = function() {
  return jspb.Message.getStringFieldWithDefault(this, 6);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Address} returns this
 */
proto.speech.tts.Address.prototype.setCountryName = function(value) {
  return jspb.Message.setField(this, 6, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Address} returns this
 */
proto.speech.tts.Address.prototype.clearCountryName = function() {
  return jspb.Message.clearField(this, 6);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Address.prototype.hasCountryName = function() {
  return jspb.Message.hasField(this, 6);
};


/**
 * optional string post_code = 7;
 * @return {string}
 */
proto.speech.tts.Address.prototype.getPostCode = function() {
  return jspb.Message.getStringFieldWithDefault(this, 7);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Address} returns this
 */
proto.speech.tts.Address.prototype.setPostCode = function(value) {
  return jspb.Message.setField(this, 7, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Address} returns this
 */
proto.speech.tts.Address.prototype.clearPostCode = function() {
  return jspb.Message.clearField(this, 7);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Address.prototype.hasPostCode = function() {
  return jspb.Message.hasField(this, 7);
};


/**
 * optional string po_box = 8;
 * @return {string}
 */
proto.speech.tts.Address.prototype.getPoBox = function() {
  return jspb.Message.getStringFieldWithDefault(this, 8);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Address} returns this
 */
proto.speech.tts.Address.prototype.setPoBox = function(value) {
  return jspb.Message.setField(this, 8, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Address} returns this
 */
proto.speech.tts.Address.prototype.clearPoBox = function() {
  return jspb.Message.clearField(this, 8);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Address.prototype.hasPoBox = function() {
  return jspb.Message.hasField(this, 8);
};


/**
 * optional string morphosyntactic_features = 9;
 * @return {string}
 */
proto.speech.tts.Address.prototype.getMorphosyntacticFeatures = function() {
  return jspb.Message.getStringFieldWithDefault(this, 9);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Address} returns this
 */
proto.speech.tts.Address.prototype.setMorphosyntacticFeatures = function(value) {
  return jspb.Message.setField(this, 9, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Address} returns this
 */
proto.speech.tts.Address.prototype.clearMorphosyntacticFeatures = function() {
  return jspb.Message.clearField(this, 9);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Address.prototype.hasMorphosyntacticFeatures = function() {
  return jspb.Message.hasField(this, 9);
};


/**
 * optional MorphosyntacticFeatureVector structured_features = 13;
 * @return {?proto.speech.tts.MorphosyntacticFeatureVector}
 */
proto.speech.tts.Address.prototype.getStructuredFeatures = function() {
  return /** @type{?proto.speech.tts.MorphosyntacticFeatureVector} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.MorphosyntacticFeatureVector, 13));
};


/**
 * @param {?proto.speech.tts.MorphosyntacticFeatureVector|undefined} value
 * @return {!proto.speech.tts.Address} returns this
*/
proto.speech.tts.Address.prototype.setStructuredFeatures = function(value) {
  return jspb.Message.setWrapperField(this, 13, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Address} returns this
 */
proto.speech.tts.Address.prototype.clearStructuredFeatures = function() {
  return jspb.Message.clearWrapperField(this, 13);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Address.prototype.hasStructuredFeatures = function() {
  return jspb.Message.hasField(this, 13);
};


/**
 * optional bool preserve_order = 10;
 * @return {boolean}
 */
proto.speech.tts.Address.prototype.getPreserveOrder = function() {
  return jspb.Message.getBooleanFieldWithDefault(this, 10, true);
};


/**
 * @param {boolean} value
 * @return {!proto.speech.tts.Address} returns this
 */
proto.speech.tts.Address.prototype.setPreserveOrder = function(value) {
  return jspb.Message.setField(this, 10, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Address} returns this
 */
proto.speech.tts.Address.prototype.clearPreserveOrder = function() {
  return jspb.Message.clearField(this, 10);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Address.prototype.hasPreserveOrder = function() {
  return jspb.Message.hasField(this, 10);
};


/**
 * optional string code_switch = 11;
 * @return {string}
 */
proto.speech.tts.Address.prototype.getCodeSwitch = function() {
  return jspb.Message.getStringFieldWithDefault(this, 11);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Address} returns this
 */
proto.speech.tts.Address.prototype.setCodeSwitch = function(value) {
  return jspb.Message.setField(this, 11, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Address} returns this
 */
proto.speech.tts.Address.prototype.clearCodeSwitch = function() {
  return jspb.Message.clearField(this, 11);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Address.prototype.hasCodeSwitch = function() {
  return jspb.Message.hasField(this, 11);
};


/**
 * repeated string field_order = 12;
 * @return {!Array<string>}
 */
proto.speech.tts.Address.prototype.getFieldOrderList = function() {
  return /** @type {!Array<string>} */ (jspb.Message.getRepeatedField(this, 12));
};


/**
 * @param {!Array<string>} value
 * @return {!proto.speech.tts.Address} returns this
 */
proto.speech.tts.Address.prototype.setFieldOrderList = function(value) {
  return jspb.Message.setField(this, 12, value || []);
};


/**
 * @param {string} value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.Address} returns this
 */
proto.speech.tts.Address.prototype.addFieldOrder = function(value, opt_index) {
  return jspb.Message.addToRepeatedField(this, 12, value, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.Address} returns this
 */
proto.speech.tts.Address.prototype.clearFieldOrderList = function() {
  return jspb.Message.clearRepeatedField(this, 12);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.Address}
 */
proto.speech.tts.Address.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.Address, data);
};



//speech/tts/public/semiotic_classes_proto_jspb/abbreviation.jspb.js
// source: speech/tts/public/semiotic_classes.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.Abbreviation');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.speech.tts.MorphosyntacticFeatureVector');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.Abbreviation = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.speech.tts.Abbreviation, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.Abbreviation.displayName = 'proto.speech.tts.Abbreviation';
}



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.Abbreviation.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.Abbreviation.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.Abbreviation} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.Abbreviation.toObject = function(includeInstance, msg) {
  let f, obj = {
    text: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    expansion: (f = jspb.Message.getField(msg, 5)) == null ? undefined : f,
    morphosyntacticFeatures: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f,
    structuredFeatures: (f = msg.getStructuredFeatures()) && proto.speech.tts.MorphosyntacticFeatureVector.toObject(includeInstance, f),
    codeSwitch: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of Abbreviation as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.Abbreviation.ObjectFormat = function() {
  /** @type {?string|undefined} */
  this.text;

  /** @type {?string|undefined} */
  this.expansion;

  /** @type {?string|undefined} */
  this.morphosyntacticFeatures;

  /** @type {?proto.speech.tts.MorphosyntacticFeatureVector.ObjectFormat|undefined} */
  this.structuredFeatures;

  /** @type {?string|undefined} */
  this.codeSwitch;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.Abbreviation.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.Abbreviation}
 */
proto.speech.tts.Abbreviation.fromObject = function(obj) {
  const msg = new proto.speech.tts.Abbreviation();
  obj.text != null && jspb.Message.setField(msg, 1, obj.text);
  obj.expansion != null && jspb.Message.setField(msg, 5, obj.expansion);
  obj.morphosyntacticFeatures != null && jspb.Message.setField(msg, 2, obj.morphosyntacticFeatures);
  obj.structuredFeatures && jspb.Message.setWrapperField(
      msg, 4, proto.speech.tts.MorphosyntacticFeatureVector.fromObject(obj.structuredFeatures));
  obj.codeSwitch != null && jspb.Message.setField(msg, 3, obj.codeSwitch);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.Abbreviation}
 */
proto.speech.tts.Abbreviation.deserializeBinary = function(bytes) {
  return proto.speech.tts.Abbreviation.deserializeBinaryFromReader(
      new proto.speech.tts.Abbreviation(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.Abbreviation} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.Abbreviation}
 */
proto.speech.tts.Abbreviation.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {string} */ (reader.readString());
      msg.setText(value);
      break;
    case 5:
      value = /** @type {string} */ (reader.readString());
      msg.setExpansion(value);
      break;
    case 2:
      value = /** @type {string} */ (reader.readString());
      msg.setMorphosyntacticFeatures(value);
      break;
    case 4:
      value = new proto.speech.tts.MorphosyntacticFeatureVector();
      reader.readMessage(value,proto.speech.tts.MorphosyntacticFeatureVector.deserializeBinaryFromReader);
      msg.setStructuredFeatures(value);
      break;
    case 3:
      value = /** @type {string} */ (reader.readString());
      msg.setCodeSwitch(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.Abbreviation.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.Abbreviation.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.Abbreviation} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.Abbreviation.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {string} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeString(
      1,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 5));
  if (f != null) {
    writer.writeString(
      5,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeString(
      2,
      f
    );
  }
  f = message.getStructuredFeatures();
  if (f != null) {
    writer.writeMessage(
      4,
      f,
      proto.speech.tts.MorphosyntacticFeatureVector.serializeBinaryToWriter
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeString(
      3,
      f
    );
  }
};


/**
 * required string text = 1;
 * @return {string}
 */
proto.speech.tts.Abbreviation.prototype.getText = function() {
  return jspb.Message.getStringFieldWithDefault(this, 1);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Abbreviation} returns this
 */
proto.speech.tts.Abbreviation.prototype.setText = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Abbreviation} returns this
 */
proto.speech.tts.Abbreviation.prototype.clearText = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Abbreviation.prototype.hasText = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional string expansion = 5;
 * @return {string}
 */
proto.speech.tts.Abbreviation.prototype.getExpansion = function() {
  return jspb.Message.getStringFieldWithDefault(this, 5);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Abbreviation} returns this
 */
proto.speech.tts.Abbreviation.prototype.setExpansion = function(value) {
  return jspb.Message.setField(this, 5, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Abbreviation} returns this
 */
proto.speech.tts.Abbreviation.prototype.clearExpansion = function() {
  return jspb.Message.clearField(this, 5);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Abbreviation.prototype.hasExpansion = function() {
  return jspb.Message.hasField(this, 5);
};


/**
 * optional string morphosyntactic_features = 2;
 * @return {string}
 */
proto.speech.tts.Abbreviation.prototype.getMorphosyntacticFeatures = function() {
  return jspb.Message.getStringFieldWithDefault(this, 2);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Abbreviation} returns this
 */
proto.speech.tts.Abbreviation.prototype.setMorphosyntacticFeatures = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Abbreviation} returns this
 */
proto.speech.tts.Abbreviation.prototype.clearMorphosyntacticFeatures = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Abbreviation.prototype.hasMorphosyntacticFeatures = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional MorphosyntacticFeatureVector structured_features = 4;
 * @return {?proto.speech.tts.MorphosyntacticFeatureVector}
 */
proto.speech.tts.Abbreviation.prototype.getStructuredFeatures = function() {
  return /** @type{?proto.speech.tts.MorphosyntacticFeatureVector} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.MorphosyntacticFeatureVector, 4));
};


/**
 * @param {?proto.speech.tts.MorphosyntacticFeatureVector|undefined} value
 * @return {!proto.speech.tts.Abbreviation} returns this
*/
proto.speech.tts.Abbreviation.prototype.setStructuredFeatures = function(value) {
  return jspb.Message.setWrapperField(this, 4, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Abbreviation} returns this
 */
proto.speech.tts.Abbreviation.prototype.clearStructuredFeatures = function() {
  return jspb.Message.clearWrapperField(this, 4);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Abbreviation.prototype.hasStructuredFeatures = function() {
  return jspb.Message.hasField(this, 4);
};


/**
 * optional string code_switch = 3;
 * @return {string}
 */
proto.speech.tts.Abbreviation.prototype.getCodeSwitch = function() {
  return jspb.Message.getStringFieldWithDefault(this, 3);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Abbreviation} returns this
 */
proto.speech.tts.Abbreviation.prototype.setCodeSwitch = function(value) {
  return jspb.Message.setField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Abbreviation} returns this
 */
proto.speech.tts.Abbreviation.prototype.clearCodeSwitch = function() {
  return jspb.Message.clearField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Abbreviation.prototype.hasCodeSwitch = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.Abbreviation}
 */
proto.speech.tts.Abbreviation.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.Abbreviation, data);
};



//speech/tts/public/semiotic_classes_proto_jspb/cardinal.jspb.js
// source: speech/tts/public/semiotic_classes.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.Cardinal');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.speech.tts.MorphosyntacticFeatureVector');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.Cardinal = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, proto.speech.tts.Cardinal.repeatedFields_, null);
};
goog.inherits(proto.speech.tts.Cardinal, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.Cardinal.displayName = 'proto.speech.tts.Cardinal';
}

/**
 * List of repeated fields within this message type.
 * @private {!Array<number>}
 * @const
 */
proto.speech.tts.Cardinal.repeatedFields_ = [5];



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.Cardinal.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.Cardinal.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.Cardinal} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.Cardinal.toObject = function(includeInstance, msg) {
  let f, obj = {
    integer: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    morphosyntacticFeatures: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f,
    structuredFeatures: (f = msg.getStructuredFeatures()) && proto.speech.tts.MorphosyntacticFeatureVector.toObject(includeInstance, f),
    preserveOrder: (f = jspb.Message.getBooleanField(msg, 3)) == null ? undefined : f,
    codeSwitch: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f,
    fieldOrderList: (f = jspb.Message.getRepeatedField(msg, 5)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of Cardinal as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.Cardinal.ObjectFormat = function() {
  /** @type {?string|undefined} */
  this.integer;

  /** @type {?string|undefined} */
  this.morphosyntacticFeatures;

  /** @type {?proto.speech.tts.MorphosyntacticFeatureVector.ObjectFormat|undefined} */
  this.structuredFeatures;

  /** @type {?boolean|undefined} */
  this.preserveOrder;

  /** @type {?string|undefined} */
  this.codeSwitch;

  /** @type {?Array<string>|undefined} */
  this.fieldOrderList;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.Cardinal.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.Cardinal}
 */
proto.speech.tts.Cardinal.fromObject = function(obj) {
  const msg = new proto.speech.tts.Cardinal();
  obj.integer != null && jspb.Message.setField(msg, 1, obj.integer);
  obj.morphosyntacticFeatures != null && jspb.Message.setField(msg, 2, obj.morphosyntacticFeatures);
  obj.structuredFeatures && jspb.Message.setWrapperField(
      msg, 6, proto.speech.tts.MorphosyntacticFeatureVector.fromObject(obj.structuredFeatures));
  obj.preserveOrder != null && jspb.Message.setField(msg, 3, obj.preserveOrder);
  obj.codeSwitch != null && jspb.Message.setField(msg, 4, obj.codeSwitch);
  obj.fieldOrderList != null && jspb.Message.setField(msg, 5, obj.fieldOrderList);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.Cardinal}
 */
proto.speech.tts.Cardinal.deserializeBinary = function(bytes) {
  return proto.speech.tts.Cardinal.deserializeBinaryFromReader(
      new proto.speech.tts.Cardinal(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.Cardinal} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.Cardinal}
 */
proto.speech.tts.Cardinal.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {string} */ (reader.readString());
      msg.setInteger(value);
      break;
    case 2:
      value = /** @type {string} */ (reader.readString());
      msg.setMorphosyntacticFeatures(value);
      break;
    case 6:
      value = new proto.speech.tts.MorphosyntacticFeatureVector();
      reader.readMessage(value,proto.speech.tts.MorphosyntacticFeatureVector.deserializeBinaryFromReader);
      msg.setStructuredFeatures(value);
      break;
    case 3:
      value = /** @type {boolean} */ (reader.readBool());
      msg.setPreserveOrder(value);
      break;
    case 4:
      value = /** @type {string} */ (reader.readString());
      msg.setCodeSwitch(value);
      break;
    case 5:
      value = /** @type {string} */ (reader.readString());
      msg.addFieldOrder(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.Cardinal.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.Cardinal.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.Cardinal} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.Cardinal.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {string} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeString(
      1,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeString(
      2,
      f
    );
  }
  f = message.getStructuredFeatures();
  if (f != null) {
    writer.writeMessage(
      6,
      f,
      proto.speech.tts.MorphosyntacticFeatureVector.serializeBinaryToWriter
    );
  }
  f = /** @type {boolean} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeBool(
      3,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 4));
  if (f != null) {
    writer.writeString(
      4,
      f
    );
  }
  f = message.getFieldOrderList();
  if (f.length > 0) {
    writer.writeRepeatedString(
      5,
      f
    );
  }
};


/**
 * required string integer = 1;
 * @return {string}
 */
proto.speech.tts.Cardinal.prototype.getInteger = function() {
  return jspb.Message.getStringFieldWithDefault(this, 1);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Cardinal} returns this
 */
proto.speech.tts.Cardinal.prototype.setInteger = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Cardinal} returns this
 */
proto.speech.tts.Cardinal.prototype.clearInteger = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Cardinal.prototype.hasInteger = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional string morphosyntactic_features = 2;
 * @return {string}
 */
proto.speech.tts.Cardinal.prototype.getMorphosyntacticFeatures = function() {
  return jspb.Message.getStringFieldWithDefault(this, 2);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Cardinal} returns this
 */
proto.speech.tts.Cardinal.prototype.setMorphosyntacticFeatures = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Cardinal} returns this
 */
proto.speech.tts.Cardinal.prototype.clearMorphosyntacticFeatures = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Cardinal.prototype.hasMorphosyntacticFeatures = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional MorphosyntacticFeatureVector structured_features = 6;
 * @return {?proto.speech.tts.MorphosyntacticFeatureVector}
 */
proto.speech.tts.Cardinal.prototype.getStructuredFeatures = function() {
  return /** @type{?proto.speech.tts.MorphosyntacticFeatureVector} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.MorphosyntacticFeatureVector, 6));
};


/**
 * @param {?proto.speech.tts.MorphosyntacticFeatureVector|undefined} value
 * @return {!proto.speech.tts.Cardinal} returns this
*/
proto.speech.tts.Cardinal.prototype.setStructuredFeatures = function(value) {
  return jspb.Message.setWrapperField(this, 6, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Cardinal} returns this
 */
proto.speech.tts.Cardinal.prototype.clearStructuredFeatures = function() {
  return jspb.Message.clearWrapperField(this, 6);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Cardinal.prototype.hasStructuredFeatures = function() {
  return jspb.Message.hasField(this, 6);
};


/**
 * optional bool preserve_order = 3;
 * @return {boolean}
 */
proto.speech.tts.Cardinal.prototype.getPreserveOrder = function() {
  return jspb.Message.getBooleanFieldWithDefault(this, 3);
};


/**
 * @param {boolean} value
 * @return {!proto.speech.tts.Cardinal} returns this
 */
proto.speech.tts.Cardinal.prototype.setPreserveOrder = function(value) {
  return jspb.Message.setField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Cardinal} returns this
 */
proto.speech.tts.Cardinal.prototype.clearPreserveOrder = function() {
  return jspb.Message.clearField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Cardinal.prototype.hasPreserveOrder = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * optional string code_switch = 4;
 * @return {string}
 */
proto.speech.tts.Cardinal.prototype.getCodeSwitch = function() {
  return jspb.Message.getStringFieldWithDefault(this, 4);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Cardinal} returns this
 */
proto.speech.tts.Cardinal.prototype.setCodeSwitch = function(value) {
  return jspb.Message.setField(this, 4, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Cardinal} returns this
 */
proto.speech.tts.Cardinal.prototype.clearCodeSwitch = function() {
  return jspb.Message.clearField(this, 4);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Cardinal.prototype.hasCodeSwitch = function() {
  return jspb.Message.hasField(this, 4);
};


/**
 * repeated string field_order = 5;
 * @return {!Array<string>}
 */
proto.speech.tts.Cardinal.prototype.getFieldOrderList = function() {
  return /** @type {!Array<string>} */ (jspb.Message.getRepeatedField(this, 5));
};


/**
 * @param {!Array<string>} value
 * @return {!proto.speech.tts.Cardinal} returns this
 */
proto.speech.tts.Cardinal.prototype.setFieldOrderList = function(value) {
  return jspb.Message.setField(this, 5, value || []);
};


/**
 * @param {string} value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.Cardinal} returns this
 */
proto.speech.tts.Cardinal.prototype.addFieldOrder = function(value, opt_index) {
  return jspb.Message.addToRepeatedField(this, 5, value, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.Cardinal} returns this
 */
proto.speech.tts.Cardinal.prototype.clearFieldOrderList = function() {
  return jspb.Message.clearRepeatedField(this, 5);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.Cardinal}
 */
proto.speech.tts.Cardinal.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.Cardinal, data);
};



//speech/tts/public/semiotic_classes_proto_jspb/chemicalformula.jspb.js
// source: speech/tts/public/semiotic_classes.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.ChemicalFormula');
goog.provide('proto.speech.tts.ChemicalFormula.Unit');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.ChemicalFormula = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, proto.speech.tts.ChemicalFormula.repeatedFields_, null);
};
goog.inherits(proto.speech.tts.ChemicalFormula, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.ChemicalFormula.displayName = 'proto.speech.tts.ChemicalFormula';
}
/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.ChemicalFormula.Unit = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.speech.tts.ChemicalFormula.Unit, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.ChemicalFormula.Unit.displayName = 'proto.speech.tts.ChemicalFormula.Unit';
}

/**
 * List of repeated fields within this message type.
 * @private {!Array<number>}
 * @const
 */
proto.speech.tts.ChemicalFormula.repeatedFields_ = [1];



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.ChemicalFormula.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.ChemicalFormula.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.ChemicalFormula} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.ChemicalFormula.toObject = function(includeInstance, msg) {
  let f, obj = {
    unitList: jspb.Message.toObjectList(msg.getUnitList(),
    proto.speech.tts.ChemicalFormula.Unit.toObject, includeInstance),
    type: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f,
    charge: (f = jspb.Message.getBooleanField(msg, 3)) == null ? undefined : f,
    codeSwitch: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of ChemicalFormula as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.ChemicalFormula.ObjectFormat = function() {
  /** @type {?Array<!proto.speech.tts.ChemicalFormula.Unit.ObjectFormat>|undefined} */
  this.unitList;

  /** @type {?string|undefined} */
  this.type;

  /** @type {?boolean|undefined} */
  this.charge;

  /** @type {?string|undefined} */
  this.codeSwitch;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.ChemicalFormula.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.ChemicalFormula}
 */
proto.speech.tts.ChemicalFormula.fromObject = function(obj) {
  const msg = new proto.speech.tts.ChemicalFormula();
  obj.unitList && jspb.Message.setRepeatedWrapperField(
      msg, 1, obj.unitList.map(
          proto.speech.tts.ChemicalFormula.Unit.fromObject));
  obj.type != null && jspb.Message.setField(msg, 2, obj.type);
  obj.charge != null && jspb.Message.setField(msg, 3, obj.charge);
  obj.codeSwitch != null && jspb.Message.setField(msg, 4, obj.codeSwitch);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.ChemicalFormula}
 */
proto.speech.tts.ChemicalFormula.deserializeBinary = function(bytes) {
  return proto.speech.tts.ChemicalFormula.deserializeBinaryFromReader(
      new proto.speech.tts.ChemicalFormula(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.ChemicalFormula} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.ChemicalFormula}
 */
proto.speech.tts.ChemicalFormula.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = new proto.speech.tts.ChemicalFormula.Unit();
      reader.readMessage(value,proto.speech.tts.ChemicalFormula.Unit.deserializeBinaryFromReader);
      msg.addUnit(value);
      break;
    case 2:
      value = /** @type {string} */ (reader.readString());
      msg.setType(value);
      break;
    case 3:
      value = /** @type {boolean} */ (reader.readBool());
      msg.setCharge(value);
      break;
    case 4:
      value = /** @type {string} */ (reader.readString());
      msg.setCodeSwitch(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.ChemicalFormula.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.ChemicalFormula.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.ChemicalFormula} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.ChemicalFormula.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = message.getUnitList();
  if (f.length > 0) {
    writer.writeRepeatedMessage(
      1,
      f,
      proto.speech.tts.ChemicalFormula.Unit.serializeBinaryToWriter
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeString(
      2,
      f
    );
  }
  f = /** @type {boolean} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeBool(
      3,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 4));
  if (f != null) {
    writer.writeString(
      4,
      f
    );
  }
};





if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.ChemicalFormula.Unit.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.ChemicalFormula.Unit.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.ChemicalFormula.Unit} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.ChemicalFormula.Unit.toObject = function(includeInstance, msg) {
  let f, obj = {
    symbol: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    numUnits: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of Unit as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.ChemicalFormula.Unit.ObjectFormat = function() {
  /** @type {?string|undefined} */
  this.symbol;

  /** @type {?string|undefined} */
  this.numUnits;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.ChemicalFormula.Unit.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.ChemicalFormula.Unit}
 */
proto.speech.tts.ChemicalFormula.Unit.fromObject = function(obj) {
  const msg = new proto.speech.tts.ChemicalFormula.Unit();
  obj.symbol != null && jspb.Message.setField(msg, 1, obj.symbol);
  obj.numUnits != null && jspb.Message.setField(msg, 2, obj.numUnits);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.ChemicalFormula.Unit}
 */
proto.speech.tts.ChemicalFormula.Unit.deserializeBinary = function(bytes) {
  return proto.speech.tts.ChemicalFormula.Unit.deserializeBinaryFromReader(
      new proto.speech.tts.ChemicalFormula.Unit(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.ChemicalFormula.Unit} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.ChemicalFormula.Unit}
 */
proto.speech.tts.ChemicalFormula.Unit.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {string} */ (reader.readString());
      msg.setSymbol(value);
      break;
    case 2:
      value = /** @type {string} */ (reader.readString());
      msg.setNumUnits(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.ChemicalFormula.Unit.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.ChemicalFormula.Unit.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.ChemicalFormula.Unit} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.ChemicalFormula.Unit.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {string} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeString(
      1,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeString(
      2,
      f
    );
  }
};


/**
 * optional string symbol = 1;
 * @return {string}
 */
proto.speech.tts.ChemicalFormula.Unit.prototype.getSymbol = function() {
  return jspb.Message.getStringFieldWithDefault(this, 1);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.ChemicalFormula.Unit} returns this
 */
proto.speech.tts.ChemicalFormula.Unit.prototype.setSymbol = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.ChemicalFormula.Unit} returns this
 */
proto.speech.tts.ChemicalFormula.Unit.prototype.clearSymbol = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.ChemicalFormula.Unit.prototype.hasSymbol = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional string num_units = 2;
 * @return {string}
 */
proto.speech.tts.ChemicalFormula.Unit.prototype.getNumUnits = function() {
  return jspb.Message.getStringFieldWithDefault(this, 2);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.ChemicalFormula.Unit} returns this
 */
proto.speech.tts.ChemicalFormula.Unit.prototype.setNumUnits = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.ChemicalFormula.Unit} returns this
 */
proto.speech.tts.ChemicalFormula.Unit.prototype.clearNumUnits = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.ChemicalFormula.Unit.prototype.hasNumUnits = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.ChemicalFormula.Unit}
 */
proto.speech.tts.ChemicalFormula.Unit.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.ChemicalFormula.Unit, data);
};


/**
 * repeated Unit unit = 1;
 * @return {!Array<!proto.speech.tts.ChemicalFormula.Unit>}
 */
proto.speech.tts.ChemicalFormula.prototype.getUnitList = function() {
  return /** @type{!Array<!proto.speech.tts.ChemicalFormula.Unit>} */ (
    jspb.Message.getRepeatedWrapperField(this, proto.speech.tts.ChemicalFormula.Unit, 1));
};


/**
 * @param {!Array<!proto.speech.tts.ChemicalFormula.Unit>} value
 * @return {!proto.speech.tts.ChemicalFormula} returns this
*/
proto.speech.tts.ChemicalFormula.prototype.setUnitList = function(value) {
  return jspb.Message.setRepeatedWrapperField(this, 1, value);
};


/**
 * @param {!proto.speech.tts.ChemicalFormula.Unit=} opt_value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.ChemicalFormula.Unit}
 */
proto.speech.tts.ChemicalFormula.prototype.addUnit = function(opt_value, opt_index) {
  return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.speech.tts.ChemicalFormula.Unit, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.ChemicalFormula} returns this
 */
proto.speech.tts.ChemicalFormula.prototype.clearUnitList = function() {
  return jspb.Message.clearRepeatedWrapperField(this, 1);
};


/**
 * optional string type = 2;
 * @return {string}
 */
proto.speech.tts.ChemicalFormula.prototype.getType = function() {
  return jspb.Message.getStringFieldWithDefault(this, 2);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.ChemicalFormula} returns this
 */
proto.speech.tts.ChemicalFormula.prototype.setType = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.ChemicalFormula} returns this
 */
proto.speech.tts.ChemicalFormula.prototype.clearType = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.ChemicalFormula.prototype.hasType = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional bool charge = 3;
 * @return {boolean}
 */
proto.speech.tts.ChemicalFormula.prototype.getCharge = function() {
  return jspb.Message.getBooleanFieldWithDefault(this, 3);
};


/**
 * @param {boolean} value
 * @return {!proto.speech.tts.ChemicalFormula} returns this
 */
proto.speech.tts.ChemicalFormula.prototype.setCharge = function(value) {
  return jspb.Message.setField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.ChemicalFormula} returns this
 */
proto.speech.tts.ChemicalFormula.prototype.clearCharge = function() {
  return jspb.Message.clearField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.ChemicalFormula.prototype.hasCharge = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * optional string code_switch = 4;
 * @return {string}
 */
proto.speech.tts.ChemicalFormula.prototype.getCodeSwitch = function() {
  return jspb.Message.getStringFieldWithDefault(this, 4);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.ChemicalFormula} returns this
 */
proto.speech.tts.ChemicalFormula.prototype.setCodeSwitch = function(value) {
  return jspb.Message.setField(this, 4, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.ChemicalFormula} returns this
 */
proto.speech.tts.ChemicalFormula.prototype.clearCodeSwitch = function() {
  return jspb.Message.clearField(this, 4);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.ChemicalFormula.prototype.hasCodeSwitch = function() {
  return jspb.Message.hasField(this, 4);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.ChemicalFormula}
 */
proto.speech.tts.ChemicalFormula.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.ChemicalFormula, data);
};



//speech/tts/public/semiotic_classes_proto_jspb/connector.jspb.js
// source: speech/tts/public/semiotic_classes.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.Connector');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.speech.tts.MorphosyntacticFeatureVector');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.Connector = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.speech.tts.Connector, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.Connector.displayName = 'proto.speech.tts.Connector';
}



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.Connector.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.Connector.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.Connector} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.Connector.toObject = function(includeInstance, msg) {
  let f, obj = {
    type: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    morphosyntacticFeatures: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f,
    structuredFeatures: (f = msg.getStructuredFeatures()) && proto.speech.tts.MorphosyntacticFeatureVector.toObject(includeInstance, f),
    codeSwitch: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of Connector as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.Connector.ObjectFormat = function() {
  /** @type {?string|undefined} */
  this.type;

  /** @type {?string|undefined} */
  this.morphosyntacticFeatures;

  /** @type {?proto.speech.tts.MorphosyntacticFeatureVector.ObjectFormat|undefined} */
  this.structuredFeatures;

  /** @type {?string|undefined} */
  this.codeSwitch;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.Connector.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.Connector}
 */
proto.speech.tts.Connector.fromObject = function(obj) {
  const msg = new proto.speech.tts.Connector();
  obj.type != null && jspb.Message.setField(msg, 1, obj.type);
  obj.morphosyntacticFeatures != null && jspb.Message.setField(msg, 2, obj.morphosyntacticFeatures);
  obj.structuredFeatures && jspb.Message.setWrapperField(
      msg, 4, proto.speech.tts.MorphosyntacticFeatureVector.fromObject(obj.structuredFeatures));
  obj.codeSwitch != null && jspb.Message.setField(msg, 3, obj.codeSwitch);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.Connector}
 */
proto.speech.tts.Connector.deserializeBinary = function(bytes) {
  return proto.speech.tts.Connector.deserializeBinaryFromReader(
      new proto.speech.tts.Connector(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.Connector} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.Connector}
 */
proto.speech.tts.Connector.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {string} */ (reader.readString());
      msg.setType(value);
      break;
    case 2:
      value = /** @type {string} */ (reader.readString());
      msg.setMorphosyntacticFeatures(value);
      break;
    case 4:
      value = new proto.speech.tts.MorphosyntacticFeatureVector();
      reader.readMessage(value,proto.speech.tts.MorphosyntacticFeatureVector.deserializeBinaryFromReader);
      msg.setStructuredFeatures(value);
      break;
    case 3:
      value = /** @type {string} */ (reader.readString());
      msg.setCodeSwitch(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.Connector.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.Connector.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.Connector} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.Connector.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {string} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeString(
      1,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeString(
      2,
      f
    );
  }
  f = message.getStructuredFeatures();
  if (f != null) {
    writer.writeMessage(
      4,
      f,
      proto.speech.tts.MorphosyntacticFeatureVector.serializeBinaryToWriter
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeString(
      3,
      f
    );
  }
};


/**
 * optional string type = 1;
 * @return {string}
 */
proto.speech.tts.Connector.prototype.getType = function() {
  return jspb.Message.getStringFieldWithDefault(this, 1);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Connector} returns this
 */
proto.speech.tts.Connector.prototype.setType = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Connector} returns this
 */
proto.speech.tts.Connector.prototype.clearType = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Connector.prototype.hasType = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional string morphosyntactic_features = 2;
 * @return {string}
 */
proto.speech.tts.Connector.prototype.getMorphosyntacticFeatures = function() {
  return jspb.Message.getStringFieldWithDefault(this, 2);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Connector} returns this
 */
proto.speech.tts.Connector.prototype.setMorphosyntacticFeatures = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Connector} returns this
 */
proto.speech.tts.Connector.prototype.clearMorphosyntacticFeatures = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Connector.prototype.hasMorphosyntacticFeatures = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional MorphosyntacticFeatureVector structured_features = 4;
 * @return {?proto.speech.tts.MorphosyntacticFeatureVector}
 */
proto.speech.tts.Connector.prototype.getStructuredFeatures = function() {
  return /** @type{?proto.speech.tts.MorphosyntacticFeatureVector} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.MorphosyntacticFeatureVector, 4));
};


/**
 * @param {?proto.speech.tts.MorphosyntacticFeatureVector|undefined} value
 * @return {!proto.speech.tts.Connector} returns this
*/
proto.speech.tts.Connector.prototype.setStructuredFeatures = function(value) {
  return jspb.Message.setWrapperField(this, 4, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Connector} returns this
 */
proto.speech.tts.Connector.prototype.clearStructuredFeatures = function() {
  return jspb.Message.clearWrapperField(this, 4);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Connector.prototype.hasStructuredFeatures = function() {
  return jspb.Message.hasField(this, 4);
};


/**
 * optional string code_switch = 3;
 * @return {string}
 */
proto.speech.tts.Connector.prototype.getCodeSwitch = function() {
  return jspb.Message.getStringFieldWithDefault(this, 3);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Connector} returns this
 */
proto.speech.tts.Connector.prototype.setCodeSwitch = function(value) {
  return jspb.Message.setField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Connector} returns this
 */
proto.speech.tts.Connector.prototype.clearCodeSwitch = function() {
  return jspb.Message.clearField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Connector.prototype.hasCodeSwitch = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.Connector}
 */
proto.speech.tts.Connector.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.Connector, data);
};



//speech/tts/public/semiotic_classes_proto_jspb/date.jspb.js
// source: speech/tts/public/semiotic_classes.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.Date');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.speech.tts.MorphosyntacticFeatureVector');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.Date = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, proto.speech.tts.Date.repeatedFields_, null);
};
goog.inherits(proto.speech.tts.Date, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.Date.displayName = 'proto.speech.tts.Date';
}

/**
 * List of repeated fields within this message type.
 * @private {!Array<number>}
 * @const
 */
proto.speech.tts.Date.repeatedFields_ = [12];



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.Date.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.Date.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.Date} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.Date.toObject = function(includeInstance, msg) {
  let f, obj = {
    weekday: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    day: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f,
    dayIndicator: (f = jspb.Message.getField(msg, 14)) == null ? undefined : f,
    month: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f,
    monthIndicator: (f = jspb.Message.getField(msg, 15)) == null ? undefined : f,
    year: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f,
    yearIndicator: (f = jspb.Message.getField(msg, 16)) == null ? undefined : f,
    style: (f = jspb.Message.getField(msg, 5)) == null ? undefined : f,
    text: (f = jspb.Message.getField(msg, 6)) == null ? undefined : f,
    shortYear: (f = jspb.Message.getBooleanField(msg, 7)) == null ? undefined : f,
    era: (f = jspb.Message.getField(msg, 8)) == null ? undefined : f,
    morphosyntacticFeatures: (f = jspb.Message.getField(msg, 9)) == null ? undefined : f,
    structuredFeatures: (f = msg.getStructuredFeatures()) && proto.speech.tts.MorphosyntacticFeatureVector.toObject(includeInstance, f),
    preserveOrder: (f = jspb.Message.getBooleanField(msg, 10)) == null ? undefined : f,
    codeSwitch: (f = jspb.Message.getField(msg, 11)) == null ? undefined : f,
    fieldOrderList: (f = jspb.Message.getRepeatedField(msg, 12)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of Date as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.Date.ObjectFormat = function() {
  /** @type {?string|undefined} */
  this.weekday;

  /** @type {?string|undefined} */
  this.day;

  /** @type {?string|undefined} */
  this.dayIndicator;

  /** @type {?string|undefined} */
  this.month;

  /** @type {?string|undefined} */
  this.monthIndicator;

  /** @type {?string|undefined} */
  this.year;

  /** @type {?string|undefined} */
  this.yearIndicator;

  /** @type {?number|undefined} */
  this.style;

  /** @type {?string|undefined} */
  this.text;

  /** @type {?boolean|undefined} */
  this.shortYear;

  /** @type {?string|undefined} */
  this.era;

  /** @type {?string|undefined} */
  this.morphosyntacticFeatures;

  /** @type {?proto.speech.tts.MorphosyntacticFeatureVector.ObjectFormat|undefined} */
  this.structuredFeatures;

  /** @type {?boolean|undefined} */
  this.preserveOrder;

  /** @type {?string|undefined} */
  this.codeSwitch;

  /** @type {?Array<string>|undefined} */
  this.fieldOrderList;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.Date.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.Date}
 */
proto.speech.tts.Date.fromObject = function(obj) {
  const msg = new proto.speech.tts.Date();
  obj.weekday != null && jspb.Message.setField(msg, 1, obj.weekday);
  obj.day != null && jspb.Message.setField(msg, 2, obj.day);
  obj.dayIndicator != null && jspb.Message.setField(msg, 14, obj.dayIndicator);
  obj.month != null && jspb.Message.setField(msg, 3, obj.month);
  obj.monthIndicator != null && jspb.Message.setField(msg, 15, obj.monthIndicator);
  obj.year != null && jspb.Message.setField(msg, 4, obj.year);
  obj.yearIndicator != null && jspb.Message.setField(msg, 16, obj.yearIndicator);
  obj.style != null && jspb.Message.setField(msg, 5, obj.style);
  obj.text != null && jspb.Message.setField(msg, 6, obj.text);
  obj.shortYear != null && jspb.Message.setField(msg, 7, obj.shortYear);
  obj.era != null && jspb.Message.setField(msg, 8, obj.era);
  obj.morphosyntacticFeatures != null && jspb.Message.setField(msg, 9, obj.morphosyntacticFeatures);
  obj.structuredFeatures && jspb.Message.setWrapperField(
      msg, 13, proto.speech.tts.MorphosyntacticFeatureVector.fromObject(obj.structuredFeatures));
  obj.preserveOrder != null && jspb.Message.setField(msg, 10, obj.preserveOrder);
  obj.codeSwitch != null && jspb.Message.setField(msg, 11, obj.codeSwitch);
  obj.fieldOrderList != null && jspb.Message.setField(msg, 12, obj.fieldOrderList);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.Date}
 */
proto.speech.tts.Date.deserializeBinary = function(bytes) {
  return proto.speech.tts.Date.deserializeBinaryFromReader(
      new proto.speech.tts.Date(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.Date} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.Date}
 */
proto.speech.tts.Date.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {string} */ (reader.readString());
      msg.setWeekday(value);
      break;
    case 2:
      value = /** @type {string} */ (reader.readString());
      msg.setDay(value);
      break;
    case 14:
      value = /** @type {string} */ (reader.readString());
      msg.setDayIndicator(value);
      break;
    case 3:
      value = /** @type {string} */ (reader.readString());
      msg.setMonth(value);
      break;
    case 15:
      value = /** @type {string} */ (reader.readString());
      msg.setMonthIndicator(value);
      break;
    case 4:
      value = /** @type {string} */ (reader.readString());
      msg.setYear(value);
      break;
    case 16:
      value = /** @type {string} */ (reader.readString());
      msg.setYearIndicator(value);
      break;
    case 5:
      value = /** @type {number} */ (reader.readInt32());
      msg.setStyle(value);
      break;
    case 6:
      value = /** @type {string} */ (reader.readString());
      msg.setText(value);
      break;
    case 7:
      value = /** @type {boolean} */ (reader.readBool());
      msg.setShortYear(value);
      break;
    case 8:
      value = /** @type {string} */ (reader.readString());
      msg.setEra(value);
      break;
    case 9:
      value = /** @type {string} */ (reader.readString());
      msg.setMorphosyntacticFeatures(value);
      break;
    case 13:
      value = new proto.speech.tts.MorphosyntacticFeatureVector();
      reader.readMessage(value,proto.speech.tts.MorphosyntacticFeatureVector.deserializeBinaryFromReader);
      msg.setStructuredFeatures(value);
      break;
    case 10:
      value = /** @type {boolean} */ (reader.readBool());
      msg.setPreserveOrder(value);
      break;
    case 11:
      value = /** @type {string} */ (reader.readString());
      msg.setCodeSwitch(value);
      break;
    case 12:
      value = /** @type {string} */ (reader.readString());
      msg.addFieldOrder(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.Date.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.Date.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.Date} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.Date.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {string} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeString(
      1,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeString(
      2,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 14));
  if (f != null) {
    writer.writeString(
      14,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeString(
      3,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 15));
  if (f != null) {
    writer.writeString(
      15,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 4));
  if (f != null) {
    writer.writeString(
      4,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 16));
  if (f != null) {
    writer.writeString(
      16,
      f
    );
  }
  f = /** @type {number} */ (jspb.Message.getField(message, 5));
  if (f != null) {
    writer.writeInt32(
      5,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 6));
  if (f != null) {
    writer.writeString(
      6,
      f
    );
  }
  f = /** @type {boolean} */ (jspb.Message.getField(message, 7));
  if (f != null) {
    writer.writeBool(
      7,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 8));
  if (f != null) {
    writer.writeString(
      8,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 9));
  if (f != null) {
    writer.writeString(
      9,
      f
    );
  }
  f = message.getStructuredFeatures();
  if (f != null) {
    writer.writeMessage(
      13,
      f,
      proto.speech.tts.MorphosyntacticFeatureVector.serializeBinaryToWriter
    );
  }
  f = /** @type {boolean} */ (jspb.Message.getField(message, 10));
  if (f != null) {
    writer.writeBool(
      10,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 11));
  if (f != null) {
    writer.writeString(
      11,
      f
    );
  }
  f = message.getFieldOrderList();
  if (f.length > 0) {
    writer.writeRepeatedString(
      12,
      f
    );
  }
};


/**
 * optional string weekday = 1;
 * @return {string}
 */
proto.speech.tts.Date.prototype.getWeekday = function() {
  return jspb.Message.getStringFieldWithDefault(this, 1);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Date} returns this
 */
proto.speech.tts.Date.prototype.setWeekday = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Date} returns this
 */
proto.speech.tts.Date.prototype.clearWeekday = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Date.prototype.hasWeekday = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional string day = 2;
 * @return {string}
 */
proto.speech.tts.Date.prototype.getDay = function() {
  return jspb.Message.getStringFieldWithDefault(this, 2);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Date} returns this
 */
proto.speech.tts.Date.prototype.setDay = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Date} returns this
 */
proto.speech.tts.Date.prototype.clearDay = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Date.prototype.hasDay = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional string day_indicator = 14;
 * @return {string}
 */
proto.speech.tts.Date.prototype.getDayIndicator = function() {
  return jspb.Message.getStringFieldWithDefault(this, 14);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Date} returns this
 */
proto.speech.tts.Date.prototype.setDayIndicator = function(value) {
  return jspb.Message.setField(this, 14, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Date} returns this
 */
proto.speech.tts.Date.prototype.clearDayIndicator = function() {
  return jspb.Message.clearField(this, 14);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Date.prototype.hasDayIndicator = function() {
  return jspb.Message.hasField(this, 14);
};


/**
 * optional string month = 3;
 * @return {string}
 */
proto.speech.tts.Date.prototype.getMonth = function() {
  return jspb.Message.getStringFieldWithDefault(this, 3);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Date} returns this
 */
proto.speech.tts.Date.prototype.setMonth = function(value) {
  return jspb.Message.setField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Date} returns this
 */
proto.speech.tts.Date.prototype.clearMonth = function() {
  return jspb.Message.clearField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Date.prototype.hasMonth = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * optional string month_indicator = 15;
 * @return {string}
 */
proto.speech.tts.Date.prototype.getMonthIndicator = function() {
  return jspb.Message.getStringFieldWithDefault(this, 15);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Date} returns this
 */
proto.speech.tts.Date.prototype.setMonthIndicator = function(value) {
  return jspb.Message.setField(this, 15, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Date} returns this
 */
proto.speech.tts.Date.prototype.clearMonthIndicator = function() {
  return jspb.Message.clearField(this, 15);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Date.prototype.hasMonthIndicator = function() {
  return jspb.Message.hasField(this, 15);
};


/**
 * optional string year = 4;
 * @return {string}
 */
proto.speech.tts.Date.prototype.getYear = function() {
  return jspb.Message.getStringFieldWithDefault(this, 4);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Date} returns this
 */
proto.speech.tts.Date.prototype.setYear = function(value) {
  return jspb.Message.setField(this, 4, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Date} returns this
 */
proto.speech.tts.Date.prototype.clearYear = function() {
  return jspb.Message.clearField(this, 4);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Date.prototype.hasYear = function() {
  return jspb.Message.hasField(this, 4);
};


/**
 * optional string year_indicator = 16;
 * @return {string}
 */
proto.speech.tts.Date.prototype.getYearIndicator = function() {
  return jspb.Message.getStringFieldWithDefault(this, 16);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Date} returns this
 */
proto.speech.tts.Date.prototype.setYearIndicator = function(value) {
  return jspb.Message.setField(this, 16, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Date} returns this
 */
proto.speech.tts.Date.prototype.clearYearIndicator = function() {
  return jspb.Message.clearField(this, 16);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Date.prototype.hasYearIndicator = function() {
  return jspb.Message.hasField(this, 16);
};


/**
 * optional int32 style = 5;
 * @return {number}
 */
proto.speech.tts.Date.prototype.getStyle = function() {
  return jspb.Message.getIntegerFieldWithDefault(this, 5);
};


/**
 * @param {number} value
 * @return {!proto.speech.tts.Date} returns this
 */
proto.speech.tts.Date.prototype.setStyle = function(value) {
  return jspb.Message.setField(this, 5, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Date} returns this
 */
proto.speech.tts.Date.prototype.clearStyle = function() {
  return jspb.Message.clearField(this, 5);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Date.prototype.hasStyle = function() {
  return jspb.Message.hasField(this, 5);
};


/**
 * optional string text = 6;
 * @return {string}
 * @deprecated
 */
proto.speech.tts.Date.prototype.getText = function() {
  return jspb.Message.getStringFieldWithDefault(this, 6);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Date} returns this
 * @deprecated
 */
proto.speech.tts.Date.prototype.setText = function(value) {
  return jspb.Message.setField(this, 6, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Date} returns this
 * @deprecated
 */
proto.speech.tts.Date.prototype.clearText = function() {
  return jspb.Message.clearField(this, 6);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 * @deprecated
 */
proto.speech.tts.Date.prototype.hasText = function() {
  return jspb.Message.hasField(this, 6);
};


/**
 * optional bool short_year = 7;
 * @return {boolean}
 * @deprecated
 */
proto.speech.tts.Date.prototype.getShortYear = function() {
  return jspb.Message.getBooleanFieldWithDefault(this, 7);
};


/**
 * @param {boolean} value
 * @return {!proto.speech.tts.Date} returns this
 * @deprecated
 */
proto.speech.tts.Date.prototype.setShortYear = function(value) {
  return jspb.Message.setField(this, 7, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Date} returns this
 * @deprecated
 */
proto.speech.tts.Date.prototype.clearShortYear = function() {
  return jspb.Message.clearField(this, 7);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 * @deprecated
 */
proto.speech.tts.Date.prototype.hasShortYear = function() {
  return jspb.Message.hasField(this, 7);
};


/**
 * optional string era = 8;
 * @return {string}
 */
proto.speech.tts.Date.prototype.getEra = function() {
  return jspb.Message.getStringFieldWithDefault(this, 8);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Date} returns this
 */
proto.speech.tts.Date.prototype.setEra = function(value) {
  return jspb.Message.setField(this, 8, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Date} returns this
 */
proto.speech.tts.Date.prototype.clearEra = function() {
  return jspb.Message.clearField(this, 8);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Date.prototype.hasEra = function() {
  return jspb.Message.hasField(this, 8);
};


/**
 * optional string morphosyntactic_features = 9;
 * @return {string}
 */
proto.speech.tts.Date.prototype.getMorphosyntacticFeatures = function() {
  return jspb.Message.getStringFieldWithDefault(this, 9);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Date} returns this
 */
proto.speech.tts.Date.prototype.setMorphosyntacticFeatures = function(value) {
  return jspb.Message.setField(this, 9, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Date} returns this
 */
proto.speech.tts.Date.prototype.clearMorphosyntacticFeatures = function() {
  return jspb.Message.clearField(this, 9);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Date.prototype.hasMorphosyntacticFeatures = function() {
  return jspb.Message.hasField(this, 9);
};


/**
 * optional MorphosyntacticFeatureVector structured_features = 13;
 * @return {?proto.speech.tts.MorphosyntacticFeatureVector}
 */
proto.speech.tts.Date.prototype.getStructuredFeatures = function() {
  return /** @type{?proto.speech.tts.MorphosyntacticFeatureVector} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.MorphosyntacticFeatureVector, 13));
};


/**
 * @param {?proto.speech.tts.MorphosyntacticFeatureVector|undefined} value
 * @return {!proto.speech.tts.Date} returns this
*/
proto.speech.tts.Date.prototype.setStructuredFeatures = function(value) {
  return jspb.Message.setWrapperField(this, 13, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Date} returns this
 */
proto.speech.tts.Date.prototype.clearStructuredFeatures = function() {
  return jspb.Message.clearWrapperField(this, 13);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Date.prototype.hasStructuredFeatures = function() {
  return jspb.Message.hasField(this, 13);
};


/**
 * optional bool preserve_order = 10;
 * @return {boolean}
 */
proto.speech.tts.Date.prototype.getPreserveOrder = function() {
  return jspb.Message.getBooleanFieldWithDefault(this, 10);
};


/**
 * @param {boolean} value
 * @return {!proto.speech.tts.Date} returns this
 */
proto.speech.tts.Date.prototype.setPreserveOrder = function(value) {
  return jspb.Message.setField(this, 10, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Date} returns this
 */
proto.speech.tts.Date.prototype.clearPreserveOrder = function() {
  return jspb.Message.clearField(this, 10);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Date.prototype.hasPreserveOrder = function() {
  return jspb.Message.hasField(this, 10);
};


/**
 * optional string code_switch = 11;
 * @return {string}
 */
proto.speech.tts.Date.prototype.getCodeSwitch = function() {
  return jspb.Message.getStringFieldWithDefault(this, 11);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Date} returns this
 */
proto.speech.tts.Date.prototype.setCodeSwitch = function(value) {
  return jspb.Message.setField(this, 11, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Date} returns this
 */
proto.speech.tts.Date.prototype.clearCodeSwitch = function() {
  return jspb.Message.clearField(this, 11);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Date.prototype.hasCodeSwitch = function() {
  return jspb.Message.hasField(this, 11);
};


/**
 * repeated string field_order = 12;
 * @return {!Array<string>}
 */
proto.speech.tts.Date.prototype.getFieldOrderList = function() {
  return /** @type {!Array<string>} */ (jspb.Message.getRepeatedField(this, 12));
};


/**
 * @param {!Array<string>} value
 * @return {!proto.speech.tts.Date} returns this
 */
proto.speech.tts.Date.prototype.setFieldOrderList = function(value) {
  return jspb.Message.setField(this, 12, value || []);
};


/**
 * @param {string} value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.Date} returns this
 */
proto.speech.tts.Date.prototype.addFieldOrder = function(value, opt_index) {
  return jspb.Message.addToRepeatedField(this, 12, value, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.Date} returns this
 */
proto.speech.tts.Date.prototype.clearFieldOrderList = function() {
  return jspb.Message.clearRepeatedField(this, 12);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.Date}
 */
proto.speech.tts.Date.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.Date, data);
};



//speech/tts/public/semiotic_classes_proto_jspb/decimal.jspb.js
// source: speech/tts/public/semiotic_classes.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.Decimal');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.speech.tts.MorphosyntacticFeatureVector');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.Decimal = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, proto.speech.tts.Decimal.repeatedFields_, null);
};
goog.inherits(proto.speech.tts.Decimal, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.Decimal.displayName = 'proto.speech.tts.Decimal';
}

/**
 * List of repeated fields within this message type.
 * @private {!Array<number>}
 * @const
 */
proto.speech.tts.Decimal.repeatedFields_ = [10];



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.Decimal.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.Decimal.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.Decimal} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.Decimal.toObject = function(includeInstance, msg) {
  let f, obj = {
    negative: (f = jspb.Message.getBooleanField(msg, 1)) == null ? undefined : f,
    integerPart: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f,
    fractionalPart: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f,
    quantity: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f,
    exponent: (f = jspb.Message.getField(msg, 5)) == null ? undefined : f,
    style: (f = jspb.Message.getField(msg, 6)) == null ? undefined : f,
    morphosyntacticFeatures: (f = jspb.Message.getField(msg, 7)) == null ? undefined : f,
    structuredFeatures: (f = msg.getStructuredFeatures()) && proto.speech.tts.MorphosyntacticFeatureVector.toObject(includeInstance, f),
    preserveOrder: (f = jspb.Message.getBooleanField(msg, 8)) == null ? undefined : f,
    codeSwitch: (f = jspb.Message.getField(msg, 9)) == null ? undefined : f,
    fieldOrderList: (f = jspb.Message.getRepeatedField(msg, 10)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of Decimal as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.Decimal.ObjectFormat = function() {
  /** @type {?boolean|undefined} */
  this.negative;

  /** @type {?string|undefined} */
  this.integerPart;

  /** @type {?string|undefined} */
  this.fractionalPart;

  /** @type {?string|undefined} */
  this.quantity;

  /** @type {?string|undefined} */
  this.exponent;

  /** @type {?number|undefined} */
  this.style;

  /** @type {?string|undefined} */
  this.morphosyntacticFeatures;

  /** @type {?proto.speech.tts.MorphosyntacticFeatureVector.ObjectFormat|undefined} */
  this.structuredFeatures;

  /** @type {?boolean|undefined} */
  this.preserveOrder;

  /** @type {?string|undefined} */
  this.codeSwitch;

  /** @type {?Array<string>|undefined} */
  this.fieldOrderList;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.Decimal.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.Decimal}
 */
proto.speech.tts.Decimal.fromObject = function(obj) {
  const msg = new proto.speech.tts.Decimal();
  obj.negative != null && jspb.Message.setField(msg, 1, obj.negative);
  obj.integerPart != null && jspb.Message.setField(msg, 2, obj.integerPart);
  obj.fractionalPart != null && jspb.Message.setField(msg, 3, obj.fractionalPart);
  obj.quantity != null && jspb.Message.setField(msg, 4, obj.quantity);
  obj.exponent != null && jspb.Message.setField(msg, 5, obj.exponent);
  obj.style != null && jspb.Message.setField(msg, 6, obj.style);
  obj.morphosyntacticFeatures != null && jspb.Message.setField(msg, 7, obj.morphosyntacticFeatures);
  obj.structuredFeatures && jspb.Message.setWrapperField(
      msg, 11, proto.speech.tts.MorphosyntacticFeatureVector.fromObject(obj.structuredFeatures));
  obj.preserveOrder != null && jspb.Message.setField(msg, 8, obj.preserveOrder);
  obj.codeSwitch != null && jspb.Message.setField(msg, 9, obj.codeSwitch);
  obj.fieldOrderList != null && jspb.Message.setField(msg, 10, obj.fieldOrderList);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.Decimal}
 */
proto.speech.tts.Decimal.deserializeBinary = function(bytes) {
  return proto.speech.tts.Decimal.deserializeBinaryFromReader(
      new proto.speech.tts.Decimal(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.Decimal} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.Decimal}
 */
proto.speech.tts.Decimal.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {boolean} */ (reader.readBool());
      msg.setNegative(value);
      break;
    case 2:
      value = /** @type {string} */ (reader.readString());
      msg.setIntegerPart(value);
      break;
    case 3:
      value = /** @type {string} */ (reader.readString());
      msg.setFractionalPart(value);
      break;
    case 4:
      value = /** @type {string} */ (reader.readString());
      msg.setQuantity(value);
      break;
    case 5:
      value = /** @type {string} */ (reader.readString());
      msg.setExponent(value);
      break;
    case 6:
      value = /** @type {number} */ (reader.readInt32());
      msg.setStyle(value);
      break;
    case 7:
      value = /** @type {string} */ (reader.readString());
      msg.setMorphosyntacticFeatures(value);
      break;
    case 11:
      value = new proto.speech.tts.MorphosyntacticFeatureVector();
      reader.readMessage(value,proto.speech.tts.MorphosyntacticFeatureVector.deserializeBinaryFromReader);
      msg.setStructuredFeatures(value);
      break;
    case 8:
      value = /** @type {boolean} */ (reader.readBool());
      msg.setPreserveOrder(value);
      break;
    case 9:
      value = /** @type {string} */ (reader.readString());
      msg.setCodeSwitch(value);
      break;
    case 10:
      value = /** @type {string} */ (reader.readString());
      msg.addFieldOrder(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.Decimal.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.Decimal.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.Decimal} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.Decimal.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {boolean} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeBool(
      1,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeString(
      2,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeString(
      3,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 4));
  if (f != null) {
    writer.writeString(
      4,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 5));
  if (f != null) {
    writer.writeString(
      5,
      f
    );
  }
  f = /** @type {number} */ (jspb.Message.getField(message, 6));
  if (f != null) {
    writer.writeInt32(
      6,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 7));
  if (f != null) {
    writer.writeString(
      7,
      f
    );
  }
  f = message.getStructuredFeatures();
  if (f != null) {
    writer.writeMessage(
      11,
      f,
      proto.speech.tts.MorphosyntacticFeatureVector.serializeBinaryToWriter
    );
  }
  f = /** @type {boolean} */ (jspb.Message.getField(message, 8));
  if (f != null) {
    writer.writeBool(
      8,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 9));
  if (f != null) {
    writer.writeString(
      9,
      f
    );
  }
  f = message.getFieldOrderList();
  if (f.length > 0) {
    writer.writeRepeatedString(
      10,
      f
    );
  }
};


/**
 * optional bool negative = 1;
 * @return {boolean}
 */
proto.speech.tts.Decimal.prototype.getNegative = function() {
  return jspb.Message.getBooleanFieldWithDefault(this, 1);
};


/**
 * @param {boolean} value
 * @return {!proto.speech.tts.Decimal} returns this
 */
proto.speech.tts.Decimal.prototype.setNegative = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Decimal} returns this
 */
proto.speech.tts.Decimal.prototype.clearNegative = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Decimal.prototype.hasNegative = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional string integer_part = 2;
 * @return {string}
 */
proto.speech.tts.Decimal.prototype.getIntegerPart = function() {
  return jspb.Message.getStringFieldWithDefault(this, 2);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Decimal} returns this
 */
proto.speech.tts.Decimal.prototype.setIntegerPart = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Decimal} returns this
 */
proto.speech.tts.Decimal.prototype.clearIntegerPart = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Decimal.prototype.hasIntegerPart = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional string fractional_part = 3;
 * @return {string}
 */
proto.speech.tts.Decimal.prototype.getFractionalPart = function() {
  return jspb.Message.getStringFieldWithDefault(this, 3);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Decimal} returns this
 */
proto.speech.tts.Decimal.prototype.setFractionalPart = function(value) {
  return jspb.Message.setField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Decimal} returns this
 */
proto.speech.tts.Decimal.prototype.clearFractionalPart = function() {
  return jspb.Message.clearField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Decimal.prototype.hasFractionalPart = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * optional string quantity = 4;
 * @return {string}
 */
proto.speech.tts.Decimal.prototype.getQuantity = function() {
  return jspb.Message.getStringFieldWithDefault(this, 4);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Decimal} returns this
 */
proto.speech.tts.Decimal.prototype.setQuantity = function(value) {
  return jspb.Message.setField(this, 4, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Decimal} returns this
 */
proto.speech.tts.Decimal.prototype.clearQuantity = function() {
  return jspb.Message.clearField(this, 4);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Decimal.prototype.hasQuantity = function() {
  return jspb.Message.hasField(this, 4);
};


/**
 * optional string exponent = 5;
 * @return {string}
 */
proto.speech.tts.Decimal.prototype.getExponent = function() {
  return jspb.Message.getStringFieldWithDefault(this, 5);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Decimal} returns this
 */
proto.speech.tts.Decimal.prototype.setExponent = function(value) {
  return jspb.Message.setField(this, 5, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Decimal} returns this
 */
proto.speech.tts.Decimal.prototype.clearExponent = function() {
  return jspb.Message.clearField(this, 5);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Decimal.prototype.hasExponent = function() {
  return jspb.Message.hasField(this, 5);
};


/**
 * optional int32 style = 6;
 * @return {number}
 * @deprecated
 */
proto.speech.tts.Decimal.prototype.getStyle = function() {
  return jspb.Message.getIntegerFieldWithDefault(this, 6);
};


/**
 * @param {number} value
 * @return {!proto.speech.tts.Decimal} returns this
 * @deprecated
 */
proto.speech.tts.Decimal.prototype.setStyle = function(value) {
  return jspb.Message.setField(this, 6, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Decimal} returns this
 * @deprecated
 */
proto.speech.tts.Decimal.prototype.clearStyle = function() {
  return jspb.Message.clearField(this, 6);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 * @deprecated
 */
proto.speech.tts.Decimal.prototype.hasStyle = function() {
  return jspb.Message.hasField(this, 6);
};


/**
 * optional string morphosyntactic_features = 7;
 * @return {string}
 */
proto.speech.tts.Decimal.prototype.getMorphosyntacticFeatures = function() {
  return jspb.Message.getStringFieldWithDefault(this, 7);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Decimal} returns this
 */
proto.speech.tts.Decimal.prototype.setMorphosyntacticFeatures = function(value) {
  return jspb.Message.setField(this, 7, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Decimal} returns this
 */
proto.speech.tts.Decimal.prototype.clearMorphosyntacticFeatures = function() {
  return jspb.Message.clearField(this, 7);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Decimal.prototype.hasMorphosyntacticFeatures = function() {
  return jspb.Message.hasField(this, 7);
};


/**
 * optional MorphosyntacticFeatureVector structured_features = 11;
 * @return {?proto.speech.tts.MorphosyntacticFeatureVector}
 */
proto.speech.tts.Decimal.prototype.getStructuredFeatures = function() {
  return /** @type{?proto.speech.tts.MorphosyntacticFeatureVector} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.MorphosyntacticFeatureVector, 11));
};


/**
 * @param {?proto.speech.tts.MorphosyntacticFeatureVector|undefined} value
 * @return {!proto.speech.tts.Decimal} returns this
*/
proto.speech.tts.Decimal.prototype.setStructuredFeatures = function(value) {
  return jspb.Message.setWrapperField(this, 11, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Decimal} returns this
 */
proto.speech.tts.Decimal.prototype.clearStructuredFeatures = function() {
  return jspb.Message.clearWrapperField(this, 11);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Decimal.prototype.hasStructuredFeatures = function() {
  return jspb.Message.hasField(this, 11);
};


/**
 * optional bool preserve_order = 8;
 * @return {boolean}
 */
proto.speech.tts.Decimal.prototype.getPreserveOrder = function() {
  return jspb.Message.getBooleanFieldWithDefault(this, 8);
};


/**
 * @param {boolean} value
 * @return {!proto.speech.tts.Decimal} returns this
 */
proto.speech.tts.Decimal.prototype.setPreserveOrder = function(value) {
  return jspb.Message.setField(this, 8, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Decimal} returns this
 */
proto.speech.tts.Decimal.prototype.clearPreserveOrder = function() {
  return jspb.Message.clearField(this, 8);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Decimal.prototype.hasPreserveOrder = function() {
  return jspb.Message.hasField(this, 8);
};


/**
 * optional string code_switch = 9;
 * @return {string}
 */
proto.speech.tts.Decimal.prototype.getCodeSwitch = function() {
  return jspb.Message.getStringFieldWithDefault(this, 9);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Decimal} returns this
 */
proto.speech.tts.Decimal.prototype.setCodeSwitch = function(value) {
  return jspb.Message.setField(this, 9, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Decimal} returns this
 */
proto.speech.tts.Decimal.prototype.clearCodeSwitch = function() {
  return jspb.Message.clearField(this, 9);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Decimal.prototype.hasCodeSwitch = function() {
  return jspb.Message.hasField(this, 9);
};


/**
 * repeated string field_order = 10;
 * @return {!Array<string>}
 */
proto.speech.tts.Decimal.prototype.getFieldOrderList = function() {
  return /** @type {!Array<string>} */ (jspb.Message.getRepeatedField(this, 10));
};


/**
 * @param {!Array<string>} value
 * @return {!proto.speech.tts.Decimal} returns this
 */
proto.speech.tts.Decimal.prototype.setFieldOrderList = function(value) {
  return jspb.Message.setField(this, 10, value || []);
};


/**
 * @param {string} value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.Decimal} returns this
 */
proto.speech.tts.Decimal.prototype.addFieldOrder = function(value, opt_index) {
  return jspb.Message.addToRepeatedField(this, 10, value, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.Decimal} returns this
 */
proto.speech.tts.Decimal.prototype.clearFieldOrderList = function() {
  return jspb.Message.clearRepeatedField(this, 10);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.Decimal}
 */
proto.speech.tts.Decimal.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.Decimal, data);
};



//speech/tts/public/semiotic_classes_proto_jspb/electronic.jspb.js
// source: speech/tts/public/semiotic_classes.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.Electronic');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.speech.tts.MorphosyntacticFeatureVector');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.Electronic = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, proto.speech.tts.Electronic.repeatedFields_, null);
};
goog.inherits(proto.speech.tts.Electronic, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.Electronic.displayName = 'proto.speech.tts.Electronic';
}

/**
 * List of repeated fields within this message type.
 * @private {!Array<number>}
 * @const
 */
proto.speech.tts.Electronic.repeatedFields_ = [12];



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.Electronic.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.Electronic.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.Electronic} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.Electronic.toObject = function(includeInstance, msg) {
  let f, obj = {
    protocol: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    username: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f,
    password: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f,
    domain: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f,
    port: (f = jspb.Message.getField(msg, 5)) == null ? undefined : f,
    path: (f = jspb.Message.getField(msg, 6)) == null ? undefined : f,
    queryString: (f = jspb.Message.getField(msg, 7)) == null ? undefined : f,
    fragmentId: (f = jspb.Message.getField(msg, 8)) == null ? undefined : f,
    morphosyntacticFeatures: (f = jspb.Message.getField(msg, 9)) == null ? undefined : f,
    structuredFeatures: (f = msg.getStructuredFeatures()) && proto.speech.tts.MorphosyntacticFeatureVector.toObject(includeInstance, f),
    preserveOrder: (f = jspb.Message.getBooleanField(msg, 10)) == null ? undefined : f,
    codeSwitch: (f = jspb.Message.getField(msg, 11)) == null ? undefined : f,
    fieldOrderList: (f = jspb.Message.getRepeatedField(msg, 12)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of Electronic as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.Electronic.ObjectFormat = function() {
  /** @type {?string|undefined} */
  this.protocol;

  /** @type {?string|undefined} */
  this.username;

  /** @type {?string|undefined} */
  this.password;

  /** @type {?string|undefined} */
  this.domain;

  /** @type {?number|undefined} */
  this.port;

  /** @type {?string|undefined} */
  this.path;

  /** @type {?string|undefined} */
  this.queryString;

  /** @type {?string|undefined} */
  this.fragmentId;

  /** @type {?string|undefined} */
  this.morphosyntacticFeatures;

  /** @type {?proto.speech.tts.MorphosyntacticFeatureVector.ObjectFormat|undefined} */
  this.structuredFeatures;

  /** @type {?boolean|undefined} */
  this.preserveOrder;

  /** @type {?string|undefined} */
  this.codeSwitch;

  /** @type {?Array<string>|undefined} */
  this.fieldOrderList;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.Electronic.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.Electronic}
 */
proto.speech.tts.Electronic.fromObject = function(obj) {
  const msg = new proto.speech.tts.Electronic();
  obj.protocol != null && jspb.Message.setField(msg, 1, obj.protocol);
  obj.username != null && jspb.Message.setField(msg, 2, obj.username);
  obj.password != null && jspb.Message.setField(msg, 3, obj.password);
  obj.domain != null && jspb.Message.setField(msg, 4, obj.domain);
  obj.port != null && jspb.Message.setField(msg, 5, obj.port);
  obj.path != null && jspb.Message.setField(msg, 6, obj.path);
  obj.queryString != null && jspb.Message.setField(msg, 7, obj.queryString);
  obj.fragmentId != null && jspb.Message.setField(msg, 8, obj.fragmentId);
  obj.morphosyntacticFeatures != null && jspb.Message.setField(msg, 9, obj.morphosyntacticFeatures);
  obj.structuredFeatures && jspb.Message.setWrapperField(
      msg, 13, proto.speech.tts.MorphosyntacticFeatureVector.fromObject(obj.structuredFeatures));
  obj.preserveOrder != null && jspb.Message.setField(msg, 10, obj.preserveOrder);
  obj.codeSwitch != null && jspb.Message.setField(msg, 11, obj.codeSwitch);
  obj.fieldOrderList != null && jspb.Message.setField(msg, 12, obj.fieldOrderList);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.Electronic}
 */
proto.speech.tts.Electronic.deserializeBinary = function(bytes) {
  return proto.speech.tts.Electronic.deserializeBinaryFromReader(
      new proto.speech.tts.Electronic(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.Electronic} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.Electronic}
 */
proto.speech.tts.Electronic.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {string} */ (reader.readString());
      msg.setProtocol(value);
      break;
    case 2:
      value = /** @type {string} */ (reader.readString());
      msg.setUsername(value);
      break;
    case 3:
      value = /** @type {string} */ (reader.readString());
      msg.setPassword(value);
      break;
    case 4:
      value = /** @type {string} */ (reader.readString());
      msg.setDomain(value);
      break;
    case 5:
      value = /** @type {number} */ (reader.readInt32());
      msg.setPort(value);
      break;
    case 6:
      value = /** @type {string} */ (reader.readString());
      msg.setPath(value);
      break;
    case 7:
      value = /** @type {string} */ (reader.readString());
      msg.setQueryString(value);
      break;
    case 8:
      value = /** @type {string} */ (reader.readString());
      msg.setFragmentId(value);
      break;
    case 9:
      value = /** @type {string} */ (reader.readString());
      msg.setMorphosyntacticFeatures(value);
      break;
    case 13:
      value = new proto.speech.tts.MorphosyntacticFeatureVector();
      reader.readMessage(value,proto.speech.tts.MorphosyntacticFeatureVector.deserializeBinaryFromReader);
      msg.setStructuredFeatures(value);
      break;
    case 10:
      value = /** @type {boolean} */ (reader.readBool());
      msg.setPreserveOrder(value);
      break;
    case 11:
      value = /** @type {string} */ (reader.readString());
      msg.setCodeSwitch(value);
      break;
    case 12:
      value = /** @type {string} */ (reader.readString());
      msg.addFieldOrder(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.Electronic.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.Electronic.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.Electronic} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.Electronic.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {string} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeString(
      1,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeString(
      2,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeString(
      3,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 4));
  if (f != null) {
    writer.writeString(
      4,
      f
    );
  }
  f = /** @type {number} */ (jspb.Message.getField(message, 5));
  if (f != null) {
    writer.writeInt32(
      5,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 6));
  if (f != null) {
    writer.writeString(
      6,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 7));
  if (f != null) {
    writer.writeString(
      7,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 8));
  if (f != null) {
    writer.writeString(
      8,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 9));
  if (f != null) {
    writer.writeString(
      9,
      f
    );
  }
  f = message.getStructuredFeatures();
  if (f != null) {
    writer.writeMessage(
      13,
      f,
      proto.speech.tts.MorphosyntacticFeatureVector.serializeBinaryToWriter
    );
  }
  f = /** @type {boolean} */ (jspb.Message.getField(message, 10));
  if (f != null) {
    writer.writeBool(
      10,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 11));
  if (f != null) {
    writer.writeString(
      11,
      f
    );
  }
  f = message.getFieldOrderList();
  if (f.length > 0) {
    writer.writeRepeatedString(
      12,
      f
    );
  }
};


/**
 * optional string protocol = 1;
 * @return {string}
 */
proto.speech.tts.Electronic.prototype.getProtocol = function() {
  return jspb.Message.getStringFieldWithDefault(this, 1);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Electronic} returns this
 */
proto.speech.tts.Electronic.prototype.setProtocol = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Electronic} returns this
 */
proto.speech.tts.Electronic.prototype.clearProtocol = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Electronic.prototype.hasProtocol = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional string username = 2;
 * @return {string}
 */
proto.speech.tts.Electronic.prototype.getUsername = function() {
  return jspb.Message.getStringFieldWithDefault(this, 2);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Electronic} returns this
 */
proto.speech.tts.Electronic.prototype.setUsername = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Electronic} returns this
 */
proto.speech.tts.Electronic.prototype.clearUsername = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Electronic.prototype.hasUsername = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional string password = 3;
 * @return {string}
 */
proto.speech.tts.Electronic.prototype.getPassword = function() {
  return jspb.Message.getStringFieldWithDefault(this, 3);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Electronic} returns this
 */
proto.speech.tts.Electronic.prototype.setPassword = function(value) {
  return jspb.Message.setField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Electronic} returns this
 */
proto.speech.tts.Electronic.prototype.clearPassword = function() {
  return jspb.Message.clearField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Electronic.prototype.hasPassword = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * optional string domain = 4;
 * @return {string}
 */
proto.speech.tts.Electronic.prototype.getDomain = function() {
  return jspb.Message.getStringFieldWithDefault(this, 4);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Electronic} returns this
 */
proto.speech.tts.Electronic.prototype.setDomain = function(value) {
  return jspb.Message.setField(this, 4, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Electronic} returns this
 */
proto.speech.tts.Electronic.prototype.clearDomain = function() {
  return jspb.Message.clearField(this, 4);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Electronic.prototype.hasDomain = function() {
  return jspb.Message.hasField(this, 4);
};


/**
 * optional int32 port = 5;
 * @return {number}
 */
proto.speech.tts.Electronic.prototype.getPort = function() {
  return jspb.Message.getIntegerFieldWithDefault(this, 5);
};


/**
 * @param {number} value
 * @return {!proto.speech.tts.Electronic} returns this
 */
proto.speech.tts.Electronic.prototype.setPort = function(value) {
  return jspb.Message.setField(this, 5, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Electronic} returns this
 */
proto.speech.tts.Electronic.prototype.clearPort = function() {
  return jspb.Message.clearField(this, 5);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Electronic.prototype.hasPort = function() {
  return jspb.Message.hasField(this, 5);
};


/**
 * optional string path = 6;
 * @return {string}
 */
proto.speech.tts.Electronic.prototype.getPath = function() {
  return jspb.Message.getStringFieldWithDefault(this, 6);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Electronic} returns this
 */
proto.speech.tts.Electronic.prototype.setPath = function(value) {
  return jspb.Message.setField(this, 6, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Electronic} returns this
 */
proto.speech.tts.Electronic.prototype.clearPath = function() {
  return jspb.Message.clearField(this, 6);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Electronic.prototype.hasPath = function() {
  return jspb.Message.hasField(this, 6);
};


/**
 * optional string query_string = 7;
 * @return {string}
 */
proto.speech.tts.Electronic.prototype.getQueryString = function() {
  return jspb.Message.getStringFieldWithDefault(this, 7);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Electronic} returns this
 */
proto.speech.tts.Electronic.prototype.setQueryString = function(value) {
  return jspb.Message.setField(this, 7, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Electronic} returns this
 */
proto.speech.tts.Electronic.prototype.clearQueryString = function() {
  return jspb.Message.clearField(this, 7);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Electronic.prototype.hasQueryString = function() {
  return jspb.Message.hasField(this, 7);
};


/**
 * optional string fragment_id = 8;
 * @return {string}
 */
proto.speech.tts.Electronic.prototype.getFragmentId = function() {
  return jspb.Message.getStringFieldWithDefault(this, 8);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Electronic} returns this
 */
proto.speech.tts.Electronic.prototype.setFragmentId = function(value) {
  return jspb.Message.setField(this, 8, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Electronic} returns this
 */
proto.speech.tts.Electronic.prototype.clearFragmentId = function() {
  return jspb.Message.clearField(this, 8);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Electronic.prototype.hasFragmentId = function() {
  return jspb.Message.hasField(this, 8);
};


/**
 * optional string morphosyntactic_features = 9;
 * @return {string}
 */
proto.speech.tts.Electronic.prototype.getMorphosyntacticFeatures = function() {
  return jspb.Message.getStringFieldWithDefault(this, 9);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Electronic} returns this
 */
proto.speech.tts.Electronic.prototype.setMorphosyntacticFeatures = function(value) {
  return jspb.Message.setField(this, 9, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Electronic} returns this
 */
proto.speech.tts.Electronic.prototype.clearMorphosyntacticFeatures = function() {
  return jspb.Message.clearField(this, 9);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Electronic.prototype.hasMorphosyntacticFeatures = function() {
  return jspb.Message.hasField(this, 9);
};


/**
 * optional MorphosyntacticFeatureVector structured_features = 13;
 * @return {?proto.speech.tts.MorphosyntacticFeatureVector}
 */
proto.speech.tts.Electronic.prototype.getStructuredFeatures = function() {
  return /** @type{?proto.speech.tts.MorphosyntacticFeatureVector} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.MorphosyntacticFeatureVector, 13));
};


/**
 * @param {?proto.speech.tts.MorphosyntacticFeatureVector|undefined} value
 * @return {!proto.speech.tts.Electronic} returns this
*/
proto.speech.tts.Electronic.prototype.setStructuredFeatures = function(value) {
  return jspb.Message.setWrapperField(this, 13, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Electronic} returns this
 */
proto.speech.tts.Electronic.prototype.clearStructuredFeatures = function() {
  return jspb.Message.clearWrapperField(this, 13);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Electronic.prototype.hasStructuredFeatures = function() {
  return jspb.Message.hasField(this, 13);
};


/**
 * optional bool preserve_order = 10;
 * @return {boolean}
 */
proto.speech.tts.Electronic.prototype.getPreserveOrder = function() {
  return jspb.Message.getBooleanFieldWithDefault(this, 10);
};


/**
 * @param {boolean} value
 * @return {!proto.speech.tts.Electronic} returns this
 */
proto.speech.tts.Electronic.prototype.setPreserveOrder = function(value) {
  return jspb.Message.setField(this, 10, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Electronic} returns this
 */
proto.speech.tts.Electronic.prototype.clearPreserveOrder = function() {
  return jspb.Message.clearField(this, 10);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Electronic.prototype.hasPreserveOrder = function() {
  return jspb.Message.hasField(this, 10);
};


/**
 * optional string code_switch = 11;
 * @return {string}
 */
proto.speech.tts.Electronic.prototype.getCodeSwitch = function() {
  return jspb.Message.getStringFieldWithDefault(this, 11);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Electronic} returns this
 */
proto.speech.tts.Electronic.prototype.setCodeSwitch = function(value) {
  return jspb.Message.setField(this, 11, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Electronic} returns this
 */
proto.speech.tts.Electronic.prototype.clearCodeSwitch = function() {
  return jspb.Message.clearField(this, 11);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Electronic.prototype.hasCodeSwitch = function() {
  return jspb.Message.hasField(this, 11);
};


/**
 * repeated string field_order = 12;
 * @return {!Array<string>}
 */
proto.speech.tts.Electronic.prototype.getFieldOrderList = function() {
  return /** @type {!Array<string>} */ (jspb.Message.getRepeatedField(this, 12));
};


/**
 * @param {!Array<string>} value
 * @return {!proto.speech.tts.Electronic} returns this
 */
proto.speech.tts.Electronic.prototype.setFieldOrderList = function(value) {
  return jspb.Message.setField(this, 12, value || []);
};


/**
 * @param {string} value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.Electronic} returns this
 */
proto.speech.tts.Electronic.prototype.addFieldOrder = function(value, opt_index) {
  return jspb.Message.addToRepeatedField(this, 12, value, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.Electronic} returns this
 */
proto.speech.tts.Electronic.prototype.clearFieldOrderList = function() {
  return jspb.Message.clearRepeatedField(this, 12);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.Electronic}
 */
proto.speech.tts.Electronic.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.Electronic, data);
};



//speech/tts/public/semiotic_classes_proto_jspb/emoticonemoji.jspb.js
// source: speech/tts/public/semiotic_classes.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.EmoticonEmoji');
goog.provide('proto.speech.tts.EmoticonEmoji.Type');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.EmoticonEmoji = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.speech.tts.EmoticonEmoji, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.EmoticonEmoji.displayName = 'proto.speech.tts.EmoticonEmoji';
}



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.EmoticonEmoji.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.EmoticonEmoji.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.EmoticonEmoji} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.EmoticonEmoji.toObject = function(includeInstance, msg) {
  let f, obj = {
    text: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    occurrences: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f,
    type: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f,
    codeSwitch: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of EmoticonEmoji as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.EmoticonEmoji.ObjectFormat = function() {
  /** @type {?string|undefined} */
  this.text;

  /** @type {?number|undefined} */
  this.occurrences;

  /** @type {?number|undefined} */
  this.type;

  /** @type {?string|undefined} */
  this.codeSwitch;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.EmoticonEmoji.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.EmoticonEmoji}
 */
proto.speech.tts.EmoticonEmoji.fromObject = function(obj) {
  const msg = new proto.speech.tts.EmoticonEmoji();
  obj.text != null && jspb.Message.setField(msg, 1, obj.text);
  obj.occurrences != null && jspb.Message.setField(msg, 2, obj.occurrences);
  obj.type != null && jspb.Message.setField(msg, 3, obj.type);
  obj.codeSwitch != null && jspb.Message.setField(msg, 4, obj.codeSwitch);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.EmoticonEmoji}
 */
proto.speech.tts.EmoticonEmoji.deserializeBinary = function(bytes) {
  return proto.speech.tts.EmoticonEmoji.deserializeBinaryFromReader(
      new proto.speech.tts.EmoticonEmoji(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.EmoticonEmoji} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.EmoticonEmoji}
 */
proto.speech.tts.EmoticonEmoji.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {string} */ (reader.readString());
      msg.setText(value);
      break;
    case 2:
      value = /** @type {number} */ (reader.readInt32());
      msg.setOccurrences(value);
      break;
    case 3:
      value = /** @type {!proto.speech.tts.EmoticonEmoji.Type} */ (reader.readEnum());
      msg.setType(value);
      break;
    case 4:
      value = /** @type {string} */ (reader.readString());
      msg.setCodeSwitch(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.EmoticonEmoji.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.EmoticonEmoji.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.EmoticonEmoji} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.EmoticonEmoji.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {string} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeString(
      1,
      f
    );
  }
  f = /** @type {number} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeInt32(
      2,
      f
    );
  }
  f = /** @type {!proto.speech.tts.EmoticonEmoji.Type} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeEnum(
      3,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 4));
  if (f != null) {
    writer.writeString(
      4,
      f
    );
  }
};


/**
 * @enum {number}
 */
proto.speech.tts.EmoticonEmoji.Type = {
  TYPE_UNSPECIFIED: 0,
  EMOTICONS: 1,
  EMOJIS: 2
};

/**
 * optional string text = 1;
 * @return {string}
 */
proto.speech.tts.EmoticonEmoji.prototype.getText = function() {
  return jspb.Message.getStringFieldWithDefault(this, 1);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.EmoticonEmoji} returns this
 */
proto.speech.tts.EmoticonEmoji.prototype.setText = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.EmoticonEmoji} returns this
 */
proto.speech.tts.EmoticonEmoji.prototype.clearText = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.EmoticonEmoji.prototype.hasText = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional int32 occurrences = 2;
 * @return {number}
 */
proto.speech.tts.EmoticonEmoji.prototype.getOccurrences = function() {
  return jspb.Message.getIntegerFieldWithDefault(this, 2);
};


/**
 * @param {number} value
 * @return {!proto.speech.tts.EmoticonEmoji} returns this
 */
proto.speech.tts.EmoticonEmoji.prototype.setOccurrences = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.EmoticonEmoji} returns this
 */
proto.speech.tts.EmoticonEmoji.prototype.clearOccurrences = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.EmoticonEmoji.prototype.hasOccurrences = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional Type type = 3;
 * @return {!proto.speech.tts.EmoticonEmoji.Type}
 */
proto.speech.tts.EmoticonEmoji.prototype.getType = function() {
  return /** @type {!proto.speech.tts.EmoticonEmoji.Type} */ (jspb.Message.getFieldWithDefault(this, 3, 0));
};


/**
 * @param {!proto.speech.tts.EmoticonEmoji.Type} value
 * @return {!proto.speech.tts.EmoticonEmoji} returns this
 */
proto.speech.tts.EmoticonEmoji.prototype.setType = function(value) {
  return jspb.Message.setField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.EmoticonEmoji} returns this
 */
proto.speech.tts.EmoticonEmoji.prototype.clearType = function() {
  return jspb.Message.clearField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.EmoticonEmoji.prototype.hasType = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * optional string code_switch = 4;
 * @return {string}
 */
proto.speech.tts.EmoticonEmoji.prototype.getCodeSwitch = function() {
  return jspb.Message.getStringFieldWithDefault(this, 4);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.EmoticonEmoji} returns this
 */
proto.speech.tts.EmoticonEmoji.prototype.setCodeSwitch = function(value) {
  return jspb.Message.setField(this, 4, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.EmoticonEmoji} returns this
 */
proto.speech.tts.EmoticonEmoji.prototype.clearCodeSwitch = function() {
  return jspb.Message.clearField(this, 4);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.EmoticonEmoji.prototype.hasCodeSwitch = function() {
  return jspb.Message.hasField(this, 4);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.EmoticonEmoji}
 */
proto.speech.tts.EmoticonEmoji.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.EmoticonEmoji, data);
};



//speech/tts/public/semiotic_classes_proto_jspb/fraction.jspb.js
// source: speech/tts/public/semiotic_classes.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.Fraction');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.speech.tts.MorphosyntacticFeatureVector');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.Fraction = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, proto.speech.tts.Fraction.repeatedFields_, null);
};
goog.inherits(proto.speech.tts.Fraction, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.Fraction.displayName = 'proto.speech.tts.Fraction';
}

/**
 * List of repeated fields within this message type.
 * @private {!Array<number>}
 * @const
 */
proto.speech.tts.Fraction.repeatedFields_ = [9];



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.Fraction.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.Fraction.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.Fraction} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.Fraction.toObject = function(includeInstance, msg) {
  let f, obj = {
    integerPart: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    numerator: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f,
    denominator: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f,
    style: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f,
    morphosyntacticFeatures: (f = jspb.Message.getField(msg, 5)) == null ? undefined : f,
    structuredFeatures: (f = msg.getStructuredFeatures()) && proto.speech.tts.MorphosyntacticFeatureVector.toObject(includeInstance, f),
    preserveOrder: (f = jspb.Message.getBooleanField(msg, 6)) == null ? undefined : f,
    codeSwitch: (f = jspb.Message.getField(msg, 7)) == null ? undefined : f,
    negative: (f = jspb.Message.getBooleanField(msg, 8)) == null ? undefined : f,
    fieldOrderList: (f = jspb.Message.getRepeatedField(msg, 9)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of Fraction as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.Fraction.ObjectFormat = function() {
  /** @type {?string|undefined} */
  this.integerPart;

  /** @type {?string|undefined} */
  this.numerator;

  /** @type {?string|undefined} */
  this.denominator;

  /** @type {?number|undefined} */
  this.style;

  /** @type {?string|undefined} */
  this.morphosyntacticFeatures;

  /** @type {?proto.speech.tts.MorphosyntacticFeatureVector.ObjectFormat|undefined} */
  this.structuredFeatures;

  /** @type {?boolean|undefined} */
  this.preserveOrder;

  /** @type {?string|undefined} */
  this.codeSwitch;

  /** @type {?boolean|undefined} */
  this.negative;

  /** @type {?Array<string>|undefined} */
  this.fieldOrderList;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.Fraction.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.Fraction}
 */
proto.speech.tts.Fraction.fromObject = function(obj) {
  const msg = new proto.speech.tts.Fraction();
  obj.integerPart != null && jspb.Message.setField(msg, 1, obj.integerPart);
  obj.numerator != null && jspb.Message.setField(msg, 2, obj.numerator);
  obj.denominator != null && jspb.Message.setField(msg, 3, obj.denominator);
  obj.style != null && jspb.Message.setField(msg, 4, obj.style);
  obj.morphosyntacticFeatures != null && jspb.Message.setField(msg, 5, obj.morphosyntacticFeatures);
  obj.structuredFeatures && jspb.Message.setWrapperField(
      msg, 10, proto.speech.tts.MorphosyntacticFeatureVector.fromObject(obj.structuredFeatures));
  obj.preserveOrder != null && jspb.Message.setField(msg, 6, obj.preserveOrder);
  obj.codeSwitch != null && jspb.Message.setField(msg, 7, obj.codeSwitch);
  obj.negative != null && jspb.Message.setField(msg, 8, obj.negative);
  obj.fieldOrderList != null && jspb.Message.setField(msg, 9, obj.fieldOrderList);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.Fraction}
 */
proto.speech.tts.Fraction.deserializeBinary = function(bytes) {
  return proto.speech.tts.Fraction.deserializeBinaryFromReader(
      new proto.speech.tts.Fraction(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.Fraction} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.Fraction}
 */
proto.speech.tts.Fraction.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {string} */ (reader.readString());
      msg.setIntegerPart(value);
      break;
    case 2:
      value = /** @type {string} */ (reader.readString());
      msg.setNumerator(value);
      break;
    case 3:
      value = /** @type {string} */ (reader.readString());
      msg.setDenominator(value);
      break;
    case 4:
      value = /** @type {number} */ (reader.readInt32());
      msg.setStyle(value);
      break;
    case 5:
      value = /** @type {string} */ (reader.readString());
      msg.setMorphosyntacticFeatures(value);
      break;
    case 10:
      value = new proto.speech.tts.MorphosyntacticFeatureVector();
      reader.readMessage(value,proto.speech.tts.MorphosyntacticFeatureVector.deserializeBinaryFromReader);
      msg.setStructuredFeatures(value);
      break;
    case 6:
      value = /** @type {boolean} */ (reader.readBool());
      msg.setPreserveOrder(value);
      break;
    case 7:
      value = /** @type {string} */ (reader.readString());
      msg.setCodeSwitch(value);
      break;
    case 8:
      value = /** @type {boolean} */ (reader.readBool());
      msg.setNegative(value);
      break;
    case 9:
      value = /** @type {string} */ (reader.readString());
      msg.addFieldOrder(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.Fraction.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.Fraction.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.Fraction} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.Fraction.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {string} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeString(
      1,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeString(
      2,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeString(
      3,
      f
    );
  }
  f = /** @type {number} */ (jspb.Message.getField(message, 4));
  if (f != null) {
    writer.writeInt32(
      4,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 5));
  if (f != null) {
    writer.writeString(
      5,
      f
    );
  }
  f = message.getStructuredFeatures();
  if (f != null) {
    writer.writeMessage(
      10,
      f,
      proto.speech.tts.MorphosyntacticFeatureVector.serializeBinaryToWriter
    );
  }
  f = /** @type {boolean} */ (jspb.Message.getField(message, 6));
  if (f != null) {
    writer.writeBool(
      6,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 7));
  if (f != null) {
    writer.writeString(
      7,
      f
    );
  }
  f = /** @type {boolean} */ (jspb.Message.getField(message, 8));
  if (f != null) {
    writer.writeBool(
      8,
      f
    );
  }
  f = message.getFieldOrderList();
  if (f.length > 0) {
    writer.writeRepeatedString(
      9,
      f
    );
  }
};


/**
 * optional string integer_part = 1;
 * @return {string}
 */
proto.speech.tts.Fraction.prototype.getIntegerPart = function() {
  return jspb.Message.getStringFieldWithDefault(this, 1);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Fraction} returns this
 */
proto.speech.tts.Fraction.prototype.setIntegerPart = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Fraction} returns this
 */
proto.speech.tts.Fraction.prototype.clearIntegerPart = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Fraction.prototype.hasIntegerPart = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * required string numerator = 2;
 * @return {string}
 */
proto.speech.tts.Fraction.prototype.getNumerator = function() {
  return jspb.Message.getStringFieldWithDefault(this, 2);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Fraction} returns this
 */
proto.speech.tts.Fraction.prototype.setNumerator = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Fraction} returns this
 */
proto.speech.tts.Fraction.prototype.clearNumerator = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Fraction.prototype.hasNumerator = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * required string denominator = 3;
 * @return {string}
 */
proto.speech.tts.Fraction.prototype.getDenominator = function() {
  return jspb.Message.getStringFieldWithDefault(this, 3);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Fraction} returns this
 */
proto.speech.tts.Fraction.prototype.setDenominator = function(value) {
  return jspb.Message.setField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Fraction} returns this
 */
proto.speech.tts.Fraction.prototype.clearDenominator = function() {
  return jspb.Message.clearField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Fraction.prototype.hasDenominator = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * optional int32 style = 4;
 * @return {number}
 * @deprecated
 */
proto.speech.tts.Fraction.prototype.getStyle = function() {
  return jspb.Message.getIntegerFieldWithDefault(this, 4);
};


/**
 * @param {number} value
 * @return {!proto.speech.tts.Fraction} returns this
 * @deprecated
 */
proto.speech.tts.Fraction.prototype.setStyle = function(value) {
  return jspb.Message.setField(this, 4, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Fraction} returns this
 * @deprecated
 */
proto.speech.tts.Fraction.prototype.clearStyle = function() {
  return jspb.Message.clearField(this, 4);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 * @deprecated
 */
proto.speech.tts.Fraction.prototype.hasStyle = function() {
  return jspb.Message.hasField(this, 4);
};


/**
 * optional string morphosyntactic_features = 5;
 * @return {string}
 */
proto.speech.tts.Fraction.prototype.getMorphosyntacticFeatures = function() {
  return jspb.Message.getStringFieldWithDefault(this, 5);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Fraction} returns this
 */
proto.speech.tts.Fraction.prototype.setMorphosyntacticFeatures = function(value) {
  return jspb.Message.setField(this, 5, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Fraction} returns this
 */
proto.speech.tts.Fraction.prototype.clearMorphosyntacticFeatures = function() {
  return jspb.Message.clearField(this, 5);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Fraction.prototype.hasMorphosyntacticFeatures = function() {
  return jspb.Message.hasField(this, 5);
};


/**
 * optional MorphosyntacticFeatureVector structured_features = 10;
 * @return {?proto.speech.tts.MorphosyntacticFeatureVector}
 */
proto.speech.tts.Fraction.prototype.getStructuredFeatures = function() {
  return /** @type{?proto.speech.tts.MorphosyntacticFeatureVector} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.MorphosyntacticFeatureVector, 10));
};


/**
 * @param {?proto.speech.tts.MorphosyntacticFeatureVector|undefined} value
 * @return {!proto.speech.tts.Fraction} returns this
*/
proto.speech.tts.Fraction.prototype.setStructuredFeatures = function(value) {
  return jspb.Message.setWrapperField(this, 10, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Fraction} returns this
 */
proto.speech.tts.Fraction.prototype.clearStructuredFeatures = function() {
  return jspb.Message.clearWrapperField(this, 10);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Fraction.prototype.hasStructuredFeatures = function() {
  return jspb.Message.hasField(this, 10);
};


/**
 * optional bool preserve_order = 6;
 * @return {boolean}
 */
proto.speech.tts.Fraction.prototype.getPreserveOrder = function() {
  return jspb.Message.getBooleanFieldWithDefault(this, 6);
};


/**
 * @param {boolean} value
 * @return {!proto.speech.tts.Fraction} returns this
 */
proto.speech.tts.Fraction.prototype.setPreserveOrder = function(value) {
  return jspb.Message.setField(this, 6, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Fraction} returns this
 */
proto.speech.tts.Fraction.prototype.clearPreserveOrder = function() {
  return jspb.Message.clearField(this, 6);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Fraction.prototype.hasPreserveOrder = function() {
  return jspb.Message.hasField(this, 6);
};


/**
 * optional string code_switch = 7;
 * @return {string}
 */
proto.speech.tts.Fraction.prototype.getCodeSwitch = function() {
  return jspb.Message.getStringFieldWithDefault(this, 7);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Fraction} returns this
 */
proto.speech.tts.Fraction.prototype.setCodeSwitch = function(value) {
  return jspb.Message.setField(this, 7, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Fraction} returns this
 */
proto.speech.tts.Fraction.prototype.clearCodeSwitch = function() {
  return jspb.Message.clearField(this, 7);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Fraction.prototype.hasCodeSwitch = function() {
  return jspb.Message.hasField(this, 7);
};


/**
 * optional bool negative = 8;
 * @return {boolean}
 */
proto.speech.tts.Fraction.prototype.getNegative = function() {
  return jspb.Message.getBooleanFieldWithDefault(this, 8);
};


/**
 * @param {boolean} value
 * @return {!proto.speech.tts.Fraction} returns this
 */
proto.speech.tts.Fraction.prototype.setNegative = function(value) {
  return jspb.Message.setField(this, 8, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Fraction} returns this
 */
proto.speech.tts.Fraction.prototype.clearNegative = function() {
  return jspb.Message.clearField(this, 8);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Fraction.prototype.hasNegative = function() {
  return jspb.Message.hasField(this, 8);
};


/**
 * repeated string field_order = 9;
 * @return {!Array<string>}
 */
proto.speech.tts.Fraction.prototype.getFieldOrderList = function() {
  return /** @type {!Array<string>} */ (jspb.Message.getRepeatedField(this, 9));
};


/**
 * @param {!Array<string>} value
 * @return {!proto.speech.tts.Fraction} returns this
 */
proto.speech.tts.Fraction.prototype.setFieldOrderList = function(value) {
  return jspb.Message.setField(this, 9, value || []);
};


/**
 * @param {string} value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.Fraction} returns this
 */
proto.speech.tts.Fraction.prototype.addFieldOrder = function(value, opt_index) {
  return jspb.Message.addToRepeatedField(this, 9, value, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.Fraction} returns this
 */
proto.speech.tts.Fraction.prototype.clearFieldOrderList = function() {
  return jspb.Message.clearRepeatedField(this, 9);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.Fraction}
 */
proto.speech.tts.Fraction.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.Fraction, data);
};



//speech/tts/public/semiotic_classes_proto_jspb/measure.jspb.js
// source: speech/tts/public/semiotic_classes.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.Measure');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.speech.tts.Cardinal');
goog.require('proto.speech.tts.Decimal');
goog.require('proto.speech.tts.Fraction');
goog.require('proto.speech.tts.MorphosyntacticFeatureVector');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.Measure = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, proto.speech.tts.Measure.repeatedFields_, null);
};
goog.inherits(proto.speech.tts.Measure, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.Measure.displayName = 'proto.speech.tts.Measure';
}

/**
 * List of repeated fields within this message type.
 * @private {!Array<number>}
 * @const
 */
proto.speech.tts.Measure.repeatedFields_ = [9];



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.Measure.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.Measure.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.Measure} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.Measure.toObject = function(includeInstance, msg) {
  let f, obj = {
    decimal: (f = msg.getDecimal()) && proto.speech.tts.Decimal.toObject(includeInstance, f),
    fraction: (f = msg.getFraction()) && proto.speech.tts.Fraction.toObject(includeInstance, f),
    cardinal: (f = msg.getCardinal()) && proto.speech.tts.Cardinal.toObject(includeInstance, f),
    units: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f,
    style: (f = jspb.Message.getField(msg, 5)) == null ? undefined : f,
    morphosyntacticFeatures: (f = jspb.Message.getField(msg, 6)) == null ? undefined : f,
    structuredFeatures: (f = msg.getStructuredFeatures()) && proto.speech.tts.MorphosyntacticFeatureVector.toObject(includeInstance, f),
    preserveOrder: (f = jspb.Message.getBooleanField(msg, 7)) == null ? undefined : f,
    codeSwitch: (f = jspb.Message.getField(msg, 8)) == null ? undefined : f,
    fieldOrderList: (f = jspb.Message.getRepeatedField(msg, 9)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of Measure as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.Measure.ObjectFormat = function() {
  /** @type {?proto.speech.tts.Decimal.ObjectFormat|undefined} */
  this.decimal;

  /** @type {?proto.speech.tts.Fraction.ObjectFormat|undefined} */
  this.fraction;

  /** @type {?proto.speech.tts.Cardinal.ObjectFormat|undefined} */
  this.cardinal;

  /** @type {?string|undefined} */
  this.units;

  /** @type {?number|undefined} */
  this.style;

  /** @type {?string|undefined} */
  this.morphosyntacticFeatures;

  /** @type {?proto.speech.tts.MorphosyntacticFeatureVector.ObjectFormat|undefined} */
  this.structuredFeatures;

  /** @type {?boolean|undefined} */
  this.preserveOrder;

  /** @type {?string|undefined} */
  this.codeSwitch;

  /** @type {?Array<string>|undefined} */
  this.fieldOrderList;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.Measure.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.Measure}
 */
proto.speech.tts.Measure.fromObject = function(obj) {
  const msg = new proto.speech.tts.Measure();
  obj.decimal && jspb.Message.setWrapperField(
      msg, 1, proto.speech.tts.Decimal.fromObject(obj.decimal));
  obj.fraction && jspb.Message.setWrapperField(
      msg, 2, proto.speech.tts.Fraction.fromObject(obj.fraction));
  obj.cardinal && jspb.Message.setWrapperField(
      msg, 3, proto.speech.tts.Cardinal.fromObject(obj.cardinal));
  obj.units != null && jspb.Message.setField(msg, 4, obj.units);
  obj.style != null && jspb.Message.setField(msg, 5, obj.style);
  obj.morphosyntacticFeatures != null && jspb.Message.setField(msg, 6, obj.morphosyntacticFeatures);
  obj.structuredFeatures && jspb.Message.setWrapperField(
      msg, 10, proto.speech.tts.MorphosyntacticFeatureVector.fromObject(obj.structuredFeatures));
  obj.preserveOrder != null && jspb.Message.setField(msg, 7, obj.preserveOrder);
  obj.codeSwitch != null && jspb.Message.setField(msg, 8, obj.codeSwitch);
  obj.fieldOrderList != null && jspb.Message.setField(msg, 9, obj.fieldOrderList);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.Measure}
 */
proto.speech.tts.Measure.deserializeBinary = function(bytes) {
  return proto.speech.tts.Measure.deserializeBinaryFromReader(
      new proto.speech.tts.Measure(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.Measure} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.Measure}
 */
proto.speech.tts.Measure.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = new proto.speech.tts.Decimal();
      reader.readMessage(value,proto.speech.tts.Decimal.deserializeBinaryFromReader);
      msg.setDecimal(value);
      break;
    case 2:
      value = new proto.speech.tts.Fraction();
      reader.readMessage(value,proto.speech.tts.Fraction.deserializeBinaryFromReader);
      msg.setFraction(value);
      break;
    case 3:
      value = new proto.speech.tts.Cardinal();
      reader.readMessage(value,proto.speech.tts.Cardinal.deserializeBinaryFromReader);
      msg.setCardinal(value);
      break;
    case 4:
      value = /** @type {string} */ (reader.readString());
      msg.setUnits(value);
      break;
    case 5:
      value = /** @type {number} */ (reader.readInt32());
      msg.setStyle(value);
      break;
    case 6:
      value = /** @type {string} */ (reader.readString());
      msg.setMorphosyntacticFeatures(value);
      break;
    case 10:
      value = new proto.speech.tts.MorphosyntacticFeatureVector();
      reader.readMessage(value,proto.speech.tts.MorphosyntacticFeatureVector.deserializeBinaryFromReader);
      msg.setStructuredFeatures(value);
      break;
    case 7:
      value = /** @type {boolean} */ (reader.readBool());
      msg.setPreserveOrder(value);
      break;
    case 8:
      value = /** @type {string} */ (reader.readString());
      msg.setCodeSwitch(value);
      break;
    case 9:
      value = /** @type {string} */ (reader.readString());
      msg.addFieldOrder(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.Measure.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.Measure.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.Measure} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.Measure.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = message.getDecimal();
  if (f != null) {
    writer.writeMessage(
      1,
      f,
      proto.speech.tts.Decimal.serializeBinaryToWriter
    );
  }
  f = message.getFraction();
  if (f != null) {
    writer.writeMessage(
      2,
      f,
      proto.speech.tts.Fraction.serializeBinaryToWriter
    );
  }
  f = message.getCardinal();
  if (f != null) {
    writer.writeMessage(
      3,
      f,
      proto.speech.tts.Cardinal.serializeBinaryToWriter
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 4));
  if (f != null) {
    writer.writeString(
      4,
      f
    );
  }
  f = /** @type {number} */ (jspb.Message.getField(message, 5));
  if (f != null) {
    writer.writeInt32(
      5,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 6));
  if (f != null) {
    writer.writeString(
      6,
      f
    );
  }
  f = message.getStructuredFeatures();
  if (f != null) {
    writer.writeMessage(
      10,
      f,
      proto.speech.tts.MorphosyntacticFeatureVector.serializeBinaryToWriter
    );
  }
  f = /** @type {boolean} */ (jspb.Message.getField(message, 7));
  if (f != null) {
    writer.writeBool(
      7,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 8));
  if (f != null) {
    writer.writeString(
      8,
      f
    );
  }
  f = message.getFieldOrderList();
  if (f.length > 0) {
    writer.writeRepeatedString(
      9,
      f
    );
  }
};


/**
 * optional Decimal decimal = 1;
 * @return {?proto.speech.tts.Decimal}
 */
proto.speech.tts.Measure.prototype.getDecimal = function() {
  return /** @type{?proto.speech.tts.Decimal} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.Decimal, 1));
};


/**
 * @param {?proto.speech.tts.Decimal|undefined} value
 * @return {!proto.speech.tts.Measure} returns this
*/
proto.speech.tts.Measure.prototype.setDecimal = function(value) {
  return jspb.Message.setWrapperField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Measure} returns this
 */
proto.speech.tts.Measure.prototype.clearDecimal = function() {
  return jspb.Message.clearWrapperField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Measure.prototype.hasDecimal = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional Fraction fraction = 2;
 * @return {?proto.speech.tts.Fraction}
 */
proto.speech.tts.Measure.prototype.getFraction = function() {
  return /** @type{?proto.speech.tts.Fraction} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.Fraction, 2));
};


/**
 * @param {?proto.speech.tts.Fraction|undefined} value
 * @return {!proto.speech.tts.Measure} returns this
*/
proto.speech.tts.Measure.prototype.setFraction = function(value) {
  return jspb.Message.setWrapperField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Measure} returns this
 */
proto.speech.tts.Measure.prototype.clearFraction = function() {
  return jspb.Message.clearWrapperField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Measure.prototype.hasFraction = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional Cardinal cardinal = 3;
 * @return {?proto.speech.tts.Cardinal}
 */
proto.speech.tts.Measure.prototype.getCardinal = function() {
  return /** @type{?proto.speech.tts.Cardinal} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.Cardinal, 3));
};


/**
 * @param {?proto.speech.tts.Cardinal|undefined} value
 * @return {!proto.speech.tts.Measure} returns this
*/
proto.speech.tts.Measure.prototype.setCardinal = function(value) {
  return jspb.Message.setWrapperField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Measure} returns this
 */
proto.speech.tts.Measure.prototype.clearCardinal = function() {
  return jspb.Message.clearWrapperField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Measure.prototype.hasCardinal = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * optional string units = 4;
 * @return {string}
 */
proto.speech.tts.Measure.prototype.getUnits = function() {
  return jspb.Message.getStringFieldWithDefault(this, 4);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Measure} returns this
 */
proto.speech.tts.Measure.prototype.setUnits = function(value) {
  return jspb.Message.setField(this, 4, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Measure} returns this
 */
proto.speech.tts.Measure.prototype.clearUnits = function() {
  return jspb.Message.clearField(this, 4);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Measure.prototype.hasUnits = function() {
  return jspb.Message.hasField(this, 4);
};


/**
 * optional int32 style = 5;
 * @return {number}
 */
proto.speech.tts.Measure.prototype.getStyle = function() {
  return jspb.Message.getIntegerFieldWithDefault(this, 5);
};


/**
 * @param {number} value
 * @return {!proto.speech.tts.Measure} returns this
 */
proto.speech.tts.Measure.prototype.setStyle = function(value) {
  return jspb.Message.setField(this, 5, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Measure} returns this
 */
proto.speech.tts.Measure.prototype.clearStyle = function() {
  return jspb.Message.clearField(this, 5);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Measure.prototype.hasStyle = function() {
  return jspb.Message.hasField(this, 5);
};


/**
 * optional string morphosyntactic_features = 6;
 * @return {string}
 */
proto.speech.tts.Measure.prototype.getMorphosyntacticFeatures = function() {
  return jspb.Message.getStringFieldWithDefault(this, 6);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Measure} returns this
 */
proto.speech.tts.Measure.prototype.setMorphosyntacticFeatures = function(value) {
  return jspb.Message.setField(this, 6, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Measure} returns this
 */
proto.speech.tts.Measure.prototype.clearMorphosyntacticFeatures = function() {
  return jspb.Message.clearField(this, 6);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Measure.prototype.hasMorphosyntacticFeatures = function() {
  return jspb.Message.hasField(this, 6);
};


/**
 * optional MorphosyntacticFeatureVector structured_features = 10;
 * @return {?proto.speech.tts.MorphosyntacticFeatureVector}
 */
proto.speech.tts.Measure.prototype.getStructuredFeatures = function() {
  return /** @type{?proto.speech.tts.MorphosyntacticFeatureVector} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.MorphosyntacticFeatureVector, 10));
};


/**
 * @param {?proto.speech.tts.MorphosyntacticFeatureVector|undefined} value
 * @return {!proto.speech.tts.Measure} returns this
*/
proto.speech.tts.Measure.prototype.setStructuredFeatures = function(value) {
  return jspb.Message.setWrapperField(this, 10, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Measure} returns this
 */
proto.speech.tts.Measure.prototype.clearStructuredFeatures = function() {
  return jspb.Message.clearWrapperField(this, 10);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Measure.prototype.hasStructuredFeatures = function() {
  return jspb.Message.hasField(this, 10);
};


/**
 * optional bool preserve_order = 7;
 * @return {boolean}
 */
proto.speech.tts.Measure.prototype.getPreserveOrder = function() {
  return jspb.Message.getBooleanFieldWithDefault(this, 7);
};


/**
 * @param {boolean} value
 * @return {!proto.speech.tts.Measure} returns this
 */
proto.speech.tts.Measure.prototype.setPreserveOrder = function(value) {
  return jspb.Message.setField(this, 7, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Measure} returns this
 */
proto.speech.tts.Measure.prototype.clearPreserveOrder = function() {
  return jspb.Message.clearField(this, 7);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Measure.prototype.hasPreserveOrder = function() {
  return jspb.Message.hasField(this, 7);
};


/**
 * optional string code_switch = 8;
 * @return {string}
 */
proto.speech.tts.Measure.prototype.getCodeSwitch = function() {
  return jspb.Message.getStringFieldWithDefault(this, 8);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Measure} returns this
 */
proto.speech.tts.Measure.prototype.setCodeSwitch = function(value) {
  return jspb.Message.setField(this, 8, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Measure} returns this
 */
proto.speech.tts.Measure.prototype.clearCodeSwitch = function() {
  return jspb.Message.clearField(this, 8);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Measure.prototype.hasCodeSwitch = function() {
  return jspb.Message.hasField(this, 8);
};


/**
 * repeated string field_order = 9;
 * @return {!Array<string>}
 */
proto.speech.tts.Measure.prototype.getFieldOrderList = function() {
  return /** @type {!Array<string>} */ (jspb.Message.getRepeatedField(this, 9));
};


/**
 * @param {!Array<string>} value
 * @return {!proto.speech.tts.Measure} returns this
 */
proto.speech.tts.Measure.prototype.setFieldOrderList = function(value) {
  return jspb.Message.setField(this, 9, value || []);
};


/**
 * @param {string} value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.Measure} returns this
 */
proto.speech.tts.Measure.prototype.addFieldOrder = function(value, opt_index) {
  return jspb.Message.addToRepeatedField(this, 9, value, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.Measure} returns this
 */
proto.speech.tts.Measure.prototype.clearFieldOrderList = function() {
  return jspb.Message.clearRepeatedField(this, 9);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.Measure}
 */
proto.speech.tts.Measure.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.Measure, data);
};



//speech/tts/public/semiotic_classes_proto_jspb/money.jspb.js
// source: speech/tts/public/semiotic_classes.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.Money');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.speech.tts.Decimal');
goog.require('proto.speech.tts.MorphosyntacticFeatureVector');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.Money = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, proto.speech.tts.Money.repeatedFields_, null);
};
goog.inherits(proto.speech.tts.Money, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.Money.displayName = 'proto.speech.tts.Money';
}

/**
 * List of repeated fields within this message type.
 * @private {!Array<number>}
 * @const
 */
proto.speech.tts.Money.repeatedFields_ = [8];



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.Money.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.Money.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.Money} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.Money.toObject = function(includeInstance, msg) {
  let f, obj = {
    amount: (f = msg.getAmount()) && proto.speech.tts.Decimal.toObject(includeInstance, f),
    quantity: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f,
    stringQuantity: (f = jspb.Message.getField(msg, 10)) == null ? undefined : f,
    currency: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f,
    style: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f,
    morphosyntacticFeatures: (f = jspb.Message.getField(msg, 5)) == null ? undefined : f,
    structuredFeatures: (f = msg.getStructuredFeatures()) && proto.speech.tts.MorphosyntacticFeatureVector.toObject(includeInstance, f),
    preserveOrder: (f = jspb.Message.getBooleanField(msg, 6)) == null ? undefined : f,
    codeSwitch: (f = jspb.Message.getField(msg, 7)) == null ? undefined : f,
    fieldOrderList: (f = jspb.Message.getRepeatedField(msg, 8)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of Money as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.Money.ObjectFormat = function() {
  /** @type {?proto.speech.tts.Decimal.ObjectFormat|undefined} */
  this.amount;

  /** @type {?number|undefined} */
  this.quantity;

  /** @type {?string|undefined} */
  this.stringQuantity;

  /** @type {?string|undefined} */
  this.currency;

  /** @type {?number|undefined} */
  this.style;

  /** @type {?string|undefined} */
  this.morphosyntacticFeatures;

  /** @type {?proto.speech.tts.MorphosyntacticFeatureVector.ObjectFormat|undefined} */
  this.structuredFeatures;

  /** @type {?boolean|undefined} */
  this.preserveOrder;

  /** @type {?string|undefined} */
  this.codeSwitch;

  /** @type {?Array<string>|undefined} */
  this.fieldOrderList;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.Money.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.Money}
 */
proto.speech.tts.Money.fromObject = function(obj) {
  const msg = new proto.speech.tts.Money();
  obj.amount && jspb.Message.setWrapperField(
      msg, 1, proto.speech.tts.Decimal.fromObject(obj.amount));
  obj.quantity != null && jspb.Message.setField(msg, 2, obj.quantity);
  obj.stringQuantity != null && jspb.Message.setField(msg, 10, obj.stringQuantity);
  obj.currency != null && jspb.Message.setField(msg, 3, obj.currency);
  obj.style != null && jspb.Message.setField(msg, 4, obj.style);
  obj.morphosyntacticFeatures != null && jspb.Message.setField(msg, 5, obj.morphosyntacticFeatures);
  obj.structuredFeatures && jspb.Message.setWrapperField(
      msg, 9, proto.speech.tts.MorphosyntacticFeatureVector.fromObject(obj.structuredFeatures));
  obj.preserveOrder != null && jspb.Message.setField(msg, 6, obj.preserveOrder);
  obj.codeSwitch != null && jspb.Message.setField(msg, 7, obj.codeSwitch);
  obj.fieldOrderList != null && jspb.Message.setField(msg, 8, obj.fieldOrderList);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.Money}
 */
proto.speech.tts.Money.deserializeBinary = function(bytes) {
  return proto.speech.tts.Money.deserializeBinaryFromReader(
      new proto.speech.tts.Money(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.Money} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.Money}
 */
proto.speech.tts.Money.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = new proto.speech.tts.Decimal();
      reader.readMessage(value,proto.speech.tts.Decimal.deserializeBinaryFromReader);
      msg.setAmount(value);
      break;
    case 2:
      value = /** @type {number} */ (reader.readInt64());
      msg.setQuantity(value);
      break;
    case 10:
      value = /** @type {string} */ (reader.readString());
      msg.setStringQuantity(value);
      break;
    case 3:
      value = /** @type {string} */ (reader.readString());
      msg.setCurrency(value);
      break;
    case 4:
      value = /** @type {number} */ (reader.readInt32());
      msg.setStyle(value);
      break;
    case 5:
      value = /** @type {string} */ (reader.readString());
      msg.setMorphosyntacticFeatures(value);
      break;
    case 9:
      value = new proto.speech.tts.MorphosyntacticFeatureVector();
      reader.readMessage(value,proto.speech.tts.MorphosyntacticFeatureVector.deserializeBinaryFromReader);
      msg.setStructuredFeatures(value);
      break;
    case 6:
      value = /** @type {boolean} */ (reader.readBool());
      msg.setPreserveOrder(value);
      break;
    case 7:
      value = /** @type {string} */ (reader.readString());
      msg.setCodeSwitch(value);
      break;
    case 8:
      value = /** @type {string} */ (reader.readString());
      msg.addFieldOrder(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.Money.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.Money.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.Money} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.Money.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = message.getAmount();
  if (f != null) {
    writer.writeMessage(
      1,
      f,
      proto.speech.tts.Decimal.serializeBinaryToWriter
    );
  }
  f = /** @type {number} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeInt64(
      2,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 10));
  if (f != null) {
    writer.writeString(
      10,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeString(
      3,
      f
    );
  }
  f = /** @type {number} */ (jspb.Message.getField(message, 4));
  if (f != null) {
    writer.writeInt32(
      4,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 5));
  if (f != null) {
    writer.writeString(
      5,
      f
    );
  }
  f = message.getStructuredFeatures();
  if (f != null) {
    writer.writeMessage(
      9,
      f,
      proto.speech.tts.MorphosyntacticFeatureVector.serializeBinaryToWriter
    );
  }
  f = /** @type {boolean} */ (jspb.Message.getField(message, 6));
  if (f != null) {
    writer.writeBool(
      6,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 7));
  if (f != null) {
    writer.writeString(
      7,
      f
    );
  }
  f = message.getFieldOrderList();
  if (f.length > 0) {
    writer.writeRepeatedString(
      8,
      f
    );
  }
};


/**
 * required Decimal amount = 1;
 * @return {!proto.speech.tts.Decimal}
 */
proto.speech.tts.Money.prototype.getAmount = function() {
  return /** @type{!proto.speech.tts.Decimal} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.Decimal, 1, 1));
};


/**
 * @param {!proto.speech.tts.Decimal} value
 * @return {!proto.speech.tts.Money} returns this
*/
proto.speech.tts.Money.prototype.setAmount = function(value) {
  return jspb.Message.setWrapperField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Money} returns this
 */
proto.speech.tts.Money.prototype.clearAmount = function() {
  return jspb.Message.clearWrapperField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Money.prototype.hasAmount = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional int64 quantity = 2;
 * @return {number}
 */
proto.speech.tts.Money.prototype.getQuantity = function() {
  return jspb.Message.getIntegerFieldWithDefault(this, 2);
};


/**
 * @param {number} value
 * @return {!proto.speech.tts.Money} returns this
 */
proto.speech.tts.Money.prototype.setQuantity = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Money} returns this
 */
proto.speech.tts.Money.prototype.clearQuantity = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Money.prototype.hasQuantity = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional string string_quantity = 10;
 * @return {string}
 */
proto.speech.tts.Money.prototype.getStringQuantity = function() {
  return jspb.Message.getStringFieldWithDefault(this, 10);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Money} returns this
 */
proto.speech.tts.Money.prototype.setStringQuantity = function(value) {
  return jspb.Message.setField(this, 10, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Money} returns this
 */
proto.speech.tts.Money.prototype.clearStringQuantity = function() {
  return jspb.Message.clearField(this, 10);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Money.prototype.hasStringQuantity = function() {
  return jspb.Message.hasField(this, 10);
};


/**
 * required string currency = 3;
 * @return {string}
 */
proto.speech.tts.Money.prototype.getCurrency = function() {
  return jspb.Message.getStringFieldWithDefault(this, 3);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Money} returns this
 */
proto.speech.tts.Money.prototype.setCurrency = function(value) {
  return jspb.Message.setField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Money} returns this
 */
proto.speech.tts.Money.prototype.clearCurrency = function() {
  return jspb.Message.clearField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Money.prototype.hasCurrency = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * optional int32 style = 4;
 * @return {number}
 */
proto.speech.tts.Money.prototype.getStyle = function() {
  return jspb.Message.getIntegerFieldWithDefault(this, 4);
};


/**
 * @param {number} value
 * @return {!proto.speech.tts.Money} returns this
 */
proto.speech.tts.Money.prototype.setStyle = function(value) {
  return jspb.Message.setField(this, 4, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Money} returns this
 */
proto.speech.tts.Money.prototype.clearStyle = function() {
  return jspb.Message.clearField(this, 4);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Money.prototype.hasStyle = function() {
  return jspb.Message.hasField(this, 4);
};


/**
 * optional string morphosyntactic_features = 5;
 * @return {string}
 */
proto.speech.tts.Money.prototype.getMorphosyntacticFeatures = function() {
  return jspb.Message.getStringFieldWithDefault(this, 5);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Money} returns this
 */
proto.speech.tts.Money.prototype.setMorphosyntacticFeatures = function(value) {
  return jspb.Message.setField(this, 5, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Money} returns this
 */
proto.speech.tts.Money.prototype.clearMorphosyntacticFeatures = function() {
  return jspb.Message.clearField(this, 5);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Money.prototype.hasMorphosyntacticFeatures = function() {
  return jspb.Message.hasField(this, 5);
};


/**
 * optional MorphosyntacticFeatureVector structured_features = 9;
 * @return {?proto.speech.tts.MorphosyntacticFeatureVector}
 */
proto.speech.tts.Money.prototype.getStructuredFeatures = function() {
  return /** @type{?proto.speech.tts.MorphosyntacticFeatureVector} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.MorphosyntacticFeatureVector, 9));
};


/**
 * @param {?proto.speech.tts.MorphosyntacticFeatureVector|undefined} value
 * @return {!proto.speech.tts.Money} returns this
*/
proto.speech.tts.Money.prototype.setStructuredFeatures = function(value) {
  return jspb.Message.setWrapperField(this, 9, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Money} returns this
 */
proto.speech.tts.Money.prototype.clearStructuredFeatures = function() {
  return jspb.Message.clearWrapperField(this, 9);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Money.prototype.hasStructuredFeatures = function() {
  return jspb.Message.hasField(this, 9);
};


/**
 * optional bool preserve_order = 6;
 * @return {boolean}
 */
proto.speech.tts.Money.prototype.getPreserveOrder = function() {
  return jspb.Message.getBooleanFieldWithDefault(this, 6);
};


/**
 * @param {boolean} value
 * @return {!proto.speech.tts.Money} returns this
 */
proto.speech.tts.Money.prototype.setPreserveOrder = function(value) {
  return jspb.Message.setField(this, 6, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Money} returns this
 */
proto.speech.tts.Money.prototype.clearPreserveOrder = function() {
  return jspb.Message.clearField(this, 6);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Money.prototype.hasPreserveOrder = function() {
  return jspb.Message.hasField(this, 6);
};


/**
 * optional string code_switch = 7;
 * @return {string}
 */
proto.speech.tts.Money.prototype.getCodeSwitch = function() {
  return jspb.Message.getStringFieldWithDefault(this, 7);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Money} returns this
 */
proto.speech.tts.Money.prototype.setCodeSwitch = function(value) {
  return jspb.Message.setField(this, 7, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Money} returns this
 */
proto.speech.tts.Money.prototype.clearCodeSwitch = function() {
  return jspb.Message.clearField(this, 7);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Money.prototype.hasCodeSwitch = function() {
  return jspb.Message.hasField(this, 7);
};


/**
 * repeated string field_order = 8;
 * @return {!Array<string>}
 */
proto.speech.tts.Money.prototype.getFieldOrderList = function() {
  return /** @type {!Array<string>} */ (jspb.Message.getRepeatedField(this, 8));
};


/**
 * @param {!Array<string>} value
 * @return {!proto.speech.tts.Money} returns this
 */
proto.speech.tts.Money.prototype.setFieldOrderList = function(value) {
  return jspb.Message.setField(this, 8, value || []);
};


/**
 * @param {string} value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.Money} returns this
 */
proto.speech.tts.Money.prototype.addFieldOrder = function(value, opt_index) {
  return jspb.Message.addToRepeatedField(this, 8, value, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.Money} returns this
 */
proto.speech.tts.Money.prototype.clearFieldOrderList = function() {
  return jspb.Message.clearRepeatedField(this, 8);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.Money}
 */
proto.speech.tts.Money.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.Money, data);
};



//speech/tts/public/semiotic_classes_proto_jspb/ordinal.jspb.js
// source: speech/tts/public/semiotic_classes.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.Ordinal');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.speech.tts.MorphosyntacticFeatureVector');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.Ordinal = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, proto.speech.tts.Ordinal.repeatedFields_, null);
};
goog.inherits(proto.speech.tts.Ordinal, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.Ordinal.displayName = 'proto.speech.tts.Ordinal';
}

/**
 * List of repeated fields within this message type.
 * @private {!Array<number>}
 * @const
 */
proto.speech.tts.Ordinal.repeatedFields_ = [5];



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.Ordinal.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.Ordinal.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.Ordinal} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.Ordinal.toObject = function(includeInstance, msg) {
  let f, obj = {
    integer: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    morphosyntacticFeatures: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f,
    structuredFeatures: (f = msg.getStructuredFeatures()) && proto.speech.tts.MorphosyntacticFeatureVector.toObject(includeInstance, f),
    preserveOrder: (f = jspb.Message.getBooleanField(msg, 3)) == null ? undefined : f,
    codeSwitch: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f,
    fieldOrderList: (f = jspb.Message.getRepeatedField(msg, 5)) == null ? undefined : f,
    definiteArticle: (f = jspb.Message.getBooleanField(msg, 7)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of Ordinal as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.Ordinal.ObjectFormat = function() {
  /** @type {?string|undefined} */
  this.integer;

  /** @type {?string|undefined} */
  this.morphosyntacticFeatures;

  /** @type {?proto.speech.tts.MorphosyntacticFeatureVector.ObjectFormat|undefined} */
  this.structuredFeatures;

  /** @type {?boolean|undefined} */
  this.preserveOrder;

  /** @type {?string|undefined} */
  this.codeSwitch;

  /** @type {?Array<string>|undefined} */
  this.fieldOrderList;

  /** @type {?boolean|undefined} */
  this.definiteArticle;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.Ordinal.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.Ordinal}
 */
proto.speech.tts.Ordinal.fromObject = function(obj) {
  const msg = new proto.speech.tts.Ordinal();
  obj.integer != null && jspb.Message.setField(msg, 1, obj.integer);
  obj.morphosyntacticFeatures != null && jspb.Message.setField(msg, 2, obj.morphosyntacticFeatures);
  obj.structuredFeatures && jspb.Message.setWrapperField(
      msg, 6, proto.speech.tts.MorphosyntacticFeatureVector.fromObject(obj.structuredFeatures));
  obj.preserveOrder != null && jspb.Message.setField(msg, 3, obj.preserveOrder);
  obj.codeSwitch != null && jspb.Message.setField(msg, 4, obj.codeSwitch);
  obj.fieldOrderList != null && jspb.Message.setField(msg, 5, obj.fieldOrderList);
  obj.definiteArticle != null && jspb.Message.setField(msg, 7, obj.definiteArticle);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.Ordinal}
 */
proto.speech.tts.Ordinal.deserializeBinary = function(bytes) {
  return proto.speech.tts.Ordinal.deserializeBinaryFromReader(
      new proto.speech.tts.Ordinal(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.Ordinal} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.Ordinal}
 */
proto.speech.tts.Ordinal.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {string} */ (reader.readString());
      msg.setInteger(value);
      break;
    case 2:
      value = /** @type {string} */ (reader.readString());
      msg.setMorphosyntacticFeatures(value);
      break;
    case 6:
      value = new proto.speech.tts.MorphosyntacticFeatureVector();
      reader.readMessage(value,proto.speech.tts.MorphosyntacticFeatureVector.deserializeBinaryFromReader);
      msg.setStructuredFeatures(value);
      break;
    case 3:
      value = /** @type {boolean} */ (reader.readBool());
      msg.setPreserveOrder(value);
      break;
    case 4:
      value = /** @type {string} */ (reader.readString());
      msg.setCodeSwitch(value);
      break;
    case 5:
      value = /** @type {string} */ (reader.readString());
      msg.addFieldOrder(value);
      break;
    case 7:
      value = /** @type {boolean} */ (reader.readBool());
      msg.setDefiniteArticle(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.Ordinal.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.Ordinal.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.Ordinal} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.Ordinal.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {string} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeString(
      1,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeString(
      2,
      f
    );
  }
  f = message.getStructuredFeatures();
  if (f != null) {
    writer.writeMessage(
      6,
      f,
      proto.speech.tts.MorphosyntacticFeatureVector.serializeBinaryToWriter
    );
  }
  f = /** @type {boolean} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeBool(
      3,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 4));
  if (f != null) {
    writer.writeString(
      4,
      f
    );
  }
  f = message.getFieldOrderList();
  if (f.length > 0) {
    writer.writeRepeatedString(
      5,
      f
    );
  }
  f = /** @type {boolean} */ (jspb.Message.getField(message, 7));
  if (f != null) {
    writer.writeBool(
      7,
      f
    );
  }
};


/**
 * required string integer = 1;
 * @return {string}
 */
proto.speech.tts.Ordinal.prototype.getInteger = function() {
  return jspb.Message.getStringFieldWithDefault(this, 1);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Ordinal} returns this
 */
proto.speech.tts.Ordinal.prototype.setInteger = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Ordinal} returns this
 */
proto.speech.tts.Ordinal.prototype.clearInteger = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Ordinal.prototype.hasInteger = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional string morphosyntactic_features = 2;
 * @return {string}
 */
proto.speech.tts.Ordinal.prototype.getMorphosyntacticFeatures = function() {
  return jspb.Message.getStringFieldWithDefault(this, 2);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Ordinal} returns this
 */
proto.speech.tts.Ordinal.prototype.setMorphosyntacticFeatures = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Ordinal} returns this
 */
proto.speech.tts.Ordinal.prototype.clearMorphosyntacticFeatures = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Ordinal.prototype.hasMorphosyntacticFeatures = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional MorphosyntacticFeatureVector structured_features = 6;
 * @return {?proto.speech.tts.MorphosyntacticFeatureVector}
 */
proto.speech.tts.Ordinal.prototype.getStructuredFeatures = function() {
  return /** @type{?proto.speech.tts.MorphosyntacticFeatureVector} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.MorphosyntacticFeatureVector, 6));
};


/**
 * @param {?proto.speech.tts.MorphosyntacticFeatureVector|undefined} value
 * @return {!proto.speech.tts.Ordinal} returns this
*/
proto.speech.tts.Ordinal.prototype.setStructuredFeatures = function(value) {
  return jspb.Message.setWrapperField(this, 6, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Ordinal} returns this
 */
proto.speech.tts.Ordinal.prototype.clearStructuredFeatures = function() {
  return jspb.Message.clearWrapperField(this, 6);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Ordinal.prototype.hasStructuredFeatures = function() {
  return jspb.Message.hasField(this, 6);
};


/**
 * optional bool preserve_order = 3;
 * @return {boolean}
 */
proto.speech.tts.Ordinal.prototype.getPreserveOrder = function() {
  return jspb.Message.getBooleanFieldWithDefault(this, 3);
};


/**
 * @param {boolean} value
 * @return {!proto.speech.tts.Ordinal} returns this
 */
proto.speech.tts.Ordinal.prototype.setPreserveOrder = function(value) {
  return jspb.Message.setField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Ordinal} returns this
 */
proto.speech.tts.Ordinal.prototype.clearPreserveOrder = function() {
  return jspb.Message.clearField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Ordinal.prototype.hasPreserveOrder = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * optional string code_switch = 4;
 * @return {string}
 */
proto.speech.tts.Ordinal.prototype.getCodeSwitch = function() {
  return jspb.Message.getStringFieldWithDefault(this, 4);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Ordinal} returns this
 */
proto.speech.tts.Ordinal.prototype.setCodeSwitch = function(value) {
  return jspb.Message.setField(this, 4, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Ordinal} returns this
 */
proto.speech.tts.Ordinal.prototype.clearCodeSwitch = function() {
  return jspb.Message.clearField(this, 4);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Ordinal.prototype.hasCodeSwitch = function() {
  return jspb.Message.hasField(this, 4);
};


/**
 * repeated string field_order = 5;
 * @return {!Array<string>}
 */
proto.speech.tts.Ordinal.prototype.getFieldOrderList = function() {
  return /** @type {!Array<string>} */ (jspb.Message.getRepeatedField(this, 5));
};


/**
 * @param {!Array<string>} value
 * @return {!proto.speech.tts.Ordinal} returns this
 */
proto.speech.tts.Ordinal.prototype.setFieldOrderList = function(value) {
  return jspb.Message.setField(this, 5, value || []);
};


/**
 * @param {string} value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.Ordinal} returns this
 */
proto.speech.tts.Ordinal.prototype.addFieldOrder = function(value, opt_index) {
  return jspb.Message.addToRepeatedField(this, 5, value, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.Ordinal} returns this
 */
proto.speech.tts.Ordinal.prototype.clearFieldOrderList = function() {
  return jspb.Message.clearRepeatedField(this, 5);
};


/**
 * optional bool definite_article = 7;
 * @return {boolean}
 */
proto.speech.tts.Ordinal.prototype.getDefiniteArticle = function() {
  return jspb.Message.getBooleanFieldWithDefault(this, 7);
};


/**
 * @param {boolean} value
 * @return {!proto.speech.tts.Ordinal} returns this
 */
proto.speech.tts.Ordinal.prototype.setDefiniteArticle = function(value) {
  return jspb.Message.setField(this, 7, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Ordinal} returns this
 */
proto.speech.tts.Ordinal.prototype.clearDefiniteArticle = function() {
  return jspb.Message.clearField(this, 7);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Ordinal.prototype.hasDefiniteArticle = function() {
  return jspb.Message.hasField(this, 7);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.Ordinal}
 */
proto.speech.tts.Ordinal.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.Ordinal, data);
};



//speech/tts/public/semiotic_classes_proto_jspb/spelling.jspb.js
// source: speech/tts/public/semiotic_classes.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.Spelling');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.Spelling = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.speech.tts.Spelling, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.Spelling.displayName = 'proto.speech.tts.Spelling';
}



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.Spelling.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.Spelling.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.Spelling} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.Spelling.toObject = function(includeInstance, msg) {
  let f, obj = {
    graphemes: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    chunkSize: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f,
    expressCapitalization: (f = jspb.Message.getBooleanField(msg, 3)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of Spelling as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.Spelling.ObjectFormat = function() {
  /** @type {?string|undefined} */
  this.graphemes;

  /** @type {?number|undefined} */
  this.chunkSize;

  /** @type {?boolean|undefined} */
  this.expressCapitalization;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.Spelling.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.Spelling}
 */
proto.speech.tts.Spelling.fromObject = function(obj) {
  const msg = new proto.speech.tts.Spelling();
  obj.graphemes != null && jspb.Message.setField(msg, 1, obj.graphemes);
  obj.chunkSize != null && jspb.Message.setField(msg, 2, obj.chunkSize);
  obj.expressCapitalization != null && jspb.Message.setField(msg, 3, obj.expressCapitalization);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.Spelling}
 */
proto.speech.tts.Spelling.deserializeBinary = function(bytes) {
  return proto.speech.tts.Spelling.deserializeBinaryFromReader(
      new proto.speech.tts.Spelling(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.Spelling} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.Spelling}
 */
proto.speech.tts.Spelling.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {string} */ (reader.readString());
      msg.setGraphemes(value);
      break;
    case 2:
      value = /** @type {number} */ (reader.readInt32());
      msg.setChunkSize(value);
      break;
    case 3:
      value = /** @type {boolean} */ (reader.readBool());
      msg.setExpressCapitalization(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.Spelling.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.Spelling.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.Spelling} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.Spelling.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {string} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeString(
      1,
      f
    );
  }
  f = /** @type {number} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeInt32(
      2,
      f
    );
  }
  f = /** @type {boolean} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeBool(
      3,
      f
    );
  }
};


/**
 * optional string graphemes = 1;
 * @return {string}
 */
proto.speech.tts.Spelling.prototype.getGraphemes = function() {
  return jspb.Message.getStringFieldWithDefault(this, 1);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Spelling} returns this
 */
proto.speech.tts.Spelling.prototype.setGraphemes = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Spelling} returns this
 */
proto.speech.tts.Spelling.prototype.clearGraphemes = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Spelling.prototype.hasGraphemes = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional int32 chunk_size = 2;
 * @return {number}
 */
proto.speech.tts.Spelling.prototype.getChunkSize = function() {
  return jspb.Message.getIntegerFieldWithDefault(this, 2);
};


/**
 * @param {number} value
 * @return {!proto.speech.tts.Spelling} returns this
 */
proto.speech.tts.Spelling.prototype.setChunkSize = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Spelling} returns this
 */
proto.speech.tts.Spelling.prototype.clearChunkSize = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Spelling.prototype.hasChunkSize = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional bool express_capitalization = 3;
 * @return {boolean}
 */
proto.speech.tts.Spelling.prototype.getExpressCapitalization = function() {
  return jspb.Message.getBooleanFieldWithDefault(this, 3);
};


/**
 * @param {boolean} value
 * @return {!proto.speech.tts.Spelling} returns this
 */
proto.speech.tts.Spelling.prototype.setExpressCapitalization = function(value) {
  return jspb.Message.setField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Spelling} returns this
 */
proto.speech.tts.Spelling.prototype.clearExpressCapitalization = function() {
  return jspb.Message.clearField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Spelling.prototype.hasExpressCapitalization = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.Spelling}
 */
proto.speech.tts.Spelling.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.Spelling, data);
};



//speech/tts/public/semiotic_classes_proto_jspb/telephone.jspb.js
// source: speech/tts/public/semiotic_classes.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.Telephone');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.speech.tts.MorphosyntacticFeatureVector');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.Telephone = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, proto.speech.tts.Telephone.repeatedFields_, null);
};
goog.inherits(proto.speech.tts.Telephone, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.Telephone.displayName = 'proto.speech.tts.Telephone';
}

/**
 * List of repeated fields within this message type.
 * @private {!Array<number>}
 * @const
 */
proto.speech.tts.Telephone.repeatedFields_ = [2,8];



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.Telephone.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.Telephone.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.Telephone} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.Telephone.toObject = function(includeInstance, msg) {
  let f, obj = {
    countryCode: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    numberPartList: (f = jspb.Message.getRepeatedField(msg, 2)) == null ? undefined : f,
    extension: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f,
    style: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f,
    morphosyntacticFeatures: (f = jspb.Message.getField(msg, 5)) == null ? undefined : f,
    structuredFeatures: (f = msg.getStructuredFeatures()) && proto.speech.tts.MorphosyntacticFeatureVector.toObject(includeInstance, f),
    preserveOrder: (f = jspb.Message.getBooleanField(msg, 6)) == null ? undefined : f,
    codeSwitch: (f = jspb.Message.getField(msg, 7)) == null ? undefined : f,
    fieldOrderList: (f = jspb.Message.getRepeatedField(msg, 8)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of Telephone as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.Telephone.ObjectFormat = function() {
  /** @type {?string|undefined} */
  this.countryCode;

  /** @type {?Array<string>|undefined} */
  this.numberPartList;

  /** @type {?string|undefined} */
  this.extension;

  /** @type {?number|undefined} */
  this.style;

  /** @type {?string|undefined} */
  this.morphosyntacticFeatures;

  /** @type {?proto.speech.tts.MorphosyntacticFeatureVector.ObjectFormat|undefined} */
  this.structuredFeatures;

  /** @type {?boolean|undefined} */
  this.preserveOrder;

  /** @type {?string|undefined} */
  this.codeSwitch;

  /** @type {?Array<string>|undefined} */
  this.fieldOrderList;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.Telephone.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.Telephone}
 */
proto.speech.tts.Telephone.fromObject = function(obj) {
  const msg = new proto.speech.tts.Telephone();
  obj.countryCode != null && jspb.Message.setField(msg, 1, obj.countryCode);
  obj.numberPartList != null && jspb.Message.setField(msg, 2, obj.numberPartList);
  obj.extension != null && jspb.Message.setField(msg, 3, obj.extension);
  obj.style != null && jspb.Message.setField(msg, 4, obj.style);
  obj.morphosyntacticFeatures != null && jspb.Message.setField(msg, 5, obj.morphosyntacticFeatures);
  obj.structuredFeatures && jspb.Message.setWrapperField(
      msg, 9, proto.speech.tts.MorphosyntacticFeatureVector.fromObject(obj.structuredFeatures));
  obj.preserveOrder != null && jspb.Message.setField(msg, 6, obj.preserveOrder);
  obj.codeSwitch != null && jspb.Message.setField(msg, 7, obj.codeSwitch);
  obj.fieldOrderList != null && jspb.Message.setField(msg, 8, obj.fieldOrderList);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.Telephone}
 */
proto.speech.tts.Telephone.deserializeBinary = function(bytes) {
  return proto.speech.tts.Telephone.deserializeBinaryFromReader(
      new proto.speech.tts.Telephone(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.Telephone} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.Telephone}
 */
proto.speech.tts.Telephone.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {string} */ (reader.readString());
      msg.setCountryCode(value);
      break;
    case 2:
      value = /** @type {string} */ (reader.readString());
      msg.addNumberPart(value);
      break;
    case 3:
      value = /** @type {string} */ (reader.readString());
      msg.setExtension$(value);
      break;
    case 4:
      value = /** @type {number} */ (reader.readInt32());
      msg.setStyle(value);
      break;
    case 5:
      value = /** @type {string} */ (reader.readString());
      msg.setMorphosyntacticFeatures(value);
      break;
    case 9:
      value = new proto.speech.tts.MorphosyntacticFeatureVector();
      reader.readMessage(value,proto.speech.tts.MorphosyntacticFeatureVector.deserializeBinaryFromReader);
      msg.setStructuredFeatures(value);
      break;
    case 6:
      value = /** @type {boolean} */ (reader.readBool());
      msg.setPreserveOrder(value);
      break;
    case 7:
      value = /** @type {string} */ (reader.readString());
      msg.setCodeSwitch(value);
      break;
    case 8:
      value = /** @type {string} */ (reader.readString());
      msg.addFieldOrder(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.Telephone.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.Telephone.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.Telephone} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.Telephone.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {string} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeString(
      1,
      f
    );
  }
  f = message.getNumberPartList();
  if (f.length > 0) {
    writer.writeRepeatedString(
      2,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeString(
      3,
      f
    );
  }
  f = /** @type {number} */ (jspb.Message.getField(message, 4));
  if (f != null) {
    writer.writeInt32(
      4,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 5));
  if (f != null) {
    writer.writeString(
      5,
      f
    );
  }
  f = message.getStructuredFeatures();
  if (f != null) {
    writer.writeMessage(
      9,
      f,
      proto.speech.tts.MorphosyntacticFeatureVector.serializeBinaryToWriter
    );
  }
  f = /** @type {boolean} */ (jspb.Message.getField(message, 6));
  if (f != null) {
    writer.writeBool(
      6,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 7));
  if (f != null) {
    writer.writeString(
      7,
      f
    );
  }
  f = message.getFieldOrderList();
  if (f.length > 0) {
    writer.writeRepeatedString(
      8,
      f
    );
  }
};


/**
 * optional string country_code = 1;
 * @return {string}
 */
proto.speech.tts.Telephone.prototype.getCountryCode = function() {
  return jspb.Message.getStringFieldWithDefault(this, 1);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Telephone} returns this
 */
proto.speech.tts.Telephone.prototype.setCountryCode = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Telephone} returns this
 */
proto.speech.tts.Telephone.prototype.clearCountryCode = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Telephone.prototype.hasCountryCode = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * repeated string number_part = 2;
 * @return {!Array<string>}
 */
proto.speech.tts.Telephone.prototype.getNumberPartList = function() {
  return /** @type {!Array<string>} */ (jspb.Message.getRepeatedField(this, 2));
};


/**
 * @param {!Array<string>} value
 * @return {!proto.speech.tts.Telephone} returns this
 */
proto.speech.tts.Telephone.prototype.setNumberPartList = function(value) {
  return jspb.Message.setField(this, 2, value || []);
};


/**
 * @param {string} value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.Telephone} returns this
 */
proto.speech.tts.Telephone.prototype.addNumberPart = function(value, opt_index) {
  return jspb.Message.addToRepeatedField(this, 2, value, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.Telephone} returns this
 */
proto.speech.tts.Telephone.prototype.clearNumberPartList = function() {
  return jspb.Message.clearRepeatedField(this, 2);
};


/**
 * optional string extension = 3;
 * @return {string}
 */
proto.speech.tts.Telephone.prototype.getExtension$ = function() {
  return jspb.Message.getStringFieldWithDefault(this, 3);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Telephone} returns this
 */
proto.speech.tts.Telephone.prototype.setExtension$ = function(value) {
  return jspb.Message.setField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Telephone} returns this
 */
proto.speech.tts.Telephone.prototype.clearExtension$ = function() {
  return jspb.Message.clearField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Telephone.prototype.hasExtension$ = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * optional int32 style = 4;
 * @return {number}
 */
proto.speech.tts.Telephone.prototype.getStyle = function() {
  return jspb.Message.getIntegerFieldWithDefault(this, 4);
};


/**
 * @param {number} value
 * @return {!proto.speech.tts.Telephone} returns this
 */
proto.speech.tts.Telephone.prototype.setStyle = function(value) {
  return jspb.Message.setField(this, 4, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Telephone} returns this
 */
proto.speech.tts.Telephone.prototype.clearStyle = function() {
  return jspb.Message.clearField(this, 4);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Telephone.prototype.hasStyle = function() {
  return jspb.Message.hasField(this, 4);
};


/**
 * optional string morphosyntactic_features = 5;
 * @return {string}
 */
proto.speech.tts.Telephone.prototype.getMorphosyntacticFeatures = function() {
  return jspb.Message.getStringFieldWithDefault(this, 5);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Telephone} returns this
 */
proto.speech.tts.Telephone.prototype.setMorphosyntacticFeatures = function(value) {
  return jspb.Message.setField(this, 5, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Telephone} returns this
 */
proto.speech.tts.Telephone.prototype.clearMorphosyntacticFeatures = function() {
  return jspb.Message.clearField(this, 5);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Telephone.prototype.hasMorphosyntacticFeatures = function() {
  return jspb.Message.hasField(this, 5);
};


/**
 * optional MorphosyntacticFeatureVector structured_features = 9;
 * @return {?proto.speech.tts.MorphosyntacticFeatureVector}
 */
proto.speech.tts.Telephone.prototype.getStructuredFeatures = function() {
  return /** @type{?proto.speech.tts.MorphosyntacticFeatureVector} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.MorphosyntacticFeatureVector, 9));
};


/**
 * @param {?proto.speech.tts.MorphosyntacticFeatureVector|undefined} value
 * @return {!proto.speech.tts.Telephone} returns this
*/
proto.speech.tts.Telephone.prototype.setStructuredFeatures = function(value) {
  return jspb.Message.setWrapperField(this, 9, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Telephone} returns this
 */
proto.speech.tts.Telephone.prototype.clearStructuredFeatures = function() {
  return jspb.Message.clearWrapperField(this, 9);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Telephone.prototype.hasStructuredFeatures = function() {
  return jspb.Message.hasField(this, 9);
};


/**
 * optional bool preserve_order = 6;
 * @return {boolean}
 */
proto.speech.tts.Telephone.prototype.getPreserveOrder = function() {
  return jspb.Message.getBooleanFieldWithDefault(this, 6);
};


/**
 * @param {boolean} value
 * @return {!proto.speech.tts.Telephone} returns this
 */
proto.speech.tts.Telephone.prototype.setPreserveOrder = function(value) {
  return jspb.Message.setField(this, 6, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Telephone} returns this
 */
proto.speech.tts.Telephone.prototype.clearPreserveOrder = function() {
  return jspb.Message.clearField(this, 6);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Telephone.prototype.hasPreserveOrder = function() {
  return jspb.Message.hasField(this, 6);
};


/**
 * optional string code_switch = 7;
 * @return {string}
 */
proto.speech.tts.Telephone.prototype.getCodeSwitch = function() {
  return jspb.Message.getStringFieldWithDefault(this, 7);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Telephone} returns this
 */
proto.speech.tts.Telephone.prototype.setCodeSwitch = function(value) {
  return jspb.Message.setField(this, 7, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Telephone} returns this
 */
proto.speech.tts.Telephone.prototype.clearCodeSwitch = function() {
  return jspb.Message.clearField(this, 7);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Telephone.prototype.hasCodeSwitch = function() {
  return jspb.Message.hasField(this, 7);
};


/**
 * repeated string field_order = 8;
 * @return {!Array<string>}
 */
proto.speech.tts.Telephone.prototype.getFieldOrderList = function() {
  return /** @type {!Array<string>} */ (jspb.Message.getRepeatedField(this, 8));
};


/**
 * @param {!Array<string>} value
 * @return {!proto.speech.tts.Telephone} returns this
 */
proto.speech.tts.Telephone.prototype.setFieldOrderList = function(value) {
  return jspb.Message.setField(this, 8, value || []);
};


/**
 * @param {string} value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.Telephone} returns this
 */
proto.speech.tts.Telephone.prototype.addFieldOrder = function(value, opt_index) {
  return jspb.Message.addToRepeatedField(this, 8, value, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.Telephone} returns this
 */
proto.speech.tts.Telephone.prototype.clearFieldOrderList = function() {
  return jspb.Message.clearRepeatedField(this, 8);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.Telephone}
 */
proto.speech.tts.Telephone.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.Telephone, data);
};



//speech/tts/public/semiotic_classes_proto_jspb/time.jspb.js
// source: speech/tts/public/semiotic_classes.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.Time');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.speech.tts.MorphosyntacticFeatureVector');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.Time = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, proto.speech.tts.Time.repeatedFields_, null);
};
goog.inherits(proto.speech.tts.Time, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.Time.displayName = 'proto.speech.tts.Time';
}

/**
 * List of repeated fields within this message type.
 * @private {!Array<number>}
 * @const
 */
proto.speech.tts.Time.repeatedFields_ = [12];



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.Time.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.Time.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.Time} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.Time.toObject = function(includeInstance, msg) {
  let f, obj = {
    hours: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    minutes: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f,
    seconds: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f,
    milliseconds: (f = jspb.Message.getField(msg, 8)) == null ? undefined : f,
    speakPeriod: (f = jspb.Message.getBooleanField(msg, 4)) == null ? undefined : f,
    suffix: (f = jspb.Message.getField(msg, 5)) == null ? undefined : f,
    style: (f = jspb.Message.getField(msg, 6)) == null ? undefined : f,
    zone: (f = jspb.Message.getField(msg, 7)) == null ? undefined : f,
    morphosyntacticFeatures: (f = jspb.Message.getField(msg, 9)) == null ? undefined : f,
    structuredFeatures: (f = msg.getStructuredFeatures()) && proto.speech.tts.MorphosyntacticFeatureVector.toObject(includeInstance, f),
    preserveOrder: (f = jspb.Message.getBooleanField(msg, 10)) == null ? undefined : f,
    codeSwitch: (f = jspb.Message.getField(msg, 11)) == null ? undefined : f,
    fieldOrderList: (f = jspb.Message.getRepeatedField(msg, 12)) == null ? undefined : f,
    duration: (f = jspb.Message.getBooleanField(msg, 14)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of Time as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.Time.ObjectFormat = function() {
  /** @type {?number|undefined} */
  this.hours;

  /** @type {?number|undefined} */
  this.minutes;

  /** @type {?number|undefined} */
  this.seconds;

  /** @type {?number|undefined} */
  this.milliseconds;

  /** @type {?boolean|undefined} */
  this.speakPeriod;

  /** @type {?string|undefined} */
  this.suffix;

  /** @type {?number|undefined} */
  this.style;

  /** @type {?string|undefined} */
  this.zone;

  /** @type {?string|undefined} */
  this.morphosyntacticFeatures;

  /** @type {?proto.speech.tts.MorphosyntacticFeatureVector.ObjectFormat|undefined} */
  this.structuredFeatures;

  /** @type {?boolean|undefined} */
  this.preserveOrder;

  /** @type {?string|undefined} */
  this.codeSwitch;

  /** @type {?Array<string>|undefined} */
  this.fieldOrderList;

  /** @type {?boolean|undefined} */
  this.duration;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.Time.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.Time}
 */
proto.speech.tts.Time.fromObject = function(obj) {
  const msg = new proto.speech.tts.Time();
  obj.hours != null && jspb.Message.setField(msg, 1, obj.hours);
  obj.minutes != null && jspb.Message.setField(msg, 2, obj.minutes);
  obj.seconds != null && jspb.Message.setField(msg, 3, obj.seconds);
  obj.milliseconds != null && jspb.Message.setField(msg, 8, obj.milliseconds);
  obj.speakPeriod != null && jspb.Message.setField(msg, 4, obj.speakPeriod);
  obj.suffix != null && jspb.Message.setField(msg, 5, obj.suffix);
  obj.style != null && jspb.Message.setField(msg, 6, obj.style);
  obj.zone != null && jspb.Message.setField(msg, 7, obj.zone);
  obj.morphosyntacticFeatures != null && jspb.Message.setField(msg, 9, obj.morphosyntacticFeatures);
  obj.structuredFeatures && jspb.Message.setWrapperField(
      msg, 13, proto.speech.tts.MorphosyntacticFeatureVector.fromObject(obj.structuredFeatures));
  obj.preserveOrder != null && jspb.Message.setField(msg, 10, obj.preserveOrder);
  obj.codeSwitch != null && jspb.Message.setField(msg, 11, obj.codeSwitch);
  obj.fieldOrderList != null && jspb.Message.setField(msg, 12, obj.fieldOrderList);
  obj.duration != null && jspb.Message.setField(msg, 14, obj.duration);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.Time}
 */
proto.speech.tts.Time.deserializeBinary = function(bytes) {
  return proto.speech.tts.Time.deserializeBinaryFromReader(
      new proto.speech.tts.Time(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.Time} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.Time}
 */
proto.speech.tts.Time.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {number} */ (reader.readInt32());
      msg.setHours(value);
      break;
    case 2:
      value = /** @type {number} */ (reader.readInt32());
      msg.setMinutes(value);
      break;
    case 3:
      value = /** @type {number} */ (reader.readInt32());
      msg.setSeconds(value);
      break;
    case 8:
      value = /** @type {number} */ (reader.readInt32());
      msg.setMilliseconds(value);
      break;
    case 4:
      value = /** @type {boolean} */ (reader.readBool());
      msg.setSpeakPeriod(value);
      break;
    case 5:
      value = /** @type {string} */ (reader.readString());
      msg.setSuffix(value);
      break;
    case 6:
      value = /** @type {number} */ (reader.readInt32());
      msg.setStyle(value);
      break;
    case 7:
      value = /** @type {string} */ (reader.readString());
      msg.setZone(value);
      break;
    case 9:
      value = /** @type {string} */ (reader.readString());
      msg.setMorphosyntacticFeatures(value);
      break;
    case 13:
      value = new proto.speech.tts.MorphosyntacticFeatureVector();
      reader.readMessage(value,proto.speech.tts.MorphosyntacticFeatureVector.deserializeBinaryFromReader);
      msg.setStructuredFeatures(value);
      break;
    case 10:
      value = /** @type {boolean} */ (reader.readBool());
      msg.setPreserveOrder(value);
      break;
    case 11:
      value = /** @type {string} */ (reader.readString());
      msg.setCodeSwitch(value);
      break;
    case 12:
      value = /** @type {string} */ (reader.readString());
      msg.addFieldOrder(value);
      break;
    case 14:
      value = /** @type {boolean} */ (reader.readBool());
      msg.setDuration(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.Time.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.Time.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.Time} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.Time.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {number} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeInt32(
      1,
      f
    );
  }
  f = /** @type {number} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeInt32(
      2,
      f
    );
  }
  f = /** @type {number} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeInt32(
      3,
      f
    );
  }
  f = /** @type {number} */ (jspb.Message.getField(message, 8));
  if (f != null) {
    writer.writeInt32(
      8,
      f
    );
  }
  f = /** @type {boolean} */ (jspb.Message.getField(message, 4));
  if (f != null) {
    writer.writeBool(
      4,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 5));
  if (f != null) {
    writer.writeString(
      5,
      f
    );
  }
  f = /** @type {number} */ (jspb.Message.getField(message, 6));
  if (f != null) {
    writer.writeInt32(
      6,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 7));
  if (f != null) {
    writer.writeString(
      7,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 9));
  if (f != null) {
    writer.writeString(
      9,
      f
    );
  }
  f = message.getStructuredFeatures();
  if (f != null) {
    writer.writeMessage(
      13,
      f,
      proto.speech.tts.MorphosyntacticFeatureVector.serializeBinaryToWriter
    );
  }
  f = /** @type {boolean} */ (jspb.Message.getField(message, 10));
  if (f != null) {
    writer.writeBool(
      10,
      f
    );
  }
  f = /** @type {string} */ (jspb.Message.getField(message, 11));
  if (f != null) {
    writer.writeString(
      11,
      f
    );
  }
  f = message.getFieldOrderList();
  if (f.length > 0) {
    writer.writeRepeatedString(
      12,
      f
    );
  }
  f = /** @type {boolean} */ (jspb.Message.getField(message, 14));
  if (f != null) {
    writer.writeBool(
      14,
      f
    );
  }
};


/**
 * optional int32 hours = 1;
 * @return {number}
 */
proto.speech.tts.Time.prototype.getHours = function() {
  return jspb.Message.getIntegerFieldWithDefault(this, 1);
};


/**
 * @param {number} value
 * @return {!proto.speech.tts.Time} returns this
 */
proto.speech.tts.Time.prototype.setHours = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Time} returns this
 */
proto.speech.tts.Time.prototype.clearHours = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Time.prototype.hasHours = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional int32 minutes = 2;
 * @return {number}
 */
proto.speech.tts.Time.prototype.getMinutes = function() {
  return jspb.Message.getIntegerFieldWithDefault(this, 2);
};


/**
 * @param {number} value
 * @return {!proto.speech.tts.Time} returns this
 */
proto.speech.tts.Time.prototype.setMinutes = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Time} returns this
 */
proto.speech.tts.Time.prototype.clearMinutes = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Time.prototype.hasMinutes = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional int32 seconds = 3;
 * @return {number}
 */
proto.speech.tts.Time.prototype.getSeconds = function() {
  return jspb.Message.getIntegerFieldWithDefault(this, 3);
};


/**
 * @param {number} value
 * @return {!proto.speech.tts.Time} returns this
 */
proto.speech.tts.Time.prototype.setSeconds = function(value) {
  return jspb.Message.setField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Time} returns this
 */
proto.speech.tts.Time.prototype.clearSeconds = function() {
  return jspb.Message.clearField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Time.prototype.hasSeconds = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * optional int32 milliseconds = 8;
 * @return {number}
 */
proto.speech.tts.Time.prototype.getMilliseconds = function() {
  return jspb.Message.getIntegerFieldWithDefault(this, 8);
};


/**
 * @param {number} value
 * @return {!proto.speech.tts.Time} returns this
 */
proto.speech.tts.Time.prototype.setMilliseconds = function(value) {
  return jspb.Message.setField(this, 8, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Time} returns this
 */
proto.speech.tts.Time.prototype.clearMilliseconds = function() {
  return jspb.Message.clearField(this, 8);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Time.prototype.hasMilliseconds = function() {
  return jspb.Message.hasField(this, 8);
};


/**
 * optional bool speak_period = 4;
 * @return {boolean}
 */
proto.speech.tts.Time.prototype.getSpeakPeriod = function() {
  return jspb.Message.getBooleanFieldWithDefault(this, 4);
};


/**
 * @param {boolean} value
 * @return {!proto.speech.tts.Time} returns this
 */
proto.speech.tts.Time.prototype.setSpeakPeriod = function(value) {
  return jspb.Message.setField(this, 4, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Time} returns this
 */
proto.speech.tts.Time.prototype.clearSpeakPeriod = function() {
  return jspb.Message.clearField(this, 4);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Time.prototype.hasSpeakPeriod = function() {
  return jspb.Message.hasField(this, 4);
};


/**
 * optional string suffix = 5;
 * @return {string}
 * @deprecated
 */
proto.speech.tts.Time.prototype.getSuffix = function() {
  return jspb.Message.getStringFieldWithDefault(this, 5);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Time} returns this
 * @deprecated
 */
proto.speech.tts.Time.prototype.setSuffix = function(value) {
  return jspb.Message.setField(this, 5, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Time} returns this
 * @deprecated
 */
proto.speech.tts.Time.prototype.clearSuffix = function() {
  return jspb.Message.clearField(this, 5);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 * @deprecated
 */
proto.speech.tts.Time.prototype.hasSuffix = function() {
  return jspb.Message.hasField(this, 5);
};


/**
 * optional int32 style = 6;
 * @return {number}
 */
proto.speech.tts.Time.prototype.getStyle = function() {
  return jspb.Message.getIntegerFieldWithDefault(this, 6);
};


/**
 * @param {number} value
 * @return {!proto.speech.tts.Time} returns this
 */
proto.speech.tts.Time.prototype.setStyle = function(value) {
  return jspb.Message.setField(this, 6, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Time} returns this
 */
proto.speech.tts.Time.prototype.clearStyle = function() {
  return jspb.Message.clearField(this, 6);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Time.prototype.hasStyle = function() {
  return jspb.Message.hasField(this, 6);
};


/**
 * optional string zone = 7;
 * @return {string}
 */
proto.speech.tts.Time.prototype.getZone = function() {
  return jspb.Message.getStringFieldWithDefault(this, 7);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Time} returns this
 */
proto.speech.tts.Time.prototype.setZone = function(value) {
  return jspb.Message.setField(this, 7, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Time} returns this
 */
proto.speech.tts.Time.prototype.clearZone = function() {
  return jspb.Message.clearField(this, 7);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Time.prototype.hasZone = function() {
  return jspb.Message.hasField(this, 7);
};


/**
 * optional string morphosyntactic_features = 9;
 * @return {string}
 */
proto.speech.tts.Time.prototype.getMorphosyntacticFeatures = function() {
  return jspb.Message.getStringFieldWithDefault(this, 9);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Time} returns this
 */
proto.speech.tts.Time.prototype.setMorphosyntacticFeatures = function(value) {
  return jspb.Message.setField(this, 9, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Time} returns this
 */
proto.speech.tts.Time.prototype.clearMorphosyntacticFeatures = function() {
  return jspb.Message.clearField(this, 9);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Time.prototype.hasMorphosyntacticFeatures = function() {
  return jspb.Message.hasField(this, 9);
};


/**
 * optional MorphosyntacticFeatureVector structured_features = 13;
 * @return {?proto.speech.tts.MorphosyntacticFeatureVector}
 */
proto.speech.tts.Time.prototype.getStructuredFeatures = function() {
  return /** @type{?proto.speech.tts.MorphosyntacticFeatureVector} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.MorphosyntacticFeatureVector, 13));
};


/**
 * @param {?proto.speech.tts.MorphosyntacticFeatureVector|undefined} value
 * @return {!proto.speech.tts.Time} returns this
*/
proto.speech.tts.Time.prototype.setStructuredFeatures = function(value) {
  return jspb.Message.setWrapperField(this, 13, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Time} returns this
 */
proto.speech.tts.Time.prototype.clearStructuredFeatures = function() {
  return jspb.Message.clearWrapperField(this, 13);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Time.prototype.hasStructuredFeatures = function() {
  return jspb.Message.hasField(this, 13);
};


/**
 * optional bool preserve_order = 10;
 * @return {boolean}
 */
proto.speech.tts.Time.prototype.getPreserveOrder = function() {
  return jspb.Message.getBooleanFieldWithDefault(this, 10);
};


/**
 * @param {boolean} value
 * @return {!proto.speech.tts.Time} returns this
 */
proto.speech.tts.Time.prototype.setPreserveOrder = function(value) {
  return jspb.Message.setField(this, 10, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Time} returns this
 */
proto.speech.tts.Time.prototype.clearPreserveOrder = function() {
  return jspb.Message.clearField(this, 10);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Time.prototype.hasPreserveOrder = function() {
  return jspb.Message.hasField(this, 10);
};


/**
 * optional string code_switch = 11;
 * @return {string}
 */
proto.speech.tts.Time.prototype.getCodeSwitch = function() {
  return jspb.Message.getStringFieldWithDefault(this, 11);
};


/**
 * @param {string} value
 * @return {!proto.speech.tts.Time} returns this
 */
proto.speech.tts.Time.prototype.setCodeSwitch = function(value) {
  return jspb.Message.setField(this, 11, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Time} returns this
 */
proto.speech.tts.Time.prototype.clearCodeSwitch = function() {
  return jspb.Message.clearField(this, 11);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Time.prototype.hasCodeSwitch = function() {
  return jspb.Message.hasField(this, 11);
};


/**
 * repeated string field_order = 12;
 * @return {!Array<string>}
 */
proto.speech.tts.Time.prototype.getFieldOrderList = function() {
  return /** @type {!Array<string>} */ (jspb.Message.getRepeatedField(this, 12));
};


/**
 * @param {!Array<string>} value
 * @return {!proto.speech.tts.Time} returns this
 */
proto.speech.tts.Time.prototype.setFieldOrderList = function(value) {
  return jspb.Message.setField(this, 12, value || []);
};


/**
 * @param {string} value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.Time} returns this
 */
proto.speech.tts.Time.prototype.addFieldOrder = function(value, opt_index) {
  return jspb.Message.addToRepeatedField(this, 12, value, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.Time} returns this
 */
proto.speech.tts.Time.prototype.clearFieldOrderList = function() {
  return jspb.Message.clearRepeatedField(this, 12);
};


/**
 * optional bool duration = 14;
 * @return {boolean}
 */
proto.speech.tts.Time.prototype.getDuration = function() {
  return jspb.Message.getBooleanFieldWithDefault(this, 14);
};


/**
 * @param {boolean} value
 * @return {!proto.speech.tts.Time} returns this
 */
proto.speech.tts.Time.prototype.setDuration = function(value) {
  return jspb.Message.setField(this, 14, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Time} returns this
 */
proto.speech.tts.Time.prototype.clearDuration = function() {
  return jspb.Message.clearField(this, 14);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Time.prototype.hasDuration = function() {
  return jspb.Message.hasField(this, 14);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.Time}
 */
proto.speech.tts.Time.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.Time, data);
};



//speech/tts/public/tts_markup_proto_jspb/audiosource.jspb.js
// source: speech/tts/public/tts_markup.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.AudioSource');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.AudioSource = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.speech.tts.AudioSource, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.AudioSource.displayName = 'proto.speech.tts.AudioSource';
}



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.AudioSource.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.AudioSource.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.AudioSource} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.AudioSource.toObject = function(includeInstance, msg) {
  let f, obj = {
    vuiId: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    stageName: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of AudioSource as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.AudioSource.ObjectFormat = function() {
  /** @type {?string|undefined} */
  this.vuiId;

  /** @type {?string|undefined} */
  this.stageName;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.AudioSource.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.AudioSource}
 */
proto.speech.tts.AudioSource.fromObject = function(obj) {
  const msg = new proto.speech.tts.AudioSource();
  obj.vuiId != null && jspb.Message.setField(msg, 1, obj.vuiId);
  obj.stageName != null && jspb.Message.setField(msg, 2, obj.stageName);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.AudioSource}
 */
proto.speech.tts.AudioSource.deserializeBinary = function(bytes) {
  return proto.speech.tts.AudioSource.deserializeBinaryFromReader(
      new proto.speech.tts.AudioSource(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.AudioSource} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.AudioSource}
 */
proto.speech.tts.AudioSource.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {string} */ (reader.readString());
      msg.setVuiId(value);
      break;
    case 2:
      value = /** @type {string} */ (reader.readString());
      msg.setStageName(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.AudioSource.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.AudioSource.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.AudioSource} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.AudioSource.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {?string} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeString(
      1,
      f
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeString(
      2,
      f
    );
  }
};


/**
 * optional string vui_id = 1;
 * @return {?string}
 */
proto.speech.tts.AudioSource.prototype.getVuiId = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 1));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.AudioSource} returns this
 */
proto.speech.tts.AudioSource.prototype.setVuiId = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.AudioSource} returns this
 */
proto.speech.tts.AudioSource.prototype.clearVuiId = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.AudioSource.prototype.hasVuiId = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional string stage_name = 2;
 * @return {?string}
 */
proto.speech.tts.AudioSource.prototype.getStageName = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 2));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.AudioSource} returns this
 */
proto.speech.tts.AudioSource.prototype.setStageName = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.AudioSource} returns this
 */
proto.speech.tts.AudioSource.prototype.clearStageName = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.AudioSource.prototype.hasStageName = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.AudioSource}
 */
proto.speech.tts.AudioSource.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.AudioSource, data);
};



//speech/tts/public/tts_markup_proto_jspb/crosslingual.jspb.js
// source: speech/tts/public/tts_markup.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.CrossLingual');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.CrossLingual = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, proto.speech.tts.CrossLingual.repeatedFields_, null);
};
goog.inherits(proto.speech.tts.CrossLingual, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.CrossLingual.displayName = 'proto.speech.tts.CrossLingual';
}

/**
 * List of repeated fields within this message type.
 * @private {!Array<number>}
 * @const
 */
proto.speech.tts.CrossLingual.repeatedFields_ = [1];



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.CrossLingual.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.CrossLingual.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.CrossLingual} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.CrossLingual.toObject = function(includeInstance, msg) {
  let f, obj = {
    foreignLanguageHintList: (f = jspb.Message.getRepeatedField(msg, 1)) == null ? undefined : f,
    foreignLanguageOverride: (f = jspb.Message.getBooleanField(msg, 2)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of CrossLingual as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.CrossLingual.ObjectFormat = function() {
  /** @type {?Array<string>|undefined} */
  this.foreignLanguageHintList;

  /** @type {?boolean|undefined} */
  this.foreignLanguageOverride;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.CrossLingual.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.CrossLingual}
 */
proto.speech.tts.CrossLingual.fromObject = function(obj) {
  const msg = new proto.speech.tts.CrossLingual();
  obj.foreignLanguageHintList != null && jspb.Message.setField(msg, 1, obj.foreignLanguageHintList);
  obj.foreignLanguageOverride != null && jspb.Message.setField(msg, 2, obj.foreignLanguageOverride);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.CrossLingual}
 */
proto.speech.tts.CrossLingual.deserializeBinary = function(bytes) {
  return proto.speech.tts.CrossLingual.deserializeBinaryFromReader(
      new proto.speech.tts.CrossLingual(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.CrossLingual} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.CrossLingual}
 */
proto.speech.tts.CrossLingual.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {string} */ (reader.readString());
      msg.addForeignLanguageHint(value);
      break;
    case 2:
      value = /** @type {boolean} */ (reader.readBool());
      msg.setForeignLanguageOverride(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.CrossLingual.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.CrossLingual.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.CrossLingual} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.CrossLingual.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = message.getForeignLanguageHintList();
  if (f.length > 0) {
    writer.writeRepeatedString(
      1,
      f
    );
  }
  f = /** @type {?boolean} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeBool(
      2,
      f
    );
  }
};


/**
 * repeated string foreign_language_hint = 1;
 * @return {!Array<string>}
 */
proto.speech.tts.CrossLingual.prototype.getForeignLanguageHintList = function() {
  return /** @type {!Array<string>} */ (jspb.Message.getRepeatedField(this, 1));
};


/**
 * @param {Array<string>|undefined} value
 * @return {!proto.speech.tts.CrossLingual} returns this
 */
proto.speech.tts.CrossLingual.prototype.setForeignLanguageHintList = function(value) {
  return jspb.Message.setField(this, 1, value || []);
};


/**
 * @param {string} value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.CrossLingual} returns this
 */
proto.speech.tts.CrossLingual.prototype.addForeignLanguageHint = function(value, opt_index) {
  return jspb.Message.addToRepeatedField(this, 1, value, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.CrossLingual} returns this
 */
proto.speech.tts.CrossLingual.prototype.clearForeignLanguageHintList = function() {
  return jspb.Message.clearRepeatedField(this, 1);
};


/**
 * optional bool foreign_language_override = 2;
 * @return {?boolean}
 */
proto.speech.tts.CrossLingual.prototype.getForeignLanguageOverride = function() {
  return /** @type {?boolean} */ (jspb.Message.getBooleanField(this, 2));
};


/**
 * @param {?boolean|undefined} value
 * @return {!proto.speech.tts.CrossLingual} returns this
 */
proto.speech.tts.CrossLingual.prototype.setForeignLanguageOverride = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.CrossLingual} returns this
 */
proto.speech.tts.CrossLingual.prototype.clearForeignLanguageOverride = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.CrossLingual.prototype.hasForeignLanguageOverride = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.CrossLingual}
 */
proto.speech.tts.CrossLingual.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.CrossLingual, data);
};



//speech/tts/public/tts_markup_proto_jspb/markupword.jspb.js
// source: speech/tts/public/tts_markup.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.MarkupWord');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.MarkupWord = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.speech.tts.MarkupWord, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.MarkupWord.displayName = 'proto.speech.tts.MarkupWord';
}



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.MarkupWord.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.MarkupWord.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.MarkupWord} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.MarkupWord.toObject = function(includeInstance, msg) {
  let f, obj = {
    id: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    variant: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f,
    tokenName: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f,
    pitchAccentPhraseStart: (f = jspb.Message.getBooleanField(msg, 4)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of MarkupWord as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.MarkupWord.ObjectFormat = function() {
  /** @type {?string|undefined} */
  this.id;

  /** @type {?string|undefined} */
  this.variant;

  /** @type {?string|undefined} */
  this.tokenName;

  /** @type {?boolean|undefined} */
  this.pitchAccentPhraseStart;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.MarkupWord.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.MarkupWord}
 */
proto.speech.tts.MarkupWord.fromObject = function(obj) {
  const msg = new proto.speech.tts.MarkupWord();
  obj.id != null && jspb.Message.setField(msg, 1, obj.id);
  obj.variant != null && jspb.Message.setField(msg, 2, obj.variant);
  obj.tokenName != null && jspb.Message.setField(msg, 3, obj.tokenName);
  obj.pitchAccentPhraseStart != null && jspb.Message.setField(msg, 4, obj.pitchAccentPhraseStart);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.MarkupWord}
 */
proto.speech.tts.MarkupWord.deserializeBinary = function(bytes) {
  return proto.speech.tts.MarkupWord.deserializeBinaryFromReader(
      new proto.speech.tts.MarkupWord(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.MarkupWord} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.MarkupWord}
 */
proto.speech.tts.MarkupWord.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {string} */ (reader.readString());
      msg.setId(value);
      break;
    case 2:
      value = /** @type {string} */ (reader.readString());
      msg.setVariant(value);
      break;
    case 3:
      value = /** @type {string} */ (reader.readString());
      msg.setTokenName(value);
      break;
    case 4:
      value = /** @type {boolean} */ (reader.readBool());
      msg.setPitchAccentPhraseStart(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.MarkupWord.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.MarkupWord.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.MarkupWord} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.MarkupWord.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {?string} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeString(
      1,
      f
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeString(
      2,
      f
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeString(
      3,
      f
    );
  }
  f = /** @type {?boolean} */ (jspb.Message.getField(message, 4));
  if (f != null) {
    writer.writeBool(
      4,
      f
    );
  }
};


/**
 * optional string id = 1;
 * @return {?string}
 */
proto.speech.tts.MarkupWord.prototype.getId = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 1));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.MarkupWord} returns this
 */
proto.speech.tts.MarkupWord.prototype.setId = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.MarkupWord} returns this
 */
proto.speech.tts.MarkupWord.prototype.clearId = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.MarkupWord.prototype.hasId = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional string variant = 2;
 * @return {?string}
 */
proto.speech.tts.MarkupWord.prototype.getVariant = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 2));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.MarkupWord} returns this
 */
proto.speech.tts.MarkupWord.prototype.setVariant = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.MarkupWord} returns this
 */
proto.speech.tts.MarkupWord.prototype.clearVariant = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.MarkupWord.prototype.hasVariant = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional string token_name = 3;
 * @return {?string}
 */
proto.speech.tts.MarkupWord.prototype.getTokenName = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 3));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.MarkupWord} returns this
 */
proto.speech.tts.MarkupWord.prototype.setTokenName = function(value) {
  return jspb.Message.setField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.MarkupWord} returns this
 */
proto.speech.tts.MarkupWord.prototype.clearTokenName = function() {
  return jspb.Message.clearField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.MarkupWord.prototype.hasTokenName = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * optional bool pitch_accent_phrase_start = 4;
 * @return {?boolean}
 */
proto.speech.tts.MarkupWord.prototype.getPitchAccentPhraseStart = function() {
  return /** @type {?boolean} */ (jspb.Message.getBooleanField(this, 4));
};


/**
 * @param {?boolean|undefined} value
 * @return {!proto.speech.tts.MarkupWord} returns this
 */
proto.speech.tts.MarkupWord.prototype.setPitchAccentPhraseStart = function(value) {
  return jspb.Message.setField(this, 4, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.MarkupWord} returns this
 */
proto.speech.tts.MarkupWord.prototype.clearPitchAccentPhraseStart = function() {
  return jspb.Message.clearField(this, 4);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.MarkupWord.prototype.hasPitchAccentPhraseStart = function() {
  return jspb.Message.hasField(this, 4);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.MarkupWord}
 */
proto.speech.tts.MarkupWord.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.MarkupWord, data);
};



//speech/tts/public/prosody_proto_jspb/emotiondimensions.jspb.js
// source: speech/tts/public/prosody.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.EmotionDimensions');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.EmotionDimensions = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.speech.tts.EmotionDimensions, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.EmotionDimensions.displayName = 'proto.speech.tts.EmotionDimensions';
}



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.EmotionDimensions.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.EmotionDimensions.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.EmotionDimensions} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.EmotionDimensions.toObject = function(includeInstance, msg) {
  let f, obj = {
    arousal: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    valence: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of EmotionDimensions as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.EmotionDimensions.ObjectFormat = function() {
  /** @type {?number|undefined} */
  this.arousal;

  /** @type {?number|undefined} */
  this.valence;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.EmotionDimensions.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.EmotionDimensions}
 */
proto.speech.tts.EmotionDimensions.fromObject = function(obj) {
  const msg = new proto.speech.tts.EmotionDimensions();
  obj.arousal != null && jspb.Message.setField(msg, 1, obj.arousal);
  obj.valence != null && jspb.Message.setField(msg, 2, obj.valence);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.EmotionDimensions}
 */
proto.speech.tts.EmotionDimensions.deserializeBinary = function(bytes) {
  return proto.speech.tts.EmotionDimensions.deserializeBinaryFromReader(
      new proto.speech.tts.EmotionDimensions(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.EmotionDimensions} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.EmotionDimensions}
 */
proto.speech.tts.EmotionDimensions.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {number} */ (reader.readInt32());
      msg.setArousal(value);
      break;
    case 2:
      value = /** @type {number} */ (reader.readInt32());
      msg.setValence(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.EmotionDimensions.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.EmotionDimensions.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.EmotionDimensions} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.EmotionDimensions.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {number} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeInt32(
      1,
      f
    );
  }
  f = /** @type {number} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeInt32(
      2,
      f
    );
  }
};


/**
 * optional int32 arousal = 1;
 * @return {number}
 */
proto.speech.tts.EmotionDimensions.prototype.getArousal = function() {
  return jspb.Message.getIntegerFieldWithDefault(this, 1);
};


/**
 * @param {number} value
 * @return {!proto.speech.tts.EmotionDimensions} returns this
 */
proto.speech.tts.EmotionDimensions.prototype.setArousal = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.EmotionDimensions} returns this
 */
proto.speech.tts.EmotionDimensions.prototype.clearArousal = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.EmotionDimensions.prototype.hasArousal = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional int32 valence = 2;
 * @return {number}
 */
proto.speech.tts.EmotionDimensions.prototype.getValence = function() {
  return jspb.Message.getIntegerFieldWithDefault(this, 2);
};


/**
 * @param {number} value
 * @return {!proto.speech.tts.EmotionDimensions} returns this
 */
proto.speech.tts.EmotionDimensions.prototype.setValence = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.EmotionDimensions} returns this
 */
proto.speech.tts.EmotionDimensions.prototype.clearValence = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.EmotionDimensions.prototype.hasValence = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.EmotionDimensions}
 */
proto.speech.tts.EmotionDimensions.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.EmotionDimensions, data);
};



//speech/tts/public/prosody_proto_jspb/prominence.jspb.js
// source: speech/tts/public/prosody.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.Prominence');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.requireType('jspb.ByteSource');
goog.requireType('proto.speech.tts.ProminenceLevel');
goog.requireType('proto.speech.tts.ProminenceType');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.Prominence = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.speech.tts.Prominence, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.Prominence.displayName = 'proto.speech.tts.Prominence';
}



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.Prominence.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.Prominence.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.Prominence} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.Prominence.toObject = function(includeInstance, msg) {
  let f, obj = {
    prominenceLevel: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    prominenceType: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of Prominence as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.Prominence.ObjectFormat = function() {
  /** @type {?number|undefined} */
  this.prominenceLevel;

  /** @type {?number|undefined} */
  this.prominenceType;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.Prominence.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.Prominence}
 */
proto.speech.tts.Prominence.fromObject = function(obj) {
  const msg = new proto.speech.tts.Prominence();
  obj.prominenceLevel != null && jspb.Message.setField(msg, 1, obj.prominenceLevel);
  obj.prominenceType != null && jspb.Message.setField(msg, 2, obj.prominenceType);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.Prominence}
 */
proto.speech.tts.Prominence.deserializeBinary = function(bytes) {
  return proto.speech.tts.Prominence.deserializeBinaryFromReader(
      new proto.speech.tts.Prominence(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.Prominence} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.Prominence}
 */
proto.speech.tts.Prominence.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {!proto.speech.tts.ProminenceLevel} */ (reader.readEnum());
      msg.setProminenceLevel(value);
      break;
    case 2:
      value = /** @type {!proto.speech.tts.ProminenceType} */ (reader.readEnum());
      msg.setProminenceType(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.Prominence.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.Prominence.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.Prominence} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.Prominence.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {!proto.speech.tts.ProminenceLevel} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeEnum(
      1,
      f
    );
  }
  f = /** @type {!proto.speech.tts.ProminenceType} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeEnum(
      2,
      f
    );
  }
};


/**
 * optional ProminenceLevel prominence_level = 1;
 * @return {!proto.speech.tts.ProminenceLevel}
 */
proto.speech.tts.Prominence.prototype.getProminenceLevel = function() {
  return /** @type {!proto.speech.tts.ProminenceLevel} */ (jspb.Message.getFieldWithDefault(this, 1, 0));
};


/**
 * @param {!proto.speech.tts.ProminenceLevel} value
 * @return {!proto.speech.tts.Prominence} returns this
 */
proto.speech.tts.Prominence.prototype.setProminenceLevel = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Prominence} returns this
 */
proto.speech.tts.Prominence.prototype.clearProminenceLevel = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Prominence.prototype.hasProminenceLevel = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional ProminenceType prominence_type = 2;
 * @return {!proto.speech.tts.ProminenceType}
 */
proto.speech.tts.Prominence.prototype.getProminenceType = function() {
  return /** @type {!proto.speech.tts.ProminenceType} */ (jspb.Message.getFieldWithDefault(this, 2, 0));
};


/**
 * @param {!proto.speech.tts.ProminenceType} value
 * @return {!proto.speech.tts.Prominence} returns this
 */
proto.speech.tts.Prominence.prototype.setProminenceType = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Prominence} returns this
 */
proto.speech.tts.Prominence.prototype.clearProminenceType = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Prominence.prototype.hasProminenceType = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.Prominence}
 */
proto.speech.tts.Prominence.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.Prominence, data);
};



//speech/tts/public/tts_markup_proto_jspb/prosodicfeatures.jspb.js
// source: speech/tts/public/tts_markup.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.ProsodicFeatures');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.speech.tts.EmotionDimensions');
goog.require('proto.speech.tts.Prominence');
goog.requireType('jspb.ByteSource');
goog.requireType('proto.speech.tts.IntonationType');
goog.requireType('proto.speech.tts.PhonationMode');
goog.requireType('proto.speech.tts.SpeakingStyle');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.ProsodicFeatures = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, proto.speech.tts.ProsodicFeatures.repeatedFields_, null);
};
goog.inherits(proto.speech.tts.ProsodicFeatures, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.ProsodicFeatures.displayName = 'proto.speech.tts.ProsodicFeatures';
}

/**
 * List of repeated fields within this message type.
 * @private {!Array<number>}
 * @const
 */
proto.speech.tts.ProsodicFeatures.repeatedFields_ = [9];



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.ProsodicFeatures.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.ProsodicFeatures.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.ProsodicFeatures} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.ProsodicFeatures.toObject = function(includeInstance, msg) {
  let f, obj = {
    containsAccent: (f = jspb.Message.getBooleanField(msg, 1)) == null ? undefined : f,
    containsNucleus: (f = jspb.Message.getBooleanField(msg, 2)) == null ? undefined : f,
    intonationType: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f,
    prominence: (f = msg.getProminence()) && proto.speech.tts.Prominence.toObject(includeInstance, f),
    containsPause: (f = jspb.Message.getBooleanField(msg, 5)) == null ? undefined : f,
    precedesPause: (f = jspb.Message.getBooleanField(msg, 6)) == null ? undefined : f,
    ratedProminence: (f = jspb.Message.getOptionalFloatingPointField(msg, 7)) == null ? undefined : f,
    isExpressive: (f = jspb.Message.getBooleanField(msg, 8)) == null ? undefined : f,
    vuiProsodyStyleList: (f = jspb.Message.getRepeatedField(msg, 9)) == null ? undefined : f,
    emotionDimensions: (f = msg.getEmotionDimensions()) && proto.speech.tts.EmotionDimensions.toObject(includeInstance, f),
    speakingStyle: (f = jspb.Message.getField(msg, 11)) == null ? undefined : f,
    phonationMode: (f = jspb.Message.getField(msg, 12)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of ProsodicFeatures as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.ProsodicFeatures.ObjectFormat = function() {
  /** @type {?boolean|undefined} */
  this.containsAccent;

  /** @type {?boolean|undefined} */
  this.containsNucleus;

  /** @type {?number|undefined} */
  this.intonationType;

  /** @type {?proto.speech.tts.Prominence.ObjectFormat|undefined} */
  this.prominence;

  /** @type {?boolean|undefined} */
  this.containsPause;

  /** @type {?boolean|undefined} */
  this.precedesPause;

  /** @type {?number|undefined} */
  this.ratedProminence;

  /** @type {?boolean|undefined} */
  this.isExpressive;

  /** @type {?Array<string>|undefined} */
  this.vuiProsodyStyleList;

  /** @type {?proto.speech.tts.EmotionDimensions.ObjectFormat|undefined} */
  this.emotionDimensions;

  /** @type {?number|undefined} */
  this.speakingStyle;

  /** @type {?number|undefined} */
  this.phonationMode;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.ProsodicFeatures.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.ProsodicFeatures}
 */
proto.speech.tts.ProsodicFeatures.fromObject = function(obj) {
  const msg = new proto.speech.tts.ProsodicFeatures();
  obj.containsAccent != null && jspb.Message.setField(msg, 1, obj.containsAccent);
  obj.containsNucleus != null && jspb.Message.setField(msg, 2, obj.containsNucleus);
  obj.intonationType != null && jspb.Message.setField(msg, 3, obj.intonationType);
  obj.prominence && jspb.Message.setWrapperField(
      msg, 4, proto.speech.tts.Prominence.fromObject(obj.prominence));
  obj.containsPause != null && jspb.Message.setField(msg, 5, obj.containsPause);
  obj.precedesPause != null && jspb.Message.setField(msg, 6, obj.precedesPause);
  obj.ratedProminence != null && jspb.Message.setField(msg, 7, obj.ratedProminence);
  obj.isExpressive != null && jspb.Message.setField(msg, 8, obj.isExpressive);
  obj.vuiProsodyStyleList != null && jspb.Message.setField(msg, 9, obj.vuiProsodyStyleList);
  obj.emotionDimensions && jspb.Message.setWrapperField(
      msg, 10, proto.speech.tts.EmotionDimensions.fromObject(obj.emotionDimensions));
  obj.speakingStyle != null && jspb.Message.setField(msg, 11, obj.speakingStyle);
  obj.phonationMode != null && jspb.Message.setField(msg, 12, obj.phonationMode);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.ProsodicFeatures}
 */
proto.speech.tts.ProsodicFeatures.deserializeBinary = function(bytes) {
  return proto.speech.tts.ProsodicFeatures.deserializeBinaryFromReader(
      new proto.speech.tts.ProsodicFeatures(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.ProsodicFeatures} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.ProsodicFeatures}
 */
proto.speech.tts.ProsodicFeatures.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {boolean} */ (reader.readBool());
      msg.setContainsAccent(value);
      break;
    case 2:
      value = /** @type {boolean} */ (reader.readBool());
      msg.setContainsNucleus(value);
      break;
    case 3:
      value = /** @type {!proto.speech.tts.IntonationType} */ (reader.readEnum());
      msg.setIntonationType(value);
      break;
    case 4:
      value = new proto.speech.tts.Prominence();
      reader.readMessage(value,proto.speech.tts.Prominence.deserializeBinaryFromReader);
      msg.setProminence(value);
      break;
    case 5:
      value = /** @type {boolean} */ (reader.readBool());
      msg.setContainsPause(value);
      break;
    case 6:
      value = /** @type {boolean} */ (reader.readBool());
      msg.setPrecedesPause(value);
      break;
    case 7:
      value = /** @type {number} */ (reader.readFloat());
      msg.setRatedProminence(value);
      break;
    case 8:
      value = /** @type {boolean} */ (reader.readBool());
      msg.setIsExpressive(value);
      break;
    case 9:
      value = /** @type {string} */ (reader.readString());
      msg.addVuiProsodyStyle(value);
      break;
    case 10:
      value = new proto.speech.tts.EmotionDimensions();
      reader.readMessage(value,proto.speech.tts.EmotionDimensions.deserializeBinaryFromReader);
      msg.setEmotionDimensions(value);
      break;
    case 11:
      value = /** @type {!proto.speech.tts.SpeakingStyle} */ (reader.readEnum());
      msg.setSpeakingStyle(value);
      break;
    case 12:
      value = /** @type {!proto.speech.tts.PhonationMode} */ (reader.readEnum());
      msg.setPhonationMode(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.ProsodicFeatures.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.ProsodicFeatures.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.ProsodicFeatures} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.ProsodicFeatures.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {?boolean} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeBool(
      1,
      f
    );
  }
  f = /** @type {?boolean} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeBool(
      2,
      f
    );
  }
  f = /** @type {!proto.speech.tts.IntonationType} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeEnum(
      3,
      f
    );
  }
  f = message.getProminence();
  if (f != null) {
    writer.writeMessage(
      4,
      f,
      proto.speech.tts.Prominence.serializeBinaryToWriter
    );
  }
  f = /** @type {?boolean} */ (jspb.Message.getField(message, 5));
  if (f != null) {
    writer.writeBool(
      5,
      f
    );
  }
  f = /** @type {?boolean} */ (jspb.Message.getField(message, 6));
  if (f != null) {
    writer.writeBool(
      6,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 7));
  if (f != null) {
    writer.writeFloat(
      7,
      f
    );
  }
  f = /** @type {?boolean} */ (jspb.Message.getField(message, 8));
  if (f != null) {
    writer.writeBool(
      8,
      f
    );
  }
  f = message.getVuiProsodyStyleList();
  if (f.length > 0) {
    writer.writeRepeatedString(
      9,
      f
    );
  }
  f = message.getEmotionDimensions();
  if (f != null) {
    writer.writeMessage(
      10,
      f,
      proto.speech.tts.EmotionDimensions.serializeBinaryToWriter
    );
  }
  f = /** @type {!proto.speech.tts.SpeakingStyle} */ (jspb.Message.getField(message, 11));
  if (f != null) {
    writer.writeEnum(
      11,
      f
    );
  }
  f = /** @type {!proto.speech.tts.PhonationMode} */ (jspb.Message.getField(message, 12));
  if (f != null) {
    writer.writeEnum(
      12,
      f
    );
  }
};


/**
 * optional bool contains_accent = 1;
 * @return {?boolean}
 */
proto.speech.tts.ProsodicFeatures.prototype.getContainsAccent = function() {
  return /** @type {?boolean} */ (jspb.Message.getBooleanField(this, 1));
};


/**
 * @param {?boolean|undefined} value
 * @return {!proto.speech.tts.ProsodicFeatures} returns this
 */
proto.speech.tts.ProsodicFeatures.prototype.setContainsAccent = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.ProsodicFeatures} returns this
 */
proto.speech.tts.ProsodicFeatures.prototype.clearContainsAccent = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.ProsodicFeatures.prototype.hasContainsAccent = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional bool contains_nucleus = 2;
 * @return {?boolean}
 */
proto.speech.tts.ProsodicFeatures.prototype.getContainsNucleus = function() {
  return /** @type {?boolean} */ (jspb.Message.getBooleanField(this, 2));
};


/**
 * @param {?boolean|undefined} value
 * @return {!proto.speech.tts.ProsodicFeatures} returns this
 */
proto.speech.tts.ProsodicFeatures.prototype.setContainsNucleus = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.ProsodicFeatures} returns this
 */
proto.speech.tts.ProsodicFeatures.prototype.clearContainsNucleus = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.ProsodicFeatures.prototype.hasContainsNucleus = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional IntonationType intonation_type = 3;
 * @return {!proto.speech.tts.IntonationType}
 */
proto.speech.tts.ProsodicFeatures.prototype.getIntonationType = function() {
  return /** @type {!proto.speech.tts.IntonationType} */ (jspb.Message.getField(this, 3));
};


/**
 * @param {?proto.speech.tts.IntonationType|undefined} value
 * @return {!proto.speech.tts.ProsodicFeatures} returns this
 */
proto.speech.tts.ProsodicFeatures.prototype.setIntonationType = function(value) {
  return jspb.Message.setField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.ProsodicFeatures} returns this
 */
proto.speech.tts.ProsodicFeatures.prototype.clearIntonationType = function() {
  return jspb.Message.clearField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.ProsodicFeatures.prototype.hasIntonationType = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * optional Prominence prominence = 4;
 * @return {?proto.speech.tts.Prominence}
 */
proto.speech.tts.ProsodicFeatures.prototype.getProminence = function() {
  return /** @type{?proto.speech.tts.Prominence} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.Prominence, 4));
};


/**
 * @param {?proto.speech.tts.Prominence|undefined} value
 * @return {!proto.speech.tts.ProsodicFeatures} returns this
*/
proto.speech.tts.ProsodicFeatures.prototype.setProminence = function(value) {
  return jspb.Message.setWrapperField(this, 4, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.ProsodicFeatures} returns this
 */
proto.speech.tts.ProsodicFeatures.prototype.clearProminence = function() {
  return jspb.Message.clearWrapperField(this, 4);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.ProsodicFeatures.prototype.hasProminence = function() {
  return jspb.Message.hasField(this, 4);
};


/**
 * optional bool contains_pause = 5;
 * @return {?boolean}
 */
proto.speech.tts.ProsodicFeatures.prototype.getContainsPause = function() {
  return /** @type {?boolean} */ (jspb.Message.getBooleanField(this, 5));
};


/**
 * @param {?boolean|undefined} value
 * @return {!proto.speech.tts.ProsodicFeatures} returns this
 */
proto.speech.tts.ProsodicFeatures.prototype.setContainsPause = function(value) {
  return jspb.Message.setField(this, 5, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.ProsodicFeatures} returns this
 */
proto.speech.tts.ProsodicFeatures.prototype.clearContainsPause = function() {
  return jspb.Message.clearField(this, 5);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.ProsodicFeatures.prototype.hasContainsPause = function() {
  return jspb.Message.hasField(this, 5);
};


/**
 * optional bool precedes_pause = 6;
 * @return {?boolean}
 */
proto.speech.tts.ProsodicFeatures.prototype.getPrecedesPause = function() {
  return /** @type {?boolean} */ (jspb.Message.getBooleanField(this, 6));
};


/**
 * @param {?boolean|undefined} value
 * @return {!proto.speech.tts.ProsodicFeatures} returns this
 */
proto.speech.tts.ProsodicFeatures.prototype.setPrecedesPause = function(value) {
  return jspb.Message.setField(this, 6, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.ProsodicFeatures} returns this
 */
proto.speech.tts.ProsodicFeatures.prototype.clearPrecedesPause = function() {
  return jspb.Message.clearField(this, 6);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.ProsodicFeatures.prototype.hasPrecedesPause = function() {
  return jspb.Message.hasField(this, 6);
};


/**
 * optional float rated_prominence = 7;
 * @return {?number}
 */
proto.speech.tts.ProsodicFeatures.prototype.getRatedProminence = function() {
  return /** @type {?number} */ (jspb.Message.getOptionalFloatingPointField(this, 7));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.speech.tts.ProsodicFeatures} returns this
 */
proto.speech.tts.ProsodicFeatures.prototype.setRatedProminence = function(value) {
  return jspb.Message.setField(this, 7, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.ProsodicFeatures} returns this
 */
proto.speech.tts.ProsodicFeatures.prototype.clearRatedProminence = function() {
  return jspb.Message.clearField(this, 7);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.ProsodicFeatures.prototype.hasRatedProminence = function() {
  return jspb.Message.hasField(this, 7);
};


/**
 * optional bool is_expressive = 8;
 * @return {?boolean}
 */
proto.speech.tts.ProsodicFeatures.prototype.getIsExpressive = function() {
  return /** @type {?boolean} */ (jspb.Message.getBooleanField(this, 8));
};


/**
 * @param {?boolean|undefined} value
 * @return {!proto.speech.tts.ProsodicFeatures} returns this
 */
proto.speech.tts.ProsodicFeatures.prototype.setIsExpressive = function(value) {
  return jspb.Message.setField(this, 8, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.ProsodicFeatures} returns this
 */
proto.speech.tts.ProsodicFeatures.prototype.clearIsExpressive = function() {
  return jspb.Message.clearField(this, 8);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.ProsodicFeatures.prototype.hasIsExpressive = function() {
  return jspb.Message.hasField(this, 8);
};


/**
 * repeated string vui_prosody_style = 9;
 * @return {!Array<string>}
 */
proto.speech.tts.ProsodicFeatures.prototype.getVuiProsodyStyleList = function() {
  return /** @type {!Array<string>} */ (jspb.Message.getRepeatedField(this, 9));
};


/**
 * @param {Array<string>|undefined} value
 * @return {!proto.speech.tts.ProsodicFeatures} returns this
 */
proto.speech.tts.ProsodicFeatures.prototype.setVuiProsodyStyleList = function(value) {
  return jspb.Message.setField(this, 9, value || []);
};


/**
 * @param {string} value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.ProsodicFeatures} returns this
 */
proto.speech.tts.ProsodicFeatures.prototype.addVuiProsodyStyle = function(value, opt_index) {
  return jspb.Message.addToRepeatedField(this, 9, value, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.ProsodicFeatures} returns this
 */
proto.speech.tts.ProsodicFeatures.prototype.clearVuiProsodyStyleList = function() {
  return jspb.Message.clearRepeatedField(this, 9);
};


/**
 * optional EmotionDimensions emotion_dimensions = 10;
 * @return {?proto.speech.tts.EmotionDimensions}
 */
proto.speech.tts.ProsodicFeatures.prototype.getEmotionDimensions = function() {
  return /** @type{?proto.speech.tts.EmotionDimensions} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.EmotionDimensions, 10));
};


/**
 * @param {?proto.speech.tts.EmotionDimensions|undefined} value
 * @return {!proto.speech.tts.ProsodicFeatures} returns this
*/
proto.speech.tts.ProsodicFeatures.prototype.setEmotionDimensions = function(value) {
  return jspb.Message.setWrapperField(this, 10, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.ProsodicFeatures} returns this
 */
proto.speech.tts.ProsodicFeatures.prototype.clearEmotionDimensions = function() {
  return jspb.Message.clearWrapperField(this, 10);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.ProsodicFeatures.prototype.hasEmotionDimensions = function() {
  return jspb.Message.hasField(this, 10);
};


/**
 * optional SpeakingStyle speaking_style = 11;
 * @return {!proto.speech.tts.SpeakingStyle}
 */
proto.speech.tts.ProsodicFeatures.prototype.getSpeakingStyle = function() {
  return /** @type {!proto.speech.tts.SpeakingStyle} */ (jspb.Message.getField(this, 11));
};


/**
 * @param {?proto.speech.tts.SpeakingStyle|undefined} value
 * @return {!proto.speech.tts.ProsodicFeatures} returns this
 */
proto.speech.tts.ProsodicFeatures.prototype.setSpeakingStyle = function(value) {
  return jspb.Message.setField(this, 11, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.ProsodicFeatures} returns this
 */
proto.speech.tts.ProsodicFeatures.prototype.clearSpeakingStyle = function() {
  return jspb.Message.clearField(this, 11);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.ProsodicFeatures.prototype.hasSpeakingStyle = function() {
  return jspb.Message.hasField(this, 11);
};


/**
 * optional PhonationMode phonation_mode = 12;
 * @return {!proto.speech.tts.PhonationMode}
 */
proto.speech.tts.ProsodicFeatures.prototype.getPhonationMode = function() {
  return /** @type {!proto.speech.tts.PhonationMode} */ (jspb.Message.getField(this, 12));
};


/**
 * @param {?proto.speech.tts.PhonationMode|undefined} value
 * @return {!proto.speech.tts.ProsodicFeatures} returns this
 */
proto.speech.tts.ProsodicFeatures.prototype.setPhonationMode = function(value) {
  return jspb.Message.setField(this, 12, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.ProsodicFeatures} returns this
 */
proto.speech.tts.ProsodicFeatures.prototype.clearPhonationMode = function() {
  return jspb.Message.clearField(this, 12);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.ProsodicFeatures.prototype.hasPhonationMode = function() {
  return jspb.Message.hasField(this, 12);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.ProsodicFeatures}
 */
proto.speech.tts.ProsodicFeatures.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.ProsodicFeatures, data);
};



//speech/tts/public/tts_markup_proto_jspb/synthesizerselection.jspb.js
// source: speech/tts/public/tts_markup.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.SynthesizerSelection');
goog.provide('proto.speech.tts.SynthesizerSelection.Method');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.SynthesizerSelection = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.speech.tts.SynthesizerSelection, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.SynthesizerSelection.displayName = 'proto.speech.tts.SynthesizerSelection';
}



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.SynthesizerSelection.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.SynthesizerSelection.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.SynthesizerSelection} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.SynthesizerSelection.toObject = function(includeInstance, msg) {
  let f, obj = {
    method: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of SynthesizerSelection as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.SynthesizerSelection.ObjectFormat = function() {
  /** @type {?number|undefined} */
  this.method;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.SynthesizerSelection.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.SynthesizerSelection}
 */
proto.speech.tts.SynthesizerSelection.fromObject = function(obj) {
  const msg = new proto.speech.tts.SynthesizerSelection();
  obj.method != null && jspb.Message.setField(msg, 1, obj.method);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.SynthesizerSelection}
 */
proto.speech.tts.SynthesizerSelection.deserializeBinary = function(bytes) {
  return proto.speech.tts.SynthesizerSelection.deserializeBinaryFromReader(
      new proto.speech.tts.SynthesizerSelection(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.SynthesizerSelection} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.SynthesizerSelection}
 */
proto.speech.tts.SynthesizerSelection.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {!proto.speech.tts.SynthesizerSelection.Method} */ (reader.readEnum());
      msg.setMethod(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.SynthesizerSelection.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.SynthesizerSelection.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.SynthesizerSelection} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.SynthesizerSelection.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {!proto.speech.tts.SynthesizerSelection.Method} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeEnum(
      1,
      f
    );
  }
};


/**
 * @enum {number}
 */
proto.speech.tts.SynthesizerSelection.Method = {
  AUTOMATIC: 0,
  UNIT_SELECTION: 1,
  PARAMETRIC: 2
};

/**
 * optional Method method = 1;
 * @return {!proto.speech.tts.SynthesizerSelection.Method}
 */
proto.speech.tts.SynthesizerSelection.prototype.getMethod = function() {
  return /** @type {!proto.speech.tts.SynthesizerSelection.Method} */ (jspb.Message.getField(this, 1));
};


/**
 * @param {?proto.speech.tts.SynthesizerSelection.Method|undefined} value
 * @return {!proto.speech.tts.SynthesizerSelection} returns this
 */
proto.speech.tts.SynthesizerSelection.prototype.setMethod = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.SynthesizerSelection} returns this
 */
proto.speech.tts.SynthesizerSelection.prototype.clearMethod = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.SynthesizerSelection.prototype.hasMethod = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.SynthesizerSelection}
 */
proto.speech.tts.SynthesizerSelection.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.SynthesizerSelection, data);
};



//speech/tts/public/tts_markup_proto_jspb/verbalinfo.jspb.js
// source: speech/tts/public/tts_markup.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.VerbalInfo');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.VerbalInfo = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.speech.tts.VerbalInfo, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.VerbalInfo.displayName = 'proto.speech.tts.VerbalInfo';
}



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.VerbalInfo.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.VerbalInfo.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.VerbalInfo} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.VerbalInfo.toObject = function(includeInstance, msg) {
  let f, obj = {
    text: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    pronunciation: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of VerbalInfo as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.VerbalInfo.ObjectFormat = function() {
  /** @type {?string|undefined} */
  this.text;

  /** @type {?string|undefined} */
  this.pronunciation;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.VerbalInfo.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.VerbalInfo}
 */
proto.speech.tts.VerbalInfo.fromObject = function(obj) {
  const msg = new proto.speech.tts.VerbalInfo();
  obj.text != null && jspb.Message.setField(msg, 1, obj.text);
  obj.pronunciation != null && jspb.Message.setField(msg, 2, obj.pronunciation);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.VerbalInfo}
 */
proto.speech.tts.VerbalInfo.deserializeBinary = function(bytes) {
  return proto.speech.tts.VerbalInfo.deserializeBinaryFromReader(
      new proto.speech.tts.VerbalInfo(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.VerbalInfo} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.VerbalInfo}
 */
proto.speech.tts.VerbalInfo.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {string} */ (reader.readString());
      msg.setText(value);
      break;
    case 2:
      value = /** @type {string} */ (reader.readString());
      msg.setPronunciation(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.VerbalInfo.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.VerbalInfo.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.VerbalInfo} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.VerbalInfo.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {?string} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeString(
      1,
      f
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeString(
      2,
      f
    );
  }
};


/**
 * optional string text = 1;
 * @return {?string}
 */
proto.speech.tts.VerbalInfo.prototype.getText = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 1));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.VerbalInfo} returns this
 */
proto.speech.tts.VerbalInfo.prototype.setText = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.VerbalInfo} returns this
 */
proto.speech.tts.VerbalInfo.prototype.clearText = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.VerbalInfo.prototype.hasText = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional string pronunciation = 2;
 * @return {?string}
 */
proto.speech.tts.VerbalInfo.prototype.getPronunciation = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 2));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.VerbalInfo} returns this
 */
proto.speech.tts.VerbalInfo.prototype.setPronunciation = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.VerbalInfo} returns this
 */
proto.speech.tts.VerbalInfo.prototype.clearPronunciation = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.VerbalInfo.prototype.hasPronunciation = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.VerbalInfo}
 */
proto.speech.tts.VerbalInfo.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.VerbalInfo, data);
};



//speech/tts/public/advanced_voice_mod_proto_jspb/timevaluefunctionsamples.jspb.js
// source: speech/tts/public/advanced_voice_mod.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.TimeValueFunctionSamples');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.TimeValueFunctionSamples = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.speech.tts.TimeValueFunctionSamples, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.TimeValueFunctionSamples.displayName = 'proto.speech.tts.TimeValueFunctionSamples';
}



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.TimeValueFunctionSamples.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.TimeValueFunctionSamples.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.TimeValueFunctionSamples} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.TimeValueFunctionSamples.toObject = function(includeInstance, msg) {
  let f, obj = {
    time: (f = jspb.Message.getOptionalFloatingPointField(msg, 1)) == null ? undefined : f,
    value: (f = jspb.Message.getOptionalFloatingPointField(msg, 2)) == null ? undefined : f
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of TimeValueFunctionSamples as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.TimeValueFunctionSamples.ObjectFormat = function() {
  /** @type {?number|undefined} */
  this.time;

  /** @type {?number|undefined} */
  this.value;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.TimeValueFunctionSamples.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.TimeValueFunctionSamples}
 */
proto.speech.tts.TimeValueFunctionSamples.fromObject = function(obj) {
  const msg = new proto.speech.tts.TimeValueFunctionSamples();
  obj.time != null && jspb.Message.setField(msg, 1, obj.time);
  obj.value != null && jspb.Message.setField(msg, 2, obj.value);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.TimeValueFunctionSamples}
 */
proto.speech.tts.TimeValueFunctionSamples.deserializeBinary = function(bytes) {
  return proto.speech.tts.TimeValueFunctionSamples.deserializeBinaryFromReader(
      new proto.speech.tts.TimeValueFunctionSamples(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.TimeValueFunctionSamples} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.TimeValueFunctionSamples}
 */
proto.speech.tts.TimeValueFunctionSamples.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {number} */ (reader.readFloat());
      msg.setTime(value);
      break;
    case 2:
      value = /** @type {number} */ (reader.readFloat());
      msg.setValue(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.TimeValueFunctionSamples.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.TimeValueFunctionSamples.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.TimeValueFunctionSamples} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.TimeValueFunctionSamples.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {number} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeFloat(
      1,
      f
    );
  }
  f = /** @type {number} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeFloat(
      2,
      f
    );
  }
};


/**
 * required float time = 1;
 * @return {number}
 */
proto.speech.tts.TimeValueFunctionSamples.prototype.getTime = function() {
  return jspb.Message.getFloatingPointFieldWithDefault(this, 1);
};


/**
 * @param {number} value
 * @return {!proto.speech.tts.TimeValueFunctionSamples} returns this
 */
proto.speech.tts.TimeValueFunctionSamples.prototype.setTime = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.TimeValueFunctionSamples} returns this
 */
proto.speech.tts.TimeValueFunctionSamples.prototype.clearTime = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.TimeValueFunctionSamples.prototype.hasTime = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * required float value = 2;
 * @return {number}
 */
proto.speech.tts.TimeValueFunctionSamples.prototype.getValue = function() {
  return jspb.Message.getFloatingPointFieldWithDefault(this, 2);
};


/**
 * @param {number} value
 * @return {!proto.speech.tts.TimeValueFunctionSamples} returns this
 */
proto.speech.tts.TimeValueFunctionSamples.prototype.setValue = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.TimeValueFunctionSamples} returns this
 */
proto.speech.tts.TimeValueFunctionSamples.prototype.clearValue = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.TimeValueFunctionSamples.prototype.hasValue = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.TimeValueFunctionSamples}
 */
proto.speech.tts.TimeValueFunctionSamples.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.TimeValueFunctionSamples, data);
};



//speech/tts/public/advanced_voice_mod_proto_jspb/copycatparams.jspb.js
// source: speech/tts/public/advanced_voice_mod.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.CopyCatParams');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.speech.tts.TimeValueFunctionSamples');
goog.requireType('jspb.ByteSource');
goog.requireType('proto.speech.tts.TimeAddressingType');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.CopyCatParams = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, proto.speech.tts.CopyCatParams.repeatedFields_, null);
};
goog.inherits(proto.speech.tts.CopyCatParams, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.CopyCatParams.displayName = 'proto.speech.tts.CopyCatParams';
}

/**
 * List of repeated fields within this message type.
 * @private {!Array<number>}
 * @const
 */
proto.speech.tts.CopyCatParams.repeatedFields_ = [1];



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.CopyCatParams.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.CopyCatParams.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.CopyCatParams} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.CopyCatParams.toObject = function(includeInstance, msg) {
  let f, obj = {
    sampleList: jspb.Message.toObjectList(msg.getSampleList(),
    proto.speech.tts.TimeValueFunctionSamples.toObject, includeInstance),
    timeAddressing: jspb.Message.getFieldWithDefault(msg, 2, 0)
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of CopyCatParams as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.CopyCatParams.ObjectFormat = function() {
  /** @type {?Array<!proto.speech.tts.TimeValueFunctionSamples.ObjectFormat>|undefined} */
  this.sampleList;

  /** @type {?number|undefined} */
  this.timeAddressing;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.CopyCatParams.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.CopyCatParams}
 */
proto.speech.tts.CopyCatParams.fromObject = function(obj) {
  const msg = new proto.speech.tts.CopyCatParams();
  obj.sampleList && jspb.Message.setRepeatedWrapperField(
      msg, 1, obj.sampleList.map(
          proto.speech.tts.TimeValueFunctionSamples.fromObject));
  obj.timeAddressing != null && jspb.Message.setField(msg, 2, obj.timeAddressing);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.CopyCatParams}
 */
proto.speech.tts.CopyCatParams.deserializeBinary = function(bytes) {
  return proto.speech.tts.CopyCatParams.deserializeBinaryFromReader(
      new proto.speech.tts.CopyCatParams(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.CopyCatParams} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.CopyCatParams}
 */
proto.speech.tts.CopyCatParams.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = new proto.speech.tts.TimeValueFunctionSamples();
      reader.readMessage(value,proto.speech.tts.TimeValueFunctionSamples.deserializeBinaryFromReader);
      msg.addSample(value);
      break;
    case 2:
      value = /** @type {!proto.speech.tts.TimeAddressingType} */ (reader.readEnum());
      msg.setTimeAddressing(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.CopyCatParams.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.CopyCatParams.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.CopyCatParams} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.CopyCatParams.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = message.getSampleList();
  if (f.length > 0) {
    writer.writeRepeatedMessage(
      1,
      f,
      proto.speech.tts.TimeValueFunctionSamples.serializeBinaryToWriter
    );
  }
  f = /** @type {!proto.speech.tts.TimeAddressingType} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeEnum(
      2,
      f
    );
  }
};


/**
 * repeated TimeValueFunctionSamples sample = 1;
 * @return {!Array<!proto.speech.tts.TimeValueFunctionSamples>}
 */
proto.speech.tts.CopyCatParams.prototype.getSampleList = function() {
  return /** @type{!Array<!proto.speech.tts.TimeValueFunctionSamples>} */ (
    jspb.Message.getRepeatedWrapperField(this, proto.speech.tts.TimeValueFunctionSamples, 1));
};


/**
 * @param {!Array<!proto.speech.tts.TimeValueFunctionSamples>} value
 * @return {!proto.speech.tts.CopyCatParams} returns this
*/
proto.speech.tts.CopyCatParams.prototype.setSampleList = function(value) {
  return jspb.Message.setRepeatedWrapperField(this, 1, value);
};


/**
 * @param {!proto.speech.tts.TimeValueFunctionSamples=} opt_value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.TimeValueFunctionSamples}
 */
proto.speech.tts.CopyCatParams.prototype.addSample = function(opt_value, opt_index) {
  return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.speech.tts.TimeValueFunctionSamples, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.CopyCatParams} returns this
 */
proto.speech.tts.CopyCatParams.prototype.clearSampleList = function() {
  return jspb.Message.clearRepeatedWrapperField(this, 1);
};


/**
 * optional TimeAddressingType time_addressing = 2;
 * @return {!proto.speech.tts.TimeAddressingType}
 */
proto.speech.tts.CopyCatParams.prototype.getTimeAddressing = function() {
  return /** @type {!proto.speech.tts.TimeAddressingType} */ (jspb.Message.getFieldWithDefault(this, 2, 0));
};


/**
 * @param {!proto.speech.tts.TimeAddressingType} value
 * @return {!proto.speech.tts.CopyCatParams} returns this
 */
proto.speech.tts.CopyCatParams.prototype.setTimeAddressing = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.CopyCatParams} returns this
 */
proto.speech.tts.CopyCatParams.prototype.clearTimeAddressing = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.CopyCatParams.prototype.hasTimeAddressing = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.CopyCatParams}
 */
proto.speech.tts.CopyCatParams.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.CopyCatParams, data);
};



//speech/tts/public/advanced_voice_mod_proto_jspb/meanmodelparams.jspb.js
// source: speech/tts/public/advanced_voice_mod.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.MeanModelParams');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.MeanModelParams = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.speech.tts.MeanModelParams, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.MeanModelParams.displayName = 'proto.speech.tts.MeanModelParams';
}



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.MeanModelParams.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.MeanModelParams.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.MeanModelParams} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.MeanModelParams.toObject = function(includeInstance, msg) {
  let f, obj = {
    mean: (f = jspb.Message.getOptionalFloatingPointField(msg, 1)) == null ? undefined : f,
    deviation: jspb.Message.getFloatingPointFieldWithDefault(msg, 2, 1.0)
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of MeanModelParams as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.MeanModelParams.ObjectFormat = function() {
  /** @type {?number|undefined} */
  this.mean;

  /** @type {?number|undefined} */
  this.deviation;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.MeanModelParams.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.MeanModelParams}
 */
proto.speech.tts.MeanModelParams.fromObject = function(obj) {
  const msg = new proto.speech.tts.MeanModelParams();
  obj.mean != null && jspb.Message.setField(msg, 1, obj.mean);
  obj.deviation != null && jspb.Message.setField(msg, 2, obj.deviation);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.MeanModelParams}
 */
proto.speech.tts.MeanModelParams.deserializeBinary = function(bytes) {
  return proto.speech.tts.MeanModelParams.deserializeBinaryFromReader(
      new proto.speech.tts.MeanModelParams(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.MeanModelParams} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.MeanModelParams}
 */
proto.speech.tts.MeanModelParams.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {number} */ (reader.readFloat());
      msg.setMean(value);
      break;
    case 2:
      value = /** @type {number} */ (reader.readFloat());
      msg.setDeviation(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.MeanModelParams.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.MeanModelParams.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.MeanModelParams} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.MeanModelParams.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {number} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeFloat(
      1,
      f
    );
  }
  f = /** @type {number} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeFloat(
      2,
      f
    );
  }
};


/**
 * required float mean = 1;
 * @return {number}
 */
proto.speech.tts.MeanModelParams.prototype.getMean = function() {
  return jspb.Message.getFloatingPointFieldWithDefault(this, 1);
};


/**
 * @param {number} value
 * @return {!proto.speech.tts.MeanModelParams} returns this
 */
proto.speech.tts.MeanModelParams.prototype.setMean = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.MeanModelParams} returns this
 */
proto.speech.tts.MeanModelParams.prototype.clearMean = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.MeanModelParams.prototype.hasMean = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional float deviation = 2;
 * @return {number}
 */
proto.speech.tts.MeanModelParams.prototype.getDeviation = function() {
  return jspb.Message.getFloatingPointFieldWithDefault(this, 2, 1.0);
};


/**
 * @param {number} value
 * @return {!proto.speech.tts.MeanModelParams} returns this
 */
proto.speech.tts.MeanModelParams.prototype.setDeviation = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.MeanModelParams} returns this
 */
proto.speech.tts.MeanModelParams.prototype.clearDeviation = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.MeanModelParams.prototype.hasDeviation = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.MeanModelParams}
 */
proto.speech.tts.MeanModelParams.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.MeanModelParams, data);
};



//speech/tts/public/advanced_voice_mod_proto_jspb/piecewisemodelparams.jspb.js
// source: speech/tts/public/advanced_voice_mod.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.PiecewiseModelParams');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.speech.tts.TimeValueFunctionSamples');
goog.requireType('jspb.ByteSource');
goog.requireType('proto.speech.tts.TimeAddressingType');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.PiecewiseModelParams = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, proto.speech.tts.PiecewiseModelParams.repeatedFields_, null);
};
goog.inherits(proto.speech.tts.PiecewiseModelParams, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.PiecewiseModelParams.displayName = 'proto.speech.tts.PiecewiseModelParams';
}

/**
 * List of repeated fields within this message type.
 * @private {!Array<number>}
 * @const
 */
proto.speech.tts.PiecewiseModelParams.repeatedFields_ = [1];



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.PiecewiseModelParams.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.PiecewiseModelParams.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.PiecewiseModelParams} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.PiecewiseModelParams.toObject = function(includeInstance, msg) {
  let f, obj = {
    sampleList: jspb.Message.toObjectList(msg.getSampleList(),
    proto.speech.tts.TimeValueFunctionSamples.toObject, includeInstance),
    deviation: jspb.Message.getFloatingPointFieldWithDefault(msg, 2, 1.0),
    timeAddressing: jspb.Message.getFieldWithDefault(msg, 3, 0)
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of PiecewiseModelParams as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.PiecewiseModelParams.ObjectFormat = function() {
  /** @type {?Array<!proto.speech.tts.TimeValueFunctionSamples.ObjectFormat>|undefined} */
  this.sampleList;

  /** @type {?number|undefined} */
  this.deviation;

  /** @type {?number|undefined} */
  this.timeAddressing;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.PiecewiseModelParams.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.PiecewiseModelParams}
 */
proto.speech.tts.PiecewiseModelParams.fromObject = function(obj) {
  const msg = new proto.speech.tts.PiecewiseModelParams();
  obj.sampleList && jspb.Message.setRepeatedWrapperField(
      msg, 1, obj.sampleList.map(
          proto.speech.tts.TimeValueFunctionSamples.fromObject));
  obj.deviation != null && jspb.Message.setField(msg, 2, obj.deviation);
  obj.timeAddressing != null && jspb.Message.setField(msg, 3, obj.timeAddressing);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.PiecewiseModelParams}
 */
proto.speech.tts.PiecewiseModelParams.deserializeBinary = function(bytes) {
  return proto.speech.tts.PiecewiseModelParams.deserializeBinaryFromReader(
      new proto.speech.tts.PiecewiseModelParams(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.PiecewiseModelParams} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.PiecewiseModelParams}
 */
proto.speech.tts.PiecewiseModelParams.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = new proto.speech.tts.TimeValueFunctionSamples();
      reader.readMessage(value,proto.speech.tts.TimeValueFunctionSamples.deserializeBinaryFromReader);
      msg.addSample(value);
      break;
    case 2:
      value = /** @type {number} */ (reader.readFloat());
      msg.setDeviation(value);
      break;
    case 3:
      value = /** @type {!proto.speech.tts.TimeAddressingType} */ (reader.readEnum());
      msg.setTimeAddressing(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.PiecewiseModelParams.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.PiecewiseModelParams.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.PiecewiseModelParams} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.PiecewiseModelParams.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = message.getSampleList();
  if (f.length > 0) {
    writer.writeRepeatedMessage(
      1,
      f,
      proto.speech.tts.TimeValueFunctionSamples.serializeBinaryToWriter
    );
  }
  f = /** @type {number} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeFloat(
      2,
      f
    );
  }
  f = /** @type {!proto.speech.tts.TimeAddressingType} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeEnum(
      3,
      f
    );
  }
};


/**
 * repeated TimeValueFunctionSamples sample = 1;
 * @return {!Array<!proto.speech.tts.TimeValueFunctionSamples>}
 */
proto.speech.tts.PiecewiseModelParams.prototype.getSampleList = function() {
  return /** @type{!Array<!proto.speech.tts.TimeValueFunctionSamples>} */ (
    jspb.Message.getRepeatedWrapperField(this, proto.speech.tts.TimeValueFunctionSamples, 1));
};


/**
 * @param {!Array<!proto.speech.tts.TimeValueFunctionSamples>} value
 * @return {!proto.speech.tts.PiecewiseModelParams} returns this
*/
proto.speech.tts.PiecewiseModelParams.prototype.setSampleList = function(value) {
  return jspb.Message.setRepeatedWrapperField(this, 1, value);
};


/**
 * @param {!proto.speech.tts.TimeValueFunctionSamples=} opt_value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.TimeValueFunctionSamples}
 */
proto.speech.tts.PiecewiseModelParams.prototype.addSample = function(opt_value, opt_index) {
  return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.speech.tts.TimeValueFunctionSamples, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.PiecewiseModelParams} returns this
 */
proto.speech.tts.PiecewiseModelParams.prototype.clearSampleList = function() {
  return jspb.Message.clearRepeatedWrapperField(this, 1);
};


/**
 * optional float deviation = 2;
 * @return {number}
 */
proto.speech.tts.PiecewiseModelParams.prototype.getDeviation = function() {
  return jspb.Message.getFloatingPointFieldWithDefault(this, 2, 1.0);
};


/**
 * @param {number} value
 * @return {!proto.speech.tts.PiecewiseModelParams} returns this
 */
proto.speech.tts.PiecewiseModelParams.prototype.setDeviation = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.PiecewiseModelParams} returns this
 */
proto.speech.tts.PiecewiseModelParams.prototype.clearDeviation = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.PiecewiseModelParams.prototype.hasDeviation = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional TimeAddressingType time_addressing = 3;
 * @return {!proto.speech.tts.TimeAddressingType}
 */
proto.speech.tts.PiecewiseModelParams.prototype.getTimeAddressing = function() {
  return /** @type {!proto.speech.tts.TimeAddressingType} */ (jspb.Message.getFieldWithDefault(this, 3, 0));
};


/**
 * @param {!proto.speech.tts.TimeAddressingType} value
 * @return {!proto.speech.tts.PiecewiseModelParams} returns this
 */
proto.speech.tts.PiecewiseModelParams.prototype.setTimeAddressing = function(value) {
  return jspb.Message.setField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.PiecewiseModelParams} returns this
 */
proto.speech.tts.PiecewiseModelParams.prototype.clearTimeAddressing = function() {
  return jspb.Message.clearField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.PiecewiseModelParams.prototype.hasTimeAddressing = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.PiecewiseModelParams}
 */
proto.speech.tts.PiecewiseModelParams.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.PiecewiseModelParams, data);
};



//speech/tts/public/advanced_voice_mod_proto_jspb/advancedvoicemod.jspb.js
// source: speech/tts/public/advanced_voice_mod.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.AdvancedVoiceMod');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.speech.tts.CopyCatParams');
goog.require('proto.speech.tts.MeanModelParams');
goog.require('proto.speech.tts.PiecewiseModelParams');
goog.require('proto.speech.tts.SpeechMorphingTargets');
goog.require('proto.speech.tts.TimeValueFunctionSamples');
goog.requireType('jspb.ByteSource');
goog.requireType('proto.speech.tts.VoiceModFactorType');
goog.requireType('proto.speech.tts.VoiceModIntervalType');
goog.requireType('proto.speech.tts.VoiceModLinguisticItemType');
goog.requireType('proto.speech.tts.VoiceModTransformType');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.AdvancedVoiceMod = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, proto.speech.tts.AdvancedVoiceMod.repeatedFields_, null);
};
goog.inherits(proto.speech.tts.AdvancedVoiceMod, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.AdvancedVoiceMod.displayName = 'proto.speech.tts.AdvancedVoiceMod';
}

/**
 * List of repeated fields within this message type.
 * @private {!Array<number>}
 * @const
 */
proto.speech.tts.AdvancedVoiceMod.repeatedFields_ = [8];



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.AdvancedVoiceMod.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.AdvancedVoiceMod.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.AdvancedVoiceMod} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.AdvancedVoiceMod.toObject = function(includeInstance, msg) {
  let f, obj = {
    wordIndex: jspb.Message.getIntegerFieldWithDefault(msg, 1, -1),
    item: jspb.Message.getFieldWithDefault(msg, 2, 2),
    itemIndex: jspb.Message.getIntegerFieldWithDefault(msg, 3, -1),
    interval: jspb.Message.getFieldWithDefault(msg, 4, 0),
    spanId: jspb.Message.getIntegerFieldWithDefault(msg, 5, 0),
    transform: jspb.Message.getFieldWithDefault(msg, 6, 0),
    factor: (f = jspb.Message.getField(msg, 7)) == null ? undefined : f,
    operatorParamsList: jspb.Message.toObjectList(msg.getOperatorParamsList(),
    proto.speech.tts.TimeValueFunctionSamples.toObject, includeInstance),
    meanParams: (f = msg.getMeanParams()) && proto.speech.tts.MeanModelParams.toObject(includeInstance, f),
    piecewiseParams: (f = msg.getPiecewiseParams()) && proto.speech.tts.PiecewiseModelParams.toObject(includeInstance, f),
    copycatParams: (f = msg.getCopycatParams()) && proto.speech.tts.CopyCatParams.toObject(includeInstance, f),
    morphing: (f = msg.getMorphing()) && proto.speech.tts.SpeechMorphingTargets.toObject(includeInstance, f)
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of AdvancedVoiceMod as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.AdvancedVoiceMod.ObjectFormat = function() {
  /** @type {?number|undefined} */
  this.wordIndex;

  /** @type {?number|undefined} */
  this.item;

  /** @type {?number|undefined} */
  this.itemIndex;

  /** @type {?number|undefined} */
  this.interval;

  /** @type {?number|undefined} */
  this.spanId;

  /** @type {?number|undefined} */
  this.transform;

  /** @type {?number|undefined} */
  this.factor;

  /** @type {?Array<!proto.speech.tts.TimeValueFunctionSamples.ObjectFormat>|undefined} */
  this.operatorParamsList;

  /** @type {?proto.speech.tts.MeanModelParams.ObjectFormat|undefined} */
  this.meanParams;

  /** @type {?proto.speech.tts.PiecewiseModelParams.ObjectFormat|undefined} */
  this.piecewiseParams;

  /** @type {?proto.speech.tts.CopyCatParams.ObjectFormat|undefined} */
  this.copycatParams;

  /** @type {?proto.speech.tts.SpeechMorphingTargets.ObjectFormat|undefined} */
  this.morphing;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.AdvancedVoiceMod.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.AdvancedVoiceMod}
 */
proto.speech.tts.AdvancedVoiceMod.fromObject = function(obj) {
  const msg = new proto.speech.tts.AdvancedVoiceMod();
  obj.wordIndex != null && jspb.Message.setField(msg, 1, obj.wordIndex);
  obj.item != null && jspb.Message.setField(msg, 2, obj.item);
  obj.itemIndex != null && jspb.Message.setField(msg, 3, obj.itemIndex);
  obj.interval != null && jspb.Message.setField(msg, 4, obj.interval);
  obj.spanId != null && jspb.Message.setField(msg, 5, obj.spanId);
  obj.transform != null && jspb.Message.setField(msg, 6, obj.transform);
  obj.factor != null && jspb.Message.setField(msg, 7, obj.factor);
  obj.operatorParamsList && jspb.Message.setRepeatedWrapperField(
      msg, 8, obj.operatorParamsList.map(
          proto.speech.tts.TimeValueFunctionSamples.fromObject));
  obj.meanParams && jspb.Message.setWrapperField(
      msg, 9, proto.speech.tts.MeanModelParams.fromObject(obj.meanParams));
  obj.piecewiseParams && jspb.Message.setWrapperField(
      msg, 10, proto.speech.tts.PiecewiseModelParams.fromObject(obj.piecewiseParams));
  obj.copycatParams && jspb.Message.setWrapperField(
      msg, 11, proto.speech.tts.CopyCatParams.fromObject(obj.copycatParams));
  obj.morphing && jspb.Message.setWrapperField(
      msg, 12, proto.speech.tts.SpeechMorphingTargets.fromObject(obj.morphing));
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.AdvancedVoiceMod}
 */
proto.speech.tts.AdvancedVoiceMod.deserializeBinary = function(bytes) {
  return proto.speech.tts.AdvancedVoiceMod.deserializeBinaryFromReader(
      new proto.speech.tts.AdvancedVoiceMod(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.AdvancedVoiceMod} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.AdvancedVoiceMod}
 */
proto.speech.tts.AdvancedVoiceMod.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {number} */ (reader.readInt32());
      msg.setWordIndex(value);
      break;
    case 2:
      value = /** @type {!proto.speech.tts.VoiceModLinguisticItemType} */ (reader.readEnum());
      msg.setItem(value);
      break;
    case 3:
      value = /** @type {number} */ (reader.readInt32());
      msg.setItemIndex(value);
      break;
    case 4:
      value = /** @type {!proto.speech.tts.VoiceModIntervalType} */ (reader.readEnum());
      msg.setInterval(value);
      break;
    case 5:
      value = /** @type {number} */ (reader.readUint32());
      msg.setSpanId(value);
      break;
    case 6:
      value = /** @type {!proto.speech.tts.VoiceModTransformType} */ (reader.readEnum());
      msg.setTransform(value);
      break;
    case 7:
      value = /** @type {!proto.speech.tts.VoiceModFactorType} */ (reader.readEnum());
      msg.setFactor(value);
      break;
    case 8:
      value = new proto.speech.tts.TimeValueFunctionSamples();
      reader.readMessage(value,proto.speech.tts.TimeValueFunctionSamples.deserializeBinaryFromReader);
      msg.addOperatorParams(value);
      break;
    case 9:
      value = new proto.speech.tts.MeanModelParams();
      reader.readMessage(value,proto.speech.tts.MeanModelParams.deserializeBinaryFromReader);
      msg.setMeanParams(value);
      break;
    case 10:
      value = new proto.speech.tts.PiecewiseModelParams();
      reader.readMessage(value,proto.speech.tts.PiecewiseModelParams.deserializeBinaryFromReader);
      msg.setPiecewiseParams(value);
      break;
    case 11:
      value = new proto.speech.tts.CopyCatParams();
      reader.readMessage(value,proto.speech.tts.CopyCatParams.deserializeBinaryFromReader);
      msg.setCopycatParams(value);
      break;
    case 12:
      value = new proto.speech.tts.SpeechMorphingTargets();
      reader.readMessage(value,proto.speech.tts.SpeechMorphingTargets.deserializeBinaryFromReader);
      msg.setMorphing(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.AdvancedVoiceMod.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.AdvancedVoiceMod.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.AdvancedVoiceMod} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.AdvancedVoiceMod.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {number} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeInt32(
      1,
      f
    );
  }
  f = /** @type {!proto.speech.tts.VoiceModLinguisticItemType} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeEnum(
      2,
      f
    );
  }
  f = /** @type {number} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeInt32(
      3,
      f
    );
  }
  f = /** @type {!proto.speech.tts.VoiceModIntervalType} */ (jspb.Message.getField(message, 4));
  if (f != null) {
    writer.writeEnum(
      4,
      f
    );
  }
  f = /** @type {number} */ (jspb.Message.getField(message, 5));
  if (f != null) {
    writer.writeUint32(
      5,
      f
    );
  }
  f = /** @type {!proto.speech.tts.VoiceModTransformType} */ (jspb.Message.getField(message, 6));
  if (f != null) {
    writer.writeEnum(
      6,
      f
    );
  }
  f = /** @type {!proto.speech.tts.VoiceModFactorType} */ (jspb.Message.getField(message, 7));
  if (f != null) {
    writer.writeEnum(
      7,
      f
    );
  }
  f = message.getOperatorParamsList();
  if (f.length > 0) {
    writer.writeRepeatedMessage(
      8,
      f,
      proto.speech.tts.TimeValueFunctionSamples.serializeBinaryToWriter
    );
  }
  f = message.getMeanParams();
  if (f != null) {
    writer.writeMessage(
      9,
      f,
      proto.speech.tts.MeanModelParams.serializeBinaryToWriter
    );
  }
  f = message.getPiecewiseParams();
  if (f != null) {
    writer.writeMessage(
      10,
      f,
      proto.speech.tts.PiecewiseModelParams.serializeBinaryToWriter
    );
  }
  f = message.getCopycatParams();
  if (f != null) {
    writer.writeMessage(
      11,
      f,
      proto.speech.tts.CopyCatParams.serializeBinaryToWriter
    );
  }
  f = message.getMorphing();
  if (f != null) {
    writer.writeMessage(
      12,
      f,
      proto.speech.tts.SpeechMorphingTargets.serializeBinaryToWriter
    );
  }
};


/**
 * optional int32 word_index = 1;
 * @return {number}
 */
proto.speech.tts.AdvancedVoiceMod.prototype.getWordIndex = function() {
  return jspb.Message.getIntegerFieldWithDefault(this, 1, -1);
};


/**
 * @param {number} value
 * @return {!proto.speech.tts.AdvancedVoiceMod} returns this
 */
proto.speech.tts.AdvancedVoiceMod.prototype.setWordIndex = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.AdvancedVoiceMod} returns this
 */
proto.speech.tts.AdvancedVoiceMod.prototype.clearWordIndex = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.AdvancedVoiceMod.prototype.hasWordIndex = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional VoiceModLinguisticItemType item = 2;
 * @return {!proto.speech.tts.VoiceModLinguisticItemType}
 */
proto.speech.tts.AdvancedVoiceMod.prototype.getItem = function() {
  return /** @type {!proto.speech.tts.VoiceModLinguisticItemType} */ (jspb.Message.getFieldWithDefault(this, 2, 2));
};


/**
 * @param {!proto.speech.tts.VoiceModLinguisticItemType} value
 * @return {!proto.speech.tts.AdvancedVoiceMod} returns this
 */
proto.speech.tts.AdvancedVoiceMod.prototype.setItem = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.AdvancedVoiceMod} returns this
 */
proto.speech.tts.AdvancedVoiceMod.prototype.clearItem = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.AdvancedVoiceMod.prototype.hasItem = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional int32 item_index = 3;
 * @return {number}
 */
proto.speech.tts.AdvancedVoiceMod.prototype.getItemIndex = function() {
  return jspb.Message.getIntegerFieldWithDefault(this, 3, -1);
};


/**
 * @param {number} value
 * @return {!proto.speech.tts.AdvancedVoiceMod} returns this
 */
proto.speech.tts.AdvancedVoiceMod.prototype.setItemIndex = function(value) {
  return jspb.Message.setField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.AdvancedVoiceMod} returns this
 */
proto.speech.tts.AdvancedVoiceMod.prototype.clearItemIndex = function() {
  return jspb.Message.clearField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.AdvancedVoiceMod.prototype.hasItemIndex = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * optional VoiceModIntervalType interval = 4;
 * @return {!proto.speech.tts.VoiceModIntervalType}
 */
proto.speech.tts.AdvancedVoiceMod.prototype.getInterval = function() {
  return /** @type {!proto.speech.tts.VoiceModIntervalType} */ (jspb.Message.getFieldWithDefault(this, 4, 0));
};


/**
 * @param {!proto.speech.tts.VoiceModIntervalType} value
 * @return {!proto.speech.tts.AdvancedVoiceMod} returns this
 */
proto.speech.tts.AdvancedVoiceMod.prototype.setInterval = function(value) {
  return jspb.Message.setField(this, 4, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.AdvancedVoiceMod} returns this
 */
proto.speech.tts.AdvancedVoiceMod.prototype.clearInterval = function() {
  return jspb.Message.clearField(this, 4);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.AdvancedVoiceMod.prototype.hasInterval = function() {
  return jspb.Message.hasField(this, 4);
};


/**
 * optional uint32 span_id = 5;
 * @return {number}
 */
proto.speech.tts.AdvancedVoiceMod.prototype.getSpanId = function() {
  return jspb.Message.getIntegerFieldWithDefault(this, 5, 0);
};


/**
 * @param {number} value
 * @return {!proto.speech.tts.AdvancedVoiceMod} returns this
 */
proto.speech.tts.AdvancedVoiceMod.prototype.setSpanId = function(value) {
  return jspb.Message.setField(this, 5, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.AdvancedVoiceMod} returns this
 */
proto.speech.tts.AdvancedVoiceMod.prototype.clearSpanId = function() {
  return jspb.Message.clearField(this, 5);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.AdvancedVoiceMod.prototype.hasSpanId = function() {
  return jspb.Message.hasField(this, 5);
};


/**
 * optional VoiceModTransformType transform = 6;
 * @return {!proto.speech.tts.VoiceModTransformType}
 */
proto.speech.tts.AdvancedVoiceMod.prototype.getTransform = function() {
  return /** @type {!proto.speech.tts.VoiceModTransformType} */ (jspb.Message.getFieldWithDefault(this, 6, 0));
};


/**
 * @param {!proto.speech.tts.VoiceModTransformType} value
 * @return {!proto.speech.tts.AdvancedVoiceMod} returns this
 */
proto.speech.tts.AdvancedVoiceMod.prototype.setTransform = function(value) {
  return jspb.Message.setField(this, 6, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.AdvancedVoiceMod} returns this
 */
proto.speech.tts.AdvancedVoiceMod.prototype.clearTransform = function() {
  return jspb.Message.clearField(this, 6);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.AdvancedVoiceMod.prototype.hasTransform = function() {
  return jspb.Message.hasField(this, 6);
};


/**
 * optional VoiceModFactorType factor = 7;
 * @return {!proto.speech.tts.VoiceModFactorType}
 */
proto.speech.tts.AdvancedVoiceMod.prototype.getFactor = function() {
  return /** @type {!proto.speech.tts.VoiceModFactorType} */ (jspb.Message.getFieldWithDefault(this, 7, 0));
};


/**
 * @param {!proto.speech.tts.VoiceModFactorType} value
 * @return {!proto.speech.tts.AdvancedVoiceMod} returns this
 */
proto.speech.tts.AdvancedVoiceMod.prototype.setFactor = function(value) {
  return jspb.Message.setField(this, 7, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.AdvancedVoiceMod} returns this
 */
proto.speech.tts.AdvancedVoiceMod.prototype.clearFactor = function() {
  return jspb.Message.clearField(this, 7);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.AdvancedVoiceMod.prototype.hasFactor = function() {
  return jspb.Message.hasField(this, 7);
};


/**
 * repeated TimeValueFunctionSamples operator_params = 8;
 * @return {!Array<!proto.speech.tts.TimeValueFunctionSamples>}
 */
proto.speech.tts.AdvancedVoiceMod.prototype.getOperatorParamsList = function() {
  return /** @type{!Array<!proto.speech.tts.TimeValueFunctionSamples>} */ (
    jspb.Message.getRepeatedWrapperField(this, proto.speech.tts.TimeValueFunctionSamples, 8));
};


/**
 * @param {!Array<!proto.speech.tts.TimeValueFunctionSamples>} value
 * @return {!proto.speech.tts.AdvancedVoiceMod} returns this
*/
proto.speech.tts.AdvancedVoiceMod.prototype.setOperatorParamsList = function(value) {
  return jspb.Message.setRepeatedWrapperField(this, 8, value);
};


/**
 * @param {!proto.speech.tts.TimeValueFunctionSamples=} opt_value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.TimeValueFunctionSamples}
 */
proto.speech.tts.AdvancedVoiceMod.prototype.addOperatorParams = function(opt_value, opt_index) {
  return jspb.Message.addToRepeatedWrapperField(this, 8, opt_value, proto.speech.tts.TimeValueFunctionSamples, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.AdvancedVoiceMod} returns this
 */
proto.speech.tts.AdvancedVoiceMod.prototype.clearOperatorParamsList = function() {
  return jspb.Message.clearRepeatedWrapperField(this, 8);
};


/**
 * optional MeanModelParams mean_params = 9;
 * @return {?proto.speech.tts.MeanModelParams}
 */
proto.speech.tts.AdvancedVoiceMod.prototype.getMeanParams = function() {
  return /** @type{?proto.speech.tts.MeanModelParams} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.MeanModelParams, 9));
};


/**
 * @param {?proto.speech.tts.MeanModelParams|undefined} value
 * @return {!proto.speech.tts.AdvancedVoiceMod} returns this
*/
proto.speech.tts.AdvancedVoiceMod.prototype.setMeanParams = function(value) {
  return jspb.Message.setWrapperField(this, 9, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.AdvancedVoiceMod} returns this
 */
proto.speech.tts.AdvancedVoiceMod.prototype.clearMeanParams = function() {
  return jspb.Message.clearWrapperField(this, 9);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.AdvancedVoiceMod.prototype.hasMeanParams = function() {
  return jspb.Message.hasField(this, 9);
};


/**
 * optional PiecewiseModelParams piecewise_params = 10;
 * @return {?proto.speech.tts.PiecewiseModelParams}
 */
proto.speech.tts.AdvancedVoiceMod.prototype.getPiecewiseParams = function() {
  return /** @type{?proto.speech.tts.PiecewiseModelParams} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.PiecewiseModelParams, 10));
};


/**
 * @param {?proto.speech.tts.PiecewiseModelParams|undefined} value
 * @return {!proto.speech.tts.AdvancedVoiceMod} returns this
*/
proto.speech.tts.AdvancedVoiceMod.prototype.setPiecewiseParams = function(value) {
  return jspb.Message.setWrapperField(this, 10, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.AdvancedVoiceMod} returns this
 */
proto.speech.tts.AdvancedVoiceMod.prototype.clearPiecewiseParams = function() {
  return jspb.Message.clearWrapperField(this, 10);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.AdvancedVoiceMod.prototype.hasPiecewiseParams = function() {
  return jspb.Message.hasField(this, 10);
};


/**
 * optional CopyCatParams copycat_params = 11;
 * @return {?proto.speech.tts.CopyCatParams}
 */
proto.speech.tts.AdvancedVoiceMod.prototype.getCopycatParams = function() {
  return /** @type{?proto.speech.tts.CopyCatParams} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.CopyCatParams, 11));
};


/**
 * @param {?proto.speech.tts.CopyCatParams|undefined} value
 * @return {!proto.speech.tts.AdvancedVoiceMod} returns this
*/
proto.speech.tts.AdvancedVoiceMod.prototype.setCopycatParams = function(value) {
  return jspb.Message.setWrapperField(this, 11, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.AdvancedVoiceMod} returns this
 */
proto.speech.tts.AdvancedVoiceMod.prototype.clearCopycatParams = function() {
  return jspb.Message.clearWrapperField(this, 11);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.AdvancedVoiceMod.prototype.hasCopycatParams = function() {
  return jspb.Message.hasField(this, 11);
};


/**
 * optional SpeechMorphingTargets morphing = 12;
 * @return {?proto.speech.tts.SpeechMorphingTargets}
 */
proto.speech.tts.AdvancedVoiceMod.prototype.getMorphing = function() {
  return /** @type{?proto.speech.tts.SpeechMorphingTargets} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.SpeechMorphingTargets, 12));
};


/**
 * @param {?proto.speech.tts.SpeechMorphingTargets|undefined} value
 * @return {!proto.speech.tts.AdvancedVoiceMod} returns this
*/
proto.speech.tts.AdvancedVoiceMod.prototype.setMorphing = function(value) {
  return jspb.Message.setWrapperField(this, 12, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.AdvancedVoiceMod} returns this
 */
proto.speech.tts.AdvancedVoiceMod.prototype.clearMorphing = function() {
  return jspb.Message.clearWrapperField(this, 12);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.AdvancedVoiceMod.prototype.hasMorphing = function() {
  return jspb.Message.hasField(this, 12);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.AdvancedVoiceMod}
 */
proto.speech.tts.AdvancedVoiceMod.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.AdvancedVoiceMod, data);
};



//speech/tts/public/voice_mod_proto_jspb/voicemodpair.jspb.js
// source: speech/tts/public/voice_mod.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.VoiceModPair');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.VoiceModPair = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.speech.tts.VoiceModPair, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.VoiceModPair.displayName = 'proto.speech.tts.VoiceModPair';
}



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.VoiceModPair.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.VoiceModPair.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.VoiceModPair} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.VoiceModPair.toObject = function(includeInstance, msg) {
  let f, obj = {
    t: (f = jspb.Message.getOptionalFloatingPointField(msg, 1)) == null ? undefined : f,
    v: (f = jspb.Message.getOptionalFloatingPointField(msg, 2)) == null ? undefined : f,
    deviation: jspb.Message.getFloatingPointFieldWithDefault(msg, 3, 1.0)
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of VoiceModPair as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.VoiceModPair.ObjectFormat = function() {
  /** @type {?number|undefined} */
  this.t;

  /** @type {?number|undefined} */
  this.v;

  /** @type {?number|undefined} */
  this.deviation;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.VoiceModPair.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.VoiceModPair}
 */
proto.speech.tts.VoiceModPair.fromObject = function(obj) {
  const msg = new proto.speech.tts.VoiceModPair();
  obj.t != null && jspb.Message.setField(msg, 1, obj.t);
  obj.v != null && jspb.Message.setField(msg, 2, obj.v);
  obj.deviation != null && jspb.Message.setField(msg, 3, obj.deviation);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.VoiceModPair}
 */
proto.speech.tts.VoiceModPair.deserializeBinary = function(bytes) {
  return proto.speech.tts.VoiceModPair.deserializeBinaryFromReader(
      new proto.speech.tts.VoiceModPair(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.VoiceModPair} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.VoiceModPair}
 */
proto.speech.tts.VoiceModPair.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {number} */ (reader.readFloat());
      msg.setT(value);
      break;
    case 2:
      value = /** @type {number} */ (reader.readFloat());
      msg.setV(value);
      break;
    case 3:
      value = /** @type {number} */ (reader.readFloat());
      msg.setDeviation(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.VoiceModPair.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.VoiceModPair.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.VoiceModPair} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.VoiceModPair.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {number} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeFloat(
      1,
      f
    );
  }
  f = /** @type {number} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeFloat(
      2,
      f
    );
  }
  f = /** @type {number} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeFloat(
      3,
      f
    );
  }
};


/**
 * required float t = 1;
 * @return {number}
 */
proto.speech.tts.VoiceModPair.prototype.getT = function() {
  return /** @type {number} */ (jspb.Message.getOptionalFloatingPointField(this, 1));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.speech.tts.VoiceModPair} returns this
 */
proto.speech.tts.VoiceModPair.prototype.setT = function(value) {
  return jspb.Message.setField(this, 1, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.VoiceModPair} returns this
 */
proto.speech.tts.VoiceModPair.prototype.clearT = function() {
  return jspb.Message.clearField(this, 1);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.VoiceModPair.prototype.hasT = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * required float v = 2;
 * @return {number}
 */
proto.speech.tts.VoiceModPair.prototype.getV = function() {
  return /** @type {number} */ (jspb.Message.getOptionalFloatingPointField(this, 2));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.speech.tts.VoiceModPair} returns this
 */
proto.speech.tts.VoiceModPair.prototype.setV = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.VoiceModPair} returns this
 */
proto.speech.tts.VoiceModPair.prototype.clearV = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.VoiceModPair.prototype.hasV = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional float deviation = 3;
 * @return {number}
 */
proto.speech.tts.VoiceModPair.prototype.getDeviation = function() {
  return jspb.Message.getFloatingPointFieldWithDefault(this, 3, 1.0);
};


/**
 * @param {?number|undefined} value
 * @return {!proto.speech.tts.VoiceModPair} returns this
 */
proto.speech.tts.VoiceModPair.prototype.setDeviation = function(value) {
  return jspb.Message.setField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.VoiceModPair} returns this
 */
proto.speech.tts.VoiceModPair.prototype.clearDeviation = function() {
  return jspb.Message.clearField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.VoiceModPair.prototype.hasDeviation = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.VoiceModPair}
 */
proto.speech.tts.VoiceModPair.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.VoiceModPair, data);
};



//speech/tts/public/voice_mod_proto_jspb/voicemod.jspb.js
// source: speech/tts/public/voice_mod.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.VoiceMod');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.speech.tts.AdvancedVoiceMod');
goog.require('proto.speech.tts.VoiceModPair');
goog.requireType('jspb.ByteSource');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.VoiceMod = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, proto.speech.tts.VoiceMod.repeatedFields_, null);
};
goog.inherits(proto.speech.tts.VoiceMod, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.VoiceMod.displayName = 'proto.speech.tts.VoiceMod';
}

/**
 * List of repeated fields within this message type.
 * @private {!Array<number>}
 * @const
 */
proto.speech.tts.VoiceMod.repeatedFields_ = [1,5];



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.VoiceMod.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.VoiceMod.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.VoiceMod} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.VoiceMod.toObject = function(includeInstance, msg) {
  let f, obj = {
    f0TargetList: jspb.Message.toObjectList(msg.getF0TargetList(),
    proto.speech.tts.VoiceModPair.toObject, includeInstance),
    f0Scale: (f = jspb.Message.getOptionalFloatingPointField(msg, 2)) == null ? undefined : f,
    durScale: (f = jspb.Message.getOptionalFloatingPointField(msg, 3)) == null ? undefined : f,
    wordsPerMinute: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f,
    advancedList: jspb.Message.toObjectList(msg.getAdvancedList(),
    proto.speech.tts.AdvancedVoiceMod.toObject, includeInstance),
    f0DeviationScaling: jspb.Message.getFloatingPointFieldWithDefault(msg, 6, 1.0)
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of VoiceMod as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.VoiceMod.ObjectFormat = function() {
  /** @type {?Array<!proto.speech.tts.VoiceModPair.ObjectFormat>|undefined} */
  this.f0TargetList;

  /** @type {?number|undefined} */
  this.f0Scale;

  /** @type {?number|undefined} */
  this.durScale;

  /** @type {?number|undefined} */
  this.wordsPerMinute;

  /** @type {?Array<!proto.speech.tts.AdvancedVoiceMod.ObjectFormat>|undefined} */
  this.advancedList;

  /** @type {?number|undefined} */
  this.f0DeviationScaling;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.VoiceMod.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.VoiceMod}
 */
proto.speech.tts.VoiceMod.fromObject = function(obj) {
  const msg = new proto.speech.tts.VoiceMod();
  obj.f0TargetList && jspb.Message.setRepeatedWrapperField(
      msg, 1, obj.f0TargetList.map(
          proto.speech.tts.VoiceModPair.fromObject));
  obj.f0Scale != null && jspb.Message.setField(msg, 2, obj.f0Scale);
  obj.durScale != null && jspb.Message.setField(msg, 3, obj.durScale);
  obj.wordsPerMinute != null && jspb.Message.setField(msg, 4, obj.wordsPerMinute);
  obj.advancedList && jspb.Message.setRepeatedWrapperField(
      msg, 5, obj.advancedList.map(
          proto.speech.tts.AdvancedVoiceMod.fromObject));
  obj.f0DeviationScaling != null && jspb.Message.setField(msg, 6, obj.f0DeviationScaling);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.VoiceMod}
 */
proto.speech.tts.VoiceMod.deserializeBinary = function(bytes) {
  return proto.speech.tts.VoiceMod.deserializeBinaryFromReader(
      new proto.speech.tts.VoiceMod(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.VoiceMod} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.VoiceMod}
 */
proto.speech.tts.VoiceMod.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = new proto.speech.tts.VoiceModPair();
      reader.readMessage(value,proto.speech.tts.VoiceModPair.deserializeBinaryFromReader);
      msg.addF0Target(value);
      break;
    case 2:
      value = /** @type {number} */ (reader.readFloat());
      msg.setF0Scale(value);
      break;
    case 3:
      value = /** @type {number} */ (reader.readFloat());
      msg.setDurScale(value);
      break;
    case 4:
      value = /** @type {number} */ (reader.readInt32());
      msg.setWordsPerMinute(value);
      break;
    case 5:
      value = new proto.speech.tts.AdvancedVoiceMod();
      reader.readMessage(value,proto.speech.tts.AdvancedVoiceMod.deserializeBinaryFromReader);
      msg.addAdvanced(value);
      break;
    case 6:
      value = /** @type {number} */ (reader.readFloat());
      msg.setF0DeviationScaling(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.VoiceMod.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.VoiceMod.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.VoiceMod} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.VoiceMod.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = message.getF0TargetList();
  if (f.length > 0) {
    writer.writeRepeatedMessage(
      1,
      f,
      proto.speech.tts.VoiceModPair.serializeBinaryToWriter
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeFloat(
      2,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 3));
  if (f != null) {
    writer.writeFloat(
      3,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 4));
  if (f != null) {
    writer.writeInt32(
      4,
      f
    );
  }
  f = message.getAdvancedList();
  if (f.length > 0) {
    writer.writeRepeatedMessage(
      5,
      f,
      proto.speech.tts.AdvancedVoiceMod.serializeBinaryToWriter
    );
  }
  f = /** @type {number} */ (jspb.Message.getField(message, 6));
  if (f != null) {
    writer.writeFloat(
      6,
      f
    );
  }
};


/**
 * repeated VoiceModPair f0_target = 1;
 * @return {!Array<!proto.speech.tts.VoiceModPair>}
 */
proto.speech.tts.VoiceMod.prototype.getF0TargetList = function() {
  return /** @type{!Array<!proto.speech.tts.VoiceModPair>} */ (
    jspb.Message.getRepeatedWrapperField(this, proto.speech.tts.VoiceModPair, 1));
};


/**
 * @param {Array<!proto.speech.tts.VoiceModPair>|undefined} value
 * @return {!proto.speech.tts.VoiceMod} returns this
*/
proto.speech.tts.VoiceMod.prototype.setF0TargetList = function(value) {
  return jspb.Message.setRepeatedWrapperField(this, 1, value);
};


/**
 * @param {!proto.speech.tts.VoiceModPair=} opt_value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.VoiceModPair}
 */
proto.speech.tts.VoiceMod.prototype.addF0Target = function(opt_value, opt_index) {
  return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.speech.tts.VoiceModPair, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.VoiceMod} returns this
 */
proto.speech.tts.VoiceMod.prototype.clearF0TargetList = function() {
  return jspb.Message.clearRepeatedWrapperField(this, 1);
};


/**
 * optional float f0_scale = 2;
 * @return {?number}
 */
proto.speech.tts.VoiceMod.prototype.getF0Scale = function() {
  return /** @type {?number} */ (jspb.Message.getOptionalFloatingPointField(this, 2));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.speech.tts.VoiceMod} returns this
 */
proto.speech.tts.VoiceMod.prototype.setF0Scale = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.VoiceMod} returns this
 */
proto.speech.tts.VoiceMod.prototype.clearF0Scale = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.VoiceMod.prototype.hasF0Scale = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional float dur_scale = 3;
 * @return {?number}
 */
proto.speech.tts.VoiceMod.prototype.getDurScale = function() {
  return /** @type {?number} */ (jspb.Message.getOptionalFloatingPointField(this, 3));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.speech.tts.VoiceMod} returns this
 */
proto.speech.tts.VoiceMod.prototype.setDurScale = function(value) {
  return jspb.Message.setField(this, 3, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.VoiceMod} returns this
 */
proto.speech.tts.VoiceMod.prototype.clearDurScale = function() {
  return jspb.Message.clearField(this, 3);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.VoiceMod.prototype.hasDurScale = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * optional int32 words_per_minute = 4;
 * @return {?number}
 */
proto.speech.tts.VoiceMod.prototype.getWordsPerMinute = function() {
  return /** @type {?number} */ (jspb.Message.getField(this, 4));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.speech.tts.VoiceMod} returns this
 */
proto.speech.tts.VoiceMod.prototype.setWordsPerMinute = function(value) {
  return jspb.Message.setField(this, 4, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.VoiceMod} returns this
 */
proto.speech.tts.VoiceMod.prototype.clearWordsPerMinute = function() {
  return jspb.Message.clearField(this, 4);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.VoiceMod.prototype.hasWordsPerMinute = function() {
  return jspb.Message.hasField(this, 4);
};


/**
 * repeated AdvancedVoiceMod advanced = 5;
 * @return {!Array<!proto.speech.tts.AdvancedVoiceMod>}
 */
proto.speech.tts.VoiceMod.prototype.getAdvancedList = function() {
  return /** @type{!Array<!proto.speech.tts.AdvancedVoiceMod>} */ (
    jspb.Message.getRepeatedWrapperField(this, proto.speech.tts.AdvancedVoiceMod, 5));
};


/**
 * @param {Array<!proto.speech.tts.AdvancedVoiceMod>|undefined} value
 * @return {!proto.speech.tts.VoiceMod} returns this
*/
proto.speech.tts.VoiceMod.prototype.setAdvancedList = function(value) {
  return jspb.Message.setRepeatedWrapperField(this, 5, value);
};


/**
 * @param {!proto.speech.tts.AdvancedVoiceMod=} opt_value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.AdvancedVoiceMod}
 */
proto.speech.tts.VoiceMod.prototype.addAdvanced = function(opt_value, opt_index) {
  return jspb.Message.addToRepeatedWrapperField(this, 5, opt_value, proto.speech.tts.AdvancedVoiceMod, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.VoiceMod} returns this
 */
proto.speech.tts.VoiceMod.prototype.clearAdvancedList = function() {
  return jspb.Message.clearRepeatedWrapperField(this, 5);
};


/**
 * optional float f0_deviation_scaling = 6;
 * @return {number}
 */
proto.speech.tts.VoiceMod.prototype.getF0DeviationScaling = function() {
  return jspb.Message.getFloatingPointFieldWithDefault(this, 6, 1.0);
};


/**
 * @param {?number|undefined} value
 * @return {!proto.speech.tts.VoiceMod} returns this
 */
proto.speech.tts.VoiceMod.prototype.setF0DeviationScaling = function(value) {
  return jspb.Message.setField(this, 6, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.VoiceMod} returns this
 */
proto.speech.tts.VoiceMod.prototype.clearF0DeviationScaling = function() {
  return jspb.Message.clearField(this, 6);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.VoiceMod.prototype.hasF0DeviationScaling = function() {
  return jspb.Message.hasField(this, 6);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.VoiceMod}
 */
proto.speech.tts.VoiceMod.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.VoiceMod, data);
};



//speech/tts/public/tts_markup_proto_jspb/say.jspb.js
// source: speech/tts/public/tts_markup.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.Say');
goog.provide('proto.speech.tts.Say.WhatToSayCase');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.location.unified.LocationDescriptor');
goog.require('proto.speech.tts.Abbreviation');
goog.require('proto.speech.tts.Address');
goog.require('proto.speech.tts.AudioSource');
goog.require('proto.speech.tts.Cardinal');
goog.require('proto.speech.tts.ChemicalFormula');
goog.require('proto.speech.tts.Connector');
goog.require('proto.speech.tts.CrossLingual');
goog.require('proto.speech.tts.Date');
goog.require('proto.speech.tts.Decimal');
goog.require('proto.speech.tts.Electronic');
goog.require('proto.speech.tts.EmoticonEmoji');
goog.require('proto.speech.tts.Fraction');
goog.require('proto.speech.tts.MarkupWord');
goog.require('proto.speech.tts.Measure');
goog.require('proto.speech.tts.Money');
goog.require('proto.speech.tts.MorphosyntacticFeatureVector');
goog.require('proto.speech.tts.Ordinal');
goog.require('proto.speech.tts.ProsodicFeatures');
goog.require('proto.speech.tts.Spelling');
goog.require('proto.speech.tts.SynthesizerSelection');
goog.require('proto.speech.tts.Telephone');
goog.require('proto.speech.tts.Time');
goog.require('proto.speech.tts.VerbalInfo');
goog.require('proto.speech.tts.VoiceMod');
goog.requireType('jspb.ByteSource');
goog.requireType('jspb.ExtensionFieldBinaryInfo');
goog.requireType('jspb.ExtensionFieldInfo');
goog.requireType('proto.speech.tts.TextnormLevel');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.Say = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, 42, proto.speech.tts.Say.repeatedFields_, proto.speech.tts.Say.oneofGroups_);
};
goog.inherits(proto.speech.tts.Say, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.Say.displayName = 'proto.speech.tts.Say';
}

/**
 * The extensions registered with this message class. This is a map of
 * extension field number to fieldInfo object. This field should be considered
 * a private API (it is public because it is needed by other generated code).
 *
 * For example:
 *     { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} }
 *
 * fieldName contains the JsCompiler renamed field name property so that it
 * works in OPTIMIZED mode.
 *
 * @type {!Object<number, jspb.ExtensionFieldInfo>}
 */
proto.speech.tts.Say.extensions = {};


/**
 * The extensions registered with this message class. This is a map of
 * extension field number to fieldInfo object. This field should be considered
 * a private API (it is public because it is needed by other generated code).
 *
 * For example:
 *     { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} }
 *
 * fieldName contains the JsCompiler renamed field name property so that it
 * works in OPTIMIZED mode.
 *
 * @type {!Object<number, jspb.ExtensionFieldBinaryInfo>}
 */
proto.speech.tts.Say.extensionsBinary = {};


/**
 * List of repeated fields within this message type.
 * @private {!Array<number>}
 * @const
 */
proto.speech.tts.Say.repeatedFields_ = [17,34,26];

/**
 * Oneof group definitions for this message. Each group defines the field
 * numbers belonging to that group. When of these fields' value is set, all
 * other fields in the group are cleared. During deserialization, if multiple
 * fields are encountered for a group, only the last value seen will be kept.
 * @private {!Array<!Array<number>>}
 * @const
 */
proto.speech.tts.Say.oneofGroups_ = [[1,3,4,5,6,15,7,8,9,10,11,12,13,14,16,18,19,21,32,25,36,37,41]];

/**
 * @enum {number}
 */
proto.speech.tts.Say.WhatToSayCase = {
  WHAT_TO_SAY_NOT_SET: 0,
  TEXT: 1,
  CARDINAL: 3,
  ORDINAL: 4,
  DECIMAL: 5,
  FRACTION: 6,
  DIGIT: 15,
  TIME: 7,
  MEASURE: 8,
  DATE: 9,
  ADDRESS: 10,
  TELEPHONE: 11,
  MONEY: 12,
  ELECTRONIC: 13,
  CHEMICAL_FORMULA: 14,
  WORDS: 16,
  LETTERS: 18,
  VERBATIM: 19,
  PAUSE: 21,
  SPELL: 32,
  VERBAL_INFO: 25,
  CONNECTOR: 36,
  ABBREVIATION: 37,
  EMOTICON_EMOJI: 41
};

/**
 * @return {!proto.speech.tts.Say.WhatToSayCase}
 */
proto.speech.tts.Say.prototype.getWhatToSayCase = function() {
  return /** @type {!proto.speech.tts.Say.WhatToSayCase} */(jspb.Message.computeOneofCase(this, proto.speech.tts.Say.oneofGroups_[0]));
};



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.Say.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.Say.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.Say} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.Say.toObject = function(includeInstance, msg) {
  let f, obj = {
    text: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f,
    cardinal: (f = msg.getCardinal()) && proto.speech.tts.Cardinal.toObject(includeInstance, f),
    ordinal: (f = msg.getOrdinal()) && proto.speech.tts.Ordinal.toObject(includeInstance, f),
    decimal: (f = msg.getDecimal()) && proto.speech.tts.Decimal.toObject(includeInstance, f),
    fraction: (f = msg.getFraction()) && proto.speech.tts.Fraction.toObject(includeInstance, f),
    digit: (f = jspb.Message.getField(msg, 15)) == null ? undefined : f,
    time: (f = msg.getTime()) && proto.speech.tts.Time.toObject(includeInstance, f),
    measure: (f = msg.getMeasure()) && proto.speech.tts.Measure.toObject(includeInstance, f),
    date: (f = msg.getDate()) && proto.speech.tts.Date.toObject(includeInstance, f),
    address: (f = msg.getAddress()) && proto.speech.tts.Address.toObject(includeInstance, f),
    telephone: (f = msg.getTelephone()) && proto.speech.tts.Telephone.toObject(includeInstance, f),
    money: (f = msg.getMoney()) && proto.speech.tts.Money.toObject(includeInstance, f),
    electronic: (f = msg.getElectronic()) && proto.speech.tts.Electronic.toObject(includeInstance, f),
    chemicalFormula: (f = msg.getChemicalFormula()) && proto.speech.tts.ChemicalFormula.toObject(includeInstance, f),
    words: (f = jspb.Message.getField(msg, 16)) == null ? undefined : f,
    letters: (f = jspb.Message.getField(msg, 18)) == null ? undefined : f,
    verbatim: (f = jspb.Message.getField(msg, 19)) == null ? undefined : f,
    pause: (f = jspb.Message.getOptionalFloatingPointField(msg, 21)) == null ? undefined : f,
    spell: (f = msg.getSpell()) && proto.speech.tts.Spelling.toObject(includeInstance, f),
    verbalInfo: (f = msg.getVerbalInfo()) && proto.speech.tts.VerbalInfo.toObject(includeInstance, f),
    connector: (f = msg.getConnector()) && proto.speech.tts.Connector.toObject(includeInstance, f),
    abbreviation: (f = msg.getAbbreviation()) && proto.speech.tts.Abbreviation.toObject(includeInstance, f),
    emoticonEmoji: (f = msg.getEmoticonEmoji()) && proto.speech.tts.EmoticonEmoji.toObject(includeInstance, f),
    wordSequenceList: jspb.Message.toObjectList(msg.getWordSequenceList(),
    proto.speech.tts.MarkupWord.toObject, includeInstance),
    voicemod: (f = msg.getVoicemod()) && proto.speech.tts.VoiceMod.toObject(includeInstance, f),
    morphosyntacticFeatures: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f,
    structuredFeatures: (f = msg.getStructuredFeatures()) && proto.speech.tts.MorphosyntacticFeatureVector.toObject(includeInstance, f),
    prosodicFeatures: (f = msg.getProsodicFeatures()) && proto.speech.tts.ProsodicFeatures.toObject(includeInstance, f),
    location: (f = msg.getLocation()) && proto.location.unified.LocationDescriptor.toObject(includeInstance, f),
    knowledgeGraphMidList: (f = jspb.Message.getRepeatedField(msg, 34)) == null ? undefined : f,
    conciseEmoji: (f = jspb.Message.getBooleanField(msg, 24)) == null ? undefined : f,
    audioSourceList: jspb.Message.toObjectList(msg.getAudioSourceList(),
    proto.speech.tts.AudioSource.toObject, includeInstance),
    crossLingual: (f = msg.getCrossLingual()) && proto.speech.tts.CrossLingual.toObject(includeInstance, f),
    foreignScript: (f = jspb.Message.getField(msg, 39)) == null ? undefined : f,
    textnormLevel: (f = jspb.Message.getField(msg, 29)) == null ? undefined : f,
    synthesizerSelection: (f = msg.getSynthesizerSelection()) && proto.speech.tts.SynthesizerSelection.toObject(includeInstance, f),
    bleep: (f = jspb.Message.getBooleanField(msg, 31)) == null ? undefined : f,
    prefix: (f = jspb.Message.getField(msg, 33)) == null ? undefined : f,
    suffix: (f = jspb.Message.getField(msg, 35)) == null ? undefined : f,
    timepointName: (f = jspb.Message.getField(msg, 38)) == null ? undefined : f,
    noCelebrity: (f = jspb.Message.getBooleanField(msg, 40)) == null ? undefined : f
  };

  jspb.Message.toObjectExtension(/** @type {!jspb.Message} */ (msg), obj,
      proto.speech.tts.Say.extensions, proto.speech.tts.Say.prototype.getExtension,
      includeInstance);
  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of Say as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.Say.ObjectFormat = function() {
  /** @type {?string|undefined} */
  this.text;

  /** @type {?proto.speech.tts.Cardinal.ObjectFormat|undefined} */
  this.cardinal;

  /** @type {?proto.speech.tts.Ordinal.ObjectFormat|undefined} */
  this.ordinal;

  /** @type {?proto.speech.tts.Decimal.ObjectFormat|undefined} */
  this.decimal;

  /** @type {?proto.speech.tts.Fraction.ObjectFormat|undefined} */
  this.fraction;

  /** @type {?string|undefined} */
  this.digit;

  /** @type {?proto.speech.tts.Time.ObjectFormat|undefined} */
  this.time;

  /** @type {?proto.speech.tts.Measure.ObjectFormat|undefined} */
  this.measure;

  /** @type {?proto.speech.tts.Date.ObjectFormat|undefined} */
  this.date;

  /** @type {?proto.speech.tts.Address.ObjectFormat|undefined} */
  this.address;

  /** @type {?proto.speech.tts.Telephone.ObjectFormat|undefined} */
  this.telephone;

  /** @type {?proto.speech.tts.Money.ObjectFormat|undefined} */
  this.money;

  /** @type {?proto.speech.tts.Electronic.ObjectFormat|undefined} */
  this.electronic;

  /** @type {?proto.speech.tts.ChemicalFormula.ObjectFormat|undefined} */
  this.chemicalFormula;

  /** @type {?string|undefined} */
  this.words;

  /** @type {?string|undefined} */
  this.letters;

  /** @type {?string|undefined} */
  this.verbatim;

  /** @type {?number|undefined} */
  this.pause;

  /** @type {?proto.speech.tts.Spelling.ObjectFormat|undefined} */
  this.spell;

  /** @type {?proto.speech.tts.VerbalInfo.ObjectFormat|undefined} */
  this.verbalInfo;

  /** @type {?proto.speech.tts.Connector.ObjectFormat|undefined} */
  this.connector;

  /** @type {?proto.speech.tts.Abbreviation.ObjectFormat|undefined} */
  this.abbreviation;

  /** @type {?proto.speech.tts.EmoticonEmoji.ObjectFormat|undefined} */
  this.emoticonEmoji;

  /** @type {?Array<!proto.speech.tts.MarkupWord.ObjectFormat>|undefined} */
  this.wordSequenceList;

  /** @type {?proto.speech.tts.VoiceMod.ObjectFormat|undefined} */
  this.voicemod;

  /** @type {?string|undefined} */
  this.morphosyntacticFeatures;

  /** @type {?proto.speech.tts.MorphosyntacticFeatureVector.ObjectFormat|undefined} */
  this.structuredFeatures;

  /** @type {?proto.speech.tts.ProsodicFeatures.ObjectFormat|undefined} */
  this.prosodicFeatures;

  /** @type {?proto.location.unified.LocationDescriptor.ObjectFormat|undefined} */
  this.location;

  /** @type {?Array<string>|undefined} */
  this.knowledgeGraphMidList;

  /** @type {?boolean|undefined} */
  this.conciseEmoji;

  /** @type {?Array<!proto.speech.tts.AudioSource.ObjectFormat>|undefined} */
  this.audioSourceList;

  /** @type {?proto.speech.tts.CrossLingual.ObjectFormat|undefined} */
  this.crossLingual;

  /** @type {?string|undefined} */
  this.foreignScript;

  /** @type {?number|undefined} */
  this.textnormLevel;

  /** @type {?proto.speech.tts.SynthesizerSelection.ObjectFormat|undefined} */
  this.synthesizerSelection;

  /** @type {?boolean|undefined} */
  this.bleep;

  /** @type {?string|undefined} */
  this.prefix;

  /** @type {?string|undefined} */
  this.suffix;

  /** @type {?string|undefined} */
  this.timepointName;

  /** @type {?boolean|undefined} */
  this.noCelebrity;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.Say.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.Say}
 */
proto.speech.tts.Say.fromObject = function(obj) {
  const msg = new proto.speech.tts.Say();
  obj.text != null && jspb.Message.setOneofField(msg, 1, proto.speech.tts.Say.oneofGroups_[0], obj.text);
  obj.cardinal && jspb.Message.setOneofWrapperField(
      msg, 3, proto.speech.tts.Say.oneofGroups_[0], proto.speech.tts.Cardinal.fromObject(obj.cardinal));
  obj.ordinal && jspb.Message.setOneofWrapperField(
      msg, 4, proto.speech.tts.Say.oneofGroups_[0], proto.speech.tts.Ordinal.fromObject(obj.ordinal));
  obj.decimal && jspb.Message.setOneofWrapperField(
      msg, 5, proto.speech.tts.Say.oneofGroups_[0], proto.speech.tts.Decimal.fromObject(obj.decimal));
  obj.fraction && jspb.Message.setOneofWrapperField(
      msg, 6, proto.speech.tts.Say.oneofGroups_[0], proto.speech.tts.Fraction.fromObject(obj.fraction));
  obj.digit != null && jspb.Message.setOneofField(msg, 15, proto.speech.tts.Say.oneofGroups_[0], obj.digit);
  obj.time && jspb.Message.setOneofWrapperField(
      msg, 7, proto.speech.tts.Say.oneofGroups_[0], proto.speech.tts.Time.fromObject(obj.time));
  obj.measure && jspb.Message.setOneofWrapperField(
      msg, 8, proto.speech.tts.Say.oneofGroups_[0], proto.speech.tts.Measure.fromObject(obj.measure));
  obj.date && jspb.Message.setOneofWrapperField(
      msg, 9, proto.speech.tts.Say.oneofGroups_[0], proto.speech.tts.Date.fromObject(obj.date));
  obj.address && jspb.Message.setOneofWrapperField(
      msg, 10, proto.speech.tts.Say.oneofGroups_[0], proto.speech.tts.Address.fromObject(obj.address));
  obj.telephone && jspb.Message.setOneofWrapperField(
      msg, 11, proto.speech.tts.Say.oneofGroups_[0], proto.speech.tts.Telephone.fromObject(obj.telephone));
  obj.money && jspb.Message.setOneofWrapperField(
      msg, 12, proto.speech.tts.Say.oneofGroups_[0], proto.speech.tts.Money.fromObject(obj.money));
  obj.electronic && jspb.Message.setOneofWrapperField(
      msg, 13, proto.speech.tts.Say.oneofGroups_[0], proto.speech.tts.Electronic.fromObject(obj.electronic));
  obj.chemicalFormula && jspb.Message.setOneofWrapperField(
      msg, 14, proto.speech.tts.Say.oneofGroups_[0], proto.speech.tts.ChemicalFormula.fromObject(obj.chemicalFormula));
  obj.words != null && jspb.Message.setOneofField(msg, 16, proto.speech.tts.Say.oneofGroups_[0], obj.words);
  obj.letters != null && jspb.Message.setOneofField(msg, 18, proto.speech.tts.Say.oneofGroups_[0], obj.letters);
  obj.verbatim != null && jspb.Message.setOneofField(msg, 19, proto.speech.tts.Say.oneofGroups_[0], obj.verbatim);
  obj.pause != null && jspb.Message.setOneofField(msg, 21, proto.speech.tts.Say.oneofGroups_[0], obj.pause);
  obj.spell && jspb.Message.setOneofWrapperField(
      msg, 32, proto.speech.tts.Say.oneofGroups_[0], proto.speech.tts.Spelling.fromObject(obj.spell));
  obj.verbalInfo && jspb.Message.setOneofWrapperField(
      msg, 25, proto.speech.tts.Say.oneofGroups_[0], proto.speech.tts.VerbalInfo.fromObject(obj.verbalInfo));
  obj.connector && jspb.Message.setOneofWrapperField(
      msg, 36, proto.speech.tts.Say.oneofGroups_[0], proto.speech.tts.Connector.fromObject(obj.connector));
  obj.abbreviation && jspb.Message.setOneofWrapperField(
      msg, 37, proto.speech.tts.Say.oneofGroups_[0], proto.speech.tts.Abbreviation.fromObject(obj.abbreviation));
  obj.emoticonEmoji && jspb.Message.setOneofWrapperField(
      msg, 41, proto.speech.tts.Say.oneofGroups_[0], proto.speech.tts.EmoticonEmoji.fromObject(obj.emoticonEmoji));
  obj.wordSequenceList && jspb.Message.setRepeatedWrapperField(
      msg, 17, obj.wordSequenceList.map(
          proto.speech.tts.MarkupWord.fromObject));
  obj.voicemod && jspb.Message.setWrapperField(
      msg, 20, proto.speech.tts.VoiceMod.fromObject(obj.voicemod));
  obj.morphosyntacticFeatures != null && jspb.Message.setField(msg, 2, obj.morphosyntacticFeatures);
  obj.structuredFeatures && jspb.Message.setWrapperField(
      msg, 28, proto.speech.tts.MorphosyntacticFeatureVector.fromObject(obj.structuredFeatures));
  obj.prosodicFeatures && jspb.Message.setWrapperField(
      msg, 22, proto.speech.tts.ProsodicFeatures.fromObject(obj.prosodicFeatures));
  obj.location && jspb.Message.setWrapperField(
      msg, 23, proto.location.unified.LocationDescriptor.fromObject(obj.location));
  obj.knowledgeGraphMidList != null && jspb.Message.setField(msg, 34, obj.knowledgeGraphMidList);
  obj.conciseEmoji != null && jspb.Message.setField(msg, 24, obj.conciseEmoji);
  obj.audioSourceList && jspb.Message.setRepeatedWrapperField(
      msg, 26, obj.audioSourceList.map(
          proto.speech.tts.AudioSource.fromObject));
  obj.crossLingual && jspb.Message.setWrapperField(
      msg, 27, proto.speech.tts.CrossLingual.fromObject(obj.crossLingual));
  obj.foreignScript != null && jspb.Message.setField(msg, 39, obj.foreignScript);
  obj.textnormLevel != null && jspb.Message.setField(msg, 29, obj.textnormLevel);
  obj.synthesizerSelection && jspb.Message.setWrapperField(
      msg, 30, proto.speech.tts.SynthesizerSelection.fromObject(obj.synthesizerSelection));
  obj.bleep != null && jspb.Message.setField(msg, 31, obj.bleep);
  obj.prefix != null && jspb.Message.setField(msg, 33, obj.prefix);
  obj.suffix != null && jspb.Message.setField(msg, 35, obj.suffix);
  obj.timepointName != null && jspb.Message.setField(msg, 38, obj.timepointName);
  obj.noCelebrity != null && jspb.Message.setField(msg, 40, obj.noCelebrity);
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.Say}
 */
proto.speech.tts.Say.deserializeBinary = function(bytes) {
  return proto.speech.tts.Say.deserializeBinaryFromReader(
      new proto.speech.tts.Say(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.Say} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.Say}
 */
proto.speech.tts.Say.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = /** @type {string} */ (reader.readString());
      msg.setText(value);
      break;
    case 3:
      value = new proto.speech.tts.Cardinal();
      reader.readMessage(value,proto.speech.tts.Cardinal.deserializeBinaryFromReader);
      msg.setCardinal(value);
      break;
    case 4:
      value = new proto.speech.tts.Ordinal();
      reader.readMessage(value,proto.speech.tts.Ordinal.deserializeBinaryFromReader);
      msg.setOrdinal(value);
      break;
    case 5:
      value = new proto.speech.tts.Decimal();
      reader.readMessage(value,proto.speech.tts.Decimal.deserializeBinaryFromReader);
      msg.setDecimal(value);
      break;
    case 6:
      value = new proto.speech.tts.Fraction();
      reader.readMessage(value,proto.speech.tts.Fraction.deserializeBinaryFromReader);
      msg.setFraction(value);
      break;
    case 15:
      value = /** @type {string} */ (reader.readString());
      msg.setDigit(value);
      break;
    case 7:
      value = new proto.speech.tts.Time();
      reader.readMessage(value,proto.speech.tts.Time.deserializeBinaryFromReader);
      msg.setTime(value);
      break;
    case 8:
      value = new proto.speech.tts.Measure();
      reader.readMessage(value,proto.speech.tts.Measure.deserializeBinaryFromReader);
      msg.setMeasure(value);
      break;
    case 9:
      value = new proto.speech.tts.Date();
      reader.readMessage(value,proto.speech.tts.Date.deserializeBinaryFromReader);
      msg.setDate(value);
      break;
    case 10:
      value = new proto.speech.tts.Address();
      reader.readMessage(value,proto.speech.tts.Address.deserializeBinaryFromReader);
      msg.setAddress(value);
      break;
    case 11:
      value = new proto.speech.tts.Telephone();
      reader.readMessage(value,proto.speech.tts.Telephone.deserializeBinaryFromReader);
      msg.setTelephone(value);
      break;
    case 12:
      value = new proto.speech.tts.Money();
      reader.readMessage(value,proto.speech.tts.Money.deserializeBinaryFromReader);
      msg.setMoney(value);
      break;
    case 13:
      value = new proto.speech.tts.Electronic();
      reader.readMessage(value,proto.speech.tts.Electronic.deserializeBinaryFromReader);
      msg.setElectronic(value);
      break;
    case 14:
      value = new proto.speech.tts.ChemicalFormula();
      reader.readMessage(value,proto.speech.tts.ChemicalFormula.deserializeBinaryFromReader);
      msg.setChemicalFormula(value);
      break;
    case 16:
      value = /** @type {string} */ (reader.readString());
      msg.setWords(value);
      break;
    case 18:
      value = /** @type {string} */ (reader.readString());
      msg.setLetters(value);
      break;
    case 19:
      value = /** @type {string} */ (reader.readString());
      msg.setVerbatim(value);
      break;
    case 21:
      value = /** @type {number} */ (reader.readFloat());
      msg.setPause(value);
      break;
    case 32:
      value = new proto.speech.tts.Spelling();
      reader.readMessage(value,proto.speech.tts.Spelling.deserializeBinaryFromReader);
      msg.setSpell(value);
      break;
    case 25:
      value = new proto.speech.tts.VerbalInfo();
      reader.readMessage(value,proto.speech.tts.VerbalInfo.deserializeBinaryFromReader);
      msg.setVerbalInfo(value);
      break;
    case 36:
      value = new proto.speech.tts.Connector();
      reader.readMessage(value,proto.speech.tts.Connector.deserializeBinaryFromReader);
      msg.setConnector(value);
      break;
    case 37:
      value = new proto.speech.tts.Abbreviation();
      reader.readMessage(value,proto.speech.tts.Abbreviation.deserializeBinaryFromReader);
      msg.setAbbreviation(value);
      break;
    case 41:
      value = new proto.speech.tts.EmoticonEmoji();
      reader.readMessage(value,proto.speech.tts.EmoticonEmoji.deserializeBinaryFromReader);
      msg.setEmoticonEmoji(value);
      break;
    case 17:
      value = new proto.speech.tts.MarkupWord();
      reader.readMessage(value,proto.speech.tts.MarkupWord.deserializeBinaryFromReader);
      msg.addWordSequence(value);
      break;
    case 20:
      value = new proto.speech.tts.VoiceMod();
      reader.readMessage(value,proto.speech.tts.VoiceMod.deserializeBinaryFromReader);
      msg.setVoicemod(value);
      break;
    case 2:
      value = /** @type {string} */ (reader.readString());
      msg.setMorphosyntacticFeatures(value);
      break;
    case 28:
      value = new proto.speech.tts.MorphosyntacticFeatureVector();
      reader.readMessage(value,proto.speech.tts.MorphosyntacticFeatureVector.deserializeBinaryFromReader);
      msg.setStructuredFeatures(value);
      break;
    case 22:
      value = new proto.speech.tts.ProsodicFeatures();
      reader.readMessage(value,proto.speech.tts.ProsodicFeatures.deserializeBinaryFromReader);
      msg.setProsodicFeatures(value);
      break;
    case 23:
      value = new proto.location.unified.LocationDescriptor();
      reader.readMessage(value,proto.location.unified.LocationDescriptor.deserializeBinaryFromReader);
      msg.setLocation(value);
      break;
    case 34:
      value = /** @type {string} */ (reader.readString());
      msg.addKnowledgeGraphMid(value);
      break;
    case 24:
      value = /** @type {boolean} */ (reader.readBool());
      msg.setConciseEmoji(value);
      break;
    case 26:
      value = new proto.speech.tts.AudioSource();
      reader.readMessage(value,proto.speech.tts.AudioSource.deserializeBinaryFromReader);
      msg.addAudioSource(value);
      break;
    case 27:
      value = new proto.speech.tts.CrossLingual();
      reader.readMessage(value,proto.speech.tts.CrossLingual.deserializeBinaryFromReader);
      msg.setCrossLingual(value);
      break;
    case 39:
      value = /** @type {string} */ (reader.readString());
      msg.setForeignScript(value);
      break;
    case 29:
      value = /** @type {!proto.speech.tts.TextnormLevel} */ (reader.readEnum());
      msg.setTextnormLevel(value);
      break;
    case 30:
      value = new proto.speech.tts.SynthesizerSelection();
      reader.readMessage(value,proto.speech.tts.SynthesizerSelection.deserializeBinaryFromReader);
      msg.setSynthesizerSelection(value);
      break;
    case 31:
      value = /** @type {boolean} */ (reader.readBool());
      msg.setBleep(value);
      break;
    case 33:
      value = /** @type {string} */ (reader.readString());
      msg.setPrefix(value);
      break;
    case 35:
      value = /** @type {string} */ (reader.readString());
      msg.setSuffix(value);
      break;
    case 38:
      value = /** @type {string} */ (reader.readString());
      msg.setTimepointName(value);
      break;
    case 40:
      value = /** @type {boolean} */ (reader.readBool());
      msg.setNoCelebrity(value);
      break;
    default:
      jspb.Message.readBinaryExtension(msg, reader,
        proto.speech.tts.Say.extensionsBinary,
        proto.speech.tts.Say.prototype.getExtension,
        proto.speech.tts.Say.prototype.setExtension);
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.Say.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.Say.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.Say} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.Say.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = /** @type {?string} */ (jspb.Message.getField(message, 1));
  if (f != null) {
    writer.writeString(
      1,
      f
    );
  }
  f = message.getCardinal();
  if (f != null) {
    writer.writeMessage(
      3,
      f,
      proto.speech.tts.Cardinal.serializeBinaryToWriter
    );
  }
  f = message.getOrdinal();
  if (f != null) {
    writer.writeMessage(
      4,
      f,
      proto.speech.tts.Ordinal.serializeBinaryToWriter
    );
  }
  f = message.getDecimal();
  if (f != null) {
    writer.writeMessage(
      5,
      f,
      proto.speech.tts.Decimal.serializeBinaryToWriter
    );
  }
  f = message.getFraction();
  if (f != null) {
    writer.writeMessage(
      6,
      f,
      proto.speech.tts.Fraction.serializeBinaryToWriter
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 15));
  if (f != null) {
    writer.writeString(
      15,
      f
    );
  }
  f = message.getTime();
  if (f != null) {
    writer.writeMessage(
      7,
      f,
      proto.speech.tts.Time.serializeBinaryToWriter
    );
  }
  f = message.getMeasure();
  if (f != null) {
    writer.writeMessage(
      8,
      f,
      proto.speech.tts.Measure.serializeBinaryToWriter
    );
  }
  f = message.getDate();
  if (f != null) {
    writer.writeMessage(
      9,
      f,
      proto.speech.tts.Date.serializeBinaryToWriter
    );
  }
  f = message.getAddress();
  if (f != null) {
    writer.writeMessage(
      10,
      f,
      proto.speech.tts.Address.serializeBinaryToWriter
    );
  }
  f = message.getTelephone();
  if (f != null) {
    writer.writeMessage(
      11,
      f,
      proto.speech.tts.Telephone.serializeBinaryToWriter
    );
  }
  f = message.getMoney();
  if (f != null) {
    writer.writeMessage(
      12,
      f,
      proto.speech.tts.Money.serializeBinaryToWriter
    );
  }
  f = message.getElectronic();
  if (f != null) {
    writer.writeMessage(
      13,
      f,
      proto.speech.tts.Electronic.serializeBinaryToWriter
    );
  }
  f = message.getChemicalFormula();
  if (f != null) {
    writer.writeMessage(
      14,
      f,
      proto.speech.tts.ChemicalFormula.serializeBinaryToWriter
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 16));
  if (f != null) {
    writer.writeString(
      16,
      f
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 18));
  if (f != null) {
    writer.writeString(
      18,
      f
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 19));
  if (f != null) {
    writer.writeString(
      19,
      f
    );
  }
  f = /** @type {?number} */ (jspb.Message.getField(message, 21));
  if (f != null) {
    writer.writeFloat(
      21,
      f
    );
  }
  f = message.getSpell();
  if (f != null) {
    writer.writeMessage(
      32,
      f,
      proto.speech.tts.Spelling.serializeBinaryToWriter
    );
  }
  f = message.getVerbalInfo();
  if (f != null) {
    writer.writeMessage(
      25,
      f,
      proto.speech.tts.VerbalInfo.serializeBinaryToWriter
    );
  }
  f = message.getConnector();
  if (f != null) {
    writer.writeMessage(
      36,
      f,
      proto.speech.tts.Connector.serializeBinaryToWriter
    );
  }
  f = message.getAbbreviation();
  if (f != null) {
    writer.writeMessage(
      37,
      f,
      proto.speech.tts.Abbreviation.serializeBinaryToWriter
    );
  }
  f = message.getEmoticonEmoji();
  if (f != null) {
    writer.writeMessage(
      41,
      f,
      proto.speech.tts.EmoticonEmoji.serializeBinaryToWriter
    );
  }
  f = message.getWordSequenceList();
  if (f.length > 0) {
    writer.writeRepeatedMessage(
      17,
      f,
      proto.speech.tts.MarkupWord.serializeBinaryToWriter
    );
  }
  f = message.getVoicemod();
  if (f != null) {
    writer.writeMessage(
      20,
      f,
      proto.speech.tts.VoiceMod.serializeBinaryToWriter
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 2));
  if (f != null) {
    writer.writeString(
      2,
      f
    );
  }
  f = message.getStructuredFeatures();
  if (f != null) {
    writer.writeMessage(
      28,
      f,
      proto.speech.tts.MorphosyntacticFeatureVector.serializeBinaryToWriter
    );
  }
  f = message.getProsodicFeatures();
  if (f != null) {
    writer.writeMessage(
      22,
      f,
      proto.speech.tts.ProsodicFeatures.serializeBinaryToWriter
    );
  }
  f = message.getLocation();
  if (f != null) {
    writer.writeMessage(
      23,
      f,
      proto.location.unified.LocationDescriptor.serializeBinaryToWriter
    );
  }
  f = message.getKnowledgeGraphMidList();
  if (f.length > 0) {
    writer.writeRepeatedString(
      34,
      f
    );
  }
  f = /** @type {?boolean} */ (jspb.Message.getField(message, 24));
  if (f != null) {
    writer.writeBool(
      24,
      f
    );
  }
  f = message.getAudioSourceList();
  if (f.length > 0) {
    writer.writeRepeatedMessage(
      26,
      f,
      proto.speech.tts.AudioSource.serializeBinaryToWriter
    );
  }
  f = message.getCrossLingual();
  if (f != null) {
    writer.writeMessage(
      27,
      f,
      proto.speech.tts.CrossLingual.serializeBinaryToWriter
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 39));
  if (f != null) {
    writer.writeString(
      39,
      f
    );
  }
  f = /** @type {!proto.speech.tts.TextnormLevel} */ (jspb.Message.getField(message, 29));
  if (f != null) {
    writer.writeEnum(
      29,
      f
    );
  }
  f = message.getSynthesizerSelection();
  if (f != null) {
    writer.writeMessage(
      30,
      f,
      proto.speech.tts.SynthesizerSelection.serializeBinaryToWriter
    );
  }
  f = /** @type {?boolean} */ (jspb.Message.getField(message, 31));
  if (f != null) {
    writer.writeBool(
      31,
      f
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 33));
  if (f != null) {
    writer.writeString(
      33,
      f
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 35));
  if (f != null) {
    writer.writeString(
      35,
      f
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 38));
  if (f != null) {
    writer.writeString(
      38,
      f
    );
  }
  f = /** @type {?boolean} */ (jspb.Message.getField(message, 40));
  if (f != null) {
    writer.writeBool(
      40,
      f
    );
  }
  jspb.Message.serializeBinaryExtensions(message, writer,
    proto.speech.tts.Say.extensionsBinary, proto.speech.tts.Say.prototype.getExtension);
};


/**
 * optional string text = 1;
 * @return {?string}
 */
proto.speech.tts.Say.prototype.getText = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 1));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.Say} returns this
 */
proto.speech.tts.Say.prototype.setText = function(value) {
  return jspb.Message.setOneofField(this, 1, proto.speech.tts.Say.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Say} returns this
 */
proto.speech.tts.Say.prototype.clearText = function() {
  return jspb.Message.clearOneofField(this, 1, proto.speech.tts.Say.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Say.prototype.hasText = function() {
  return jspb.Message.hasField(this, 1);
};


/**
 * optional Cardinal cardinal = 3;
 * @return {?proto.speech.tts.Cardinal}
 */
proto.speech.tts.Say.prototype.getCardinal = function() {
  return /** @type{?proto.speech.tts.Cardinal} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.Cardinal, 3));
};


/**
 * @param {?proto.speech.tts.Cardinal|undefined} value
 * @return {!proto.speech.tts.Say} returns this
*/
proto.speech.tts.Say.prototype.setCardinal = function(value) {
  return jspb.Message.setOneofWrapperField(this, 3, proto.speech.tts.Say.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Say} returns this
 */
proto.speech.tts.Say.prototype.clearCardinal = function() {
  return jspb.Message.clearOneofWrapperField(this, 3, proto.speech.tts.Say.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Say.prototype.hasCardinal = function() {
  return jspb.Message.hasField(this, 3);
};


/**
 * optional Ordinal ordinal = 4;
 * @return {?proto.speech.tts.Ordinal}
 */
proto.speech.tts.Say.prototype.getOrdinal = function() {
  return /** @type{?proto.speech.tts.Ordinal} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.Ordinal, 4));
};


/**
 * @param {?proto.speech.tts.Ordinal|undefined} value
 * @return {!proto.speech.tts.Say} returns this
*/
proto.speech.tts.Say.prototype.setOrdinal = function(value) {
  return jspb.Message.setOneofWrapperField(this, 4, proto.speech.tts.Say.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Say} returns this
 */
proto.speech.tts.Say.prototype.clearOrdinal = function() {
  return jspb.Message.clearOneofWrapperField(this, 4, proto.speech.tts.Say.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Say.prototype.hasOrdinal = function() {
  return jspb.Message.hasField(this, 4);
};


/**
 * optional Decimal decimal = 5;
 * @return {?proto.speech.tts.Decimal}
 */
proto.speech.tts.Say.prototype.getDecimal = function() {
  return /** @type{?proto.speech.tts.Decimal} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.Decimal, 5));
};


/**
 * @param {?proto.speech.tts.Decimal|undefined} value
 * @return {!proto.speech.tts.Say} returns this
*/
proto.speech.tts.Say.prototype.setDecimal = function(value) {
  return jspb.Message.setOneofWrapperField(this, 5, proto.speech.tts.Say.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Say} returns this
 */
proto.speech.tts.Say.prototype.clearDecimal = function() {
  return jspb.Message.clearOneofWrapperField(this, 5, proto.speech.tts.Say.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Say.prototype.hasDecimal = function() {
  return jspb.Message.hasField(this, 5);
};


/**
 * optional Fraction fraction = 6;
 * @return {?proto.speech.tts.Fraction}
 */
proto.speech.tts.Say.prototype.getFraction = function() {
  return /** @type{?proto.speech.tts.Fraction} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.Fraction, 6));
};


/**
 * @param {?proto.speech.tts.Fraction|undefined} value
 * @return {!proto.speech.tts.Say} returns this
*/
proto.speech.tts.Say.prototype.setFraction = function(value) {
  return jspb.Message.setOneofWrapperField(this, 6, proto.speech.tts.Say.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Say} returns this
 */
proto.speech.tts.Say.prototype.clearFraction = function() {
  return jspb.Message.clearOneofWrapperField(this, 6, proto.speech.tts.Say.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Say.prototype.hasFraction = function() {
  return jspb.Message.hasField(this, 6);
};


/**
 * optional string digit = 15;
 * @return {?string}
 */
proto.speech.tts.Say.prototype.getDigit = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 15));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.Say} returns this
 */
proto.speech.tts.Say.prototype.setDigit = function(value) {
  return jspb.Message.setOneofField(this, 15, proto.speech.tts.Say.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Say} returns this
 */
proto.speech.tts.Say.prototype.clearDigit = function() {
  return jspb.Message.clearOneofField(this, 15, proto.speech.tts.Say.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Say.prototype.hasDigit = function() {
  return jspb.Message.hasField(this, 15);
};


/**
 * optional Time time = 7;
 * @return {?proto.speech.tts.Time}
 */
proto.speech.tts.Say.prototype.getTime = function() {
  return /** @type{?proto.speech.tts.Time} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.Time, 7));
};


/**
 * @param {?proto.speech.tts.Time|undefined} value
 * @return {!proto.speech.tts.Say} returns this
*/
proto.speech.tts.Say.prototype.setTime = function(value) {
  return jspb.Message.setOneofWrapperField(this, 7, proto.speech.tts.Say.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Say} returns this
 */
proto.speech.tts.Say.prototype.clearTime = function() {
  return jspb.Message.clearOneofWrapperField(this, 7, proto.speech.tts.Say.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Say.prototype.hasTime = function() {
  return jspb.Message.hasField(this, 7);
};


/**
 * optional Measure measure = 8;
 * @return {?proto.speech.tts.Measure}
 */
proto.speech.tts.Say.prototype.getMeasure = function() {
  return /** @type{?proto.speech.tts.Measure} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.Measure, 8));
};


/**
 * @param {?proto.speech.tts.Measure|undefined} value
 * @return {!proto.speech.tts.Say} returns this
*/
proto.speech.tts.Say.prototype.setMeasure = function(value) {
  return jspb.Message.setOneofWrapperField(this, 8, proto.speech.tts.Say.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Say} returns this
 */
proto.speech.tts.Say.prototype.clearMeasure = function() {
  return jspb.Message.clearOneofWrapperField(this, 8, proto.speech.tts.Say.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Say.prototype.hasMeasure = function() {
  return jspb.Message.hasField(this, 8);
};


/**
 * optional Date date = 9;
 * @return {?proto.speech.tts.Date}
 */
proto.speech.tts.Say.prototype.getDate = function() {
  return /** @type{?proto.speech.tts.Date} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.Date, 9));
};


/**
 * @param {?proto.speech.tts.Date|undefined} value
 * @return {!proto.speech.tts.Say} returns this
*/
proto.speech.tts.Say.prototype.setDate = function(value) {
  return jspb.Message.setOneofWrapperField(this, 9, proto.speech.tts.Say.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Say} returns this
 */
proto.speech.tts.Say.prototype.clearDate = function() {
  return jspb.Message.clearOneofWrapperField(this, 9, proto.speech.tts.Say.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Say.prototype.hasDate = function() {
  return jspb.Message.hasField(this, 9);
};


/**
 * optional Address address = 10;
 * @return {?proto.speech.tts.Address}
 * @deprecated
 */
proto.speech.tts.Say.prototype.getAddress = function() {
  return /** @type{?proto.speech.tts.Address} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.Address, 10));
};


/**
 * @param {?proto.speech.tts.Address|undefined} value
 * @return {!proto.speech.tts.Say} returns this
 * @deprecated
*/
proto.speech.tts.Say.prototype.setAddress = function(value) {
  return jspb.Message.setOneofWrapperField(this, 10, proto.speech.tts.Say.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Say} returns this
 * @deprecated
 */
proto.speech.tts.Say.prototype.clearAddress = function() {
  return jspb.Message.clearOneofWrapperField(this, 10, proto.speech.tts.Say.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 * @deprecated
 */
proto.speech.tts.Say.prototype.hasAddress = function() {
  return jspb.Message.hasField(this, 10);
};


/**
 * optional Telephone telephone = 11;
 * @return {?proto.speech.tts.Telephone}
 */
proto.speech.tts.Say.prototype.getTelephone = function() {
  return /** @type{?proto.speech.tts.Telephone} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.Telephone, 11));
};


/**
 * @param {?proto.speech.tts.Telephone|undefined} value
 * @return {!proto.speech.tts.Say} returns this
*/
proto.speech.tts.Say.prototype.setTelephone = function(value) {
  return jspb.Message.setOneofWrapperField(this, 11, proto.speech.tts.Say.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Say} returns this
 */
proto.speech.tts.Say.prototype.clearTelephone = function() {
  return jspb.Message.clearOneofWrapperField(this, 11, proto.speech.tts.Say.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Say.prototype.hasTelephone = function() {
  return jspb.Message.hasField(this, 11);
};


/**
 * optional Money money = 12;
 * @return {?proto.speech.tts.Money}
 */
proto.speech.tts.Say.prototype.getMoney = function() {
  return /** @type{?proto.speech.tts.Money} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.Money, 12));
};


/**
 * @param {?proto.speech.tts.Money|undefined} value
 * @return {!proto.speech.tts.Say} returns this
*/
proto.speech.tts.Say.prototype.setMoney = function(value) {
  return jspb.Message.setOneofWrapperField(this, 12, proto.speech.tts.Say.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Say} returns this
 */
proto.speech.tts.Say.prototype.clearMoney = function() {
  return jspb.Message.clearOneofWrapperField(this, 12, proto.speech.tts.Say.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Say.prototype.hasMoney = function() {
  return jspb.Message.hasField(this, 12);
};


/**
 * optional Electronic electronic = 13;
 * @return {?proto.speech.tts.Electronic}
 */
proto.speech.tts.Say.prototype.getElectronic = function() {
  return /** @type{?proto.speech.tts.Electronic} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.Electronic, 13));
};


/**
 * @param {?proto.speech.tts.Electronic|undefined} value
 * @return {!proto.speech.tts.Say} returns this
*/
proto.speech.tts.Say.prototype.setElectronic = function(value) {
  return jspb.Message.setOneofWrapperField(this, 13, proto.speech.tts.Say.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Say} returns this
 */
proto.speech.tts.Say.prototype.clearElectronic = function() {
  return jspb.Message.clearOneofWrapperField(this, 13, proto.speech.tts.Say.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Say.prototype.hasElectronic = function() {
  return jspb.Message.hasField(this, 13);
};


/**
 * optional ChemicalFormula chemical_formula = 14;
 * @return {?proto.speech.tts.ChemicalFormula}
 */
proto.speech.tts.Say.prototype.getChemicalFormula = function() {
  return /** @type{?proto.speech.tts.ChemicalFormula} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.ChemicalFormula, 14));
};


/**
 * @param {?proto.speech.tts.ChemicalFormula|undefined} value
 * @return {!proto.speech.tts.Say} returns this
*/
proto.speech.tts.Say.prototype.setChemicalFormula = function(value) {
  return jspb.Message.setOneofWrapperField(this, 14, proto.speech.tts.Say.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Say} returns this
 */
proto.speech.tts.Say.prototype.clearChemicalFormula = function() {
  return jspb.Message.clearOneofWrapperField(this, 14, proto.speech.tts.Say.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Say.prototype.hasChemicalFormula = function() {
  return jspb.Message.hasField(this, 14);
};


/**
 * optional string words = 16;
 * @return {?string}
 * @deprecated
 */
proto.speech.tts.Say.prototype.getWords = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 16));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.Say} returns this
 * @deprecated
 */
proto.speech.tts.Say.prototype.setWords = function(value) {
  return jspb.Message.setOneofField(this, 16, proto.speech.tts.Say.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Say} returns this
 * @deprecated
 */
proto.speech.tts.Say.prototype.clearWords = function() {
  return jspb.Message.clearOneofField(this, 16, proto.speech.tts.Say.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 * @deprecated
 */
proto.speech.tts.Say.prototype.hasWords = function() {
  return jspb.Message.hasField(this, 16);
};


/**
 * optional string letters = 18;
 * @return {?string}
 */
proto.speech.tts.Say.prototype.getLetters = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 18));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.Say} returns this
 */
proto.speech.tts.Say.prototype.setLetters = function(value) {
  return jspb.Message.setOneofField(this, 18, proto.speech.tts.Say.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Say} returns this
 */
proto.speech.tts.Say.prototype.clearLetters = function() {
  return jspb.Message.clearOneofField(this, 18, proto.speech.tts.Say.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Say.prototype.hasLetters = function() {
  return jspb.Message.hasField(this, 18);
};


/**
 * optional string verbatim = 19;
 * @return {?string}
 */
proto.speech.tts.Say.prototype.getVerbatim = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 19));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.Say} returns this
 */
proto.speech.tts.Say.prototype.setVerbatim = function(value) {
  return jspb.Message.setOneofField(this, 19, proto.speech.tts.Say.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Say} returns this
 */
proto.speech.tts.Say.prototype.clearVerbatim = function() {
  return jspb.Message.clearOneofField(this, 19, proto.speech.tts.Say.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Say.prototype.hasVerbatim = function() {
  return jspb.Message.hasField(this, 19);
};


/**
 * optional float pause = 21;
 * @return {?number}
 */
proto.speech.tts.Say.prototype.getPause = function() {
  return /** @type {?number} */ (jspb.Message.getOptionalFloatingPointField(this, 21));
};


/**
 * @param {?number|undefined} value
 * @return {!proto.speech.tts.Say} returns this
 */
proto.speech.tts.Say.prototype.setPause = function(value) {
  return jspb.Message.setOneofField(this, 21, proto.speech.tts.Say.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Say} returns this
 */
proto.speech.tts.Say.prototype.clearPause = function() {
  return jspb.Message.clearOneofField(this, 21, proto.speech.tts.Say.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Say.prototype.hasPause = function() {
  return jspb.Message.hasField(this, 21);
};


/**
 * optional Spelling spell = 32;
 * @return {?proto.speech.tts.Spelling}
 */
proto.speech.tts.Say.prototype.getSpell = function() {
  return /** @type{?proto.speech.tts.Spelling} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.Spelling, 32));
};


/**
 * @param {?proto.speech.tts.Spelling|undefined} value
 * @return {!proto.speech.tts.Say} returns this
*/
proto.speech.tts.Say.prototype.setSpell = function(value) {
  return jspb.Message.setOneofWrapperField(this, 32, proto.speech.tts.Say.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Say} returns this
 */
proto.speech.tts.Say.prototype.clearSpell = function() {
  return jspb.Message.clearOneofWrapperField(this, 32, proto.speech.tts.Say.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Say.prototype.hasSpell = function() {
  return jspb.Message.hasField(this, 32);
};


/**
 * optional VerbalInfo verbal_info = 25;
 * @return {?proto.speech.tts.VerbalInfo}
 */
proto.speech.tts.Say.prototype.getVerbalInfo = function() {
  return /** @type{?proto.speech.tts.VerbalInfo} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.VerbalInfo, 25));
};


/**
 * @param {?proto.speech.tts.VerbalInfo|undefined} value
 * @return {!proto.speech.tts.Say} returns this
*/
proto.speech.tts.Say.prototype.setVerbalInfo = function(value) {
  return jspb.Message.setOneofWrapperField(this, 25, proto.speech.tts.Say.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Say} returns this
 */
proto.speech.tts.Say.prototype.clearVerbalInfo = function() {
  return jspb.Message.clearOneofWrapperField(this, 25, proto.speech.tts.Say.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Say.prototype.hasVerbalInfo = function() {
  return jspb.Message.hasField(this, 25);
};


/**
 * optional Connector connector = 36;
 * @return {?proto.speech.tts.Connector}
 */
proto.speech.tts.Say.prototype.getConnector = function() {
  return /** @type{?proto.speech.tts.Connector} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.Connector, 36));
};


/**
 * @param {?proto.speech.tts.Connector|undefined} value
 * @return {!proto.speech.tts.Say} returns this
*/
proto.speech.tts.Say.prototype.setConnector = function(value) {
  return jspb.Message.setOneofWrapperField(this, 36, proto.speech.tts.Say.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Say} returns this
 */
proto.speech.tts.Say.prototype.clearConnector = function() {
  return jspb.Message.clearOneofWrapperField(this, 36, proto.speech.tts.Say.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Say.prototype.hasConnector = function() {
  return jspb.Message.hasField(this, 36);
};


/**
 * optional Abbreviation abbreviation = 37;
 * @return {?proto.speech.tts.Abbreviation}
 */
proto.speech.tts.Say.prototype.getAbbreviation = function() {
  return /** @type{?proto.speech.tts.Abbreviation} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.Abbreviation, 37));
};


/**
 * @param {?proto.speech.tts.Abbreviation|undefined} value
 * @return {!proto.speech.tts.Say} returns this
*/
proto.speech.tts.Say.prototype.setAbbreviation = function(value) {
  return jspb.Message.setOneofWrapperField(this, 37, proto.speech.tts.Say.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Say} returns this
 */
proto.speech.tts.Say.prototype.clearAbbreviation = function() {
  return jspb.Message.clearOneofWrapperField(this, 37, proto.speech.tts.Say.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Say.prototype.hasAbbreviation = function() {
  return jspb.Message.hasField(this, 37);
};


/**
 * optional EmoticonEmoji emoticon_emoji = 41;
 * @return {?proto.speech.tts.EmoticonEmoji}
 */
proto.speech.tts.Say.prototype.getEmoticonEmoji = function() {
  return /** @type{?proto.speech.tts.EmoticonEmoji} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.EmoticonEmoji, 41));
};


/**
 * @param {?proto.speech.tts.EmoticonEmoji|undefined} value
 * @return {!proto.speech.tts.Say} returns this
*/
proto.speech.tts.Say.prototype.setEmoticonEmoji = function(value) {
  return jspb.Message.setOneofWrapperField(this, 41, proto.speech.tts.Say.oneofGroups_[0], value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Say} returns this
 */
proto.speech.tts.Say.prototype.clearEmoticonEmoji = function() {
  return jspb.Message.clearOneofWrapperField(this, 41, proto.speech.tts.Say.oneofGroups_[0]);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Say.prototype.hasEmoticonEmoji = function() {
  return jspb.Message.hasField(this, 41);
};


/**
 * repeated MarkupWord word_sequence = 17;
 * @return {!Array<!proto.speech.tts.MarkupWord>}
 */
proto.speech.tts.Say.prototype.getWordSequenceList = function() {
  return /** @type{!Array<!proto.speech.tts.MarkupWord>} */ (
    jspb.Message.getRepeatedWrapperField(this, proto.speech.tts.MarkupWord, 17));
};


/**
 * @param {Array<!proto.speech.tts.MarkupWord>|undefined} value
 * @return {!proto.speech.tts.Say} returns this
*/
proto.speech.tts.Say.prototype.setWordSequenceList = function(value) {
  return jspb.Message.setRepeatedWrapperField(this, 17, value);
};


/**
 * @param {!proto.speech.tts.MarkupWord=} opt_value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.MarkupWord}
 */
proto.speech.tts.Say.prototype.addWordSequence = function(opt_value, opt_index) {
  return jspb.Message.addToRepeatedWrapperField(this, 17, opt_value, proto.speech.tts.MarkupWord, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.Say} returns this
 */
proto.speech.tts.Say.prototype.clearWordSequenceList = function() {
  return jspb.Message.clearRepeatedWrapperField(this, 17);
};


/**
 * optional VoiceMod voicemod = 20;
 * @return {?proto.speech.tts.VoiceMod}
 */
proto.speech.tts.Say.prototype.getVoicemod = function() {
  return /** @type{?proto.speech.tts.VoiceMod} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.VoiceMod, 20));
};


/**
 * @param {?proto.speech.tts.VoiceMod|undefined} value
 * @return {!proto.speech.tts.Say} returns this
*/
proto.speech.tts.Say.prototype.setVoicemod = function(value) {
  return jspb.Message.setWrapperField(this, 20, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Say} returns this
 */
proto.speech.tts.Say.prototype.clearVoicemod = function() {
  return jspb.Message.clearWrapperField(this, 20);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Say.prototype.hasVoicemod = function() {
  return jspb.Message.hasField(this, 20);
};


/**
 * optional string morphosyntactic_features = 2;
 * @return {?string}
 */
proto.speech.tts.Say.prototype.getMorphosyntacticFeatures = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 2));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.Say} returns this
 */
proto.speech.tts.Say.prototype.setMorphosyntacticFeatures = function(value) {
  return jspb.Message.setField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Say} returns this
 */
proto.speech.tts.Say.prototype.clearMorphosyntacticFeatures = function() {
  return jspb.Message.clearField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Say.prototype.hasMorphosyntacticFeatures = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * optional MorphosyntacticFeatureVector structured_features = 28;
 * @return {?proto.speech.tts.MorphosyntacticFeatureVector}
 */
proto.speech.tts.Say.prototype.getStructuredFeatures = function() {
  return /** @type{?proto.speech.tts.MorphosyntacticFeatureVector} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.MorphosyntacticFeatureVector, 28));
};


/**
 * @param {?proto.speech.tts.MorphosyntacticFeatureVector|undefined} value
 * @return {!proto.speech.tts.Say} returns this
*/
proto.speech.tts.Say.prototype.setStructuredFeatures = function(value) {
  return jspb.Message.setWrapperField(this, 28, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Say} returns this
 */
proto.speech.tts.Say.prototype.clearStructuredFeatures = function() {
  return jspb.Message.clearWrapperField(this, 28);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Say.prototype.hasStructuredFeatures = function() {
  return jspb.Message.hasField(this, 28);
};


/**
 * optional ProsodicFeatures prosodic_features = 22;
 * @return {?proto.speech.tts.ProsodicFeatures}
 */
proto.speech.tts.Say.prototype.getProsodicFeatures = function() {
  return /** @type{?proto.speech.tts.ProsodicFeatures} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.ProsodicFeatures, 22));
};


/**
 * @param {?proto.speech.tts.ProsodicFeatures|undefined} value
 * @return {!proto.speech.tts.Say} returns this
*/
proto.speech.tts.Say.prototype.setProsodicFeatures = function(value) {
  return jspb.Message.setWrapperField(this, 22, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Say} returns this
 */
proto.speech.tts.Say.prototype.clearProsodicFeatures = function() {
  return jspb.Message.clearWrapperField(this, 22);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Say.prototype.hasProsodicFeatures = function() {
  return jspb.Message.hasField(this, 22);
};


/**
 * optional location.unified.LocationDescriptor location = 23;
 * @return {?proto.location.unified.LocationDescriptor}
 */
proto.speech.tts.Say.prototype.getLocation = function() {
  return /** @type{?proto.location.unified.LocationDescriptor} */ (
    jspb.Message.getWrapperField(this, proto.location.unified.LocationDescriptor, 23));
};


/**
 * @param {?proto.location.unified.LocationDescriptor|undefined} value
 * @return {!proto.speech.tts.Say} returns this
*/
proto.speech.tts.Say.prototype.setLocation = function(value) {
  return jspb.Message.setWrapperField(this, 23, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Say} returns this
 */
proto.speech.tts.Say.prototype.clearLocation = function() {
  return jspb.Message.clearWrapperField(this, 23);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Say.prototype.hasLocation = function() {
  return jspb.Message.hasField(this, 23);
};


/**
 * repeated string knowledge_graph_mid = 34;
 * @return {!Array<string>}
 */
proto.speech.tts.Say.prototype.getKnowledgeGraphMidList = function() {
  return /** @type {!Array<string>} */ (jspb.Message.getRepeatedField(this, 34));
};


/**
 * @param {Array<string>|undefined} value
 * @return {!proto.speech.tts.Say} returns this
 */
proto.speech.tts.Say.prototype.setKnowledgeGraphMidList = function(value) {
  return jspb.Message.setField(this, 34, value || []);
};


/**
 * @param {string} value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.Say} returns this
 */
proto.speech.tts.Say.prototype.addKnowledgeGraphMid = function(value, opt_index) {
  return jspb.Message.addToRepeatedField(this, 34, value, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.Say} returns this
 */
proto.speech.tts.Say.prototype.clearKnowledgeGraphMidList = function() {
  return jspb.Message.clearRepeatedField(this, 34);
};


/**
 * optional bool concise_emoji = 24;
 * @return {?boolean}
 */
proto.speech.tts.Say.prototype.getConciseEmoji = function() {
  return /** @type {?boolean} */ (jspb.Message.getBooleanField(this, 24));
};


/**
 * @param {?boolean|undefined} value
 * @return {!proto.speech.tts.Say} returns this
 */
proto.speech.tts.Say.prototype.setConciseEmoji = function(value) {
  return jspb.Message.setField(this, 24, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Say} returns this
 */
proto.speech.tts.Say.prototype.clearConciseEmoji = function() {
  return jspb.Message.clearField(this, 24);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Say.prototype.hasConciseEmoji = function() {
  return jspb.Message.hasField(this, 24);
};


/**
 * repeated AudioSource audio_source = 26;
 * @return {!Array<!proto.speech.tts.AudioSource>}
 */
proto.speech.tts.Say.prototype.getAudioSourceList = function() {
  return /** @type{!Array<!proto.speech.tts.AudioSource>} */ (
    jspb.Message.getRepeatedWrapperField(this, proto.speech.tts.AudioSource, 26));
};


/**
 * @param {Array<!proto.speech.tts.AudioSource>|undefined} value
 * @return {!proto.speech.tts.Say} returns this
*/
proto.speech.tts.Say.prototype.setAudioSourceList = function(value) {
  return jspb.Message.setRepeatedWrapperField(this, 26, value);
};


/**
 * @param {!proto.speech.tts.AudioSource=} opt_value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.AudioSource}
 */
proto.speech.tts.Say.prototype.addAudioSource = function(opt_value, opt_index) {
  return jspb.Message.addToRepeatedWrapperField(this, 26, opt_value, proto.speech.tts.AudioSource, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.Say} returns this
 */
proto.speech.tts.Say.prototype.clearAudioSourceList = function() {
  return jspb.Message.clearRepeatedWrapperField(this, 26);
};


/**
 * optional CrossLingual cross_lingual = 27;
 * @return {?proto.speech.tts.CrossLingual}
 */
proto.speech.tts.Say.prototype.getCrossLingual = function() {
  return /** @type{?proto.speech.tts.CrossLingual} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.CrossLingual, 27));
};


/**
 * @param {?proto.speech.tts.CrossLingual|undefined} value
 * @return {!proto.speech.tts.Say} returns this
*/
proto.speech.tts.Say.prototype.setCrossLingual = function(value) {
  return jspb.Message.setWrapperField(this, 27, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Say} returns this
 */
proto.speech.tts.Say.prototype.clearCrossLingual = function() {
  return jspb.Message.clearWrapperField(this, 27);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Say.prototype.hasCrossLingual = function() {
  return jspb.Message.hasField(this, 27);
};


/**
 * optional string foreign_script = 39;
 * @return {?string}
 */
proto.speech.tts.Say.prototype.getForeignScript = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 39));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.Say} returns this
 */
proto.speech.tts.Say.prototype.setForeignScript = function(value) {
  return jspb.Message.setField(this, 39, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Say} returns this
 */
proto.speech.tts.Say.prototype.clearForeignScript = function() {
  return jspb.Message.clearField(this, 39);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Say.prototype.hasForeignScript = function() {
  return jspb.Message.hasField(this, 39);
};


/**
 * optional TextnormLevel textnorm_level = 29;
 * @return {!proto.speech.tts.TextnormLevel}
 */
proto.speech.tts.Say.prototype.getTextnormLevel = function() {
  return /** @type {!proto.speech.tts.TextnormLevel} */ (jspb.Message.getField(this, 29));
};


/**
 * @param {?proto.speech.tts.TextnormLevel|undefined} value
 * @return {!proto.speech.tts.Say} returns this
 */
proto.speech.tts.Say.prototype.setTextnormLevel = function(value) {
  return jspb.Message.setField(this, 29, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Say} returns this
 */
proto.speech.tts.Say.prototype.clearTextnormLevel = function() {
  return jspb.Message.clearField(this, 29);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Say.prototype.hasTextnormLevel = function() {
  return jspb.Message.hasField(this, 29);
};


/**
 * optional SynthesizerSelection synthesizer_selection = 30;
 * @return {?proto.speech.tts.SynthesizerSelection}
 */
proto.speech.tts.Say.prototype.getSynthesizerSelection = function() {
  return /** @type{?proto.speech.tts.SynthesizerSelection} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.SynthesizerSelection, 30));
};


/**
 * @param {?proto.speech.tts.SynthesizerSelection|undefined} value
 * @return {!proto.speech.tts.Say} returns this
*/
proto.speech.tts.Say.prototype.setSynthesizerSelection = function(value) {
  return jspb.Message.setWrapperField(this, 30, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Say} returns this
 */
proto.speech.tts.Say.prototype.clearSynthesizerSelection = function() {
  return jspb.Message.clearWrapperField(this, 30);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Say.prototype.hasSynthesizerSelection = function() {
  return jspb.Message.hasField(this, 30);
};


/**
 * optional bool bleep = 31;
 * @return {?boolean}
 */
proto.speech.tts.Say.prototype.getBleep = function() {
  return /** @type {?boolean} */ (jspb.Message.getBooleanField(this, 31));
};


/**
 * @param {?boolean|undefined} value
 * @return {!proto.speech.tts.Say} returns this
 */
proto.speech.tts.Say.prototype.setBleep = function(value) {
  return jspb.Message.setField(this, 31, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Say} returns this
 */
proto.speech.tts.Say.prototype.clearBleep = function() {
  return jspb.Message.clearField(this, 31);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Say.prototype.hasBleep = function() {
  return jspb.Message.hasField(this, 31);
};


/**
 * optional string prefix = 33;
 * @return {?string}
 */
proto.speech.tts.Say.prototype.getPrefix = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 33));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.Say} returns this
 */
proto.speech.tts.Say.prototype.setPrefix = function(value) {
  return jspb.Message.setField(this, 33, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Say} returns this
 */
proto.speech.tts.Say.prototype.clearPrefix = function() {
  return jspb.Message.clearField(this, 33);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Say.prototype.hasPrefix = function() {
  return jspb.Message.hasField(this, 33);
};


/**
 * optional string suffix = 35;
 * @return {?string}
 */
proto.speech.tts.Say.prototype.getSuffix = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 35));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.Say} returns this
 */
proto.speech.tts.Say.prototype.setSuffix = function(value) {
  return jspb.Message.setField(this, 35, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Say} returns this
 */
proto.speech.tts.Say.prototype.clearSuffix = function() {
  return jspb.Message.clearField(this, 35);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Say.prototype.hasSuffix = function() {
  return jspb.Message.hasField(this, 35);
};


/**
 * optional string timepoint_name = 38;
 * @return {?string}
 */
proto.speech.tts.Say.prototype.getTimepointName = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 38));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.Say} returns this
 */
proto.speech.tts.Say.prototype.setTimepointName = function(value) {
  return jspb.Message.setField(this, 38, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Say} returns this
 */
proto.speech.tts.Say.prototype.clearTimepointName = function() {
  return jspb.Message.clearField(this, 38);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Say.prototype.hasTimepointName = function() {
  return jspb.Message.hasField(this, 38);
};


/**
 * optional bool no_celebrity = 40;
 * @return {?boolean}
 * @deprecated
 */
proto.speech.tts.Say.prototype.getNoCelebrity = function() {
  return /** @type {?boolean} */ (jspb.Message.getBooleanField(this, 40));
};


/**
 * @param {?boolean|undefined} value
 * @return {!proto.speech.tts.Say} returns this
 * @deprecated
 */
proto.speech.tts.Say.prototype.setNoCelebrity = function(value) {
  return jspb.Message.setField(this, 40, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Say} returns this
 * @deprecated
 */
proto.speech.tts.Say.prototype.clearNoCelebrity = function() {
  return jspb.Message.clearField(this, 40);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 * @deprecated
 */
proto.speech.tts.Say.prototype.hasNoCelebrity = function() {
  return jspb.Message.hasField(this, 40);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.Say}
 */
proto.speech.tts.Say.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.Say, data);
};



//speech/tts/public/tts_markup_proto_jspb/context_sentence.jspb.js
// source: speech/tts/public/tts_markup.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.Context');
goog.provide('proto.speech.tts.Sentence');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.speech.tts.LexiconProto.Entry');
goog.require('proto.speech.tts.PartialSentenceProsody');
goog.require('proto.speech.tts.PerformanceOptions');
goog.require('proto.speech.tts.Say');
goog.require('proto.speech.tts.SpeechMorphingTargets');
goog.require('proto.speech.tts.SynthesizerSelection');
goog.requireType('jspb.ByteSource');
goog.requireType('jspb.ExtensionFieldBinaryInfo');
goog.requireType('jspb.ExtensionFieldInfo');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.Context = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, proto.speech.tts.Context.repeatedFields_, null);
};
goog.inherits(proto.speech.tts.Context, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.Context.displayName = 'proto.speech.tts.Context';
}
/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.Sentence = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, 15, proto.speech.tts.Sentence.repeatedFields_, null);
};
goog.inherits(proto.speech.tts.Sentence, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.Sentence.displayName = 'proto.speech.tts.Sentence';
}

/**
 * The extensions registered with this message class. This is a map of
 * extension field number to fieldInfo object. This field should be considered
 * a private API (it is public because it is needed by other generated code).
 *
 * For example:
 *     { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} }
 *
 * fieldName contains the JsCompiler renamed field name property so that it
 * works in OPTIMIZED mode.
 *
 * @type {!Object<number, jspb.ExtensionFieldInfo>}
 */
proto.speech.tts.Sentence.extensions = {};


/**
 * The extensions registered with this message class. This is a map of
 * extension field number to fieldInfo object. This field should be considered
 * a private API (it is public because it is needed by other generated code).
 *
 * For example:
 *     { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} }
 *
 * fieldName contains the JsCompiler renamed field name property so that it
 * works in OPTIMIZED mode.
 *
 * @type {!Object<number, jspb.ExtensionFieldBinaryInfo>}
 */
proto.speech.tts.Sentence.extensionsBinary = {};


/**
 * List of repeated fields within this message type.
 * @private {!Array<number>}
 * @const
 */
proto.speech.tts.Context.repeatedFields_ = [1,2];



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.Context.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.Context.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.Context} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.Context.toObject = function(includeInstance, msg) {
  let f, obj = {
    previousSentenceList: jspb.Message.toObjectList(msg.getPreviousSentenceList(),
    proto.speech.tts.Sentence.toObject, includeInstance),
    nextSentenceList: jspb.Message.toObjectList(msg.getNextSentenceList(),
    proto.speech.tts.Sentence.toObject, includeInstance)
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of Context as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.Context.ObjectFormat = function() {
  /** @type {?Array<!proto.speech.tts.Sentence.ObjectFormat>|undefined} */
  this.previousSentenceList;

  /** @type {?Array<!proto.speech.tts.Sentence.ObjectFormat>|undefined} */
  this.nextSentenceList;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.Context.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.Context}
 */
proto.speech.tts.Context.fromObject = function(obj) {
  const msg = new proto.speech.tts.Context();
  obj.previousSentenceList && jspb.Message.setRepeatedWrapperField(
      msg, 1, obj.previousSentenceList.map(
          proto.speech.tts.Sentence.fromObject));
  obj.nextSentenceList && jspb.Message.setRepeatedWrapperField(
      msg, 2, obj.nextSentenceList.map(
          proto.speech.tts.Sentence.fromObject));
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.Context}
 */
proto.speech.tts.Context.deserializeBinary = function(bytes) {
  return proto.speech.tts.Context.deserializeBinaryFromReader(
      new proto.speech.tts.Context(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.Context} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.Context}
 */
proto.speech.tts.Context.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = new proto.speech.tts.Sentence();
      reader.readMessage(value,proto.speech.tts.Sentence.deserializeBinaryFromReader);
      msg.addPreviousSentence(value);
      break;
    case 2:
      value = new proto.speech.tts.Sentence();
      reader.readMessage(value,proto.speech.tts.Sentence.deserializeBinaryFromReader);
      msg.addNextSentence(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.Context.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.Context.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.Context} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.Context.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = message.getPreviousSentenceList();
  if (f.length > 0) {
    writer.writeRepeatedMessage(
      1,
      f,
      proto.speech.tts.Sentence.serializeBinaryToWriter
    );
  }
  f = message.getNextSentenceList();
  if (f.length > 0) {
    writer.writeRepeatedMessage(
      2,
      f,
      proto.speech.tts.Sentence.serializeBinaryToWriter
    );
  }
};


/**
 * repeated Sentence previous_sentence = 1;
 * @return {!Array<!proto.speech.tts.Sentence>}
 */
proto.speech.tts.Context.prototype.getPreviousSentenceList = function() {
  return /** @type{!Array<!proto.speech.tts.Sentence>} */ (
    jspb.Message.getRepeatedWrapperField(this, proto.speech.tts.Sentence, 1));
};


/**
 * @param {Array<!proto.speech.tts.Sentence>|undefined} value
 * @return {!proto.speech.tts.Context} returns this
*/
proto.speech.tts.Context.prototype.setPreviousSentenceList = function(value) {
  return jspb.Message.setRepeatedWrapperField(this, 1, value);
};


/**
 * @param {!proto.speech.tts.Sentence=} opt_value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.Sentence}
 */
proto.speech.tts.Context.prototype.addPreviousSentence = function(opt_value, opt_index) {
  return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.speech.tts.Sentence, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.Context} returns this
 */
proto.speech.tts.Context.prototype.clearPreviousSentenceList = function() {
  return jspb.Message.clearRepeatedWrapperField(this, 1);
};


/**
 * repeated Sentence next_sentence = 2;
 * @return {!Array<!proto.speech.tts.Sentence>}
 */
proto.speech.tts.Context.prototype.getNextSentenceList = function() {
  return /** @type{!Array<!proto.speech.tts.Sentence>} */ (
    jspb.Message.getRepeatedWrapperField(this, proto.speech.tts.Sentence, 2));
};


/**
 * @param {Array<!proto.speech.tts.Sentence>|undefined} value
 * @return {!proto.speech.tts.Context} returns this
*/
proto.speech.tts.Context.prototype.setNextSentenceList = function(value) {
  return jspb.Message.setRepeatedWrapperField(this, 2, value);
};


/**
 * @param {!proto.speech.tts.Sentence=} opt_value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.Sentence}
 */
proto.speech.tts.Context.prototype.addNextSentence = function(opt_value, opt_index) {
  return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.speech.tts.Sentence, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.Context} returns this
 */
proto.speech.tts.Context.prototype.clearNextSentenceList = function() {
  return jspb.Message.clearRepeatedWrapperField(this, 2);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.Context}
 */
proto.speech.tts.Context.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.Context, data);
};



/**
 * List of repeated fields within this message type.
 * @private {!Array<number>}
 * @const
 */
proto.speech.tts.Sentence.repeatedFields_ = [1,2];



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.Sentence.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.Sentence.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.Sentence} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.Sentence.toObject = function(includeInstance, msg) {
  let f, obj = {
    sayList: jspb.Message.toObjectList(msg.getSayList(),
    proto.speech.tts.Say.toObject, includeInstance),
    entryList: jspb.Message.toObjectList(msg.getEntryList(),
    proto.speech.tts.LexiconProto.Entry.toObject, includeInstance),
    morphing: (f = msg.getMorphing()) && proto.speech.tts.SpeechMorphingTargets.toObject(includeInstance, f),
    synthesizerSelection: (f = msg.getSynthesizerSelection()) && proto.speech.tts.SynthesizerSelection.toObject(includeInstance, f),
    outputGain: jspb.Message.getFloatingPointFieldWithDefault(msg, 8, 1.0),
    automaticSentenceSplitting: jspb.Message.getBooleanFieldWithDefault(msg, 9, true),
    context: (f = msg.getContext()) && proto.speech.tts.Context.toObject(includeInstance, f),
    messageTemplateId: (f = jspb.Message.getField(msg, 11)) == null ? undefined : f,
    performanceOptions: (f = msg.getPerformanceOptions()) && proto.speech.tts.PerformanceOptions.toObject(includeInstance, f),
    bowdlerize: (f = jspb.Message.getBooleanField(msg, 13)) == null ? undefined : f,
    partialSentenceProsody: (f = msg.getPartialSentenceProsody()) && proto.speech.tts.PartialSentenceProsody.toObject(includeInstance, f)
  };

  jspb.Message.toObjectExtension(/** @type {!jspb.Message} */ (msg), obj,
      proto.speech.tts.Sentence.extensions, proto.speech.tts.Sentence.prototype.getExtension,
      includeInstance);
  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of Sentence as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.Sentence.ObjectFormat = function() {
  /** @type {?Array<!proto.speech.tts.Say.ObjectFormat>|undefined} */
  this.sayList;

  /** @type {?Array<!proto.speech.tts.LexiconProto.Entry.ObjectFormat>|undefined} */
  this.entryList;

  /** @type {?proto.speech.tts.SpeechMorphingTargets.ObjectFormat|undefined} */
  this.morphing;

  /** @type {?proto.speech.tts.SynthesizerSelection.ObjectFormat|undefined} */
  this.synthesizerSelection;

  /** @type {?number|undefined} */
  this.outputGain;

  /** @type {?boolean|undefined} */
  this.automaticSentenceSplitting;

  /** @type {?proto.speech.tts.Context.ObjectFormat|undefined} */
  this.context;

  /** @type {?string|undefined} */
  this.messageTemplateId;

  /** @type {?proto.speech.tts.PerformanceOptions.ObjectFormat|undefined} */
  this.performanceOptions;

  /** @type {?boolean|undefined} */
  this.bowdlerize;

  /** @type {?proto.speech.tts.PartialSentenceProsody.ObjectFormat|undefined} */
  this.partialSentenceProsody;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.Sentence.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.Sentence}
 */
proto.speech.tts.Sentence.fromObject = function(obj) {
  const msg = new proto.speech.tts.Sentence();
  obj.sayList && jspb.Message.setRepeatedWrapperField(
      msg, 1, obj.sayList.map(
          proto.speech.tts.Say.fromObject));
  obj.entryList && jspb.Message.setRepeatedWrapperField(
      msg, 2, obj.entryList.map(
          proto.speech.tts.LexiconProto.Entry.fromObject));
  obj.morphing && jspb.Message.setWrapperField(
      msg, 6, proto.speech.tts.SpeechMorphingTargets.fromObject(obj.morphing));
  obj.synthesizerSelection && jspb.Message.setWrapperField(
      msg, 7, proto.speech.tts.SynthesizerSelection.fromObject(obj.synthesizerSelection));
  obj.outputGain != null && jspb.Message.setField(msg, 8, obj.outputGain);
  obj.automaticSentenceSplitting != null && jspb.Message.setField(msg, 9, obj.automaticSentenceSplitting);
  obj.context && jspb.Message.setWrapperField(
      msg, 10, proto.speech.tts.Context.fromObject(obj.context));
  obj.messageTemplateId != null && jspb.Message.setField(msg, 11, obj.messageTemplateId);
  obj.performanceOptions && jspb.Message.setWrapperField(
      msg, 12, proto.speech.tts.PerformanceOptions.fromObject(obj.performanceOptions));
  obj.bowdlerize != null && jspb.Message.setField(msg, 13, obj.bowdlerize);
  obj.partialSentenceProsody && jspb.Message.setWrapperField(
      msg, 14, proto.speech.tts.PartialSentenceProsody.fromObject(obj.partialSentenceProsody));
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.Sentence}
 */
proto.speech.tts.Sentence.deserializeBinary = function(bytes) {
  return proto.speech.tts.Sentence.deserializeBinaryFromReader(
      new proto.speech.tts.Sentence(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.Sentence} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.Sentence}
 */
proto.speech.tts.Sentence.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = new proto.speech.tts.Say();
      reader.readMessage(value,proto.speech.tts.Say.deserializeBinaryFromReader);
      msg.addSay(value);
      break;
    case 2:
      value = new proto.speech.tts.LexiconProto.Entry();
      reader.readMessage(value,proto.speech.tts.LexiconProto.Entry.deserializeBinaryFromReader);
      msg.addEntry(value);
      break;
    case 6:
      value = new proto.speech.tts.SpeechMorphingTargets();
      reader.readMessage(value,proto.speech.tts.SpeechMorphingTargets.deserializeBinaryFromReader);
      msg.setMorphing(value);
      break;
    case 7:
      value = new proto.speech.tts.SynthesizerSelection();
      reader.readMessage(value,proto.speech.tts.SynthesizerSelection.deserializeBinaryFromReader);
      msg.setSynthesizerSelection(value);
      break;
    case 8:
      value = /** @type {number} */ (reader.readFloat());
      msg.setOutputGain(value);
      break;
    case 9:
      value = /** @type {boolean} */ (reader.readBool());
      msg.setAutomaticSentenceSplitting(value);
      break;
    case 10:
      value = new proto.speech.tts.Context();
      reader.readMessage(value,proto.speech.tts.Context.deserializeBinaryFromReader);
      msg.setContext(value);
      break;
    case 11:
      value = /** @type {string} */ (reader.readString());
      msg.setMessageTemplateId(value);
      break;
    case 12:
      value = new proto.speech.tts.PerformanceOptions();
      reader.readMessage(value,proto.speech.tts.PerformanceOptions.deserializeBinaryFromReader);
      msg.setPerformanceOptions(value);
      break;
    case 13:
      value = /** @type {boolean} */ (reader.readBool());
      msg.setBowdlerize(value);
      break;
    case 14:
      value = new proto.speech.tts.PartialSentenceProsody();
      reader.readMessage(value,proto.speech.tts.PartialSentenceProsody.deserializeBinaryFromReader);
      msg.setPartialSentenceProsody(value);
      break;
    default:
      jspb.Message.readBinaryExtension(msg, reader,
        proto.speech.tts.Sentence.extensionsBinary,
        proto.speech.tts.Sentence.prototype.getExtension,
        proto.speech.tts.Sentence.prototype.setExtension);
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.Sentence.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.Sentence.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.Sentence} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.Sentence.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = message.getSayList();
  if (f.length > 0) {
    writer.writeRepeatedMessage(
      1,
      f,
      proto.speech.tts.Say.serializeBinaryToWriter
    );
  }
  f = message.getEntryList();
  if (f.length > 0) {
    writer.writeRepeatedMessage(
      2,
      f,
      proto.speech.tts.LexiconProto.Entry.serializeBinaryToWriter
    );
  }
  f = message.getMorphing();
  if (f != null) {
    writer.writeMessage(
      6,
      f,
      proto.speech.tts.SpeechMorphingTargets.serializeBinaryToWriter
    );
  }
  f = message.getSynthesizerSelection();
  if (f != null) {
    writer.writeMessage(
      7,
      f,
      proto.speech.tts.SynthesizerSelection.serializeBinaryToWriter
    );
  }
  f = /** @type {number} */ (jspb.Message.getField(message, 8));
  if (f != null) {
    writer.writeFloat(
      8,
      f
    );
  }
  f = /** @type {boolean} */ (jspb.Message.getField(message, 9));
  if (f != null) {
    writer.writeBool(
      9,
      f
    );
  }
  f = message.getContext();
  if (f != null) {
    writer.writeMessage(
      10,
      f,
      proto.speech.tts.Context.serializeBinaryToWriter
    );
  }
  f = /** @type {?string} */ (jspb.Message.getField(message, 11));
  if (f != null) {
    writer.writeString(
      11,
      f
    );
  }
  f = message.getPerformanceOptions();
  if (f != null) {
    writer.writeMessage(
      12,
      f,
      proto.speech.tts.PerformanceOptions.serializeBinaryToWriter
    );
  }
  f = /** @type {?boolean} */ (jspb.Message.getField(message, 13));
  if (f != null) {
    writer.writeBool(
      13,
      f
    );
  }
  f = message.getPartialSentenceProsody();
  if (f != null) {
    writer.writeMessage(
      14,
      f,
      proto.speech.tts.PartialSentenceProsody.serializeBinaryToWriter
    );
  }
  jspb.Message.serializeBinaryExtensions(message, writer,
    proto.speech.tts.Sentence.extensionsBinary, proto.speech.tts.Sentence.prototype.getExtension);
};


/**
 * repeated Say say = 1;
 * @return {!Array<!proto.speech.tts.Say>}
 */
proto.speech.tts.Sentence.prototype.getSayList = function() {
  return /** @type{!Array<!proto.speech.tts.Say>} */ (
    jspb.Message.getRepeatedWrapperField(this, proto.speech.tts.Say, 1));
};


/**
 * @param {Array<!proto.speech.tts.Say>|undefined} value
 * @return {!proto.speech.tts.Sentence} returns this
*/
proto.speech.tts.Sentence.prototype.setSayList = function(value) {
  return jspb.Message.setRepeatedWrapperField(this, 1, value);
};


/**
 * @param {!proto.speech.tts.Say=} opt_value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.Say}
 */
proto.speech.tts.Sentence.prototype.addSay = function(opt_value, opt_index) {
  return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.speech.tts.Say, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.Sentence} returns this
 */
proto.speech.tts.Sentence.prototype.clearSayList = function() {
  return jspb.Message.clearRepeatedWrapperField(this, 1);
};


/**
 * repeated LexiconProto.Entry entry = 2;
 * @return {!Array<!proto.speech.tts.LexiconProto.Entry>}
 */
proto.speech.tts.Sentence.prototype.getEntryList = function() {
  return /** @type{!Array<!proto.speech.tts.LexiconProto.Entry>} */ (
    jspb.Message.getRepeatedWrapperField(this, proto.speech.tts.LexiconProto.Entry, 2));
};


/**
 * @param {Array<!proto.speech.tts.LexiconProto.Entry>|undefined} value
 * @return {!proto.speech.tts.Sentence} returns this
*/
proto.speech.tts.Sentence.prototype.setEntryList = function(value) {
  return jspb.Message.setRepeatedWrapperField(this, 2, value);
};


/**
 * @param {!proto.speech.tts.LexiconProto.Entry=} opt_value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.LexiconProto.Entry}
 */
proto.speech.tts.Sentence.prototype.addEntry = function(opt_value, opt_index) {
  return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.speech.tts.LexiconProto.Entry, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.Sentence} returns this
 */
proto.speech.tts.Sentence.prototype.clearEntryList = function() {
  return jspb.Message.clearRepeatedWrapperField(this, 2);
};


/**
 * optional SpeechMorphingTargets morphing = 6;
 * @return {?proto.speech.tts.SpeechMorphingTargets}
 */
proto.speech.tts.Sentence.prototype.getMorphing = function() {
  return /** @type{?proto.speech.tts.SpeechMorphingTargets} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.SpeechMorphingTargets, 6));
};


/**
 * @param {?proto.speech.tts.SpeechMorphingTargets|undefined} value
 * @return {!proto.speech.tts.Sentence} returns this
*/
proto.speech.tts.Sentence.prototype.setMorphing = function(value) {
  return jspb.Message.setWrapperField(this, 6, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Sentence} returns this
 */
proto.speech.tts.Sentence.prototype.clearMorphing = function() {
  return jspb.Message.clearWrapperField(this, 6);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Sentence.prototype.hasMorphing = function() {
  return jspb.Message.hasField(this, 6);
};


/**
 * optional SynthesizerSelection synthesizer_selection = 7;
 * @return {?proto.speech.tts.SynthesizerSelection}
 */
proto.speech.tts.Sentence.prototype.getSynthesizerSelection = function() {
  return /** @type{?proto.speech.tts.SynthesizerSelection} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.SynthesizerSelection, 7));
};


/**
 * @param {?proto.speech.tts.SynthesizerSelection|undefined} value
 * @return {!proto.speech.tts.Sentence} returns this
*/
proto.speech.tts.Sentence.prototype.setSynthesizerSelection = function(value) {
  return jspb.Message.setWrapperField(this, 7, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Sentence} returns this
 */
proto.speech.tts.Sentence.prototype.clearSynthesizerSelection = function() {
  return jspb.Message.clearWrapperField(this, 7);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Sentence.prototype.hasSynthesizerSelection = function() {
  return jspb.Message.hasField(this, 7);
};


/**
 * optional float output_gain = 8;
 * @return {number}
 */
proto.speech.tts.Sentence.prototype.getOutputGain = function() {
  return jspb.Message.getFloatingPointFieldWithDefault(this, 8, 1.0);
};


/**
 * @param {?number|undefined} value
 * @return {!proto.speech.tts.Sentence} returns this
 */
proto.speech.tts.Sentence.prototype.setOutputGain = function(value) {
  return jspb.Message.setField(this, 8, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Sentence} returns this
 */
proto.speech.tts.Sentence.prototype.clearOutputGain = function() {
  return jspb.Message.clearField(this, 8);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Sentence.prototype.hasOutputGain = function() {
  return jspb.Message.hasField(this, 8);
};


/**
 * optional bool automatic_sentence_splitting = 9;
 * @return {boolean}
 */
proto.speech.tts.Sentence.prototype.getAutomaticSentenceSplitting = function() {
  return jspb.Message.getBooleanFieldWithDefault(this, 9, true);
};


/**
 * @param {?boolean|undefined} value
 * @return {!proto.speech.tts.Sentence} returns this
 */
proto.speech.tts.Sentence.prototype.setAutomaticSentenceSplitting = function(value) {
  return jspb.Message.setField(this, 9, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Sentence} returns this
 */
proto.speech.tts.Sentence.prototype.clearAutomaticSentenceSplitting = function() {
  return jspb.Message.clearField(this, 9);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Sentence.prototype.hasAutomaticSentenceSplitting = function() {
  return jspb.Message.hasField(this, 9);
};


/**
 * optional Context context = 10;
 * @return {?proto.speech.tts.Context}
 */
proto.speech.tts.Sentence.prototype.getContext = function() {
  return /** @type{?proto.speech.tts.Context} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.Context, 10));
};


/**
 * @param {?proto.speech.tts.Context|undefined} value
 * @return {!proto.speech.tts.Sentence} returns this
*/
proto.speech.tts.Sentence.prototype.setContext = function(value) {
  return jspb.Message.setWrapperField(this, 10, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Sentence} returns this
 */
proto.speech.tts.Sentence.prototype.clearContext = function() {
  return jspb.Message.clearWrapperField(this, 10);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Sentence.prototype.hasContext = function() {
  return jspb.Message.hasField(this, 10);
};


/**
 * optional string message_template_id = 11;
 * @return {?string}
 */
proto.speech.tts.Sentence.prototype.getMessageTemplateId = function() {
  return /** @type {?string} */ (jspb.Message.getField(this, 11));
};


/**
 * @param {?string|undefined} value
 * @return {!proto.speech.tts.Sentence} returns this
 */
proto.speech.tts.Sentence.prototype.setMessageTemplateId = function(value) {
  return jspb.Message.setField(this, 11, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Sentence} returns this
 */
proto.speech.tts.Sentence.prototype.clearMessageTemplateId = function() {
  return jspb.Message.clearField(this, 11);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Sentence.prototype.hasMessageTemplateId = function() {
  return jspb.Message.hasField(this, 11);
};


/**
 * optional PerformanceOptions performance_options = 12;
 * @return {?proto.speech.tts.PerformanceOptions}
 */
proto.speech.tts.Sentence.prototype.getPerformanceOptions = function() {
  return /** @type{?proto.speech.tts.PerformanceOptions} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.PerformanceOptions, 12));
};


/**
 * @param {?proto.speech.tts.PerformanceOptions|undefined} value
 * @return {!proto.speech.tts.Sentence} returns this
*/
proto.speech.tts.Sentence.prototype.setPerformanceOptions = function(value) {
  return jspb.Message.setWrapperField(this, 12, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Sentence} returns this
 */
proto.speech.tts.Sentence.prototype.clearPerformanceOptions = function() {
  return jspb.Message.clearWrapperField(this, 12);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Sentence.prototype.hasPerformanceOptions = function() {
  return jspb.Message.hasField(this, 12);
};


/**
 * optional bool bowdlerize = 13;
 * @return {?boolean}
 */
proto.speech.tts.Sentence.prototype.getBowdlerize = function() {
  return /** @type {?boolean} */ (jspb.Message.getBooleanField(this, 13));
};


/**
 * @param {?boolean|undefined} value
 * @return {!proto.speech.tts.Sentence} returns this
 */
proto.speech.tts.Sentence.prototype.setBowdlerize = function(value) {
  return jspb.Message.setField(this, 13, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Sentence} returns this
 */
proto.speech.tts.Sentence.prototype.clearBowdlerize = function() {
  return jspb.Message.clearField(this, 13);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Sentence.prototype.hasBowdlerize = function() {
  return jspb.Message.hasField(this, 13);
};


/**
 * optional PartialSentenceProsody partial_sentence_prosody = 14;
 * @return {?proto.speech.tts.PartialSentenceProsody}
 */
proto.speech.tts.Sentence.prototype.getPartialSentenceProsody = function() {
  return /** @type{?proto.speech.tts.PartialSentenceProsody} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.PartialSentenceProsody, 14));
};


/**
 * @param {?proto.speech.tts.PartialSentenceProsody|undefined} value
 * @return {!proto.speech.tts.Sentence} returns this
*/
proto.speech.tts.Sentence.prototype.setPartialSentenceProsody = function(value) {
  return jspb.Message.setWrapperField(this, 14, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Sentence} returns this
 */
proto.speech.tts.Sentence.prototype.clearPartialSentenceProsody = function() {
  return jspb.Message.clearWrapperField(this, 14);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Sentence.prototype.hasPartialSentenceProsody = function() {
  return jspb.Message.hasField(this, 14);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.Sentence}
 */
proto.speech.tts.Sentence.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.Sentence, data);
};



//speech/tts/public/tts_markup_proto_jspb/text.jspb.js
// source: speech/tts/public/tts_markup.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.speech.tts.Text');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.speech.tts.Sentence');
goog.require('proto.speech.tts.lucid.LucidMarkup');
goog.requireType('jspb.ByteSource');
goog.requireType('jspb.ExtensionFieldBinaryInfo');
goog.requireType('jspb.ExtensionFieldInfo');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 * @final
 */
proto.speech.tts.Text = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, 3, proto.speech.tts.Text.repeatedFields_, null);
};
goog.inherits(proto.speech.tts.Text, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   * @type {string}
   */
  proto.speech.tts.Text.displayName = 'proto.speech.tts.Text';
}

/**
 * The extensions registered with this message class. This is a map of
 * extension field number to fieldInfo object. This field should be considered
 * a private API (it is public because it is needed by other generated code).
 *
 * For example:
 *     { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} }
 *
 * fieldName contains the JsCompiler renamed field name property so that it
 * works in OPTIMIZED mode.
 *
 * @type {!Object<number, jspb.ExtensionFieldInfo>}
 */
proto.speech.tts.Text.extensions = {};


/**
 * The extensions registered with this message class. This is a map of
 * extension field number to fieldInfo object. This field should be considered
 * a private API (it is public because it is needed by other generated code).
 *
 * For example:
 *     { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} }
 *
 * fieldName contains the JsCompiler renamed field name property so that it
 * works in OPTIMIZED mode.
 *
 * @type {!Object<number, jspb.ExtensionFieldBinaryInfo>}
 */
proto.speech.tts.Text.extensionsBinary = {};


/**
 * List of repeated fields within this message type.
 * @private {!Array<number>}
 * @const
 */
proto.speech.tts.Text.repeatedFields_ = [1];



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.speech.tts.Text.prototype.toObject = function(opt_includeInstance) {
  return proto.speech.tts.Text.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.speech.tts.Text} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.Text.toObject = function(includeInstance, msg) {
  let f, obj = {
    sentenceList: jspb.Message.toObjectList(msg.getSentenceList(),
    proto.speech.tts.Sentence.toObject, includeInstance),
    lucid: (f = msg.getLucid()) && proto.speech.tts.lucid.LucidMarkup.toObject(includeInstance, f)
  };

  jspb.Message.toObjectExtension(/** @type {!jspb.Message} */ (msg), obj,
      proto.speech.tts.Text.extensions, proto.speech.tts.Text.prototype.getExtension,
      includeInstance);
  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


if (jspb.Message.GENERATE_FROM_OBJECT) {

/**
 * The raw object form of Text as accepted by the `fromObject` method.
 * @record
 */
proto.speech.tts.Text.ObjectFormat = function() {
  /** @type {?Array<!proto.speech.tts.Sentence.ObjectFormat>|undefined} */
  this.sentenceList;

  /** @type {?proto.speech.tts.lucid.LucidMarkup.ObjectFormat|undefined} */
  this.lucid;
};

/**
 * Loads data from an object into a new instance of this proto.
 * @param {!proto.speech.tts.Text.ObjectFormat} obj
 *     The object representation of this proto to load the data from.
 * @return {!proto.speech.tts.Text}
 */
proto.speech.tts.Text.fromObject = function(obj) {
  const msg = new proto.speech.tts.Text();
  obj.sentenceList && jspb.Message.setRepeatedWrapperField(
      msg, 1, obj.sentenceList.map(
          proto.speech.tts.Sentence.fromObject));
  obj.lucid && jspb.Message.setWrapperField(
      msg, 2, proto.speech.tts.lucid.LucidMarkup.fromObject(obj.lucid));
  return msg;
};
}

/**
 * Deserializes binary data (in protobuf wire format).
 * @param {?jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.speech.tts.Text}
 */
proto.speech.tts.Text.deserializeBinary = function(bytes) {
  return proto.speech.tts.Text.deserializeBinaryFromReader(
      new proto.speech.tts.Text(), new jspb.BinaryReader(bytes));
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.speech.tts.Text} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.speech.tts.Text}
 */
proto.speech.tts.Text.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    let value;
    switch (reader.getFieldNumber()) {
    case 1:
      value = new proto.speech.tts.Sentence();
      reader.readMessage(value,proto.speech.tts.Sentence.deserializeBinaryFromReader);
      msg.addSentence(value);
      break;
    case 2:
      value = new proto.speech.tts.lucid.LucidMarkup();
      reader.readMessage(value,proto.speech.tts.lucid.LucidMarkup.deserializeBinaryFromReader);
      msg.setLucid(value);
      break;
    default:
      jspb.Message.readBinaryExtension(msg, reader,
        proto.speech.tts.Text.extensionsBinary,
        proto.speech.tts.Text.prototype.getExtension,
        proto.speech.tts.Text.prototype.setExtension);
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.speech.tts.Text.prototype.serializeBinary = function() {
  const writer = new jspb.BinaryWriter();
  proto.speech.tts.Text.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.speech.tts.Text} message
 * @param {!jspb.BinaryWriter} writer
 * @return {void}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.speech.tts.Text.serializeBinaryToWriter = function(message, writer) {
  let f;
  f = message.getSentenceList();
  if (f.length > 0) {
    writer.writeRepeatedMessage(
      1,
      f,
      proto.speech.tts.Sentence.serializeBinaryToWriter
    );
  }
  f = message.getLucid();
  if (f != null) {
    writer.writeMessage(
      2,
      f,
      proto.speech.tts.lucid.LucidMarkup.serializeBinaryToWriter
    );
  }
  jspb.Message.serializeBinaryExtensions(message, writer,
    proto.speech.tts.Text.extensionsBinary, proto.speech.tts.Text.prototype.getExtension);
};


/**
 * repeated Sentence sentence = 1;
 * @return {!Array<!proto.speech.tts.Sentence>}
 * @deprecated
 */
proto.speech.tts.Text.prototype.getSentenceList = function() {
  return /** @type{!Array<!proto.speech.tts.Sentence>} */ (
    jspb.Message.getRepeatedWrapperField(this, proto.speech.tts.Sentence, 1));
};


/**
 * @param {Array<!proto.speech.tts.Sentence>|undefined} value
 * @return {!proto.speech.tts.Text} returns this
 * @deprecated
*/
proto.speech.tts.Text.prototype.setSentenceList = function(value) {
  return jspb.Message.setRepeatedWrapperField(this, 1, value);
};


/**
 * @param {!proto.speech.tts.Sentence=} opt_value
 * @param {number=} opt_index
 * @return {!proto.speech.tts.Sentence}
 * @deprecated
 */
proto.speech.tts.Text.prototype.addSentence = function(opt_value, opt_index) {
  return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.speech.tts.Sentence, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.speech.tts.Text} returns this
 * @deprecated
 */
proto.speech.tts.Text.prototype.clearSentenceList = function() {
  return jspb.Message.clearRepeatedWrapperField(this, 1);
};


/**
 * optional lucid.LucidMarkup lucid = 2;
 * @return {?proto.speech.tts.lucid.LucidMarkup}
 */
proto.speech.tts.Text.prototype.getLucid = function() {
  return /** @type{?proto.speech.tts.lucid.LucidMarkup} */ (
    jspb.Message.getWrapperField(this, proto.speech.tts.lucid.LucidMarkup, 2));
};


/**
 * @param {?proto.speech.tts.lucid.LucidMarkup|undefined} value
 * @return {!proto.speech.tts.Text} returns this
*/
proto.speech.tts.Text.prototype.setLucid = function(value) {
  return jspb.Message.setWrapperField(this, 2, value);
};


/**
 * Clears the field making it undefined.
 * @return {!proto.speech.tts.Text} returns this
 */
proto.speech.tts.Text.prototype.clearLucid = function() {
  return jspb.Message.clearWrapperField(this, 2);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.speech.tts.Text.prototype.hasLucid = function() {
  return jspb.Message.hasField(this, 2);
};


/**
 * @param {string} data The serialized JSON data in JSPB wire format.
 * @return {!proto.speech.tts.Text}
 */
proto.speech.tts.Text.deserialize = function(data) {
  return jspb.Message.deserializeWithCtor(proto.speech.tts.Text, data);
};



//speech/tts/platforms/web/chrome_extension/googletts_engine_chromiumos.js
/**
 * @fileoverview Chrome port of GoogleTTS.
 */

'use strict';

goog.require('SHA256');
goog.require('proto.speech.tts.SpeakerParams');
goog.require('proto.speech.tts.Text');
goog.require('proto.speech.tts.lucid.Annotation');
goog.require('proto.speech.tts.lucid.LucidMarkup');
goog.require('proto.speech.tts.lucid.LucidMarkup.Content');
goog.require('proto.speech.tts.lucid.LucidPiece');
goog.require('proto.speech.tts.lucid.LucidUtterance');
goog.require('proto.speech.tts.lucid.Prosody');

const SHA256 = goog.module.get('SHA256');

class GoogleTtsEngine {
  constructor() {
    /**
     * The callback provided by a call to chrome.ttsEngine.onSpeak, which is
     * our channel to send status updates about the progress of speech.
     * @private {?function(!object)}
     */
    this.ttsEngineApiCallback_ = null;

    /**
     * The string containing the text we're currently speaking.
     * @private {string?}
     */
    this.utterance_ = null;

    /**
     * The current voice's name.
     * @private {string?}
     */
    this.currentVoice_ = null;

    /**
     * Callback to run after initialization.
     * @private
     */
    this.pendingCallback_ = null;

    /**
     * True if initialization is done.
     * @private {boolean}
     */
    this.initialized_ = false;

    /** @private {!Object} */
    this.voiceNameToUrl_ = {};

    /** @private {!Object} */
    this.voiceNameToId_ = {};

    /** @private {!Object} */
    this.voiceNameToFileId_ = {};

    /**
     * @private {!Object}
     * @const
     **/
    this.voiceNameToSpeakerName_ = {};

    /**
     * @private {!Object<string, string>}
     * @const
     **/
    this.speakerNameToGender_ = {};

    /** @private {!Object} */
    this.voiceData_ = {};

    /** @private {number} */
    this.volume_ = 1.0;

    // Maps a file path to whether it is installed locally.
    this.installedVoices_ = {};

    // Maps a voice file id to true if the voice data is saved in IndexedDB.
    this.savedVoices_ = {};

    // Saved voices (above) is mirrored in localStorage to avoid the need to do
    // an IndexedDB lookup.
    const savedVoices = localStorage['savedVoices'];
    if (savedVoices) {
      try {
        this.savedVoices_ = JSON.parse(savedVoices);
      } catch (e) {
      }
    }

    this.dbRequest_ = indexedDB.open('store', 1);

    /**
     * Runs when a version change occurs. For us, this should only ever occur
     * once.
     */
    this.dbRequest_.onupgradeneeded = () => {
      this.dbRequest_.result.createObjectStore('store');
    };

    // Start listening to chrome.ttsEngine requests early so we queue up any
    // utterances and speak them as soon as we've actually initialized.
    chrome.ttsEngine.onSpeak.addListener(this.onSpeak.bind(this));
    chrome.ttsEngine.onStop.addListener(this.onStop.bind(this));
    chrome.ttsEngine.onPause.addListener(this.onPause.bind(this));
    chrome.ttsEngine.onResume.addListener(this.onResume.bind(this));

    window.addEventListener('message', this.onMessage_.bind(this));

    (async () => {
      this.ttsStream_ =
          await chrome.mojoPrivate.requireAsync('chromeos.tts.google_stream');
      this.finishInitialization_();
    })();
  }

  /**
   * @private
   */
  async finishInitialization_() {
    await this.initializeVoiceMetadata();
    this.updateVoices_();
    this.initialized_ = true;
    if (this.pendingCallback_) {
      this.pendingCallback_();
      this.pendingCallback_ = null;
    }
  }

  /**
   * Retrieves metadata about voices.
   */
  async initializeVoiceMetadata() {
    const response = await fetch(chrome.extension.getURL('voices.json'));
    const json = await response.json();
    this.voiceData_ = json;
  }

  /**
   * Called by the client to stop speech.
   */
  onStop() {
    this.pendingCallback_ = null;
    if (!this.initialized_) {
      return;
    }
    this.ttsStream_.stop();
    this.ttsEngineApiCallback_ = null;
  }

  /**
   * Called by the client to pause speech.
   */
  onPause() {
    if (!this.initialized_) {
      return;
    }
    this.ttsStream_.pause();
  }

  /**
   * Called by the client to resume speech.
   */
  onResume() {
    if (!this.initialized_) {
      return;
    }
    this.ttsStream_.resume();
  }

  /**
   * Called by the client to start speech synthesis.
   *
   * @param {string} utterance The utterance to say.
   * @param {!object} options The options affecting the speech, like language,
   *   pitch, rate, etc.
   * @param {function(!object)} callback The function to receive messages
   *   from the engine.
   */
  onSpeak(utterance, options, callback) {
    this.pendingCallback_ = null;

    if (!this.initialized_) {
      // We got a call to speak before we're initialized. Enqueue this until
      // we're ready.
      this.pendingCallback_ =
          this.onSpeak.bind(this, utterance, options, callback);
      return;
    }

    this.ttsEngineApiCallback_ = callback;
    this.utterance_ = utterance;

    if (this.currentVoice_ === options.voiceName) {
      // Already initialized, nothing to do.
      this.synthesize(utterance, options, callback);
      return;
    }

    this.ensureExists(options.voiceName, false, (voiceFileId, success) => {
      if (!success) {
        console.log('Failed to ensure voice exists.');
        return;
      }

      this.loadPipeline(voiceFileId, (success) => {
        if (!success) {
          console.log('Failed to initialize pipeline');
          return;
        }

        this.currentVoice_ = options.voiceName;
        this.synthesize(utterance, options, callback);
      });
    });
  }

  /**
   * Synthesizes some text. Assumes everything is already set up.
   *
   * @param {string} utterance The utterance to synthesize.
   * @param {!object} options Options such as language, pitch etc.
   * @param {function(!object)} callback Gets called with TtsEvents from the
   *     engine.
   */
  synthesize(utterance, options, callback) {
    let lucid = new proto.speech.tts.lucid.LucidMarkup();

    if (options.rate || options.pitch) {
      let annotation = new proto.speech.tts.lucid.Annotation();
      let prosody = new proto.speech.tts.lucid.Prosody();
      if (options.rate) {
        // The Chrome TTS spec disallows anything outside the
        // range of 0.1 through 10.0. Lucid Markup matches the Chrome spec where
        // > 1 is a speedup and < 1 is a slowdown.
        let durScale = Math.min(Math.max(options.rate, 0.1), 10.0);
        prosody.setSpeechRate(durScale);
      }

      // Converts the scale of 'pitch' from the API-oriented [0.0, 1.0] range
      // to pitch scale-factor range via an intrinsic (logarithmic) [-20, +20]
      // semitone scale.
      if (options.pitch) {
        const kPitchModificationRangeInSemitones = 20;
        let f0Scale = Math.pow(
            2.0,
            2.0 * (options.pitch / 2.0 - 0.5) *
                kPitchModificationRangeInSemitones / 12.0);
        prosody.setF0Scale(f0Scale);
      }

      annotation.setProsody(prosody);
      lucid.setAnnotation(annotation);
    }

    if (options.volume) {
      this.volume_ = Math.min(Math.max(options.volume, 0.0), 1.0);
    }

    let piece = new proto.speech.tts.lucid.LucidPiece().setInputText(utterance);
    let lucid_utterance = new proto.speech.tts.lucid.LucidUtterance()
                              .setPiecesList([piece])
                              .setAttemptSentenceSplitting(true);
    let content = new proto.speech.tts.lucid.LucidMarkup.Content().setUtterance(
        lucid_utterance);
    lucid.addContents(content);
    let text = new proto.speech.tts.Text().setLucid(lucid);
    let serializedText = Array.from(new Uint8Array(text.serializeBinary()));
    let speakerName = this.voiceNameToSpeakerName_[options.voiceName];
    let speakerGender = this.speakerNameToGender_[speakerName];
    let speakerParams = new proto.speech.tts.SpeakerParams();
    speakerParams.setSpeaker(speakerName);
    speakerParams.setGender(speakerGender);
    let serializedSpeakerParams =
        Array.from(new Uint8Array(speakerParams.serializeBinary()));
    this.ttsStream_.speak(serializedText, serializedSpeakerParams)
        .then(ttsEventObserver => {
          this.ttsStream_.setVolume(this.volume_);

          new mojo.Binding(
              chromeos.tts.mojom.TtsEventObserver,
              new class {
                constructor(callback, utterance) {
                  this.callback_ = callback;
                  this.utterance_ = utterance;
                }

                onStart() {
                  this.callback_({type: 'start', charIndex: 0});
                }

                onTimepoint(charIndex) {
                  this.callback_({type: 'word', charIndex: charIndex});
                }

                onEnd() {
                  this.callback_(
                      {type: 'end', charIndex: this.utterance_.length});
                }

                onError() {
                }
              }(this.ttsEngineApiCallback_, this.utterance_),
              ttsEventObserver.eventObserver);
        });
  }

  /**
   * Clean up from synthesizing one utterance and reading back samples.
   */
  finishReadingSamples() {
    this.isReadingMoreSamples_ = false;

    this.queuedBuffersLoadTimes_ = 0;
  }

  /**
   * Load up a pipeline.
   * @param {string} voiceFileId
   * @param {function()} callback
   */
  loadPipeline(voiceFileId, callback) {
    this.ttsStream_.selectVoice(voiceFileId).then(success => {
      callback(success);
    });
  }

  /**
   * Makes sure that a voice is locally installed on disk that the tts library
   * uses. First, checks to see if the voice data is already on disk. Next,
   * tries to retrieve from IndexedDB. Finally, downloads from Google servers
   * only if requested and if all other lookups fail.
   *
   * @param {string} voiceName Name of the voice to look up.
   * @param {boolean} allowDownload The caller wants to download the voice if it
   * does not exist locally.
   * @param {function(string, boolean)} callback Callback to invoke once done.
   */
  ensureExists(voiceName, allowDownload, callback) {
    const voiceFileId = this.voiceNameToFileId_[voiceName];
    if (!voiceFileId) {
      throw 'Invalid voice name: ' + voiceName;
    }

    // The voice is installed locally.
    if (this.installedVoices_[voiceFileId]) {
      callback(voiceFileId, true);
      return;
    }

    // Do a lookup first for the voice in IndexedDB.
    this.getVoiceData_(voiceFileId, (indexDbBuffer) => {
      if (indexDbBuffer) {
        this.ttsStream_.installVoice(voiceFileId, indexDbBuffer)
            .then(success => {
              this.installedVoices_[voiceFileId] = success;
              this.updateVoices_();
              callback(voiceFileId, success);
            });
        return;
      }

      let url = this.voiceNameToUrl_[voiceName];

      // Only fetch remote urls if the voice is remote and download was
      // requested.
      if (!allowDownload && url.indexOf('http') == 0) {
        throw new Error('Unexpected remote url ' + url);
      }

      console.log(voiceFileId + ' doesn\'t exist. loading from: ' + url);
      let xhr = new XMLHttpRequest();
      xhr.open('GET', url, true);
      xhr.responseType = 'arraybuffer';
      xhr.onload = (evt) => {
        let arrayBuffer = xhr.response;
        if (!arrayBuffer) {
          callback('', false);
          return;
        }

        const buffer = new Uint8Array(arrayBuffer);

        if (!this.validateVoiceData_(voiceFileId, buffer)) {
          console.error('Failed voice archive validation: ' + voiceFileId);
          callback('', false);
          return;
        }

        this.ttsStream_.installVoice(voiceFileId, buffer).then(success => {
          this.installedVoices_[voiceFileId] = success;

          // If the voice was downloaded from the server, save it to IndexedDB
          // for future loads.
          if (success && allowDownload) {
            this.saveVoiceData_(voiceFileId, buffer);
          }
          callback(voiceFileId, success);
        });
      };
      xhr.send(null);
    });
  }

  /**
   * @param {!Object} message
   * @private
   */
  onMessage_(message) {
    let command = JSON.parse(message.data);
    switch (command.type) {
      case 'getVoices':
        this.sendToOptions_({type: 'updateVoices', data: this.voiceData_});
        break;
      case 'addVoice':
        // Add all voices for the language associated with |voice|.
        const voicesToLoad = [];
        for (let voice of this.voiceData_) {
          if (voice.language != command.data.language) {
            continue;
          }
          voicesToLoad.push(voice);
        }

        const keepAddingVoices = () => {
          const voice = voicesToLoad.shift();
          if (!voice) {
            this.updateVoices_();
            return;
          }

          // All voices have at least one speaker so we can take the first
          // speaker's name. Since all speaker names in a voice map to the same
          // voice, checking if one speaker exists, checks if all speakers
          // exist.
          let name = voice.speakers[0].name;
          this.ensureExists(name, true, () => {
            keepAddingVoices();
          });
        };
        keepAddingVoices();
        break;
      case 'removeVoice':
        for (let voice of this.voiceData_) {
          if (voice.language != command.data.language) {
            continue;
          }
          this.removeVoiceData_(voice['file_id']);
        }
        this.updateVoices_();
        break;
    }
  }

  /**
   * @param {!Object} message
   * @private
   */
  sendToOptions_(message) {
    let views = chrome.extension.getViews();
    for (let i = 0; i < views.length; i++) {
      if (views[i].location.href.indexOf('options.html') > 0) {
        views[i].postMessage(JSON.stringify(message), window.location.origin);
      }
    }
  }

  /**
   * @private
   */
  updateVoices_() {
    let data = this.voiceData_;
    let updateVoices = [];
    for (let i = 0; i < data.length; i++) {
      let voice = data[i];
      for (let j = 0; j < voice.speakers.length; j++) {
        let speaker = voice.speakers[j];
        this.voiceNameToId_[speaker.name] = voice.id;
        this.voiceNameToSpeakerName_[speaker.name] = speaker.speaker;
        this.speakerNameToGender_[speaker.speaker] = speaker.gender;

        const voiceFileId = voice['file_id'];
        this.voiceNameToFileId_[speaker.name] = voiceFileId;
        voice.unloaded = !this.savedVoices_[voiceFileId] &&
            !this.installedVoices_[voiceFileId];

        // Language is encoded into the id e.g. en-us-sfg. Take the first two
        // components.
        let parts = voice.id.split('-');
        if (parts.length < 2) throw 'Unexpected voice id format: ' + voice.id;
        let lang = parts[0] + '-' + parts[1].toUpperCase();

        // Add a few other attributes to the runtime voice data.
        voice.language = lang;
        voice.displayName = chrome.accessibilityPrivate.getDisplayNameForLocale(
                                voice.language, chrome.i18n.getUILanguage()) ||
            '';

        // Skip this voice if it doesn't belong in the set seen by Chrome.
        if (voice.remote && voice.unloaded) {
          // A remote (http) url.
          this.voiceNameToUrl_[speaker.name] = voice.url;
          continue;
        }

        this.voiceNameToUrl_[speaker.name] = '/' + voice.id + '.zvoice';

        updateVoices.push({
          voiceName: speaker.name,
          lang: lang,
          eventTypes: ['start', 'end', 'error', 'word']
        });
      }
    }
    chrome.ttsEngine.updateVoices(updateVoices);
    this.sendToOptions_({type: 'updateVoices', data: this.voiceData_});
  }

  /**
   * Returns true if the voice matches our source of truth size and checksum.
   * @param {string} voiceFileId
   * @param {!Uint8Array} buffer
   * @return {boolean}
   * @private
   */
  validateVoiceData_(voiceFileId, buffer) {
    // Compute the SHA256 hash and compare to our voices file.
    const sha256 = new SHA256();
    sha256.update(buffer);
    const hash = sha256.stringDigest();
    const voiceData = this.voiceData_.find(v => v['file_id'] == voiceFileId);
    return voiceData && voiceData.sha256_checksum == hash &&
        voiceData.compressed_size == buffer.length;
  }

  /**
   * Gets voice data from IndexedDB.
   * @private
   */
  getVoiceData_(voiceFileId, callback) {
    const readRequest =
        this.dbRequest_.result.transaction('store').objectStore('store').get(
            voiceFileId);
    readRequest.onsuccess = () => {
      const result = readRequest.result;
      if (result && this.validateVoiceData_(voiceFileId, result)) {
        callback(result);
      } else {
        this.removeVoiceData_(voiceFileId);
        callback(null);
      }
    };

    readRequest.onerror = () => {
      callback(null);
    };
  }

  /**
   * Saves voice data to IndexedDB.
   * @private
   */
  saveVoiceData_(voiceFileId, buffer) {
    const writeTransaction =
        this.dbRequest_.result.transaction('store', 'readwrite');
    writeTransaction.objectStore('store').put(buffer, voiceFileId);
    this.savedVoices_[voiceFileId] = true;
    localStorage['savedVoices'] = JSON.stringify(this.savedVoices_);
  }

  /**
   * Removes voice data from IndexedDB.
   */
  removeVoiceData_(voiceFileId) {
    const writeTransaction =
        this.dbRequest_.result.transaction('store', 'readwrite');
    writeTransaction.objectStore('store').delete(voiceFileId);
    delete this.savedVoices_[voiceFileId];
    localStorage['savedVoices'] = JSON.stringify(this.savedVoices_);

    // TODO: wire up to Chrome so that Chrome deletes the locally extracted
    // voices. They would be cleared on the next reboot, but the user may have
    // installed/uninstalled quite a number of voices prior to rebooting.
    delete this.installedVoices_[voiceFileId];
  }
}

// In 'split' manifest mode, the extension system runs two copies of the
// extension. One in an incognito context; the other not. In guest mode, the
// extension system runs only the extension in an incognito context. To prevent
// doubling of this extension, only continue for one context.
const manifest =
    /** @type {{incognito: (string|undefined)}} */ (
        chrome.runtime.getManifest());
if (manifest.incognito == 'split' && !chrome.extension.inIncognitoContext) {
  window.close();
} else {
  window.engine = new GoogleTtsEngine();
}

