@nocobase/plugin-multi-app-manager 0.15.0-alpha.4 → 0.16.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/dist/externalVersion.js +3 -3
  2. package/dist/node_modules/mariadb/LICENSE +502 -0
  3. package/dist/node_modules/mariadb/callback.js +41 -0
  4. package/dist/node_modules/mariadb/lib/cmd/batch-bulk.js +278 -0
  5. package/dist/node_modules/mariadb/lib/cmd/batch-rewrite.js +372 -0
  6. package/dist/node_modules/mariadb/lib/cmd/change-user.js +149 -0
  7. package/dist/node_modules/mariadb/lib/cmd/class/ok-packet.js +17 -0
  8. package/dist/node_modules/mariadb/lib/cmd/column-definition.js +102 -0
  9. package/dist/node_modules/mariadb/lib/cmd/command.js +168 -0
  10. package/dist/node_modules/mariadb/lib/cmd/common-binary-cmd.js +327 -0
  11. package/dist/node_modules/mariadb/lib/cmd/common-text-cmd.js +427 -0
  12. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/caching-sha2-password-auth.js +168 -0
  13. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/clear-password-auth.js +23 -0
  14. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/ed25519-password-auth.js +761 -0
  15. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/native-password-auth.js +55 -0
  16. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/pam-password-auth.js +58 -0
  17. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/plugin-auth.js +19 -0
  18. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/sha256-password-auth.js +142 -0
  19. package/dist/node_modules/mariadb/lib/cmd/handshake/client-capabilities.js +74 -0
  20. package/dist/node_modules/mariadb/lib/cmd/handshake/client-handshake-response.js +126 -0
  21. package/dist/node_modules/mariadb/lib/cmd/handshake/handshake.js +292 -0
  22. package/dist/node_modules/mariadb/lib/cmd/handshake/initial-handshake.js +74 -0
  23. package/dist/node_modules/mariadb/lib/cmd/handshake/ssl-request.js +29 -0
  24. package/dist/node_modules/mariadb/lib/cmd/ping.js +52 -0
  25. package/dist/node_modules/mariadb/lib/cmd/query.js +255 -0
  26. package/dist/node_modules/mariadb/lib/cmd/quit.js +28 -0
  27. package/dist/node_modules/mariadb/lib/cmd/reset.js +54 -0
  28. package/dist/node_modules/mariadb/lib/cmd/resultset.js +607 -0
  29. package/dist/node_modules/mariadb/lib/cmd/stream.js +45 -0
  30. package/dist/node_modules/mariadb/lib/config/connection-options.js +258 -0
  31. package/dist/node_modules/mariadb/lib/config/pool-cluster-options.js +19 -0
  32. package/dist/node_modules/mariadb/lib/config/pool-options.js +47 -0
  33. package/dist/node_modules/mariadb/lib/connection-callback.js +160 -0
  34. package/dist/node_modules/mariadb/lib/connection.js +1460 -0
  35. package/dist/node_modules/mariadb/lib/const/capabilities.js +64 -0
  36. package/dist/node_modules/mariadb/lib/const/collations.js +473 -0
  37. package/dist/node_modules/mariadb/lib/const/connection_status.js +13 -0
  38. package/dist/node_modules/mariadb/lib/const/error-code.js +1282 -0
  39. package/dist/node_modules/mariadb/lib/const/field-detail.js +35 -0
  40. package/dist/node_modules/mariadb/lib/const/field-type.js +71 -0
  41. package/dist/node_modules/mariadb/lib/const/server-status.js +30 -0
  42. package/dist/node_modules/mariadb/lib/const/state-change.js +12 -0
  43. package/dist/node_modules/mariadb/lib/filtered-pool-cluster.js +81 -0
  44. package/dist/node_modules/mariadb/lib/io/bulk-packet.js +590 -0
  45. package/dist/node_modules/mariadb/lib/io/compression-input-stream.js +141 -0
  46. package/dist/node_modules/mariadb/lib/io/compression-output-stream.js +171 -0
  47. package/dist/node_modules/mariadb/lib/io/packet-input-stream.js +193 -0
  48. package/dist/node_modules/mariadb/lib/io/packet-node-encoded.js +36 -0
  49. package/dist/node_modules/mariadb/lib/io/packet-node-iconv.js +37 -0
  50. package/dist/node_modules/mariadb/lib/io/packet-output-stream.js +502 -0
  51. package/dist/node_modules/mariadb/lib/io/packet.js +515 -0
  52. package/dist/node_modules/mariadb/lib/io/rewrite-packet.js +481 -0
  53. package/dist/node_modules/mariadb/lib/misc/connection-information.js +96 -0
  54. package/dist/node_modules/mariadb/lib/misc/errors.js +123 -0
  55. package/dist/node_modules/mariadb/lib/misc/parse.js +1033 -0
  56. package/dist/node_modules/mariadb/lib/misc/utils.js +298 -0
  57. package/dist/node_modules/mariadb/lib/pool-base.js +611 -0
  58. package/dist/node_modules/mariadb/lib/pool-callback.js +202 -0
  59. package/dist/node_modules/mariadb/lib/pool-cluster-callback.js +66 -0
  60. package/dist/node_modules/mariadb/lib/pool-cluster.js +407 -0
  61. package/dist/node_modules/mariadb/lib/pool-promise.js +108 -0
  62. package/dist/node_modules/mariadb/node_modules/@types/geojson/index.d.ts +165 -0
  63. package/dist/node_modules/mariadb/node_modules/@types/geojson/package.json +46 -0
  64. package/dist/node_modules/mariadb/node_modules/@types/node/assert/strict.d.ts +8 -0
  65. package/dist/node_modules/mariadb/node_modules/@types/node/assert.d.ts +912 -0
  66. package/dist/node_modules/mariadb/node_modules/@types/node/async_hooks.d.ts +501 -0
  67. package/dist/node_modules/mariadb/node_modules/@types/node/buffer.d.ts +2232 -0
  68. package/dist/node_modules/mariadb/node_modules/@types/node/child_process.d.ts +1366 -0
  69. package/dist/node_modules/mariadb/node_modules/@types/node/cluster.d.ts +414 -0
  70. package/dist/node_modules/mariadb/node_modules/@types/node/console.d.ts +412 -0
  71. package/dist/node_modules/mariadb/node_modules/@types/node/constants.d.ts +18 -0
  72. package/dist/node_modules/mariadb/node_modules/@types/node/crypto.d.ts +3338 -0
  73. package/dist/node_modules/mariadb/node_modules/@types/node/dgram.d.ts +545 -0
  74. package/dist/node_modules/mariadb/node_modules/@types/node/diagnostics_channel.d.ts +152 -0
  75. package/dist/node_modules/mariadb/node_modules/@types/node/dns/promises.d.ts +370 -0
  76. package/dist/node_modules/mariadb/node_modules/@types/node/dns.d.ts +659 -0
  77. package/dist/node_modules/mariadb/node_modules/@types/node/domain.d.ts +169 -0
  78. package/dist/node_modules/mariadb/node_modules/@types/node/events.d.ts +651 -0
  79. package/dist/node_modules/mariadb/node_modules/@types/node/fs/promises.d.ts +1091 -0
  80. package/dist/node_modules/mariadb/node_modules/@types/node/fs.d.ts +3869 -0
  81. package/dist/node_modules/mariadb/node_modules/@types/node/globals.d.ts +294 -0
  82. package/dist/node_modules/mariadb/node_modules/@types/node/globals.global.d.ts +1 -0
  83. package/dist/node_modules/mariadb/node_modules/@types/node/http.d.ts +1396 -0
  84. package/dist/node_modules/mariadb/node_modules/@types/node/http2.d.ts +2101 -0
  85. package/dist/node_modules/mariadb/node_modules/@types/node/https.d.ts +391 -0
  86. package/dist/node_modules/mariadb/node_modules/@types/node/index.d.ts +129 -0
  87. package/dist/node_modules/mariadb/node_modules/@types/node/inspector.d.ts +2744 -0
  88. package/dist/node_modules/mariadb/node_modules/@types/node/module.d.ts +114 -0
  89. package/dist/node_modules/mariadb/node_modules/@types/node/net.d.ts +791 -0
  90. package/dist/node_modules/mariadb/node_modules/@types/node/os.d.ts +455 -0
  91. package/dist/node_modules/mariadb/node_modules/@types/node/package.json +220 -0
  92. package/dist/node_modules/mariadb/node_modules/@types/node/path.d.ts +180 -0
  93. package/dist/node_modules/mariadb/node_modules/@types/node/perf_hooks.d.ts +557 -0
  94. package/dist/node_modules/mariadb/node_modules/@types/node/process.d.ts +1481 -0
  95. package/dist/node_modules/mariadb/node_modules/@types/node/punycode.d.ts +117 -0
  96. package/dist/node_modules/mariadb/node_modules/@types/node/querystring.d.ts +131 -0
  97. package/dist/node_modules/mariadb/node_modules/@types/node/readline.d.ts +650 -0
  98. package/dist/node_modules/mariadb/node_modules/@types/node/repl.d.ts +424 -0
  99. package/dist/node_modules/mariadb/node_modules/@types/node/stream/consumers.d.ts +24 -0
  100. package/dist/node_modules/mariadb/node_modules/@types/node/stream/promises.d.ts +42 -0
  101. package/dist/node_modules/mariadb/node_modules/@types/node/stream/web.d.ts +330 -0
  102. package/dist/node_modules/mariadb/node_modules/@types/node/stream.d.ts +1249 -0
  103. package/dist/node_modules/mariadb/node_modules/@types/node/string_decoder.d.ts +67 -0
  104. package/dist/node_modules/mariadb/node_modules/@types/node/timers/promises.d.ts +68 -0
  105. package/dist/node_modules/mariadb/node_modules/@types/node/timers.d.ts +94 -0
  106. package/dist/node_modules/mariadb/node_modules/@types/node/tls.d.ts +1020 -0
  107. package/dist/node_modules/mariadb/node_modules/@types/node/trace_events.d.ts +161 -0
  108. package/dist/node_modules/mariadb/node_modules/@types/node/tty.d.ts +204 -0
  109. package/dist/node_modules/mariadb/node_modules/@types/node/url.d.ts +891 -0
  110. package/dist/node_modules/mariadb/node_modules/@types/node/util.d.ts +1594 -0
  111. package/dist/node_modules/mariadb/node_modules/@types/node/v8.d.ts +378 -0
  112. package/dist/node_modules/mariadb/node_modules/@types/node/vm.d.ts +507 -0
  113. package/dist/node_modules/mariadb/node_modules/@types/node/wasi.d.ts +158 -0
  114. package/dist/node_modules/mariadb/node_modules/@types/node/worker_threads.d.ts +649 -0
  115. package/dist/node_modules/mariadb/node_modules/@types/node/zlib.d.ts +517 -0
  116. package/dist/node_modules/mariadb/node_modules/iconv-lite/.github/dependabot.yml +11 -0
  117. package/dist/node_modules/mariadb/node_modules/iconv-lite/.idea/codeStyles/Project.xml +47 -0
  118. package/dist/node_modules/mariadb/node_modules/iconv-lite/.idea/codeStyles/codeStyleConfig.xml +5 -0
  119. package/dist/node_modules/mariadb/node_modules/iconv-lite/.idea/iconv-lite.iml +12 -0
  120. package/dist/node_modules/mariadb/node_modules/iconv-lite/.idea/inspectionProfiles/Project_Default.xml +6 -0
  121. package/dist/node_modules/mariadb/node_modules/iconv-lite/.idea/modules.xml +8 -0
  122. package/dist/node_modules/mariadb/node_modules/iconv-lite/.idea/vcs.xml +6 -0
  123. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/dbcs-codec.js +597 -0
  124. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/dbcs-data.js +188 -0
  125. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/index.js +23 -0
  126. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/internal.js +198 -0
  127. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/sbcs-codec.js +72 -0
  128. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/sbcs-data-generated.js +451 -0
  129. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/sbcs-data.js +179 -0
  130. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/tables/big5-added.json +122 -0
  131. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/tables/cp936.json +264 -0
  132. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/tables/cp949.json +273 -0
  133. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/tables/cp950.json +177 -0
  134. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/tables/eucjp.json +182 -0
  135. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json +1 -0
  136. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/tables/gbk-added.json +56 -0
  137. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/tables/shiftjis.json +125 -0
  138. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/utf16.js +197 -0
  139. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/utf32.js +319 -0
  140. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/utf7.js +290 -0
  141. package/dist/node_modules/mariadb/node_modules/iconv-lite/lib/bom-handling.js +52 -0
  142. package/dist/node_modules/mariadb/node_modules/iconv-lite/lib/index.d.ts +41 -0
  143. package/dist/node_modules/mariadb/node_modules/iconv-lite/lib/index.js +180 -0
  144. package/dist/node_modules/mariadb/node_modules/iconv-lite/lib/streams.js +109 -0
  145. package/dist/node_modules/mariadb/node_modules/iconv-lite/package.json +44 -0
  146. package/dist/node_modules/mariadb/node_modules/long/index.d.ts +457 -0
  147. package/dist/node_modules/mariadb/node_modules/long/index.js +1467 -0
  148. package/dist/node_modules/mariadb/node_modules/long/package.json +50 -0
  149. package/dist/node_modules/mariadb/node_modules/long/umd/index.d.ts +2 -0
  150. package/dist/node_modules/mariadb/node_modules/long/umd/index.js +1432 -0
  151. package/dist/node_modules/mariadb/node_modules/long/umd/package.json +3 -0
  152. package/dist/node_modules/mariadb/package.json +1 -0
  153. package/dist/node_modules/mariadb/promise.js +34 -0
  154. package/dist/node_modules/mariadb/types/index.d.ts +870 -0
  155. package/dist/server/server.js +6 -0
  156. package/package.json +2 -2
