{"version":3,"file":"any.mjs","names":[],"sources":["../../../../../src/grpc/proto/google/protobuf/any.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\n// @generated by protobuf-ts 2.9.6 with parameter force_server_none,optimize_code_size,ts_nocheck\n// @generated from protobuf file \"google/protobuf/any.proto\" (package \"google.protobuf\", syntax proto3)\n// tslint:disable\n// @ts-nocheck\n//\n// Protocol Buffers - Google's data interchange format\n// Copyright 2008 Google Inc.  All rights reserved.\n// https://developers.google.com/protocol-buffers/\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\nimport { isJsonObject } from '@protobuf-ts/runtime';\nimport { typeofJsonValue } from '@protobuf-ts/runtime';\nimport type { JsonValue } from '@protobuf-ts/runtime';\nimport { jsonWriteOptions } from '@protobuf-ts/runtime';\nimport type { JsonReadOptions } from '@protobuf-ts/runtime';\nimport type { JsonWriteOptions } from '@protobuf-ts/runtime';\nimport type { BinaryReadOptions } from '@protobuf-ts/runtime';\nimport type { IMessageType } from '@protobuf-ts/runtime';\nimport { MessageType } from '@protobuf-ts/runtime';\n/**\n * `Any` contains an arbitrary serialized protocol buffer message along with a\n * URL that describes the type of the serialized message.\n *\n * Protobuf library provides support to pack/unpack Any values in the form\n * of utility functions or additional generated methods of the Any type.\n *\n * Example 1: Pack and unpack a message in C++.\n *\n *     Foo foo = ...;\n *     Any any;\n *     any.PackFrom(foo);\n *     ...\n *     if (any.UnpackTo(&foo)) {\n *       ...\n *     }\n *\n * Example 2: Pack and unpack a message in Java.\n *\n *     Foo foo = ...;\n *     Any any = Any.pack(foo);\n *     ...\n *     if (any.is(Foo.class)) {\n *       foo = any.unpack(Foo.class);\n *     }\n *     // or ...\n *     if (any.isSameTypeAs(Foo.getDefaultInstance())) {\n *       foo = any.unpack(Foo.getDefaultInstance());\n *     }\n *\n *  Example 3: Pack and unpack a message in Python.\n *\n *     foo = Foo(...)\n *     any = Any()\n *     any.Pack(foo)\n *     ...\n *     if any.Is(Foo.DESCRIPTOR):\n *       any.Unpack(foo)\n *       ...\n *\n *  Example 4: Pack and unpack a message in Go\n *\n *      foo := &pb.Foo{...}\n *      any, err := anypb.New(foo)\n *      if err != nil {\n *        ...\n *      }\n *      ...\n *      foo := &pb.Foo{}\n *      if err := any.UnmarshalTo(foo); err != nil {\n *        ...\n *      }\n *\n * The pack methods provided by protobuf library will by default use\n * 'type.googleapis.com/full.type.name' as the type URL and the unpack\n * methods only use the fully qualified type name after the last '/'\n * in the type URL, for example \"foo.bar.com/x/y.z\" will yield type\n * name \"y.z\".\n *\n * JSON\n * ====\n * The JSON representation of an `Any` value uses the regular\n * representation of the deserialized, embedded message, with an\n * additional field `@type` which contains the type URL. Example:\n *\n *     package google.profile;\n *     message Person {\n *       string first_name = 1;\n *       string last_name = 2;\n *     }\n *\n *     {\n *       \"@type\": \"type.googleapis.com/google.profile.Person\",\n *       \"firstName\": <string>,\n *       \"lastName\": <string>\n *     }\n *\n * If the embedded message type is well-known and has a custom JSON\n * representation, that representation will be embedded adding a field\n * `value` which holds the custom JSON in addition to the `@type`\n * field. Example (for message [google.protobuf.Duration][]):\n *\n *     {\n *       \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n *       \"value\": \"1.212s\"\n *     }\n *\n *\n * @generated from protobuf message google.protobuf.Any\n */\nexport interface Any {\n\t/**\n\t * A URL/resource name that uniquely identifies the type of the serialized\n\t * protocol buffer message. This string must contain at least\n\t * one \"/\" character. The last segment of the URL's path must represent\n\t * the fully qualified name of the type (as in\n\t * `path/google.protobuf.Duration`). The name should be in a canonical form\n\t * (e.g., leading \".\" is not accepted).\n\t *\n\t * In practice, teams usually precompile into the binary all types that they\n\t * expect it to use in the context of Any. However, for URLs which use the\n\t * scheme `http`, `https`, or no scheme, one can optionally set up a type\n\t * server that maps type URLs to message definitions as follows:\n\t *\n\t * * If no scheme is provided, `https` is assumed.\n\t * * An HTTP GET on the URL must yield a [google.protobuf.Type][]\n\t *   value in binary format, or produce an error.\n\t * * Applications are allowed to cache lookup results based on the\n\t *   URL, or have them precompiled into a binary to avoid any\n\t *   lookup. Therefore, binary compatibility needs to be preserved\n\t *   on changes to types. (Use versioned type names to manage\n\t *   breaking changes.)\n\t *\n\t * Note: this functionality is not currently available in the official\n\t * protobuf release, and it is not used for type URLs beginning with\n\t * type.googleapis.com. As of May 2023, there are no widely used type server\n\t * implementations and no plans to implement one.\n\t *\n\t * Schemes other than `http`, `https` (or the empty scheme) might be\n\t * used with implementation specific semantics.\n\t *\n\t *\n\t * @generated from protobuf field: string type_url = 1;\n\t */\n\ttypeUrl: string;\n\t/**\n\t * Must be a valid serialized protocol buffer of the above specified type.\n\t *\n\t * @generated from protobuf field: bytes value = 2;\n\t */\n\tvalue: Uint8Array;\n}\n// @generated message type with reflection information, may provide speed optimized methods\nclass Any$Type extends MessageType<Any> {\n\tconstructor() {\n\t\tsuper('google.protobuf.Any', [\n\t\t\t{ no: 1, name: 'type_url', kind: 'scalar', T: 9 /*ScalarType.STRING*/ },\n\t\t\t{ no: 2, name: 'value', kind: 'scalar', T: 12 /*ScalarType.BYTES*/ },\n\t\t]);\n\t}\n\t/**\n\t * Pack the message into a new `Any`.\n\t *\n\t * Uses 'type.googleapis.com/full.type.name' as the type URL.\n\t */\n\tpack<T extends object>(message: T, type: IMessageType<T>): Any {\n\t\treturn {\n\t\t\ttypeUrl: this.typeNameToUrl(type.typeName),\n\t\t\tvalue: type.toBinary(message),\n\t\t};\n\t}\n\t/**\n\t * Unpack the message from the `Any`.\n\t */\n\tunpack<T extends object>(\n\t\tany: Any,\n\t\ttype: IMessageType<T>,\n\t\toptions?: Partial<BinaryReadOptions>,\n\t): T {\n\t\tif (!this.contains(any, type))\n\t\t\tthrow new Error(\n\t\t\t\t\"Cannot unpack google.protobuf.Any with typeUrl '\" +\n\t\t\t\t\tany.typeUrl +\n\t\t\t\t\t\"' as \" +\n\t\t\t\t\ttype.typeName +\n\t\t\t\t\t'.',\n\t\t\t);\n\t\treturn type.fromBinary(any.value, options);\n\t}\n\t/**\n\t * Does the given `Any` contain a packed message of the given type?\n\t */\n\tcontains(any: Any, type: IMessageType<any> | string): boolean {\n\t\tif (!any.typeUrl.length) return false;\n\t\tlet wants = typeof type == 'string' ? type : type.typeName;\n\t\tlet has = this.typeUrlToName(any.typeUrl);\n\t\treturn wants === has;\n\t}\n\t/**\n\t * Convert the message to canonical JSON value.\n\t *\n\t * You have to provide the `typeRegistry` option so that the\n\t * packed message can be converted to JSON.\n\t *\n\t * The `typeRegistry` option is also required to read\n\t * `google.protobuf.Any` from JSON format.\n\t */\n\tinternalJsonWrite(any: Any, options: JsonWriteOptions): JsonValue {\n\t\tif (any.typeUrl === '') return {};\n\t\tlet typeName = this.typeUrlToName(any.typeUrl);\n\t\tlet opt = jsonWriteOptions(options);\n\t\tlet type = opt.typeRegistry?.find((t) => t.typeName === typeName);\n\t\tif (!type)\n\t\t\tthrow new globalThis.Error(\n\t\t\t\t\"Unable to convert google.protobuf.Any with typeUrl '\" +\n\t\t\t\t\tany.typeUrl +\n\t\t\t\t\t\"' to JSON. The specified type \" +\n\t\t\t\t\ttypeName +\n\t\t\t\t\t' is not available in the type registry.',\n\t\t\t);\n\t\tlet value = type.fromBinary(any.value, { readUnknownField: false });\n\t\tlet json = type.internalJsonWrite(value, opt);\n\t\tif (typeName.startsWith('google.protobuf.') || !isJsonObject(json)) json = { value: json };\n\t\tjson['@type'] = any.typeUrl;\n\t\treturn json;\n\t}\n\tinternalJsonRead(json: JsonValue, options: JsonReadOptions, target?: Any): Any {\n\t\tif (!isJsonObject(json))\n\t\t\tthrow new globalThis.Error(\n\t\t\t\t'Unable to parse google.protobuf.Any from JSON ' + typeofJsonValue(json) + '.',\n\t\t\t);\n\t\tif (typeof json['@type'] != 'string' || json['@type'] == '') return this.create();\n\t\tlet typeName = this.typeUrlToName(json['@type']);\n\t\tlet type = options?.typeRegistry?.find((t) => t.typeName == typeName);\n\t\tif (!type)\n\t\t\tthrow new globalThis.Error(\n\t\t\t\t'Unable to parse google.protobuf.Any from JSON. The specified type ' +\n\t\t\t\t\ttypeName +\n\t\t\t\t\t' is not available in the type registry.',\n\t\t\t);\n\t\tlet value;\n\t\tif (typeName.startsWith('google.protobuf.') && json.hasOwnProperty('value'))\n\t\t\tvalue = type.fromJson(json['value'], options);\n\t\telse {\n\t\t\tlet copy = Object.assign({}, json);\n\t\t\tdelete copy['@type'];\n\t\t\tvalue = type.fromJson(copy, options);\n\t\t}\n\t\tif (target === undefined) target = this.create();\n\t\ttarget.typeUrl = json['@type'];\n\t\ttarget.value = type.toBinary(value);\n\t\treturn target;\n\t}\n\ttypeNameToUrl(name: string): string {\n\t\tif (!name.length) throw new Error('invalid type name: ' + name);\n\t\treturn 'type.googleapis.com/' + name;\n\t}\n\ttypeUrlToName(url: string): string {\n\t\tif (!url.length) throw new Error('invalid type url: ' + url);\n\t\tlet slash = url.lastIndexOf('/');\n\t\tlet name = slash > 0 ? url.substring(slash + 1) : url;\n\t\tif (!name.length) throw new Error('invalid type url: ' + url);\n\t\treturn name;\n\t}\n}\n/**\n * @generated MessageType for protobuf message google.protobuf.Any\n */\nexport const Any = new Any$Type();\n"],"mappings":";;;AAoLA,IAAM,WAAN,cAAuB,YAAiB;CACvC,cAAc;AACb,QAAM,uBAAuB,CAC5B;GAAE,IAAI;GAAG,MAAM;GAAY,MAAM;GAAU,GAAG;GAAyB,EACvE;GAAE,IAAI;GAAG,MAAM;GAAS,MAAM;GAAU,GAAG;GAAyB,CACpE,CAAC;;;;;;;CAOH,KAAuB,SAAY,MAA4B;AAC9D,SAAO;GACN,SAAS,KAAK,cAAc,KAAK,SAAS;GAC1C,OAAO,KAAK,SAAS,QAAQ;GAC7B;;;;;CAKF,OACC,KACA,MACA,SACI;AACJ,MAAI,CAAC,KAAK,SAAS,KAAK,KAAK,CAC5B,OAAM,IAAI,MACT,qDACC,IAAI,UACJ,UACA,KAAK,WACL,IACD;AACF,SAAO,KAAK,WAAW,IAAI,OAAO,QAAQ;;;;;CAK3C,SAAS,KAAU,MAA2C;AAC7D,MAAI,CAAC,IAAI,QAAQ,OAAQ,QAAO;AAGhC,UAFY,OAAO,QAAQ,WAAW,OAAO,KAAK,cACxC,KAAK,cAAc,IAAI,QAAQ;;;;;;;;;;;CAY1C,kBAAkB,KAAU,SAAsC;AACjE,MAAI,IAAI,YAAY,GAAI,QAAO,EAAE;EACjC,IAAI,WAAW,KAAK,cAAc,IAAI,QAAQ;EAC9C,IAAI,MAAM,iBAAiB,QAAQ;EACnC,IAAI,OAAO,IAAI,cA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