/**
* @license
* Copyright The Closure Library Authors.
* Copyright The Closure Compiler Authors.
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @fileoverview Bootstrap for the Closure Compiler.
*
* Avoid including base.js more than once. This is strictly discouraged and not
* supported. goog.require(...) won't work properly in that case.
*
* Historically, this file originated from the Closure Library that has since
* been deprecated: https://github.com/google/closure-library/issues/1214
*
* This is a supported version released with the Closure Compiler.
*
* @suppress {deprecated} Users cannot remove deprecated uses here.
* @provideGoog
*/
/**
* @define {boolean} Overridden to true by the compiler.
*/
var COMPILED = false;
/**
* 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 || {};
/**
* A hook for overriding the define values in uncompiled or compiled mode.
*
* 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:
*
* var CLOSURE_DEFINES = {'goog.DEBUG': false} ;
*
*
* Currently the Closure Compiler will only recognize very simple definitions of
* this value when looking for values to apply to compiled code and ignore all
* other references. Specifically, it looks the value defined at the variable
* declaration, as with the example above.
*
* @type {!Object|null|undefined}
*/
globalThis.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 `globalThis`.
* @private
*/
goog.exportPath_ = function(name, object, overwriteImplicit, objectToExportTo) {
var parts = name.split('.');
var cur = objectToExportTo || globalThis;
// 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 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 defines = globalThis.CLOSURE_DEFINES;
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.
*/
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=" 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).
*/
goog.LOCALE = goog.define('goog.LOCALE', 'en'); // default to en
/**
* Defines a global namespace in Closure.
*
* NOTE: goog.module() is STRONGLY preferred over goog.provide().
*
* 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".
*/
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);
};
/**
* 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().
*
* 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.isInModuleLoader_()) {
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];
} else if (!goog.implicitNamespaces_[name]) {
var ns = goog.getObjectByName_(name);
return ns != null ? ns : null;
}
}
return null;
};
/**
* @private {?{
* moduleName: (string|undefined),
* declareLegacyNamespace:boolean,
* }}
*/
goog.moduleLoaderState_ = null;
/**
* @private
* @return {boolean} Whether a goog.module is currently being initialized.
*/
goog.isInModuleLoader_ = function() {
return !!goog.moduleLoaderState_;
};
/**
* 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.isInModuleLoader_()) {
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;
};
/**
* 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) {};
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}
* @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 satisfies 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
* globalThis.
* @return {?} The value (object or primitive) or, if not found, null.
* @private
*/
goog.getObjectByName_ = function(name, opt_obj) {
var parts = name.split('.');
var cur = opt_obj || globalThis;
for (var i = 0; i < parts.length; i++) {
cur = cur[parts[i]];
if (cur == null) {
return null;
}
}
return cur;
};
/**
* 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 or
* goog.module) in the form "goog.package.part".
* @return {?} The associated namespace or module for use in goog.module or ES6
* module source files. NOT for use in goog.provide source files where using
* this returned value will result in undefined behavior when compiled.
*/
goog.require = function(namespace) {
if (!COMPILED) {
// If the object already exists we do not need to do anything.
if (goog.isProvided_(namespace)) {
return goog.module.getInternal_(namespace);
}
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 or
* goog.module 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 {};
};
/**
* @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}
*/
goog.loadedModules_ = {};
/**
* @param {function(?):?} moduleDef The module definition.
*/
goog.loadModule = function(moduleDef) {
var previousState = goog.moduleLoaderState_;
try {
goog.moduleLoaderState_ = {
moduleName: '',
declareLegacyNamespace: false,
};
var origExports = {};
var exports = origExports;
if (typeof moduleDef === 'function') {
exports = moduleDef.call(undefined, exports);
} 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 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);
}
goog.loadedModules_[moduleName] = exports;
} else {
throw new Error('Invalid module name \"' + moduleName + '\"');
}
} finally {
goog.moduleLoaderState_ = previousState;
}
};
/**
* 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.
* @private
*/
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.
};
/**
* Optional map of CSS class names to obfuscated names used with
* goog.getCssName().
* @private {!Object|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}
*/
globalThis.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 (globalThis.CLOSURE_CSS_NAME_MAP_FN) {
return globalThis.CLOSURE_CSS_NAME_MAP_FN(result);
}
return result;
};
/**
* Sets the map to check when returning a value from goog.getCssName(). Example:
*
* 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')
*
* 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|undefined}
*/
globalThis.CLOSURE_CSS_NAME_MAPPING;
if (!COMPILED && globalThis.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_ = globalThis.CLOSURE_CSS_NAME_MAPPING;
}
/**
* Options bag type for `goog.getMsg()` third argument.
*
* It is important to note that these options need to be known at compile time,
* so they must always be provided to `goog.getMsg()` as an actual object
* literal in the function call. Otherwise, closure-compiler will report an
* error.
* @record
*/
goog.GetMsgOptions = function() {};
/**
* If `true`, escape '<' in the message string to '<'.
*
* 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`.
* @type {boolean|undefined}
*/
goog.GetMsgOptions.prototype.html;
/**
* If `true`, unescape common html entities: >, <, ', " and
* &.
*
* Used for messages not in HTML context, such as with the `textContent`
* property.
* The value must be literal `true` or `false`.
* @type {boolean|undefined}
*/
goog.GetMsgOptions.prototype.unescapeHtmlEntities;
/**
* Associates placeholder names with strings showing how their values are
* obtained.
*
* This field is intended for use in automatically generated JS code.
* Human-written code should use meaningful placeholder names instead.
*
* closure-compiler uses this as the contents of the `` tag in the
* XMB file it generates or defaults to `-` for historical reasons.
*
* Must be an object literal.
* Ignored at runtime.
* Keys are placeholder names.
* Values are string literals indicating how the value is obtained.
* Typically this is a snippet of source code.
* @type {!Object|undefined}
*/
goog.GetMsgOptions.prototype.original_code;
/**
* Associates placeholder names with example values.
*
* closure-compiler uses this as the contents of the `` tag in the
* XMB file it generates or defaults to `-` for historical reasons.
*
* Must be an object literal.
* Ignored at runtime.
* Keys are placeholder names.
* Values are string literals containing example placeholder values.
* (e.g. "George McFly" for a name placeholder)
* @type {!Object|undefined}
*/
goog.GetMsgOptions.prototype.example;
/**
* 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:
*
* var MSG_NAME = goog.getMsg('Hello {$placeholder}', {'placeholder': 'world'});
*
*
* 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=} opt_values Maps place holder name to value.
* @param {!goog.GetMsgOptions=} opt_options see `goog.GetMsgOptions`
* @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(/')
.replace(/'/g, '\'')
.replace(/"/g, '"')
.replace(/&/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:
* var x = goog.getMsgWithFallback(MSG_A, MSG_B);
* 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 globalThis.
*/
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;
};
/**
* Useful compiler idioms related to renaming.
* @const
*/
goog.reflect = {};
/**
* Syntax for object literal casts.
* @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 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:
*
* ```javascript
* // Force a layout
* goog.reflect.sinkValue(dialog.offsetHeight);
* ```
* @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[' '] = function() {};