@@ -0,0 +1,1432 @@
1
+ // GENERATED FILE. DO NOT EDIT.
2
+ var Long = (function(exports) {
3
+ "use strict";
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ /**
11
+ * @license
12
+ * Copyright 2009 The Closure Library Authors
13
+ * Copyright 2020 Daniel Wirtz / The long.js Authors.
14
+ *
15
+ * Licensed under the Apache License, Version 2.0 (the "License");
16
+ * you may not use this file except in compliance with the License.
17
+ * You may obtain a copy of the License at
18
+ *
19
+ * http://www.apache.org/licenses/LICENSE-2.0
20
+ *
21
+ * Unless required by applicable law or agreed to in writing, software
22
+ * distributed under the License is distributed on an "AS IS" BASIS,
23
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24
+ * See the License for the specific language governing permissions and
25
+ * limitations under the License.
26
+ *
27
+ * SPDX-License-Identifier: Apache-2.0
28
+ */
29
+ // WebAssembly optimizations to do native i64 multiplication and divide
30
+ var wasm = null;
31
+
32
+ try {
33
+ wasm = new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 13, 2, 96, 0, 1, 127, 96, 4, 127, 127, 127, 127, 1, 127, 3, 7, 6, 0, 1, 1, 1, 1, 1, 6, 6, 1, 127, 1, 65, 0, 11, 7, 50, 6, 3, 109, 117, 108, 0, 1, 5, 100, 105, 118, 95, 115, 0, 2, 5, 100, 105, 118, 95, 117, 0, 3, 5, 114, 101, 109, 95, 115, 0, 4, 5, 114, 101, 109, 95, 117, 0, 5, 8, 103, 101, 116, 95, 104, 105, 103, 104, 0, 0, 10, 191, 1, 6, 4, 0, 35, 0, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 126, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 127, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 128, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 129, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 130, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11])), {}).exports;
34
+ } catch (e) {// no wasm support :(
35
+ }
36
+ /**
37
+ * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers.
38
+ * See the from* functions below for more convenient ways of constructing Longs.
39
+ * @exports Long
40
+ * @class A Long class for representing a 64 bit two's-complement integer value.
41
+ * @param {number} low The low (signed) 32 bits of the long
42
+ * @param {number} high The high (signed) 32 bits of the long
43
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
44
+ * @constructor
45
+ */
46
+
47
+
48
+ function Long(low, high, unsigned) {
49
+ /**
50
+ * The low 32 bits as a signed value.
51
+ * @type {number}
52
+ */
53
+ this.low = low | 0;
54
+ /**
55
+ * The high 32 bits as a signed value.
56
+ * @type {number}
57
+ */
58
+
59
+ this.high = high | 0;
60
+ /**
61
+ * Whether unsigned or not.
62
+ * @type {boolean}
63
+ */
64
+
65
+ this.unsigned = !!unsigned;
66
+ } // The internal representation of a long is the two given signed, 32-bit values.
67
+ // We use 32-bit pieces because these are the size of integers on which
68
+ // Javascript performs bit-operations. For operations like addition and
69
+ // multiplication, we split each number into 16 bit pieces, which can easily be
70
+ // multiplied within Javascript's floating-point representation without overflow
71
+ // or change in sign.
72
+ //
73
+ // In the algorithms below, we frequently reduce the negative case to the
74
+ // positive case by negating the input(s) and then post-processing the result.
75
+ // Note that we must ALWAYS check specially whether those values are MIN_VALUE
76
+ // (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as
77
+ // a positive number, it overflows back into a negative). Not handling this
78
+ // case would often result in infinite recursion.
79
+ //
80
+ // Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the from*
81
+ // methods on which they depend.
82
+
83
+ /**
84
+ * An indicator used to reliably determine if an object is a Long or not.
85
+ * @type {boolean}
86
+ * @const
87
+ * @private
88
+ */
89
+
90
+
91
+ Long.prototype.__isLong__;
92
+ Object.defineProperty(Long.prototype, "__isLong__", {
93
+ value: true
94
+ });
95
+ /**
96
+ * @function
97
+ * @param {*} obj Object
98
+ * @returns {boolean}
99
+ * @inner
100
+ */
101
+
102
+ function isLong(obj) {
103
+ return (obj && obj["__isLong__"]) === true;
104
+ }
105
+ /**
106
+ * @function
107
+ * @param {*} value number
108
+ * @returns {number}
109
+ * @inner
110
+ */
111
+
112
+
113
+ function ctz32(value) {
114
+ var c = Math.clz32(value & -value);
115
+ return value ? 31 - c : c;
116
+ }
117
+ /**
118
+ * Tests if the specified object is a Long.
119
+ * @function
120
+ * @param {*} obj Object
121
+ * @returns {boolean}
122
+ */
123
+
124
+
125
+ Long.isLong = isLong;
126
+ /**
127
+ * A cache of the Long representations of small integer values.
128
+ * @type {!Object}
129
+ * @inner
130
+ */
131
+
132
+ var INT_CACHE = {};
133
+ /**
134
+ * A cache of the Long representations of small unsigned integer values.
135
+ * @type {!Object}
136
+ * @inner
137
+ */
138
+
139
+ var UINT_CACHE = {};
140
+ /**
141
+ * @param {number} value
142
+ * @param {boolean=} unsigned
143
+ * @returns {!Long}
144
+ * @inner
145
+ */
146
+
147
+ function fromInt(value, unsigned) {
148
+ var obj, cachedObj, cache;
149
+
150
+ if (unsigned) {
151
+ value >>>= 0;
152
+
153
+ if (cache = 0 <= value && value < 256) {
154
+ cachedObj = UINT_CACHE[value];
155
+ if (cachedObj) return cachedObj;
156
+ }
157
+
158
+ obj = fromBits(value, 0, true);
159
+ if (cache) UINT_CACHE[value] = obj;
160
+ return obj;
161
+ } else {
162
+ value |= 0;
163
+
164
+ if (cache = -128 <= value && value < 128) {
165
+ cachedObj = INT_CACHE[value];
166
+ if (cachedObj) return cachedObj;
167
+ }
168
+
169
+ obj = fromBits(value, value < 0 ? -1 : 0, false);
170
+ if (cache) INT_CACHE[value] = obj;
171
+ return obj;
172
+ }
173
+ }
174
+ /**
175
+ * Returns a Long representing the given 32 bit integer value.
176
+ * @function
177
+ * @param {number} value The 32 bit integer in question
178
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
179
+ * @returns {!Long} The corresponding Long value
180
+ */
181
+
182
+
183
+ Long.fromInt = fromInt;
184
+ /**
185
+ * @param {number} value
186
+ * @param {boolean=} unsigned
187
+ * @returns {!Long}
188
+ * @inner
189
+ */
190
+
191
+ function fromNumber(value, unsigned) {
192
+ if (isNaN(value)) return unsigned ? UZERO : ZERO;
193
+
194
+ if (unsigned) {
195
+ if (value < 0) return UZERO;
196
+ if (value >= TWO_PWR_64_DBL) return MAX_UNSIGNED_VALUE;
197
+ } else {
198
+ if (value <= -TWO_PWR_63_DBL) return MIN_VALUE;
199
+ if (value + 1 >= TWO_PWR_63_DBL) return MAX_VALUE;
200
+ }
201
+
202
+ if (value < 0) return fromNumber(-value, unsigned).neg();
203
+ return fromBits(value % TWO_PWR_32_DBL | 0, value / TWO_PWR_32_DBL | 0, unsigned);
204
+ }
205
+ /**
206
+ * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.
207
+ * @function
208
+ * @param {number} value The number in question
209
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
210
+ * @returns {!Long} The corresponding Long value
211
+ */
212
+
213
+
214
+ Long.fromNumber = fromNumber;
215
+ /**
216
+ * @param {number} lowBits
217
+ * @param {number} highBits
218
+ * @param {boolean=} unsigned
219
+ * @returns {!Long}
220
+ * @inner
221
+ */
222
+
223
+ function fromBits(lowBits, highBits, unsigned) {
224
+ return new Long(lowBits, highBits, unsigned);
225
+ }
226
+ /**
227
+ * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is
228
+ * assumed to use 32 bits.
229
+ * @function
230
+ * @param {number} lowBits The low 32 bits
231
+ * @param {number} highBits The high 32 bits
232
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
233
+ * @returns {!Long} The corresponding Long value
234
+ */
235
+
236
+
237
+ Long.fromBits = fromBits;
238
+ /**
239
+ * @function
240
+ * @param {number} base
241
+ * @param {number} exponent
242
+ * @returns {number}
243
+ * @inner
244
+ */
245
+
246
+ var pow_dbl = Math.pow; // Used 4 times (4*8 to 15+4)
247
+
248
+ /**
249
+ * @param {string} str
250
+ * @param {(boolean|number)=} unsigned
251
+ * @param {number=} radix
252
+ * @returns {!Long}
253
+ * @inner
254
+ */
255
+
256
+ function fromString(str, unsigned, radix) {
257
+ if (str.length === 0) throw Error('empty string');
258
+
259
+ if (typeof unsigned === 'number') {
260
+ // For goog.math.long compatibility
261
+ radix = unsigned;
262
+ unsigned = false;
263
+ } else {
264
+ unsigned = !!unsigned;
265
+ }
266
+
267
+ if (str === "NaN" || str === "Infinity" || str === "+Infinity" || str === "-Infinity") return unsigned ? UZERO : ZERO;
268
+ radix = radix || 10;
269
+ if (radix < 2 || 36 < radix) throw RangeError('radix');
270
+ var p;
271
+ if ((p = str.indexOf('-')) > 0) throw Error('interior hyphen');else if (p === 0) {
272
+ return fromString(str.substring(1), unsigned, radix).neg();
273
+ } // Do several (8) digits each time through the loop, so as to
274
+ // minimize the calls to the very expensive emulated div.
275
+
276
+ var radixToPower = fromNumber(pow_dbl(radix, 8));
277
+ var result = ZERO;
278
+
279
+ for (var i = 0; i < str.length; i += 8) {
280
+ var size = Math.min(8, str.length - i),
281
+ value = parseInt(str.substring(i, i + size), radix);
282
+
283
+ if (size < 8) {
284
+ var power = fromNumber(pow_dbl(radix, size));
285
+ result = result.mul(power).add(fromNumber(value));
286
+ } else {
287
+ result = result.mul(radixToPower);
288
+ result = result.add(fromNumber(value));
289
+ }
290
+ }
291
+
292
+ result.unsigned = unsigned;
293
+ return result;
294
+ }
295
+ /**
296
+ * Returns a Long representation of the given string, written using the specified radix.
297
+ * @function
298
+ * @param {string} str The textual representation of the Long
299
+ * @param {(boolean|number)=} unsigned Whether unsigned or not, defaults to signed
300
+ * @param {number=} radix The radix in which the text is written (2-36), defaults to 10
301
+ * @returns {!Long} The corresponding Long value
302
+ */
303
+
304
+
305
+ Long.fromString = fromString;
306
+ /**
307
+ * @function
308
+ * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val
309
+ * @param {boolean=} unsigned
310
+ * @returns {!Long}
311
+ * @inner
312
+ */
313
+
314
+ function fromValue(val, unsigned) {
315
+ if (typeof val === 'number') return fromNumber(val, unsigned);
316
+ if (typeof val === 'string') return fromString(val, unsigned); // Throws for non-objects, converts non-instanceof Long:
317
+
318
+ return fromBits(val.low, val.high, typeof unsigned === 'boolean' ? unsigned : val.unsigned);
319
+ }
320
+ /**
321
+ * Converts the specified value to a Long using the appropriate from* function for its type.
322
+ * @function
323
+ * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val Value
324
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
325
+ * @returns {!Long}
326
+ */
327
+
328
+
329
+ Long.fromValue = fromValue; // NOTE: the compiler should inline these constant values below and then remove these variables, so there should be
330
+ // no runtime penalty for these.
331
+
332
+ /**
333
+ * @type {number}
334
+ * @const
335
+ * @inner
336
+ */
337
+
338
+ var TWO_PWR_16_DBL = 1 << 16;
339
+ /**
340
+ * @type {number}
341
+ * @const
342
+ * @inner
343
+ */
344
+
345
+ var TWO_PWR_24_DBL = 1 << 24;
346
+ /**
347
+ * @type {number}
348
+ * @const
349
+ * @inner
350
+ */
351
+
352
+ var TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;
353
+ /**
354
+ * @type {number}
355
+ * @const
356
+ * @inner
357
+ */
358
+
359
+ var TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;
360
+ /**
361
+ * @type {number}
362
+ * @const
363
+ * @inner
364
+ */
365
+
366
+ var TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;
367
+ /**
368
+ * @type {!Long}
369
+ * @const
370
+ * @inner
371
+ */
372
+
373
+ var TWO_PWR_24 = fromInt(TWO_PWR_24_DBL);
374
+ /**
375
+ * @type {!Long}
376
+ * @inner
377
+ */
378
+
379
+ var ZERO = fromInt(0);
380
+ /**
381
+ * Signed zero.
382
+ * @type {!Long}
383
+ */
384
+
385
+ Long.ZERO = ZERO;
386
+ /**
387
+ * @type {!Long}
388
+ * @inner
389
+ */
390
+
391
+ var UZERO = fromInt(0, true);
392
+ /**
393
+ * Unsigned zero.
394
+ * @type {!Long}
395
+ */
396
+
397
+ Long.UZERO = UZERO;
398
+ /**
399
+ * @type {!Long}
400
+ * @inner
401
+ */
402
+
403
+ var ONE = fromInt(1);
404
+ /**
405
+ * Signed one.
406
+ * @type {!Long}
407
+ */
408
+
409
+ Long.ONE = ONE;
410
+ /**
411
+ * @type {!Long}
412
+ * @inner
413
+ */
414
+
415
+ var UONE = fromInt(1, true);
416
+ /**
417
+ * Unsigned one.
418
+ * @type {!Long}
419
+ */
420
+
421
+ Long.UONE = UONE;
422
+ /**
423
+ * @type {!Long}
424
+ * @inner
425
+ */
426
+
427
+ var NEG_ONE = fromInt(-1);
428
+ /**
429
+ * Signed negative one.
430
+ * @type {!Long}
431
+ */
432
+
433
+ Long.NEG_ONE = NEG_ONE;
434
+ /**
435
+ * @type {!Long}
436
+ * @inner
437
+ */
438
+
439
+ var MAX_VALUE = fromBits(0xFFFFFFFF | 0, 0x7FFFFFFF | 0, false);
440
+ /**
441
+ * Maximum signed value.
442
+ * @type {!Long}
443
+ */
444
+
445
+ Long.MAX_VALUE = MAX_VALUE;
446
+ /**
447
+ * @type {!Long}
448
+ * @inner
449
+ */
450
+
451
+ var MAX_UNSIGNED_VALUE = fromBits(0xFFFFFFFF | 0, 0xFFFFFFFF | 0, true);
452
+ /**
453
+ * Maximum unsigned value.
454
+ * @type {!Long}
455
+ */
456
+
457
+ Long.MAX_UNSIGNED_VALUE = MAX_UNSIGNED_VALUE;
458
+ /**
459
+ * @type {!Long}
460
+ * @inner
461
+ */
462
+
463
+ var MIN_VALUE = fromBits(0, 0x80000000 | 0, false);
464
+ /**
465
+ * Minimum signed value.
466
+ * @type {!Long}
467
+ */
468
+
469
+ Long.MIN_VALUE = MIN_VALUE;
470
+ /**
471
+ * @alias Long.prototype
472
+ * @inner
473
+ */
474
+
475
+ var LongPrototype = Long.prototype;
476
+ /**
477
+ * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.
478
+ * @this {!Long}
479
+ * @returns {number}
480
+ */
481
+
482
+ LongPrototype.toInt = function toInt() {
483
+ return this.unsigned ? this.low >>> 0 : this.low;
484
+ };
485
+ /**
486
+ * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).
487
+ * @this {!Long}
488
+ * @returns {number}
489
+ */
490
+
491
+
492
+ LongPrototype.toNumber = function toNumber() {
493
+ if (this.unsigned) return (this.high >>> 0) * TWO_PWR_32_DBL + (this.low >>> 0);
494
+ return this.high * TWO_PWR_32_DBL + (this.low >>> 0);
495
+ };
496
+ /**
497
+ * Converts the Long to a string written in the specified radix.
498
+ * @this {!Long}
499
+ * @param {number=} radix Radix (2-36), defaults to 10
500
+ * @returns {string}
501
+ * @override
502
+ * @throws {RangeError} If `radix` is out of range
503
+ */
504
+
505
+
506
+ LongPrototype.toString = function toString(radix) {
507
+ radix = radix || 10;
508
+ if (radix < 2 || 36 < radix) throw RangeError('radix');
509
+ if (this.isZero()) return '0';
510
+
511
+ if (this.isNegative()) {
512
+ // Unsigned Longs are never negative
513
+ if (this.eq(MIN_VALUE)) {
514
+ // We need to change the Long value before it can be negated, so we remove
515
+ // the bottom-most digit in this base and then recurse to do the rest.
516
+ var radixLong = fromNumber(radix),
517
+ div = this.div(radixLong),
518
+ rem1 = div.mul(radixLong).sub(this);
519
+ return div.toString(radix) + rem1.toInt().toString(radix);
520
+ } else return '-' + this.neg().toString(radix);
521
+ } // Do several (6) digits each time through the loop, so as to
522
+ // minimize the calls to the very expensive emulated div.
523
+
524
+
525
+ var radixToPower = fromNumber(pow_dbl(radix, 6), this.unsigned),
526
+ rem = this;
527
+ var result = '';
528
+
529
+ while (true) {
530
+ var remDiv = rem.div(radixToPower),
531
+ intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0,
532
+ digits = intval.toString(radix);
533
+ rem = remDiv;
534
+ if (rem.isZero()) return digits + result;else {
535
+ while (digits.length < 6) digits = '0' + digits;
536
+
537
+ result = '' + digits + result;
538
+ }
539
+ }
540
+ };
541
+ /**
542
+ * Gets the high 32 bits as a signed integer.
543
+ * @this {!Long}
544
+ * @returns {number} Signed high bits
545
+ */
546
+
547
+
548
+ LongPrototype.getHighBits = function getHighBits() {
549
+ return this.high;
550
+ };
551
+ /**
552
+ * Gets the high 32 bits as an unsigned integer.
553
+ * @this {!Long}
554
+ * @returns {number} Unsigned high bits
555
+ */
556
+
557
+
558
+ LongPrototype.getHighBitsUnsigned = function getHighBitsUnsigned() {
559
+ return this.high >>> 0;
560
+ };
561
+ /**
562
+ * Gets the low 32 bits as a signed integer.
563
+ * @this {!Long}
564
+ * @returns {number} Signed low bits
565
+ */
566
+
567
+
568
+ LongPrototype.getLowBits = function getLowBits() {
569
+ return this.low;
570
+ };
571
+ /**
572
+ * Gets the low 32 bits as an unsigned integer.
573
+ * @this {!Long}
574
+ * @returns {number} Unsigned low bits
575
+ */
576
+
577
+
578
+ LongPrototype.getLowBitsUnsigned = function getLowBitsUnsigned() {
579
+ return this.low >>> 0;
580
+ };
581
+ /**
582
+ * Gets the number of bits needed to represent the absolute value of this Long.
583
+ * @this {!Long}
584
+ * @returns {number}
585
+ */
586
+
587
+
588
+ LongPrototype.getNumBitsAbs = function getNumBitsAbs() {
589
+ if (this.isNegative()) // Unsigned Longs are never negative
590
+ return this.eq(MIN_VALUE) ? 64 : this.neg().getNumBitsAbs();
591
+ var val = this.high != 0 ? this.high : this.low;
592
+
593
+ for (var bit = 31; bit > 0; bit--) if ((val & 1 << bit) != 0) break;
594
+
595
+ return this.high != 0 ? bit + 33 : bit + 1;
596
+ };
597
+ /**
598
+ * Tests if this Long's value equals zero.
599
+ * @this {!Long}
600
+ * @returns {boolean}
601
+ */
602
+
603
+
604
+ LongPrototype.isZero = function isZero() {
605
+ return this.high === 0 && this.low === 0;
606
+ };
607
+ /**
608
+ * Tests if this Long's value equals zero. This is an alias of {@link Long#isZero}.
609
+ * @returns {boolean}
610
+ */
611
+
612
+
613
+ LongPrototype.eqz = LongPrototype.isZero;
614
+ /**
615
+ * Tests if this Long's value is negative.
616
+ * @this {!Long}
617
+ * @returns {boolean}
618
+ */
619
+
620
+ LongPrototype.isNegative = function isNegative() {
621
+ return !this.unsigned && this.high < 0;
622
+ };
623
+ /**
624
+ * Tests if this Long's value is positive or zero.
625
+ * @this {!Long}
626
+ * @returns {boolean}
627
+ */
628
+
629
+
630
+ LongPrototype.isPositive = function isPositive() {
631
+ return this.unsigned || this.high >= 0;
632
+ };
633
+ /**
634
+ * Tests if this Long's value is odd.
635
+ * @this {!Long}
636
+ * @returns {boolean}
637
+ */
638
+
639
+
640
+ LongPrototype.isOdd = function isOdd() {
641
+ return (this.low & 1) === 1;
642
+ };
643
+ /**
644
+ * Tests if this Long's value is even.
645
+ * @this {!Long}
646
+ * @returns {boolean}
647
+ */
648
+
649
+
650
+ LongPrototype.isEven = function isEven() {
651
+ return (this.low & 1) === 0;
652
+ };
653
+ /**
654
+ * Tests if this Long's value equals the specified's.
655
+ * @this {!Long}
656
+ * @param {!Long|number|string} other Other value
657
+ * @returns {boolean}
658
+ */
659
+
660
+
661
+ LongPrototype.equals = function equals(other) {
662
+ if (!isLong(other)) other = fromValue(other);
663
+ if (this.unsigned !== other.unsigned && this.high >>> 31 === 1 && other.high >>> 31 === 1) return false;
664
+ return this.high === other.high && this.low === other.low;
665
+ };
666
+ /**
667
+ * Tests if this Long's value equals the specified's. This is an alias of {@link Long#equals}.
668
+ * @function
669
+ * @param {!Long|number|string} other Other value
670
+ * @returns {boolean}
671
+ */
672
+
673
+
674
+ LongPrototype.eq = LongPrototype.equals;
675
+ /**
676
+ * Tests if this Long's value differs from the specified's.
677
+ * @this {!Long}
678
+ * @param {!Long|number|string} other Other value
679
+ * @returns {boolean}
680
+ */
681
+
682
+ LongPrototype.notEquals = function notEquals(other) {
683
+ return !this.eq(
684
+ /* validates */
685
+ other);
686
+ };
687
+ /**
688
+ * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.
689
+ * @function
690
+ * @param {!Long|number|string} other Other value
691
+ * @returns {boolean}
692
+ */
693
+
694
+
695
+ LongPrototype.neq = LongPrototype.notEquals;
696
+ /**
697
+ * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.
698
+ * @function
699
+ * @param {!Long|number|string} other Other value
700
+ * @returns {boolean}
701
+ */
702
+
703
+ LongPrototype.ne = LongPrototype.notEquals;
704
+ /**
705
+ * Tests if this Long's value is less than the specified's.
706
+ * @this {!Long}
707
+ * @param {!Long|number|string} other Other value
708
+ * @returns {boolean}
709
+ */
710
+
711
+ LongPrototype.lessThan = function lessThan(other) {
712
+ return this.comp(
713
+ /* validates */
714
+ other) < 0;
715
+ };
716
+ /**
717
+ * Tests if this Long's value is less than the specified's. This is an alias of {@link Long#lessThan}.
718
+ * @function
719
+ * @param {!Long|number|string} other Other value
720
+ * @returns {boolean}
721
+ */
722
+
723
+
724
+ LongPrototype.lt = LongPrototype.lessThan;
725
+ /**
726
+ * Tests if this Long's value is less than or equal the specified's.
727
+ * @this {!Long}
728
+ * @param {!Long|number|string} other Other value
729
+ * @returns {boolean}
730
+ */
731
+
732
+ LongPrototype.lessThanOrEqual = function lessThanOrEqual(other) {
733
+ return this.comp(
734
+ /* validates */
735
+ other) <= 0;
736
+ };
737
+ /**
738
+ * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.
739
+ * @function
740
+ * @param {!Long|number|string} other Other value
741
+ * @returns {boolean}
742
+ */
743
+
744
+
745
+ LongPrototype.lte = LongPrototype.lessThanOrEqual;
746
+ /**
747
+ * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.
748
+ * @function
749
+ * @param {!Long|number|string} other Other value
750
+ * @returns {boolean}
751
+ */
752
+
753
+ LongPrototype.le = LongPrototype.lessThanOrEqual;
754
+ /**
755
+ * Tests if this Long's value is greater than the specified's.
756
+ * @this {!Long}
757
+ * @param {!Long|number|string} other Other value
758
+ * @returns {boolean}
759
+ */
760
+
761
+ LongPrototype.greaterThan = function greaterThan(other) {
762
+ return this.comp(
763
+ /* validates */
764
+ other) > 0;
765
+ };
766
+ /**
767
+ * Tests if this Long's value is greater than the specified's. This is an alias of {@link Long#greaterThan}.
768
+ * @function
769
+ * @param {!Long|number|string} other Other value
770
+ * @returns {boolean}
771
+ */
772
+
773
+
774
+ LongPrototype.gt = LongPrototype.greaterThan;
775
+ /**
776
+ * Tests if this Long's value is greater than or equal the specified's.
777
+ * @this {!Long}
778
+ * @param {!Long|number|string} other Other value
779
+ * @returns {boolean}
780
+ */
781
+
782
+ LongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) {
783
+ return this.comp(
784
+ /* validates */
785
+ other) >= 0;
786
+ };
787
+ /**
788
+ * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.
789
+ * @function
790
+ * @param {!Long|number|string} other Other value
791
+ * @returns {boolean}
792
+ */
793
+
794
+
795
+ LongPrototype.gte = LongPrototype.greaterThanOrEqual;
796
+ /**
797
+ * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.
798
+ * @function
799
+ * @param {!Long|number|string} other Other value
800
+ * @returns {boolean}
801
+ */
802
+
803
+ LongPrototype.ge = LongPrototype.greaterThanOrEqual;
804
+ /**
805
+ * Compares this Long's value with the specified's.
806
+ * @this {!Long}
807
+ * @param {!Long|number|string} other Other value
808
+ * @returns {number} 0 if they are the same, 1 if the this is greater and -1
809
+ * if the given one is greater
810
+ */
811
+
812
+ LongPrototype.compare = function compare(other) {
813
+ if (!isLong(other)) other = fromValue(other);
814
+ if (this.eq(other)) return 0;
815
+ var thisNeg = this.isNegative(),
816
+ otherNeg = other.isNegative();
817
+ if (thisNeg && !otherNeg) return -1;
818
+ if (!thisNeg && otherNeg) return 1; // At this point the sign bits are the same
819
+
820
+ if (!this.unsigned) return this.sub(other).isNegative() ? -1 : 1; // Both are positive if at least one is unsigned
821
+
822
+ return other.high >>> 0 > this.high >>> 0 || other.high === this.high && other.low >>> 0 > this.low >>> 0 ? -1 : 1;
823
+ };
824
+ /**
825
+ * Compares this Long's value with the specified's. This is an alias of {@link Long#compare}.
826
+ * @function
827
+ * @param {!Long|number|string} other Other value
828
+ * @returns {number} 0 if they are the same, 1 if the this is greater and -1
829
+ * if the given one is greater
830
+ */
831
+
832
+
833
+ LongPrototype.comp = LongPrototype.compare;
834
+ /**
835
+ * Negates this Long's value.
836
+ * @this {!Long}
837
+ * @returns {!Long} Negated Long
838
+ */
839
+
840
+ LongPrototype.negate = function negate() {
841
+ if (!this.unsigned && this.eq(MIN_VALUE)) return MIN_VALUE;
842
+ return this.not().add(ONE);
843
+ };
844
+ /**
845
+ * Negates this Long's value. This is an alias of {@link Long#negate}.
846
+ * @function
847
+ * @returns {!Long} Negated Long
848
+ */
849
+
850
+
851
+ LongPrototype.neg = LongPrototype.negate;
852
+ /**
853
+ * Returns the sum of this and the specified Long.
854
+ * @this {!Long}
855
+ * @param {!Long|number|string} addend Addend
856
+ * @returns {!Long} Sum
857
+ */
858
+
859
+ LongPrototype.add = function add(addend) {
860
+ if (!isLong(addend)) addend = fromValue(addend); // Divide each number into 4 chunks of 16 bits, and then sum the chunks.
861
+
862
+ var a48 = this.high >>> 16;
863
+ var a32 = this.high & 0xFFFF;
864
+ var a16 = this.low >>> 16;
865
+ var a00 = this.low & 0xFFFF;
866
+ var b48 = addend.high >>> 16;
867
+ var b32 = addend.high & 0xFFFF;
868
+ var b16 = addend.low >>> 16;
869
+ var b00 = addend.low & 0xFFFF;
870
+ var c48 = 0,
871
+ c32 = 0,
872
+ c16 = 0,
873
+ c00 = 0;
874
+ c00 += a00 + b00;
875
+ c16 += c00 >>> 16;
876
+ c00 &= 0xFFFF;
877
+ c16 += a16 + b16;
878
+ c32 += c16 >>> 16;
879
+ c16 &= 0xFFFF;
880
+ c32 += a32 + b32;
881
+ c48 += c32 >>> 16;
882
+ c32 &= 0xFFFF;
883
+ c48 += a48 + b48;
884
+ c48 &= 0xFFFF;
885
+ return fromBits(c16 << 16 | c00, c48 << 16 | c32, this.unsigned);
886
+ };
887
+ /**
888
+ * Returns the difference of this and the specified Long.
889
+ * @this {!Long}
890
+ * @param {!Long|number|string} subtrahend Subtrahend
891
+ * @returns {!Long} Difference
892
+ */
893
+
894
+
895
+ LongPrototype.subtract = function subtract(subtrahend) {
896
+ if (!isLong(subtrahend)) subtrahend = fromValue(subtrahend);
897
+ return this.add(subtrahend.neg());
898
+ };
899
+ /**
900
+ * Returns the difference of this and the specified Long. This is an alias of {@link Long#subtract}.
901
+ * @function
902
+ * @param {!Long|number|string} subtrahend Subtrahend
903
+ * @returns {!Long} Difference
904
+ */
905
+
906
+
907
+ LongPrototype.sub = LongPrototype.subtract;
908
+ /**
909
+ * Returns the product of this and the specified Long.
910
+ * @this {!Long}
911
+ * @param {!Long|number|string} multiplier Multiplier
912
+ * @returns {!Long} Product
913
+ */
914
+
915
+ LongPrototype.multiply = function multiply(multiplier) {
916
+ if (this.isZero()) return this;
917
+ if (!isLong(multiplier)) multiplier = fromValue(multiplier); // use wasm support if present
918
+
919
+ if (wasm) {
920
+ var low = wasm["mul"](this.low, this.high, multiplier.low, multiplier.high);
921
+ return fromBits(low, wasm["get_high"](), this.unsigned);
922
+ }
923
+
924
+ if (multiplier.isZero()) return this.unsigned ? UZERO : ZERO;
925
+ if (this.eq(MIN_VALUE)) return multiplier.isOdd() ? MIN_VALUE : ZERO;
926
+ if (multiplier.eq(MIN_VALUE)) return this.isOdd() ? MIN_VALUE : ZERO;
927
+
928
+ if (this.isNegative()) {
929
+ if (multiplier.isNegative()) return this.neg().mul(multiplier.neg());else return this.neg().mul(multiplier).neg();
930
+ } else if (multiplier.isNegative()) return this.mul(multiplier.neg()).neg(); // If both longs are small, use float multiplication
931
+
932
+
933
+ if (this.lt(TWO_PWR_24) && multiplier.lt(TWO_PWR_24)) return fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned); // Divide each long into 4 chunks of 16 bits, and then add up 4x4 products.
934
+ // We can skip products that would overflow.
935
+
936
+ var a48 = this.high >>> 16;
937
+ var a32 = this.high & 0xFFFF;
938
+ var a16 = this.low >>> 16;
939
+ var a00 = this.low & 0xFFFF;
940
+ var b48 = multiplier.high >>> 16;
941
+ var b32 = multiplier.high & 0xFFFF;
942
+ var b16 = multiplier.low >>> 16;
943
+ var b00 = multiplier.low & 0xFFFF;
944
+ var c48 = 0,
945
+ c32 = 0,
946
+ c16 = 0,
947
+ c00 = 0;
948
+ c00 += a00 * b00;
949
+ c16 += c00 >>> 16;
950
+ c00 &= 0xFFFF;
951
+ c16 += a16 * b00;
952
+ c32 += c16 >>> 16;
953
+ c16 &= 0xFFFF;
954
+ c16 += a00 * b16;
955
+ c32 += c16 >>> 16;
956
+ c16 &= 0xFFFF;
957
+ c32 += a32 * b00;
958
+ c48 += c32 >>> 16;
959
+ c32 &= 0xFFFF;
960
+ c32 += a16 * b16;
961
+ c48 += c32 >>> 16;
962
+ c32 &= 0xFFFF;
963
+ c32 += a00 * b32;
964
+ c48 += c32 >>> 16;
965
+ c32 &= 0xFFFF;
966
+ c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;
967
+ c48 &= 0xFFFF;
968
+ return fromBits(c16 << 16 | c00, c48 << 16 | c32, this.unsigned);
969
+ };
970
+ /**
971
+ * Returns the product of this and the specified Long. This is an alias of {@link Long#multiply}.
972
+ * @function
973
+ * @param {!Long|number|string} multiplier Multiplier
974
+ * @returns {!Long} Product
975
+ */
976
+
977
+
978
+ LongPrototype.mul = LongPrototype.multiply;
979
+ /**
980
+ * Returns this Long divided by the specified. The result is signed if this Long is signed or
981
+ * unsigned if this Long is unsigned.
982
+ * @this {!Long}
983
+ * @param {!Long|number|string} divisor Divisor
984
+ * @returns {!Long} Quotient
985
+ */
986
+
987
+ LongPrototype.divide = function divide(divisor) {
988
+ if (!isLong(divisor)) divisor = fromValue(divisor);
989
+ if (divisor.isZero()) throw Error('division by zero'); // use wasm support if present
990
+
991
+ if (wasm) {
992
+ // guard against signed division overflow: the largest
993
+ // negative number / -1 would be 1 larger than the largest
994
+ // positive number, due to two's complement.
995
+ if (!this.unsigned && this.high === -0x80000000 && divisor.low === -1 && divisor.high === -1) {
996
+ // be consistent with non-wasm code path
997
+ return this;
998
+ }
999
+
1000
+ var low = (this.unsigned ? wasm["div_u"] : wasm["div_s"])(this.low, this.high, divisor.low, divisor.high);
1001
+ return fromBits(low, wasm["get_high"](), this.unsigned);
1002
+ }
1003
+
1004
+ if (this.isZero()) return this.unsigned ? UZERO : ZERO;
1005
+ var approx, rem, res;
1006
+
1007
+ if (!this.unsigned) {
1008
+ // This section is only relevant for signed longs and is derived from the
1009
+ // closure library as a whole.
1010
+ if (this.eq(MIN_VALUE)) {
1011
+ if (divisor.eq(ONE) || divisor.eq(NEG_ONE)) return MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE
1012
+ else if (divisor.eq(MIN_VALUE)) return ONE;else {
1013
+ // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.
1014
+ var halfThis = this.shr(1);
1015
+ approx = halfThis.div(divisor).shl(1);
1016
+
1017
+ if (approx.eq(ZERO)) {
1018
+ return divisor.isNegative() ? ONE : NEG_ONE;
1019
+ } else {
1020
+ rem = this.sub(divisor.mul(approx));
1021
+ res = approx.add(rem.div(divisor));
1022
+ return res;
1023
+ }
1024
+ }
1025
+ } else if (divisor.eq(MIN_VALUE)) return this.unsigned ? UZERO : ZERO;
1026
+
1027
+ if (this.isNegative()) {
1028
+ if (divisor.isNegative()) return this.neg().div(divisor.neg());
1029
+ return this.neg().div(divisor).neg();
1030
+ } else if (divisor.isNegative()) return this.div(divisor.neg()).neg();
1031
+
1032
+ res = ZERO;
1033
+ } else {
1034
+ // The algorithm below has not been made for unsigned longs. It's therefore
1035
+ // required to take special care of the MSB prior to running it.
1036
+ if (!divisor.unsigned) divisor = divisor.toUnsigned();
1037
+ if (divisor.gt(this)) return UZERO;
1038
+ if (divisor.gt(this.shru(1))) // 15 >>> 1 = 7 ; with divisor = 8 ; true
1039
+ return UONE;
1040
+ res = UZERO;
1041
+ } // Repeat the following until the remainder is less than other: find a
1042
+ // floating-point that approximates remainder / other *from below*, add this
1043
+ // into the result, and subtract it from the remainder. It is critical that
1044
+ // the approximate value is less than or equal to the real value so that the
1045
+ // remainder never becomes negative.
1046
+
1047
+
1048
+ rem = this;
1049
+
1050
+ while (rem.gte(divisor)) {
1051
+ // Approximate the result of division. This may be a little greater or
1052
+ // smaller than the actual value.
1053
+ approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber())); // We will tweak the approximate result by changing it in the 48-th digit or
1054
+ // the smallest non-fractional digit, whichever is larger.
1055
+
1056
+ var log2 = Math.ceil(Math.log(approx) / Math.LN2),
1057
+ delta = log2 <= 48 ? 1 : pow_dbl(2, log2 - 48),
1058
+ // Decrease the approximation until it is smaller than the remainder. Note
1059
+ // that if it is too large, the product overflows and is negative.
1060
+ approxRes = fromNumber(approx),
1061
+ approxRem = approxRes.mul(divisor);
1062
+
1063
+ while (approxRem.isNegative() || approxRem.gt(rem)) {
1064
+ approx -= delta;
1065
+ approxRes = fromNumber(approx, this.unsigned);
1066
+ approxRem = approxRes.mul(divisor);
1067
+ } // We know the answer can't be zero... and actually, zero would cause
1068
+ // infinite recursion since we would make no progress.
1069
+
1070
+
1071
+ if (approxRes.isZero()) approxRes = ONE;
1072
+ res = res.add(approxRes);
1073
+ rem = rem.sub(approxRem);
1074
+ }
1075
+
1076
+ return res;
1077
+ };
1078
+ /**
1079
+ * Returns this Long divided by the specified. This is an alias of {@link Long#divide}.
1080
+ * @function
1081
+ * @param {!Long|number|string} divisor Divisor
1082
+ * @returns {!Long} Quotient
1083
+ */
1084
+
1085
+
1086
+ LongPrototype.div = LongPrototype.divide;
1087
+ /**
1088
+ * Returns this Long modulo the specified.
1089
+ * @this {!Long}
1090
+ * @param {!Long|number|string} divisor Divisor
1091
+ * @returns {!Long} Remainder
1092
+ */
1093
+
1094
+ LongPrototype.modulo = function modulo(divisor) {
1095
+ if (!isLong(divisor)) divisor = fromValue(divisor); // use wasm support if present
1096
+
1097
+ if (wasm) {
1098
+ var low = (this.unsigned ? wasm["rem_u"] : wasm["rem_s"])(this.low, this.high, divisor.low, divisor.high);
1099
+ return fromBits(low, wasm["get_high"](), this.unsigned);
1100
+ }
1101
+
1102
+ return this.sub(this.div(divisor).mul(divisor));
1103
+ };
1104
+ /**
1105
+ * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.
1106
+ * @function
1107
+ * @param {!Long|number|string} divisor Divisor
1108
+ * @returns {!Long} Remainder
1109
+ */
1110
+
1111
+
1112
+ LongPrototype.mod = LongPrototype.modulo;
1113
+ /**
1114
+ * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.
1115
+ * @function
1116
+ * @param {!Long|number|string} divisor Divisor
1117
+ * @returns {!Long} Remainder
1118
+ */
1119
+
1120
+ LongPrototype.rem = LongPrototype.modulo;
1121
+ /**
1122
+ * Returns the bitwise NOT of this Long.
1123
+ * @this {!Long}
1124
+ * @returns {!Long}
1125
+ */
1126
+
1127
+ LongPrototype.not = function not() {
1128
+ return fromBits(~this.low, ~this.high, this.unsigned);
1129
+ };
1130
+ /**
1131
+ * Returns count leading zeros of this Long.
1132
+ * @this {!Long}
1133
+ * @returns {!number}
1134
+ */
1135
+
1136
+
1137
+ LongPrototype.countLeadingZeros = function countLeadingZeros() {
1138
+ return this.high ? Math.clz32(this.high) : Math.clz32(this.low) + 32;
1139
+ };
1140
+ /**
1141
+ * Returns count leading zeros. This is an alias of {@link Long#countLeadingZeros}.
1142
+ * @function
1143
+ * @param {!Long}
1144
+ * @returns {!number}
1145
+ */
1146
+
1147
+
1148
+ LongPrototype.clz = LongPrototype.countLeadingZeros;
1149
+ /**
1150
+ * Returns count trailing zeros of this Long.
1151
+ * @this {!Long}
1152
+ * @returns {!number}
1153
+ */
1154
+
1155
+ LongPrototype.countTrailingZeros = function countTrailingZeros() {
1156
+ return this.low ? ctz32(this.low) : ctz32(this.high) + 32;
1157
+ };
1158
+ /**
1159
+ * Returns count trailing zeros. This is an alias of {@link Long#countTrailingZeros}.
1160
+ * @function
1161
+ * @param {!Long}
1162
+ * @returns {!number}
1163
+ */
1164
+
1165
+
1166
+ LongPrototype.ctz = LongPrototype.countTrailingZeros;
1167
+ /**
1168
+ * Returns the bitwise AND of this Long and the specified.
1169
+ * @this {!Long}
1170
+ * @param {!Long|number|string} other Other Long
1171
+ * @returns {!Long}
1172
+ */
1173
+
1174
+ LongPrototype.and = function and(other) {
1175
+ if (!isLong(other)) other = fromValue(other);
1176
+ return fromBits(this.low & other.low, this.high & other.high, this.unsigned);
1177
+ };
1178
+ /**
1179
+ * Returns the bitwise OR of this Long and the specified.
1180
+ * @this {!Long}
1181
+ * @param {!Long|number|string} other Other Long
1182
+ * @returns {!Long}
1183
+ */
1184
+
1185
+
1186
+ LongPrototype.or = function or(other) {
1187
+ if (!isLong(other)) other = fromValue(other);
1188
+ return fromBits(this.low | other.low, this.high | other.high, this.unsigned);
1189
+ };
1190
+ /**
1191
+ * Returns the bitwise XOR of this Long and the given one.
1192
+ * @this {!Long}
1193
+ * @param {!Long|number|string} other Other Long
1194
+ * @returns {!Long}
1195
+ */
1196
+
1197
+
1198
+ LongPrototype.xor = function xor(other) {
1199
+ if (!isLong(other)) other = fromValue(other);
1200
+ return fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);
1201
+ };
1202
+ /**
1203
+ * Returns this Long with bits shifted to the left by the given amount.
1204
+ * @this {!Long}
1205
+ * @param {number|!Long} numBits Number of bits
1206
+ * @returns {!Long} Shifted Long
1207
+ */
1208
+
1209
+
1210
+ LongPrototype.shiftLeft = function shiftLeft(numBits) {
1211
+ if (isLong(numBits)) numBits = numBits.toInt();
1212
+ if ((numBits &= 63) === 0) return this;else if (numBits < 32) return fromBits(this.low << numBits, this.high << numBits | this.low >>> 32 - numBits, this.unsigned);else return fromBits(0, this.low << numBits - 32, this.unsigned);
1213
+ };
1214
+ /**
1215
+ * Returns this Long with bits shifted to the left by the given amount. This is an alias of {@link Long#shiftLeft}.
1216
+ * @function
1217
+ * @param {number|!Long} numBits Number of bits
1218
+ * @returns {!Long} Shifted Long
1219
+ */
1220
+
1221
+
1222
+ LongPrototype.shl = LongPrototype.shiftLeft;
1223
+ /**
1224
+ * Returns this Long with bits arithmetically shifted to the right by the given amount.
1225
+ * @this {!Long}
1226
+ * @param {number|!Long} numBits Number of bits
1227
+ * @returns {!Long} Shifted Long
1228
+ */
1229
+
1230
+ LongPrototype.shiftRight = function shiftRight(numBits) {
1231
+ if (isLong(numBits)) numBits = numBits.toInt();
1232
+ if ((numBits &= 63) === 0) return this;else if (numBits < 32) return fromBits(this.low >>> numBits | this.high << 32 - numBits, this.high >> numBits, this.unsigned);else return fromBits(this.high >> numBits - 32, this.high >= 0 ? 0 : -1, this.unsigned);
1233
+ };
1234
+ /**
1235
+ * Returns this Long with bits arithmetically shifted to the right by the given amount. This is an alias of {@link Long#shiftRight}.
1236
+ * @function
1237
+ * @param {number|!Long} numBits Number of bits
1238
+ * @returns {!Long} Shifted Long
1239
+ */
1240
+
1241
+
1242
+ LongPrototype.shr = LongPrototype.shiftRight;
1243
+ /**
1244
+ * Returns this Long with bits logically shifted to the right by the given amount.
1245
+ * @this {!Long}
1246
+ * @param {number|!Long} numBits Number of bits
1247
+ * @returns {!Long} Shifted Long
1248
+ */
1249
+
1250
+ LongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) {
1251
+ if (isLong(numBits)) numBits = numBits.toInt();
1252
+ if ((numBits &= 63) === 0) return this;
1253
+ if (numBits < 32) return fromBits(this.low >>> numBits | this.high << 32 - numBits, this.high >>> numBits, this.unsigned);
1254
+ if (numBits === 32) return fromBits(this.high, 0, this.unsigned);
1255
+ return fromBits(this.high >>> numBits - 32, 0, this.unsigned);
1256
+ };
1257
+ /**
1258
+ * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.
1259
+ * @function
1260
+ * @param {number|!Long} numBits Number of bits
1261
+ * @returns {!Long} Shifted Long
1262
+ */
1263
+
1264
+
1265
+ LongPrototype.shru = LongPrototype.shiftRightUnsigned;
1266
+ /**
1267
+ * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.
1268
+ * @function
1269
+ * @param {number|!Long} numBits Number of bits
1270
+ * @returns {!Long} Shifted Long
1271
+ */
1272
+
1273
+ LongPrototype.shr_u = LongPrototype.shiftRightUnsigned;
1274
+ /**
1275
+ * Returns this Long with bits rotated to the left by the given amount.
1276
+ * @this {!Long}
1277
+ * @param {number|!Long} numBits Number of bits
1278
+ * @returns {!Long} Rotated Long
1279
+ */
1280
+
1281
+ LongPrototype.rotateLeft = function rotateLeft(numBits) {
1282
+ var b;
1283
+ if (isLong(numBits)) numBits = numBits.toInt();
1284
+ if ((numBits &= 63) === 0) return this;
1285
+ if (numBits === 32) return fromBits(this.high, this.low, this.unsigned);
1286
+
1287
+ if (numBits < 32) {
1288
+ b = 32 - numBits;
1289
+ return fromBits(this.low << numBits | this.high >>> b, this.high << numBits | this.low >>> b, this.unsigned);
1290
+ }
1291
+
1292
+ numBits -= 32;
1293
+ b = 32 - numBits;
1294
+ return fromBits(this.high << numBits | this.low >>> b, this.low << numBits | this.high >>> b, this.unsigned);
1295
+ };
1296
+ /**
1297
+ * Returns this Long with bits rotated to the left by the given amount. This is an alias of {@link Long#rotateLeft}.
1298
+ * @function
1299
+ * @param {number|!Long} numBits Number of bits
1300
+ * @returns {!Long} Rotated Long
1301
+ */
1302
+
1303
+
1304
+ LongPrototype.rotl = LongPrototype.rotateLeft;
1305
+ /**
1306
+ * Returns this Long with bits rotated to the right by the given amount.
1307
+ * @this {!Long}
1308
+ * @param {number|!Long} numBits Number of bits
1309
+ * @returns {!Long} Rotated Long
1310
+ */
1311
+
1312
+ LongPrototype.rotateRight = function rotateRight(numBits) {
1313
+ var b;
1314
+ if (isLong(numBits)) numBits = numBits.toInt();
1315
+ if ((numBits &= 63) === 0) return this;
1316
+ if (numBits === 32) return fromBits(this.high, this.low, this.unsigned);
1317
+
1318
+ if (numBits < 32) {
1319
+ b = 32 - numBits;
1320
+ return fromBits(this.high << b | this.low >>> numBits, this.low << b | this.high >>> numBits, this.unsigned);
1321
+ }
1322
+
1323
+ numBits -= 32;
1324
+ b = 32 - numBits;
1325
+ return fromBits(this.low << b | this.high >>> numBits, this.high << b | this.low >>> numBits, this.unsigned);
1326
+ };
1327
+ /**
1328
+ * Returns this Long with bits rotated to the right by the given amount. This is an alias of {@link Long#rotateRight}.
1329
+ * @function
1330
+ * @param {number|!Long} numBits Number of bits
1331
+ * @returns {!Long} Rotated Long
1332
+ */
1333
+
1334
+
1335
+ LongPrototype.rotr = LongPrototype.rotateRight;
1336
+ /**
1337
+ * Converts this Long to signed.
1338
+ * @this {!Long}
1339
+ * @returns {!Long} Signed long
1340
+ */
1341
+
1342
+ LongPrototype.toSigned = function toSigned() {
1343
+ if (!this.unsigned) return this;
1344
+ return fromBits(this.low, this.high, false);
1345
+ };
1346
+ /**
1347
+ * Converts this Long to unsigned.
1348
+ * @this {!Long}
1349
+ * @returns {!Long} Unsigned long
1350
+ */
1351
+
1352
+
1353
+ LongPrototype.toUnsigned = function toUnsigned() {
1354
+ if (this.unsigned) return this;
1355
+ return fromBits(this.low, this.high, true);
1356
+ };
1357
+ /**
1358
+ * Converts this Long to its byte representation.
1359
+ * @param {boolean=} le Whether little or big endian, defaults to big endian
1360
+ * @this {!Long}
1361
+ * @returns {!Array.<number>} Byte representation
1362
+ */
1363
+
1364
+
1365
+ LongPrototype.toBytes = function toBytes(le) {
1366
+ return le ? this.toBytesLE() : this.toBytesBE();
1367
+ };
1368
+ /**
1369
+ * Converts this Long to its little endian byte representation.
1370
+ * @this {!Long}
1371
+ * @returns {!Array.<number>} Little endian byte representation
1372
+ */
1373
+
1374
+
1375
+ LongPrototype.toBytesLE = function toBytesLE() {
1376
+ var hi = this.high,
1377
+ lo = this.low;
1378
+ return [lo & 0xff, lo >>> 8 & 0xff, lo >>> 16 & 0xff, lo >>> 24, hi & 0xff, hi >>> 8 & 0xff, hi >>> 16 & 0xff, hi >>> 24];
1379
+ };
1380
+ /**
1381
+ * Converts this Long to its big endian byte representation.
1382
+ * @this {!Long}
1383
+ * @returns {!Array.<number>} Big endian byte representation
1384
+ */
1385
+
1386
+
1387
+ LongPrototype.toBytesBE = function toBytesBE() {
1388
+ var hi = this.high,
1389
+ lo = this.low;
1390
+ return [hi >>> 24, hi >>> 16 & 0xff, hi >>> 8 & 0xff, hi & 0xff, lo >>> 24, lo >>> 16 & 0xff, lo >>> 8 & 0xff, lo & 0xff];
1391
+ };
1392
+ /**
1393
+ * Creates a Long from its byte representation.
1394
+ * @param {!Array.<number>} bytes Byte representation
1395
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
1396
+ * @param {boolean=} le Whether little or big endian, defaults to big endian
1397
+ * @returns {Long} The corresponding Long value
1398
+ */
1399
+
1400
+
1401
+ Long.fromBytes = function fromBytes(bytes, unsigned, le) {
1402
+ return le ? Long.fromBytesLE(bytes, unsigned) : Long.fromBytesBE(bytes, unsigned);
1403
+ };
1404
+ /**
1405
+ * Creates a Long from its little endian byte representation.
1406
+ * @param {!Array.<number>} bytes Little endian byte representation
1407
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
1408
+ * @returns {Long} The corresponding Long value
1409
+ */
1410
+
1411
+
1412
+ Long.fromBytesLE = function fromBytesLE(bytes, unsigned) {
1413
+ return new Long(bytes[0] | bytes[1] << 8 | bytes[2] << 16 | bytes[3] << 24, bytes[4] | bytes[5] << 8 | bytes[6] << 16 | bytes[7] << 24, unsigned);
1414
+ };
1415
+ /**
1416
+ * Creates a Long from its big endian byte representation.
1417
+ * @param {!Array.<number>} bytes Big endian byte representation
1418
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
1419
+ * @returns {Long} The corresponding Long value
1420
+ */
1421
+
1422
+
1423
+ Long.fromBytesBE = function fromBytesBE(bytes, unsigned) {
1424
+ return new Long(bytes[4] << 24 | bytes[5] << 16 | bytes[6] << 8 | bytes[7], bytes[0] << 24 | bytes[1] << 16 | bytes[2] << 8 | bytes[3], unsigned);
1425
+ };
1426
+
1427
+ var _default = Long;
1428
+ exports.default = _default;
1429
+ return "default" in exports ? exports.default : exports;
1430
+ })({});
1431
+ if (typeof define === 'function' && define.amd) define([], function() { return Long; });
1432
+ else if (typeof module === 'object' && typeof exports === 'object') module.exports = Long;