timered-counter 1.0.0 → 1.1.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.
- package/custom-elements.json +253 -103
- package/dist/custom-elements.json +253 -103
- package/dist/decimal-js-number-adapter.esm-browser.js +9 -0
- package/dist/decimal-js-number-adapter.esm-browser.js.map +1 -0
- package/dist/decimal-js-number-adapter.global.js +10 -0
- package/dist/decimal-js-number-adapter.global.js.map +1 -0
- package/dist/grapheme-splitter-string-adapter.esm-browser.js +2 -0
- package/dist/grapheme-splitter-string-adapter.esm-browser.js.map +1 -0
- package/dist/grapheme-splitter-string-adapter.global.js +2 -0
- package/dist/grapheme-splitter-string-adapter.global.js.map +1 -0
- package/dist/src/index.d.ts +1 -5
- package/dist/src/index.js +1 -7
- package/dist/src/index.js.map +1 -1
- package/dist/src/mixins/counter-base.js +9 -9
- package/dist/src/mixins/counter-base.js.map +1 -1
- package/dist/src/number-adapter/decimal-js.d.ts +8 -1
- package/dist/src/number-adapter/decimal-js.js +7 -0
- package/dist/src/number-adapter/decimal-js.js.map +1 -1
- package/dist/src/number-adapter/index.d.ts +6 -4
- package/dist/src/number-adapter/index.js +7 -4
- package/dist/src/number-adapter/index.js.map +1 -1
- package/dist/src/string-adapter/grapheme-splitter.d.ts +7 -0
- package/dist/src/string-adapter/grapheme-splitter.js +7 -0
- package/dist/src/string-adapter/grapheme-splitter.js.map +1 -1
- package/dist/src/string-adapter/index.d.ts +6 -4
- package/dist/src/string-adapter/index.js +7 -4
- package/dist/src/string-adapter/index.js.map +1 -1
- package/dist/src/timered-counter-adapter.d.ts +65 -0
- package/dist/src/timered-counter-adapter.js +120 -0
- package/dist/src/timered-counter-adapter.js.map +1 -0
- package/dist/src/transitions/roller/roller-digit.js +3 -3
- package/dist/src/transitions/roller/roller-digit.js.map +1 -1
- package/dist/src/transitions/roller/roller.js +1 -1
- package/dist/src/transitions/roller/roller.js.map +1 -1
- package/dist/stories/timered-counter/decimaljs.stories.js +4 -2
- package/dist/stories/timered-counter/decimaljs.stories.js.map +1 -1
- package/dist/stories/timered-counter-number/decimaljs.stories.js +4 -2
- package/dist/stories/timered-counter-number/decimaljs.stories.js.map +1 -1
- package/dist/stories/timered-counter-string/decimaljs.stories.js +4 -2
- package/dist/stories/timered-counter-string/decimaljs.stories.js.map +1 -1
- package/dist/stories/timered-counter-string/grapheme-splitter.stories.js +7 -3
- package/dist/stories/timered-counter-string/grapheme-splitter.stories.js.map +1 -1
- package/dist/stories/timered-counter-string/intl-segmenter.stories.js +5 -3
- package/dist/stories/timered-counter-string/intl-segmenter.stories.js.map +1 -1
- package/dist/timered-counter.esm-browser.js +51 -58
- package/dist/timered-counter.esm-browser.js.map +1 -1
- package/dist/timered-counter.global.js +51 -58
- package/dist/timered-counter.global.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/dist/src/counter-adapter.d.ts +0 -38
- package/dist/src/counter-adapter.js +0 -71
- package/dist/src/counter-adapter.js.map +0 -1
@@ -4,13 +4,94 @@
|
|
4
4
|
"modules": [
|
5
5
|
{
|
6
6
|
"kind": "javascript-module",
|
7
|
-
"path": "src/
|
7
|
+
"path": "src/index.ts",
|
8
|
+
"declarations": [],
|
9
|
+
"exports": [
|
10
|
+
{
|
11
|
+
"kind": "js",
|
12
|
+
"name": "TimeredCounter",
|
13
|
+
"declaration": {
|
14
|
+
"name": "TimeredCounter",
|
15
|
+
"module": "src/index.ts"
|
16
|
+
}
|
17
|
+
},
|
18
|
+
{
|
19
|
+
"kind": "js",
|
20
|
+
"name": "TimeredCounterDatetimeDuration",
|
21
|
+
"declaration": {
|
22
|
+
"name": "TimeredCounterDatetimeDuration",
|
23
|
+
"module": "src/index.ts"
|
24
|
+
}
|
25
|
+
},
|
26
|
+
{
|
27
|
+
"kind": "js",
|
28
|
+
"name": "TimeredCounterNumber",
|
29
|
+
"declaration": {
|
30
|
+
"name": "TimeredCounterNumber",
|
31
|
+
"module": "src/index.ts"
|
32
|
+
}
|
33
|
+
},
|
34
|
+
{
|
35
|
+
"kind": "js",
|
36
|
+
"name": "TimeredCounterString",
|
37
|
+
"declaration": {
|
38
|
+
"name": "TimeredCounterString",
|
39
|
+
"module": "src/index.ts"
|
40
|
+
}
|
41
|
+
},
|
42
|
+
{
|
43
|
+
"kind": "js",
|
44
|
+
"name": "*",
|
45
|
+
"declaration": {
|
46
|
+
"name": "*",
|
47
|
+
"package": "./easing/index.js"
|
48
|
+
}
|
49
|
+
},
|
50
|
+
{
|
51
|
+
"kind": "js",
|
52
|
+
"name": "*",
|
53
|
+
"declaration": {
|
54
|
+
"name": "*",
|
55
|
+
"package": "./types/index.js"
|
56
|
+
}
|
57
|
+
},
|
58
|
+
{
|
59
|
+
"kind": "js",
|
60
|
+
"name": "*",
|
61
|
+
"declaration": {
|
62
|
+
"name": "*",
|
63
|
+
"package": "./timered-counter-adapter.js"
|
64
|
+
}
|
65
|
+
}
|
66
|
+
]
|
67
|
+
},
|
68
|
+
{
|
69
|
+
"kind": "javascript-module",
|
70
|
+
"path": "src/timered-counter-adapter.ts",
|
8
71
|
"declarations": [
|
9
72
|
{
|
10
73
|
"kind": "class",
|
11
74
|
"description": "",
|
12
|
-
"name": "
|
75
|
+
"name": "TimeredCounterAdapter",
|
13
76
|
"members": [
|
77
|
+
{
|
78
|
+
"kind": "field",
|
79
|
+
"name": "AVAILABLE_NUMBER_ADAPTERS",
|
80
|
+
"type": {
|
81
|
+
"text": "Map<string[], () => NumberAdapter>"
|
82
|
+
},
|
83
|
+
"static": true,
|
84
|
+
"default": "new Map([ [['number'], BuildInNumberAdapter], // [['decimal.js', 'decimaljs'], DecimalJsAdapter()], ])"
|
85
|
+
},
|
86
|
+
{
|
87
|
+
"kind": "field",
|
88
|
+
"name": "AVAILABLE_STRING_ADAPTERS",
|
89
|
+
"type": {
|
90
|
+
"text": "Map<string[], () => StringAdapter>"
|
91
|
+
},
|
92
|
+
"static": true,
|
93
|
+
"default": "new Map([ [['string'], BuildInStringAdapter], [['intl-segmenter'], BuildInIntlSegmenterAdapter], // [['grapheme-splitter'], GraphemeSplitterAdapter()], ])"
|
94
|
+
},
|
14
95
|
{
|
15
96
|
"kind": "field",
|
16
97
|
"name": "NUMBER_ADAPTER",
|
@@ -38,7 +119,7 @@
|
|
38
119
|
"text": "object"
|
39
120
|
},
|
40
121
|
"static": true,
|
41
|
-
"default": "{ fromAttribute(value: string | null) { return value; }, toAttribute(value: unknown) { return isNullish(value) ? value :
|
122
|
+
"default": "{ fromAttribute(value: string | null) { return value; }, toAttribute(value: unknown) { return isNullish(value) ? value : TimeredCounterAdapter.NUMBER_ADAPTER.toString(value); }, }",
|
42
123
|
"description": "将 value 及其相关的属性, 在 attribute 和 property 上的互相转换.",
|
43
124
|
"privacy": "protected"
|
44
125
|
},
|
@@ -50,76 +131,124 @@
|
|
50
131
|
{
|
51
132
|
"name": "adapterOrType",
|
52
133
|
"type": {
|
53
|
-
"text": "NumberAdapter | 'number' |
|
134
|
+
"text": "NumberAdapter | 'number' | string"
|
135
|
+
}
|
136
|
+
}
|
137
|
+
],
|
138
|
+
"description": "设置要使用的数字适配器. 仅对设置完之后的 TimeredCounter 实例生效.\n\n接受的关键字除了内置的 `number` 以外, 还可以通过 registerNumberAdapter 注册的 `keyword`."
|
139
|
+
},
|
140
|
+
{
|
141
|
+
"kind": "method",
|
142
|
+
"name": "setStringAdapter",
|
143
|
+
"static": true,
|
144
|
+
"parameters": [
|
145
|
+
{
|
146
|
+
"name": "adapterOrType",
|
147
|
+
"type": {
|
148
|
+
"text": "StringAdapter | 'string' | 'intl-segmenter' | string"
|
149
|
+
}
|
150
|
+
}
|
151
|
+
],
|
152
|
+
"description": "与 setNumberAdapter 类似, 用于设置字符串适配器."
|
153
|
+
},
|
154
|
+
{
|
155
|
+
"kind": "method",
|
156
|
+
"name": "registerNumberAdapter",
|
157
|
+
"static": true,
|
158
|
+
"parameters": [
|
159
|
+
{
|
160
|
+
"name": "keyword",
|
161
|
+
"type": {
|
162
|
+
"text": "string[]"
|
54
163
|
}
|
55
164
|
},
|
56
165
|
{
|
57
|
-
"name": "
|
58
|
-
"optional": true,
|
166
|
+
"name": "adapter",
|
59
167
|
"type": {
|
60
|
-
"text": "
|
168
|
+
"text": "() => NumberAdapter"
|
61
169
|
}
|
62
170
|
}
|
63
171
|
]
|
64
172
|
},
|
65
173
|
{
|
66
174
|
"kind": "method",
|
67
|
-
"name": "
|
175
|
+
"name": "registerStringAdapter",
|
68
176
|
"static": true,
|
69
177
|
"parameters": [
|
70
178
|
{
|
71
|
-
"name": "
|
179
|
+
"name": "keyword",
|
72
180
|
"type": {
|
73
|
-
"text": "
|
181
|
+
"text": "string[]"
|
182
|
+
}
|
183
|
+
},
|
184
|
+
{
|
185
|
+
"name": "adapter",
|
186
|
+
"type": {
|
187
|
+
"text": "() => StringAdapter"
|
74
188
|
}
|
75
189
|
}
|
76
190
|
]
|
191
|
+
},
|
192
|
+
{
|
193
|
+
"kind": "method",
|
194
|
+
"name": "registryAdapter",
|
195
|
+
"static": true,
|
196
|
+
"parameters": [
|
197
|
+
{
|
198
|
+
"name": "adapter",
|
199
|
+
"type": {
|
200
|
+
"text": "{\n register: (counterAdapter: typeof TimeredCounterAdapter) => void;\n }"
|
201
|
+
}
|
202
|
+
}
|
203
|
+
],
|
204
|
+
"description": "可以直接使用 adapter 文件的导出进行注册.\n\nadapter 文件需要导出一个名为 register 的函数, 该函数接受一个 TimeredCounterAdapter 类型的参数.\n\n具体示例请查看 GraphemeSplitterAdapter or DecimalJsAdapter."
|
77
205
|
}
|
78
206
|
]
|
79
|
-
}
|
80
|
-
],
|
81
|
-
"exports": [
|
82
|
-
{
|
83
|
-
"kind": "js",
|
84
|
-
"name": "CounterAdapter",
|
85
|
-
"declaration": {
|
86
|
-
"name": "CounterAdapter",
|
87
|
-
"module": "src/counter-adapter.ts"
|
88
|
-
}
|
89
|
-
}
|
90
|
-
]
|
91
|
-
},
|
92
|
-
{
|
93
|
-
"kind": "javascript-module",
|
94
|
-
"path": "src/index.ts",
|
95
|
-
"declarations": [
|
207
|
+
},
|
96
208
|
{
|
97
209
|
"kind": "function",
|
98
210
|
"name": "setNumberAdapter",
|
99
211
|
"parameters": [
|
100
212
|
{
|
101
|
-
"name": "
|
213
|
+
"name": "args",
|
102
214
|
"type": {
|
103
|
-
"text": "
|
215
|
+
"text": "Parameters<(typeof TimeredCounterAdapter)['setNumberAdapter']>"
|
104
216
|
}
|
105
|
-
}
|
217
|
+
}
|
218
|
+
]
|
219
|
+
},
|
220
|
+
{
|
221
|
+
"kind": "function",
|
222
|
+
"name": "setStringAdapter",
|
223
|
+
"parameters": [
|
106
224
|
{
|
107
|
-
"name": "
|
108
|
-
"optional": true,
|
225
|
+
"name": "args",
|
109
226
|
"type": {
|
110
|
-
"text": "
|
227
|
+
"text": "Parameters<(typeof TimeredCounterAdapter)['setStringAdapter']>"
|
111
228
|
}
|
112
229
|
}
|
113
230
|
]
|
114
231
|
},
|
115
232
|
{
|
116
233
|
"kind": "function",
|
117
|
-
"name": "
|
234
|
+
"name": "registerNumberAdapter",
|
118
235
|
"parameters": [
|
119
236
|
{
|
120
|
-
"name": "
|
237
|
+
"name": "args",
|
121
238
|
"type": {
|
122
|
-
"text": "
|
239
|
+
"text": "Parameters<(typeof TimeredCounterAdapter)['registerNumberAdapter']>"
|
240
|
+
}
|
241
|
+
}
|
242
|
+
]
|
243
|
+
},
|
244
|
+
{
|
245
|
+
"kind": "function",
|
246
|
+
"name": "registerStringAdapter",
|
247
|
+
"parameters": [
|
248
|
+
{
|
249
|
+
"name": "args",
|
250
|
+
"type": {
|
251
|
+
"text": "Parameters<(typeof TimeredCounterAdapter)['registerStringAdapter']>"
|
123
252
|
}
|
124
253
|
}
|
125
254
|
]
|
@@ -128,66 +257,42 @@
|
|
128
257
|
"exports": [
|
129
258
|
{
|
130
259
|
"kind": "js",
|
131
|
-
"name": "
|
132
|
-
"declaration": {
|
133
|
-
"name": "setNumberAdapter",
|
134
|
-
"module": "src/index.ts"
|
135
|
-
}
|
136
|
-
},
|
137
|
-
{
|
138
|
-
"kind": "js",
|
139
|
-
"name": "setStringAdapter",
|
260
|
+
"name": "TimeredCounterAdapter",
|
140
261
|
"declaration": {
|
141
|
-
"name": "
|
142
|
-
"module": "src/
|
262
|
+
"name": "TimeredCounterAdapter",
|
263
|
+
"module": "src/timered-counter-adapter.ts"
|
143
264
|
}
|
144
265
|
},
|
145
266
|
{
|
146
267
|
"kind": "js",
|
147
|
-
"name": "
|
148
|
-
"declaration": {
|
149
|
-
"name": "TimeredCounter",
|
150
|
-
"module": "src/index.ts"
|
151
|
-
}
|
152
|
-
},
|
153
|
-
{
|
154
|
-
"kind": "js",
|
155
|
-
"name": "TimeredCounterDatetimeDuration",
|
156
|
-
"declaration": {
|
157
|
-
"name": "TimeredCounterDatetimeDuration",
|
158
|
-
"module": "src/index.ts"
|
159
|
-
}
|
160
|
-
},
|
161
|
-
{
|
162
|
-
"kind": "js",
|
163
|
-
"name": "TimeredCounterNumber",
|
268
|
+
"name": "setNumberAdapter",
|
164
269
|
"declaration": {
|
165
|
-
"name": "
|
166
|
-
"module": "src/
|
270
|
+
"name": "setNumberAdapter",
|
271
|
+
"module": "src/timered-counter-adapter.ts"
|
167
272
|
}
|
168
273
|
},
|
169
274
|
{
|
170
275
|
"kind": "js",
|
171
|
-
"name": "
|
276
|
+
"name": "setStringAdapter",
|
172
277
|
"declaration": {
|
173
|
-
"name": "
|
174
|
-
"module": "src/
|
278
|
+
"name": "setStringAdapter",
|
279
|
+
"module": "src/timered-counter-adapter.ts"
|
175
280
|
}
|
176
281
|
},
|
177
282
|
{
|
178
283
|
"kind": "js",
|
179
|
-
"name": "
|
284
|
+
"name": "registerNumberAdapter",
|
180
285
|
"declaration": {
|
181
|
-
"name": "
|
182
|
-
"
|
286
|
+
"name": "registerNumberAdapter",
|
287
|
+
"module": "src/timered-counter-adapter.ts"
|
183
288
|
}
|
184
289
|
},
|
185
290
|
{
|
186
291
|
"kind": "js",
|
187
|
-
"name": "
|
292
|
+
"name": "registerStringAdapter",
|
188
293
|
"declaration": {
|
189
|
-
"name": "
|
190
|
-
"
|
294
|
+
"name": "registerStringAdapter",
|
295
|
+
"module": "src/timered-counter-adapter.ts"
|
191
296
|
}
|
192
297
|
}
|
193
298
|
]
|
@@ -5454,9 +5559,36 @@
|
|
5454
5559
|
"default": "{ precision: 1e3 }"
|
5455
5560
|
}
|
5456
5561
|
]
|
5562
|
+
},
|
5563
|
+
{
|
5564
|
+
"kind": "function",
|
5565
|
+
"name": "register",
|
5566
|
+
"parameters": [
|
5567
|
+
{
|
5568
|
+
"name": "counterAdapter",
|
5569
|
+
"type": {
|
5570
|
+
"text": "typeof TimeredCounterAdapter"
|
5571
|
+
}
|
5572
|
+
},
|
5573
|
+
{
|
5574
|
+
"name": "config",
|
5575
|
+
"optional": true,
|
5576
|
+
"type": {
|
5577
|
+
"text": "Decimal.Config"
|
5578
|
+
}
|
5579
|
+
}
|
5580
|
+
]
|
5457
5581
|
}
|
5458
5582
|
],
|
5459
5583
|
"exports": [
|
5584
|
+
{
|
5585
|
+
"kind": "js",
|
5586
|
+
"name": "register",
|
5587
|
+
"declaration": {
|
5588
|
+
"name": "register",
|
5589
|
+
"module": "src/number-adapter/decimal-js.ts"
|
5590
|
+
}
|
5591
|
+
},
|
5460
5592
|
{
|
5461
5593
|
"kind": "js",
|
5462
5594
|
"name": "DecimalJsAdapter",
|
@@ -5464,6 +5596,13 @@
|
|
5464
5596
|
"name": "DecimalJsAdapter",
|
5465
5597
|
"module": "src/number-adapter/decimal-js.ts"
|
5466
5598
|
}
|
5599
|
+
},
|
5600
|
+
{
|
5601
|
+
"kind": "js",
|
5602
|
+
"name": "default",
|
5603
|
+
"declaration": {
|
5604
|
+
"module": "src/number-adapter/decimal-js.ts"
|
5605
|
+
}
|
5467
5606
|
}
|
5468
5607
|
]
|
5469
5608
|
},
|
@@ -5477,7 +5616,7 @@
|
|
5477
5616
|
"name": "*",
|
5478
5617
|
"declaration": {
|
5479
5618
|
"name": "*",
|
5480
|
-
"package": "
|
5619
|
+
"package": "./types.js"
|
5481
5620
|
}
|
5482
5621
|
},
|
5483
5622
|
{
|
@@ -5485,7 +5624,7 @@
|
|
5485
5624
|
"name": "*",
|
5486
5625
|
"declaration": {
|
5487
5626
|
"name": "*",
|
5488
|
-
"package": "
|
5627
|
+
"package": "./build-in-number.js"
|
5489
5628
|
}
|
5490
5629
|
},
|
5491
5630
|
{
|
@@ -5493,15 +5632,7 @@
|
|
5493
5632
|
"name": "*",
|
5494
5633
|
"declaration": {
|
5495
5634
|
"name": "*",
|
5496
|
-
"package": "
|
5497
|
-
}
|
5498
|
-
},
|
5499
|
-
{
|
5500
|
-
"kind": "js",
|
5501
|
-
"name": "*",
|
5502
|
-
"declaration": {
|
5503
|
-
"name": "*",
|
5504
|
-
"package": "\"./decimal-js.js\""
|
5635
|
+
"package": "./build-in-bigint.js"
|
5505
5636
|
}
|
5506
5637
|
}
|
5507
5638
|
]
|
@@ -5568,9 +5699,29 @@
|
|
5568
5699
|
"kind": "function",
|
5569
5700
|
"name": "GraphemeSplitterAdapter",
|
5570
5701
|
"description": "使用 `grapheme-splitter` 库的字符串适配器. 该适配器使用 `grapheme-splitter` 库将字符串转换为字符数组.\n\n要使用 GraphemeSplitterAdapter 需要安装 `grapheme-splitter`."
|
5702
|
+
},
|
5703
|
+
{
|
5704
|
+
"kind": "function",
|
5705
|
+
"name": "register",
|
5706
|
+
"parameters": [
|
5707
|
+
{
|
5708
|
+
"name": "counterAdapter",
|
5709
|
+
"type": {
|
5710
|
+
"text": "typeof TimeredCounterAdapter"
|
5711
|
+
}
|
5712
|
+
}
|
5713
|
+
]
|
5571
5714
|
}
|
5572
5715
|
],
|
5573
5716
|
"exports": [
|
5717
|
+
{
|
5718
|
+
"kind": "js",
|
5719
|
+
"name": "register",
|
5720
|
+
"declaration": {
|
5721
|
+
"name": "register",
|
5722
|
+
"module": "src/string-adapter/grapheme-splitter.ts"
|
5723
|
+
}
|
5724
|
+
},
|
5574
5725
|
{
|
5575
5726
|
"kind": "js",
|
5576
5727
|
"name": "GraphemeSplitterAdapter",
|
@@ -5578,6 +5729,13 @@
|
|
5578
5729
|
"name": "GraphemeSplitterAdapter",
|
5579
5730
|
"module": "src/string-adapter/grapheme-splitter.ts"
|
5580
5731
|
}
|
5732
|
+
},
|
5733
|
+
{
|
5734
|
+
"kind": "js",
|
5735
|
+
"name": "default",
|
5736
|
+
"declaration": {
|
5737
|
+
"module": "src/string-adapter/grapheme-splitter.ts"
|
5738
|
+
}
|
5581
5739
|
}
|
5582
5740
|
]
|
5583
5741
|
},
|
@@ -5591,15 +5749,7 @@
|
|
5591
5749
|
"name": "*",
|
5592
5750
|
"declaration": {
|
5593
5751
|
"name": "*",
|
5594
|
-
"package": "
|
5595
|
-
}
|
5596
|
-
},
|
5597
|
-
{
|
5598
|
-
"kind": "js",
|
5599
|
-
"name": "*",
|
5600
|
-
"declaration": {
|
5601
|
-
"name": "*",
|
5602
|
-
"package": "\"./build-in-string.js\""
|
5752
|
+
"package": "./types.js"
|
5603
5753
|
}
|
5604
5754
|
},
|
5605
5755
|
{
|
@@ -5607,7 +5757,7 @@
|
|
5607
5757
|
"name": "*",
|
5608
5758
|
"declaration": {
|
5609
5759
|
"name": "*",
|
5610
|
-
"package": "
|
5760
|
+
"package": "./build-in-string.js"
|
5611
5761
|
}
|
5612
5762
|
},
|
5613
5763
|
{
|
@@ -5615,7 +5765,7 @@
|
|
5615
5765
|
"name": "*",
|
5616
5766
|
"declaration": {
|
5617
5767
|
"name": "*",
|
5618
|
-
"package": "
|
5768
|
+
"package": "./build-in-intl-segmenter.js"
|
5619
5769
|
}
|
5620
5770
|
}
|
5621
5771
|
]
|
@@ -6862,7 +7012,7 @@
|
|
6862
7012
|
"type": {
|
6863
7013
|
"text": "Meta"
|
6864
7014
|
},
|
6865
|
-
"default": "{ title: 'TimeredCounter/with decimal.js', component: 'timered-counter', tags: ['autodocs', 'timered-counter'], parameters: { controls: { expanded: true }, }, beforeEach: () => { setNumberAdapter('decimal.js'); }, }"
|
7015
|
+
"default": "{ title: 'TimeredCounter/with decimal.js', component: 'timered-counter', tags: ['autodocs', 'timered-counter'], parameters: { controls: { expanded: true }, }, beforeEach: () => { TimeredCounterAdapter.registryAdapter(DecimalJsNumberAdapter); TimeredCounterAdapter.setNumberAdapter('decimal.js'); }, }"
|
6866
7016
|
},
|
6867
7017
|
{
|
6868
7018
|
"kind": "variable",
|
@@ -7118,7 +7268,7 @@
|
|
7118
7268
|
"type": {
|
7119
7269
|
"text": "Meta"
|
7120
7270
|
},
|
7121
|
-
"default": "{ title: 'TimeredCounterNumber/with decimal.js', component: 'timered-counter-number', tags: ['autodocs', 'timered-counter-number'], parameters: { controls: { expanded: true }, }, beforeEach: () => { setNumberAdapter('decimal.js'); }, }"
|
7271
|
+
"default": "{ title: 'TimeredCounterNumber/with decimal.js', component: 'timered-counter-number', tags: ['autodocs', 'timered-counter-number'], parameters: { controls: { expanded: true }, }, beforeEach: () => { TimeredCounterAdapter.registryAdapter(DecimalJsNumberAdapter); TimeredCounterAdapter.setNumberAdapter('decimal.js'); }, }"
|
7122
7272
|
},
|
7123
7273
|
{
|
7124
7274
|
"kind": "variable",
|
@@ -7302,7 +7452,7 @@
|
|
7302
7452
|
"type": {
|
7303
7453
|
"text": "Meta"
|
7304
7454
|
},
|
7305
|
-
"default": "{ title: 'TimeredCounterString/with decimal.js', component: 'timered-counter-string', tags: ['autodocs', 'timered-counter-string'], parameters: { controls: { expanded: true }, }, beforeEach: () => { setNumberAdapter('decimal.js'); }, }"
|
7455
|
+
"default": "{ title: 'TimeredCounterString/with decimal.js', component: 'timered-counter-string', tags: ['autodocs', 'timered-counter-string'], parameters: { controls: { expanded: true }, }, beforeEach: () => { TimeredCounterAdapter.registryAdapter(DecimalJsNumberAdapter); TimeredCounterAdapter.setNumberAdapter('decimal.js'); }, }"
|
7306
7456
|
},
|
7307
7457
|
{
|
7308
7458
|
"kind": "variable",
|
@@ -7390,7 +7540,7 @@
|
|
7390
7540
|
"type": {
|
7391
7541
|
"text": "Meta"
|
7392
7542
|
},
|
7393
|
-
"default": "{ title: 'TimeredCounterString/with grapheme-splitter', component: 'timered-counter-string', tags: ['autodocs', 'timered-counter-string'], parameters: { controls: { expanded: true }, }, beforeEach: () => { setNumberAdapter('decimal.js'); setStringAdapter('grapheme-splitter'); }, }"
|
7543
|
+
"default": "{ title: 'TimeredCounterString/with grapheme-splitter', component: 'timered-counter-string', tags: ['autodocs', 'timered-counter-string'], parameters: { controls: { expanded: true }, }, beforeEach: () => { TimeredCounterAdapter.registryAdapter(DecimalJsNumberAdapter); TimeredCounterAdapter.registryAdapter(GraphemeSplitterStringAdapter); TimeredCounterAdapter.setNumberAdapter('decimal.js'); TimeredCounterAdapter.setStringAdapter('grapheme-splitter'); }, }"
|
7394
7544
|
},
|
7395
7545
|
{
|
7396
7546
|
"kind": "variable",
|
@@ -7582,7 +7732,7 @@
|
|
7582
7732
|
"type": {
|
7583
7733
|
"text": "Meta"
|
7584
7734
|
},
|
7585
|
-
"default": "{ title: 'TimeredCounterString/with Intl Segmenter', component: 'timered-counter-string', tags: ['autodocs', 'timered-counter-string'], parameters: { controls: { expanded: true }, }, beforeEach: () => { setNumberAdapter('decimal.js'); setStringAdapter('intl-segmenter'); }, }"
|
7735
|
+
"default": "{ title: 'TimeredCounterString/with Intl Segmenter', component: 'timered-counter-string', tags: ['autodocs', 'timered-counter-string'], parameters: { controls: { expanded: true }, }, beforeEach: () => { TimeredCounterAdapter.registryAdapter(DecimalJsNumberAdapter); TimeredCounterAdapter.setNumberAdapter('decimal.js'); TimeredCounterAdapter.setStringAdapter('intl-segmenter'); }, }"
|
7586
7736
|
},
|
7587
7737
|
{
|
7588
7738
|
"kind": "variable",
|
@@ -7899,7 +8049,7 @@
|
|
7899
8049
|
"type": {
|
7900
8050
|
"text": "ResizeObserver"
|
7901
8051
|
},
|
7902
|
-
"default": "new ResizeObserver(() => { this.digitWidth =
|
8052
|
+
"default": "new ResizeObserver(() => { this.digitWidth = this.clonedRollDigitList ? this.clonedRollDigitList.offsetWidth : 0; })"
|
7903
8053
|
},
|
7904
8054
|
{
|
7905
8055
|
"kind": "field",
|
@@ -0,0 +1,9 @@
|
|
1
|
+
/*!
|
2
|
+
* decimal.js v10.4.3
|
3
|
+
* An arbitrary-precision Decimal type for JavaScript.
|
4
|
+
* https://github.com/MikeMcl/decimal.js
|
5
|
+
* Copyright (c) 2022 Michael Mclaughlin <M8ch88l@gmail.com>
|
6
|
+
* MIT Licence
|
7
|
+
*/
|
8
|
+
var n,e,i=9e15,t=1e9,r="0123456789abcdef",s="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",o="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",u={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-9e15,maxE:i,crypto:!1},c=!0,f="[DecimalError] ",a=f+"Invalid argument: ",d=f+"Precision limit exceeded",l=f+"crypto unavailable",h="[object Decimal]",g=Math.floor,p=Math.pow,m=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,w=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,v=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,N=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,b=1e7,x=s.length-1,E=o.length-1,y={toStringTag:h};function M(n){var e,i,t,r=n.length-1,s="",o=n[0];if(r>0){for(s+=o,e=1;e<r;e++)(i=7-(t=n[e]+"").length)&&(s+=_(i)),s+=t;(i=7-(t=(o=n[e])+"").length)&&(s+=_(i))}else if(0===o)return"0";for(;o%10==0;)o/=10;return s+o}function q(n,e,i){if(n!==~~n||n<e||n>i)throw Error(a+n)}function O(n,e,i,t){var r,s,o,u;for(s=n[0];s>=10;s/=10)--e;return--e<0?(e+=7,r=0):(r=Math.ceil((e+1)/7),e%=7),s=p(10,7-e),u=n[r]%s|0,null==t?e<3?(0==e?u=u/100|0:1==e&&(u=u/10|0),o=i<4&&99999==u||i>3&&49999==u||5e4==u||0==u):o=(i<4&&u+1==s||i>3&&u+1==s/2)&&(n[r+1]/s/100|0)==p(10,e-2)-1||(u==s/2||0==u)&&!(n[r+1]/s/100|0):e<4?(0==e?u=u/1e3|0:1==e?u=u/100|0:2==e&&(u=u/10|0),o=(t||i<4)&&9999==u||!t&&i>3&&4999==u):o=((t||i<4)&&u+1==s||!t&&i>3&&u+1==s/2)&&(n[r+1]/s/1e3|0)==p(10,e-3)-1,o}function F(n,e,i){for(var t,s,o=[0],u=0,c=n.length;u<c;){for(s=o.length;s--;)o[s]*=e;for(o[0]+=r.indexOf(n.charAt(u++)),t=0;t<o.length;t++)o[t]>i-1&&(void 0===o[t+1]&&(o[t+1]=0),o[t+1]+=o[t]/i|0,o[t]%=i)}return o.reverse()}y.absoluteValue=y.abs=function(){var n=new this.constructor(this);return n.s<0&&(n.s=1),Z(n)},y.ceil=function(){return Z(new this.constructor(this),this.e+1,2)},y.clampedTo=y.clamp=function(n,e){var i=this,t=i.constructor;if(n=new t(n),e=new t(e),!n.s||!e.s)return new t(NaN);if(n.gt(e))throw Error(a+e);return i.cmp(n)<0?n:i.cmp(e)>0?e:new t(i)},y.comparedTo=y.cmp=function(n){var e,i,t,r,s=this,o=s.d,u=(n=new s.constructor(n)).d,c=s.s,f=n.s;if(!o||!u)return c&&f?c!==f?c:o===u?0:!o^c<0?1:-1:NaN;if(!o[0]||!u[0])return o[0]?c:u[0]?-f:0;if(c!==f)return c;if(s.e!==n.e)return s.e>n.e^c<0?1:-1;for(e=0,i=(t=o.length)<(r=u.length)?t:r;e<i;++e)if(o[e]!==u[e])return o[e]>u[e]^c<0?1:-1;return t===r?0:t>r^c<0?1:-1},y.cosine=y.cos=function(){var n,i,t=this,r=t.constructor;return t.d?t.d[0]?(n=r.precision,i=r.rounding,r.precision=n+Math.max(t.e,t.sd())+7,r.rounding=1,t=function(n,e){var i,t,r;if(e.isZero())return e;t=e.d.length,t<32?r=(1/$(4,i=Math.ceil(t/3))).toString():(i=16,r="2.3283064365386962890625e-10");n.precision+=i,e=V(n,1,e.times(r),new n(1));for(var s=i;s--;){var o=e.times(e);e=o.times(o).minus(o).times(8).plus(1)}return n.precision-=i,e}(r,J(r,t)),r.precision=n,r.rounding=i,Z(2==e||3==e?t.neg():t,n,i,!0)):new r(1):new r(NaN)},y.cubeRoot=y.cbrt=function(){var n,e,i,t,r,s,o,u,f,a,d=this,l=d.constructor;if(!d.isFinite()||d.isZero())return new l(d);for(c=!1,(s=d.s*p(d.s*d,1/3))&&Math.abs(s)!=1/0?t=new l(s.toString()):(i=M(d.d),(s=((n=d.e)-i.length+1)%3)&&(i+=1==s||-2==s?"0":"00"),s=p(i,1/3),n=g((n+1)/3)-(n%3==(n<0?-1:2)),(t=new l(i=s==1/0?"5e"+n:(i=s.toExponential()).slice(0,i.indexOf("e")+1)+n)).s=d.s),o=(n=l.precision)+3;;)if(a=(f=(u=t).times(u).times(u)).plus(d),t=A(a.plus(d).times(u),a.plus(f),o+2,1),M(u.d).slice(0,o)===(i=M(t.d)).slice(0,o)){if("9999"!=(i=i.slice(o-3,o+1))&&(r||"4999"!=i)){+i&&(+i.slice(1)||"5"!=i.charAt(0))||(Z(t,n+1,1),e=!t.times(t).times(t).eq(d));break}if(!r&&(Z(u,n+1,0),u.times(u).times(u).eq(d))){t=u;break}o+=4,r=1}return c=!0,Z(t,n,l.rounding,e)},y.decimalPlaces=y.dp=function(){var n,e=this.d,i=NaN;if(e){if(i=7*((n=e.length-1)-g(this.e/7)),n=e[n])for(;n%10==0;n/=10)i--;i<0&&(i=0)}return i},y.dividedBy=y.div=function(n){return A(this,new this.constructor(n))},y.dividedToIntegerBy=y.divToInt=function(n){var e=this.constructor;return Z(A(this,new e(n),0,1,1),e.precision,e.rounding)},y.equals=y.eq=function(n){return 0===this.cmp(n)},y.floor=function(){return Z(new this.constructor(this),this.e+1,3)},y.greaterThan=y.gt=function(n){return this.cmp(n)>0},y.greaterThanOrEqualTo=y.gte=function(n){var e=this.cmp(n);return 1==e||0===e},y.hyperbolicCosine=y.cosh=function(){var n,e,i,t,r,s=this,o=s.constructor,u=new o(1);if(!s.isFinite())return new o(s.s?1/0:NaN);if(s.isZero())return u;i=o.precision,t=o.rounding,o.precision=i+Math.max(s.e,s.sd())+4,o.rounding=1,(r=s.d.length)<32?e=(1/$(4,n=Math.ceil(r/3))).toString():(n=16,e="2.3283064365386962890625e-10"),s=V(o,1,s.times(e),new o(1),!0);for(var c,f=n,a=new o(8);f--;)c=s.times(s),s=u.minus(c.times(a.minus(c.times(a))));return Z(s,o.precision=i,o.rounding=t,!0)},y.hyperbolicSine=y.sinh=function(){var n,e,i,t,r=this,s=r.constructor;if(!r.isFinite()||r.isZero())return new s(r);if(e=s.precision,i=s.rounding,s.precision=e+Math.max(r.e,r.sd())+4,s.rounding=1,(t=r.d.length)<3)r=V(s,2,r,r,!0);else{n=(n=1.4*Math.sqrt(t))>16?16:0|n,r=V(s,2,r=r.times(1/$(5,n)),r,!0);for(var o,u=new s(5),c=new s(16),f=new s(20);n--;)o=r.times(r),r=r.times(u.plus(o.times(c.times(o).plus(f))))}return s.precision=e,s.rounding=i,Z(r,e,i,!0)},y.hyperbolicTangent=y.tanh=function(){var n,e,i=this,t=i.constructor;return i.isFinite()?i.isZero()?new t(i):(n=t.precision,e=t.rounding,t.precision=n+7,t.rounding=1,A(i.sinh(),i.cosh(),t.precision=n,t.rounding=e)):new t(i.s)},y.inverseCosine=y.acos=function(){var n,e=this,i=e.constructor,t=e.abs().cmp(1),r=i.precision,s=i.rounding;return-1!==t?0===t?e.isNeg()?R(i,r,s):new i(0):new i(NaN):e.isZero()?R(i,r+4,s).times(.5):(i.precision=r+6,i.rounding=1,e=e.asin(),n=R(i,r+4,s).times(.5),i.precision=r,i.rounding=s,n.minus(e))},y.inverseHyperbolicCosine=y.acosh=function(){var n,e,i=this,t=i.constructor;return i.lte(1)?new t(i.eq(1)?0:NaN):i.isFinite()?(n=t.precision,e=t.rounding,t.precision=n+Math.max(Math.abs(i.e),i.sd())+4,t.rounding=1,c=!1,i=i.times(i).minus(1).sqrt().plus(i),c=!0,t.precision=n,t.rounding=e,i.ln()):new t(i)},y.inverseHyperbolicSine=y.asinh=function(){var n,e,i=this,t=i.constructor;return!i.isFinite()||i.isZero()?new t(i):(n=t.precision,e=t.rounding,t.precision=n+2*Math.max(Math.abs(i.e),i.sd())+6,t.rounding=1,c=!1,i=i.times(i).plus(1).sqrt().plus(i),c=!0,t.precision=n,t.rounding=e,i.ln())},y.inverseHyperbolicTangent=y.atanh=function(){var n,e,i,t,r=this,s=r.constructor;return r.isFinite()?r.e>=0?new s(r.abs().eq(1)?r.s/0:r.isZero()?r:NaN):(n=s.precision,e=s.rounding,t=r.sd(),Math.max(t,n)<2*-r.e-1?Z(new s(r),n,e,!0):(s.precision=i=t-r.e,r=A(r.plus(1),new s(1).minus(r),i+n,1),s.precision=n+4,s.rounding=1,r=r.ln(),s.precision=n,s.rounding=e,r.times(.5))):new s(NaN)},y.inverseSine=y.asin=function(){var n,e,i,t,r=this,s=r.constructor;return r.isZero()?new s(r):(e=r.abs().cmp(1),i=s.precision,t=s.rounding,-1!==e?0===e?((n=R(s,i+4,t).times(.5)).s=r.s,n):new s(NaN):(s.precision=i+6,s.rounding=1,r=r.div(new s(1).minus(r.times(r)).sqrt().plus(1)).atan(),s.precision=i,s.rounding=t,r.times(2)))},y.inverseTangent=y.atan=function(){var n,e,i,t,r,s,o,u,f,a=this,d=a.constructor,l=d.precision,h=d.rounding;if(a.isFinite()){if(a.isZero())return new d(a);if(a.abs().eq(1)&&l+4<=E)return(o=R(d,l+4,h).times(.25)).s=a.s,o}else{if(!a.s)return new d(NaN);if(l+4<=E)return(o=R(d,l+4,h).times(.5)).s=a.s,o}for(d.precision=u=l+10,d.rounding=1,n=i=Math.min(28,u/7+2|0);n;--n)a=a.div(a.times(a).plus(1).sqrt().plus(1));for(c=!1,e=Math.ceil(u/7),t=1,f=a.times(a),o=new d(a),r=a;-1!==n;)if(r=r.times(f),s=o.minus(r.div(t+=2)),r=r.times(f),void 0!==(o=s.plus(r.div(t+=2))).d[e])for(n=e;o.d[n]===s.d[n]&&n--;);return i&&(o=o.times(2<<i-1)),c=!0,Z(o,d.precision=l,d.rounding=h,!0)},y.isFinite=function(){return!!this.d},y.isInteger=y.isInt=function(){return!!this.d&&g(this.e/7)>this.d.length-2},y.isNaN=function(){return!this.s},y.isNegative=y.isNeg=function(){return this.s<0},y.isPositive=y.isPos=function(){return this.s>0},y.isZero=function(){return!!this.d&&0===this.d[0]},y.lessThan=y.lt=function(n){return this.cmp(n)<0},y.lessThanOrEqualTo=y.lte=function(n){return this.cmp(n)<1},y.logarithm=y.log=function(n){var e,i,t,r,s,o,u,f,a=this,d=a.constructor,l=d.precision,h=d.rounding;if(null==n)n=new d(10),e=!0;else{if(i=(n=new d(n)).d,n.s<0||!i||!i[0]||n.eq(1))return new d(NaN);e=n.eq(10)}if(i=a.d,a.s<0||!i||!i[0]||a.eq(1))return new d(i&&!i[0]?-1/0:1!=a.s?NaN:i?0:1/0);if(e)if(i.length>1)s=!0;else{for(r=i[0];r%10==0;)r/=10;s=1!==r}if(c=!1,o=C(a,u=l+5),t=e?P(d,u+10):C(n,u),O((f=A(o,t,u,1)).d,r=l,h))do{if(o=C(a,u+=10),t=e?P(d,u+10):C(n,u),f=A(o,t,u,1),!s){+M(f.d).slice(r+1,r+15)+1==1e14&&(f=Z(f,l+1,0));break}}while(O(f.d,r+=10,h));return c=!0,Z(f,l,h)},y.minus=y.sub=function(n){var e,i,t,r,s,o,u,f,a,d,l,h,p=this,m=p.constructor;if(n=new m(n),!p.d||!n.d)return p.s&&n.s?p.d?n.s=-n.s:n=new m(n.d||p.s!==n.s?p:NaN):n=new m(NaN),n;if(p.s!=n.s)return n.s=-n.s,p.plus(n);if(a=p.d,h=n.d,u=m.precision,f=m.rounding,!a[0]||!h[0]){if(h[0])n.s=-n.s;else{if(!a[0])return new m(3===f?-0:0);n=new m(p)}return c?Z(n,u,f):n}if(i=g(n.e/7),d=g(p.e/7),a=a.slice(),s=d-i){for((l=s<0)?(e=a,s=-s,o=h.length):(e=h,i=d,o=a.length),s>(t=Math.max(Math.ceil(u/7),o)+2)&&(s=t,e.length=1),e.reverse(),t=s;t--;)e.push(0);e.reverse()}else{for((l=(t=a.length)<(o=h.length))&&(o=t),t=0;t<o;t++)if(a[t]!=h[t]){l=a[t]<h[t];break}s=0}for(l&&(e=a,a=h,h=e,n.s=-n.s),o=a.length,t=h.length-o;t>0;--t)a[o++]=0;for(t=h.length;t>s;){if(a[--t]<h[t]){for(r=t;r&&0===a[--r];)a[r]=b-1;--a[r],a[t]+=b}a[t]-=h[t]}for(;0===a[--o];)a.pop();for(;0===a[0];a.shift())--i;return a[0]?(n.d=a,n.e=S(a,i),c?Z(n,u,f):n):new m(3===f?-0:0)},y.modulo=y.mod=function(n){var e,i=this,t=i.constructor;return n=new t(n),!i.d||!n.s||n.d&&!n.d[0]?new t(NaN):!n.d||i.d&&!i.d[0]?Z(new t(i),t.precision,t.rounding):(c=!1,9==t.modulo?(e=A(i,n.abs(),0,3,1)).s*=n.s:e=A(i,n,0,t.modulo,1),e=e.times(n),c=!0,i.minus(e))},y.naturalExponential=y.exp=function(){return I(this)},y.naturalLogarithm=y.ln=function(){return C(this)},y.negated=y.neg=function(){var n=new this.constructor(this);return n.s=-n.s,Z(n)},y.plus=y.add=function(n){var e,i,t,r,s,o,u,f,a,d,l=this,h=l.constructor;if(n=new h(n),!l.d||!n.d)return l.s&&n.s?l.d||(n=new h(n.d||l.s===n.s?l:NaN)):n=new h(NaN),n;if(l.s!=n.s)return n.s=-n.s,l.minus(n);if(a=l.d,d=n.d,u=h.precision,f=h.rounding,!a[0]||!d[0])return d[0]||(n=new h(l)),c?Z(n,u,f):n;if(s=g(l.e/7),t=g(n.e/7),a=a.slice(),r=s-t){for(r<0?(i=a,r=-r,o=d.length):(i=d,t=s,o=a.length),r>(o=(s=Math.ceil(u/7))>o?s+1:o+1)&&(r=o,i.length=1),i.reverse();r--;)i.push(0);i.reverse()}for((o=a.length)-(r=d.length)<0&&(r=o,i=d,d=a,a=i),e=0;r;)e=(a[--r]=a[r]+d[r]+e)/b|0,a[r]%=b;for(e&&(a.unshift(e),++t),o=a.length;0==a[--o];)a.pop();return n.d=a,n.e=S(a,t),c?Z(n,u,f):n},y.precision=y.sd=function(n){var e,i=this;if(void 0!==n&&n!==!!n&&1!==n&&0!==n)throw Error(a+n);return i.d?(e=T(i.d),n&&i.e+1>e&&(e=i.e+1)):e=NaN,e},y.round=function(){var n=this,e=n.constructor;return Z(new e(n),n.e+1,e.rounding)},y.sine=y.sin=function(){var n,i,t=this,r=t.constructor;return t.isFinite()?t.isZero()?new r(t):(n=r.precision,i=r.rounding,r.precision=n+Math.max(t.e,t.sd())+7,r.rounding=1,t=function(n,e){var i,t=e.d.length;if(t<3)return e.isZero()?e:V(n,2,e,e);i=(i=1.4*Math.sqrt(t))>16?16:0|i,e=e.times(1/$(5,i)),e=V(n,2,e,e);for(var r,s=new n(5),o=new n(16),u=new n(20);i--;)r=e.times(e),e=e.times(s.plus(r.times(o.times(r).minus(u))));return e}(r,J(r,t)),r.precision=n,r.rounding=i,Z(e>2?t.neg():t,n,i,!0)):new r(NaN)},y.squareRoot=y.sqrt=function(){var n,e,i,t,r,s,o=this,u=o.d,f=o.e,a=o.s,d=o.constructor;if(1!==a||!u||!u[0])return new d(!a||a<0&&(!u||u[0])?NaN:u?o:1/0);for(c=!1,0==(a=Math.sqrt(+o))||a==1/0?(((e=M(u)).length+f)%2==0&&(e+="0"),a=Math.sqrt(e),f=g((f+1)/2)-(f<0||f%2),t=new d(e=a==1/0?"5e"+f:(e=a.toExponential()).slice(0,e.indexOf("e")+1)+f)):t=new d(a.toString()),i=(f=d.precision)+3;;)if(t=(s=t).plus(A(o,s,i+2,1)).times(.5),M(s.d).slice(0,i)===(e=M(t.d)).slice(0,i)){if("9999"!=(e=e.slice(i-3,i+1))&&(r||"4999"!=e)){+e&&(+e.slice(1)||"5"!=e.charAt(0))||(Z(t,f+1,1),n=!t.times(t).eq(o));break}if(!r&&(Z(s,f+1,0),s.times(s).eq(o))){t=s;break}i+=4,r=1}return c=!0,Z(t,f,d.rounding,n)},y.tangent=y.tan=function(){var n,i,t=this,r=t.constructor;return t.isFinite()?t.isZero()?new r(t):(n=r.precision,i=r.rounding,r.precision=n+10,r.rounding=1,(t=t.sin()).s=1,t=A(t,new r(1).minus(t.times(t)).sqrt(),n+10,0),r.precision=n,r.rounding=i,Z(2==e||4==e?t.neg():t,n,i,!0)):new r(NaN)},y.times=y.mul=function(n){var e,i,t,r,s,o,u,f,a,d=this,l=d.constructor,h=d.d,p=(n=new l(n)).d;if(n.s*=d.s,!(h&&h[0]&&p&&p[0]))return new l(!n.s||h&&!h[0]&&!p||p&&!p[0]&&!h?NaN:h&&p?0*n.s:n.s/0);for(i=g(d.e/7)+g(n.e/7),(f=h.length)<(a=p.length)&&(s=h,h=p,p=s,o=f,f=a,a=o),s=[],t=o=f+a;t--;)s.push(0);for(t=a;--t>=0;){for(e=0,r=f+t;r>t;)u=s[r]+p[t]*h[r-t-1]+e,s[r--]=u%b|0,e=u/b|0;s[r]=(s[r]+e)%b|0}for(;!s[--o];)s.pop();return e?++i:s.shift(),n.d=s,n.e=S(s,i),c?Z(n,l.precision,l.rounding):n},y.toBinary=function(n,e){return W(this,2,n,e)},y.toDecimalPlaces=y.toDP=function(n,e){var i=this,r=i.constructor;return i=new r(i),void 0===n?i:(q(n,0,t),void 0===e?e=r.rounding:q(e,0,8),Z(i,n+i.e+1,e))},y.toExponential=function(n,e){var i,r=this,s=r.constructor;return void 0===n?i=D(r,!0):(q(n,0,t),void 0===e?e=s.rounding:q(e,0,8),i=D(r=Z(new s(r),n+1,e),!0,n+1)),r.isNeg()&&!r.isZero()?"-"+i:i},y.toFixed=function(n,e){var i,r,s=this,o=s.constructor;return void 0===n?i=D(s):(q(n,0,t),void 0===e?e=o.rounding:q(e,0,8),i=D(r=Z(new o(s),n+s.e+1,e),!1,n+r.e+1)),s.isNeg()&&!s.isZero()?"-"+i:i},y.toFraction=function(n){var e,i,t,r,s,o,u,f,d,l,h,g,m=this,w=m.d,v=m.constructor;if(!w)return new v(m);if(d=i=new v(1),t=f=new v(0),o=(s=(e=new v(t)).e=T(w)-m.e-1)%7,e.d[0]=p(10,o<0?7+o:o),null==n)n=s>0?e:d;else{if(!(u=new v(n)).isInt()||u.lt(d))throw Error(a+u);n=u.gt(e)?s>0?e:d:u}for(c=!1,u=new v(M(w)),l=v.precision,v.precision=s=7*w.length*2;h=A(u,e,0,1,1),1!=(r=i.plus(h.times(t))).cmp(n);)i=t,t=r,r=d,d=f.plus(h.times(r)),f=r,r=e,e=u.minus(h.times(r)),u=r;return r=A(n.minus(i),t,0,1,1),f=f.plus(r.times(d)),i=i.plus(r.times(t)),f.s=d.s=m.s,g=A(d,t,s,1).minus(m).abs().cmp(A(f,i,s,1).minus(m).abs())<1?[d,t]:[f,i],v.precision=l,c=!0,g},y.toHexadecimal=y.toHex=function(n,e){return W(this,16,n,e)},y.toNearest=function(n,e){var i=this,t=i.constructor;if(i=new t(i),null==n){if(!i.d)return i;n=new t(1),e=t.rounding}else{if(n=new t(n),void 0===e?e=t.rounding:q(e,0,8),!i.d)return n.s?i:n;if(!n.d)return n.s&&(n.s=i.s),n}return n.d[0]?(c=!1,i=A(i,n,0,e,1).times(n),c=!0,Z(i)):(n.s=i.s,i=n),i},y.toNumber=function(){return+this},y.toOctal=function(n,e){return W(this,8,n,e)},y.toPower=y.pow=function(n){var e,i,t,r,s,o,u=this,f=u.constructor,a=+(n=new f(n));if(!(u.d&&n.d&&u.d[0]&&n.d[0]))return new f(p(+u,a));if((u=new f(u)).eq(1))return u;if(t=f.precision,s=f.rounding,n.eq(1))return Z(u,t,s);if((e=g(n.e/7))>=n.d.length-1&&(i=a<0?-a:a)<=9007199254740991)return r=L(f,u,i,t),n.s<0?new f(1).div(r):Z(r,t,s);if((o=u.s)<0){if(e<n.d.length-1)return new f(NaN);if(1&n.d[e]||(o=1),0==u.e&&1==u.d[0]&&1==u.d.length)return u.s=o,u}return(e=0!=(i=p(+u,a))&&isFinite(i)?new f(i+"").e:g(a*(Math.log("0."+M(u.d))/Math.LN10+u.e+1)))>f.maxE+1||e<f.minE-1?new f(e>0?o/0:0):(c=!1,f.rounding=u.s=1,i=Math.min(12,(e+"").length),(r=I(n.times(C(u,t+i)),t)).d&&O((r=Z(r,t+5,1)).d,t,s)&&(e=t+10,+M((r=Z(I(n.times(C(u,e+i)),e),e+5,1)).d).slice(t+1,t+15)+1==1e14&&(r=Z(r,t+1,0))),r.s=o,c=!0,f.rounding=s,Z(r,t,s))},y.toPrecision=function(n,e){var i,r=this,s=r.constructor;return void 0===n?i=D(r,r.e<=s.toExpNeg||r.e>=s.toExpPos):(q(n,1,t),void 0===e?e=s.rounding:q(e,0,8),i=D(r=Z(new s(r),n,e),n<=r.e||r.e<=s.toExpNeg,n)),r.isNeg()&&!r.isZero()?"-"+i:i},y.toSignificantDigits=y.toSD=function(n,e){var i=this.constructor;return void 0===n?(n=i.precision,e=i.rounding):(q(n,1,t),void 0===e?e=i.rounding:q(e,0,8)),Z(new i(this),n,e)},y.toString=function(){var n=this,e=n.constructor,i=D(n,n.e<=e.toExpNeg||n.e>=e.toExpPos);return n.isNeg()&&!n.isZero()?"-"+i:i},y.truncated=y.trunc=function(){return Z(new this.constructor(this),this.e+1,1)},y.valueOf=y.toJSON=function(){var n=this,e=n.constructor,i=D(n,n.e<=e.toExpNeg||n.e>=e.toExpPos);return n.isNeg()?"-"+i:i};var A=function(){function e(n,e,i){var t,r=0,s=n.length;for(n=n.slice();s--;)t=n[s]*e+r,n[s]=t%i|0,r=t/i|0;return r&&n.unshift(r),n}function i(n,e,i,t){var r,s;if(i!=t)s=i>t?1:-1;else for(r=s=0;r<i;r++)if(n[r]!=e[r]){s=n[r]>e[r]?1:-1;break}return s}function t(n,e,i,t){for(var r=0;i--;)n[i]-=r,r=n[i]<e[i]?1:0,n[i]=r*t+n[i]-e[i];for(;!n[0]&&n.length>1;)n.shift()}return function(r,s,o,u,c,f){var a,d,l,h,p,m,w,v,N,x,E,y,M,q,O,F,A,D,S,P,R=r.constructor,T=r.s==s.s?1:-1,_=r.d,L=s.d;if(!(_&&_[0]&&L&&L[0]))return new R(r.s&&s.s&&(_?!L||_[0]!=L[0]:L)?_&&0==_[0]||!L?0*T:T/0:NaN);for(f?(p=1,d=r.e-s.e):(f=b,p=7,d=g(r.e/p)-g(s.e/p)),S=L.length,A=_.length,x=(N=new R(T)).d=[],l=0;L[l]==(_[l]||0);l++);if(L[l]>(_[l]||0)&&d--,null==o?(q=o=R.precision,u=R.rounding):q=c?o+(r.e-s.e)+1:o,q<0)x.push(1),m=!0;else{if(q=q/p+2|0,l=0,1==S){for(h=0,L=L[0],q++;(l<A||h)&&q--;l++)O=h*f+(_[l]||0),x[l]=O/L|0,h=O%L|0;m=h||l<A}else{for((h=f/(L[0]+1)|0)>1&&(L=e(L,h,f),_=e(_,h,f),S=L.length,A=_.length),F=S,y=(E=_.slice(0,S)).length;y<S;)E[y++]=0;(P=L.slice()).unshift(0),D=L[0],L[1]>=f/2&&++D;do{h=0,(a=i(L,E,S,y))<0?(M=E[0],S!=y&&(M=M*f+(E[1]||0)),(h=M/D|0)>1?(h>=f&&(h=f-1),1==(a=i(w=e(L,h,f),E,v=w.length,y=E.length))&&(h--,t(w,S<v?P:L,v,f))):(0==h&&(a=h=1),w=L.slice()),(v=w.length)<y&&w.unshift(0),t(E,w,y,f),-1==a&&(a=i(L,E,S,y=E.length))<1&&(h++,t(E,S<y?P:L,y,f)),y=E.length):0===a&&(h++,E=[0]),x[l++]=h,a&&E[0]?E[y++]=_[F]||0:(E=[_[F]],y=1)}while((F++<A||void 0!==E[0])&&q--);m=void 0!==E[0]}x[0]||x.shift()}if(1==p)N.e=d,n=m;else{for(l=1,h=x[0];h>=10;h/=10)l++;N.e=l+d*p-1,Z(N,c?o+N.e+1:o,u,m)}return N}}();function Z(n,e,i,t){var r,s,o,u,f,a,d,l,h,g=n.constructor;n:if(null!=e){if(!(l=n.d))return n;for(r=1,u=l[0];u>=10;u/=10)r++;if((s=e-r)<0)s+=7,o=e,f=(d=l[h=0])/p(10,r-o-1)%10|0;else if((h=Math.ceil((s+1)/7))>=(u=l.length)){if(!t)break n;for(;u++<=h;)l.push(0);d=f=0,r=1,o=(s%=7)-7+1}else{for(d=u=l[h],r=1;u>=10;u/=10)r++;f=(o=(s%=7)-7+r)<0?0:d/p(10,r-o-1)%10|0}if(t=t||e<0||void 0!==l[h+1]||(o<0?d:d%p(10,r-o-1)),a=i<4?(f||t)&&(0==i||i==(n.s<0?3:2)):f>5||5==f&&(4==i||t||6==i&&(s>0?o>0?d/p(10,r-o):0:l[h-1])%10&1||i==(n.s<0?8:7)),e<1||!l[0])return l.length=0,a?(e-=n.e+1,l[0]=p(10,(7-e%7)%7),n.e=-e||0):l[0]=n.e=0,n;if(0==s?(l.length=h,u=1,h--):(l.length=h+1,u=p(10,7-s),l[h]=o>0?(d/p(10,r-o)%p(10,o)|0)*u:0),a)for(;;){if(0==h){for(s=1,o=l[0];o>=10;o/=10)s++;for(o=l[0]+=u,u=1;o>=10;o/=10)u++;s!=u&&(n.e++,l[0]==b&&(l[0]=1));break}if(l[h]+=u,l[h]!=b)break;l[h--]=0,u=1}for(s=l.length;0===l[--s];)l.pop()}return c&&(n.e>g.maxE?(n.d=null,n.e=NaN):n.e<g.minE&&(n.e=0,n.d=[0])),n}function D(n,e,i){if(!n.isFinite())return H(n);var t,r=n.e,s=M(n.d),o=s.length;return e?(i&&(t=i-o)>0?s=s.charAt(0)+"."+s.slice(1)+_(t):o>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(n.e<0?"e":"e+")+n.e):r<0?(s="0."+_(-r-1)+s,i&&(t=i-o)>0&&(s+=_(t))):r>=o?(s+=_(r+1-o),i&&(t=i-r-1)>0&&(s=s+"."+_(t))):((t=r+1)<o&&(s=s.slice(0,t)+"."+s.slice(t)),i&&(t=i-o)>0&&(r+1===o&&(s+="."),s+=_(t))),s}function S(n,e){var i=n[0];for(e*=7;i>=10;i/=10)e++;return e}function P(n,e,i){if(e>x)throw c=!0,i&&(n.precision=i),Error(d);return Z(new n(s),e,1,!0)}function R(n,e,i){if(e>E)throw Error(d);return Z(new n(o),e,i,!0)}function T(n){var e=n.length-1,i=7*e+1;if(e=n[e]){for(;e%10==0;e/=10)i--;for(e=n[0];e>=10;e/=10)i++}return i}function _(n){for(var e="";n--;)e+="0";return e}function L(n,e,i,t){var r,s=new n(1),o=Math.ceil(t/7+4);for(c=!1;;){if(i%2&&z((s=s.times(e)).d,o)&&(r=!0),0===(i=g(i/2))){i=s.d.length-1,r&&0===s.d[i]&&++s.d[i];break}z((e=e.times(e)).d,o)}return c=!0,s}function U(n){return 1&n.d[n.d.length-1]}function k(n,e,i){for(var t,r=new n(e[0]),s=0;++s<e.length;){if(!(t=new n(e[s])).s){r=t;break}r[i](t)&&(r=t)}return r}function I(n,e){var i,t,r,s,o,u,f,a=0,d=0,l=0,h=n.constructor,g=h.rounding,m=h.precision;if(!n.d||!n.d[0]||n.e>17)return new h(n.d?n.d[0]?n.s<0?0:1/0:1:n.s?n.s<0?0:n:NaN);for(null==e?(c=!1,f=m):f=e,u=new h(.03125);n.e>-2;)n=n.times(u),l+=5;for(f+=t=Math.log(p(2,l))/Math.LN10*2+5|0,i=s=o=new h(1),h.precision=f;;){if(s=Z(s.times(n),f,1),i=i.times(++d),M((u=o.plus(A(s,i,f,1))).d).slice(0,f)===M(o.d).slice(0,f)){for(r=l;r--;)o=Z(o.times(o),f,1);if(null!=e)return h.precision=m,o;if(!(a<3&&O(o.d,f-t,g,a)))return Z(o,h.precision=m,g,c=!0);h.precision=f+=10,i=s=u=new h(1),d=0,a++}o=u}}function C(n,e){var i,t,r,s,o,u,f,a,d,l,h,g=1,p=n,m=p.d,w=p.constructor,v=w.rounding,N=w.precision;if(p.s<0||!m||!m[0]||!p.e&&1==m[0]&&1==m.length)return new w(m&&!m[0]?-1/0:1!=p.s?NaN:m?0:p);if(null==e?(c=!1,d=N):d=e,w.precision=d+=10,t=(i=M(m)).charAt(0),!(Math.abs(s=p.e)<15e14))return a=P(w,d+2,N).times(s+""),p=C(new w(t+"."+i.slice(1)),d-10).plus(a),w.precision=N,null==e?Z(p,N,v,c=!0):p;for(;t<7&&1!=t||1==t&&i.charAt(1)>3;)t=(i=M((p=p.times(n)).d)).charAt(0),g++;for(s=p.e,t>1?(p=new w("0."+i),s++):p=new w(t+"."+i.slice(1)),l=p,f=o=p=A(p.minus(1),p.plus(1),d,1),h=Z(p.times(p),d,1),r=3;;){if(o=Z(o.times(h),d,1),M((a=f.plus(A(o,new w(r),d,1))).d).slice(0,d)===M(f.d).slice(0,d)){if(f=f.times(2),0!==s&&(f=f.plus(P(w,d+2,N).times(s+""))),f=A(f,new w(g),d,1),null!=e)return w.precision=N,f;if(!O(f.d,d-10,v,u))return Z(f,w.precision=N,v,c=!0);w.precision=d+=10,a=o=p=A(l.minus(1),l.plus(1),d,1),h=Z(p.times(p),d,1),r=u=1}f=a,r+=2}}function H(n){return String(n.s*n.s/0)}function j(n,e){var i,t,r;for((i=e.indexOf("."))>-1&&(e=e.replace(".","")),(t=e.search(/e/i))>0?(i<0&&(i=t),i+=+e.slice(t+1),e=e.substring(0,t)):i<0&&(i=e.length),t=0;48===e.charCodeAt(t);t++);for(r=e.length;48===e.charCodeAt(r-1);--r);if(e=e.slice(t,r)){if(r-=t,n.e=i=i-t-1,n.d=[],t=(i+1)%7,i<0&&(t+=7),t<r){for(t&&n.d.push(+e.slice(0,t)),r-=7;t<r;)n.d.push(+e.slice(t,t+=7));t=7-(e=e.slice(t)).length}else t-=r;for(;t--;)e+="0";n.d.push(+e),c&&(n.e>n.constructor.maxE?(n.d=null,n.e=NaN):n.e<n.constructor.minE&&(n.e=0,n.d=[0]))}else n.e=0,n.d=[0];return n}function B(n,e){var i,t,r,s,o,u,f,d,l;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),N.test(e))return j(n,e)}else if("Infinity"===e||"NaN"===e)return+e||(n.s=NaN),n.e=NaN,n.d=null,n;if(w.test(e))i=16,e=e.toLowerCase();else if(m.test(e))i=2;else{if(!v.test(e))throw Error(a+e);i=8}for((s=e.search(/p/i))>0?(f=+e.slice(s+1),e=e.substring(2,s)):e=e.slice(2),o=(s=e.indexOf("."))>=0,t=n.constructor,o&&(s=(u=(e=e.replace(".","")).length)-s,r=L(t,new t(i),s,2*s)),s=l=(d=F(e,i,b)).length-1;0===d[s];--s)d.pop();return s<0?new t(0*n.s):(n.e=S(d,l),n.d=d,c=!1,o&&(n=A(n,r,4*u)),f&&(n=n.times(Math.abs(f)<54?p(2,f):Ln.pow(2,f))),c=!0,n)}function V(n,e,i,t,r){var s,o,u,f,a=n.precision,d=Math.ceil(a/7);for(c=!1,f=i.times(i),u=new n(t);;){if(o=A(u.times(f),new n(e++*e++),a,1),u=r?t.plus(o):t.minus(o),t=A(o.times(f),new n(e++*e++),a,1),void 0!==(o=u.plus(t)).d[d]){for(s=d;o.d[s]===u.d[s]&&s--;);if(-1==s)break}s=u,u=t,t=o,o=s}return c=!0,o.d.length=d+1,o}function $(n,e){for(var i=n;--e;)i*=n;return i}function J(n,i){var t,r=i.s<0,s=R(n,n.precision,1),o=s.times(.5);if((i=i.abs()).lte(o))return e=r?4:1,i;if((t=i.divToInt(s)).isZero())e=r?3:2;else{if((i=i.minus(t.times(s))).lte(o))return e=U(t)?r?2:3:r?4:1,i;e=U(t)?r?1:4:r?3:2}return i.minus(s).abs()}function W(e,i,s,o){var u,c,f,a,d,l,h,g,p,m=e.constructor,w=void 0!==s;if(w?(q(s,1,t),void 0===o?o=m.rounding:q(o,0,8)):(s=m.precision,o=m.rounding),e.isFinite()){for(w?(u=2,16==i?s=4*s-3:8==i&&(s=3*s-2)):u=i,(f=(h=D(e)).indexOf("."))>=0&&(h=h.replace(".",""),(p=new m(1)).e=h.length-f,p.d=F(D(p),10,u),p.e=p.d.length),c=d=(g=F(h,10,u)).length;0==g[--d];)g.pop();if(g[0]){if(f<0?c--:((e=new m(e)).d=g,e.e=c,g=(e=A(e,p,s,o,0,u)).d,c=e.e,l=n),f=g[s],a=u/2,l=l||void 0!==g[s+1],l=o<4?(void 0!==f||l)&&(0===o||o===(e.s<0?3:2)):f>a||f===a&&(4===o||l||6===o&&1&g[s-1]||o===(e.s<0?8:7)),g.length=s,l)for(;++g[--s]>u-1;)g[s]=0,s||(++c,g.unshift(1));for(d=g.length;!g[d-1];--d);for(f=0,h="";f<d;f++)h+=r.charAt(g[f]);if(w){if(d>1)if(16==i||8==i){for(f=16==i?4:3,--d;d%f;d++)h+="0";for(d=(g=F(h,u,i)).length;!g[d-1];--d);for(f=1,h="1.";f<d;f++)h+=r.charAt(g[f])}else h=h.charAt(0)+"."+h.slice(1);h=h+(c<0?"p":"p+")+c}else if(c<0){for(;++c;)h="0"+h;h="0."+h}else if(++c>d)for(c-=d;c--;)h+="0";else c<d&&(h=h.slice(0,c)+"."+h.slice(c))}else h=w?"0p+0":"0";h=(16==i?"0x":2==i?"0b":8==i?"0o":"")+h}else h=H(e);return e.s<0?"-"+h:h}function z(n,e){if(n.length>e)return n.length=e,!0}function G(n){return new this(n).abs()}function K(n){return new this(n).acos()}function Q(n){return new this(n).acosh()}function X(n,e){return new this(n).plus(e)}function Y(n){return new this(n).asin()}function nn(n){return new this(n).asinh()}function en(n){return new this(n).atan()}function tn(n){return new this(n).atanh()}function rn(n,e){n=new this(n),e=new this(e);var i,t=this.precision,r=this.rounding,s=t+4;return n.s&&e.s?n.d||e.d?!e.d||n.isZero()?(i=e.s<0?R(this,t,r):new this(0)).s=n.s:!n.d||e.isZero()?(i=R(this,s,1).times(.5)).s=n.s:e.s<0?(this.precision=s,this.rounding=1,i=this.atan(A(n,e,s,1)),e=R(this,s,1),this.precision=t,this.rounding=r,i=n.s<0?i.minus(e):i.plus(e)):i=this.atan(A(n,e,s,1)):(i=R(this,s,1).times(e.s>0?.25:.75)).s=n.s:i=new this(NaN),i}function sn(n){return new this(n).cbrt()}function on(n){return Z(n=new this(n),n.e+1,2)}function un(n,e,i){return new this(n).clamp(e,i)}function cn(n){if(!n||"object"!=typeof n)throw Error(f+"Object expected");var e,r,s,o=!0===n.defaults,c=["precision",1,t,"rounding",0,8,"toExpNeg",-9e15,0,"toExpPos",0,i,"maxE",0,i,"minE",-9e15,0,"modulo",0,9];for(e=0;e<c.length;e+=3)if(r=c[e],o&&(this[r]=u[r]),void 0!==(s=n[r])){if(!(g(s)===s&&s>=c[e+1]&&s<=c[e+2]))throw Error(a+r+": "+s);this[r]=s}if(r="crypto",o&&(this[r]=u[r]),void 0!==(s=n[r])){if(!0!==s&&!1!==s&&0!==s&&1!==s)throw Error(a+r+": "+s);if(s){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw Error(l);this[r]=!0}else this[r]=!1}return this}function fn(n){return new this(n).cos()}function an(n){return new this(n).cosh()}function dn(n,e){return new this(n).div(e)}function ln(n){return new this(n).exp()}function hn(n){return Z(n=new this(n),n.e+1,3)}function gn(){var n,e,i=new this(0);for(c=!1,n=0;n<arguments.length;)if((e=new this(arguments[n++])).d)i.d&&(i=i.plus(e.times(e)));else{if(e.s)return c=!0,new this(1/0);i=e}return c=!0,i.sqrt()}function pn(n){return n instanceof Ln||n&&n.toStringTag===h||!1}function mn(n){return new this(n).ln()}function wn(n,e){return new this(n).log(e)}function vn(n){return new this(n).log(2)}function Nn(n){return new this(n).log(10)}function bn(){return k(this,arguments,"lt")}function xn(){return k(this,arguments,"gt")}function En(n,e){return new this(n).mod(e)}function yn(n,e){return new this(n).mul(e)}function Mn(n,e){return new this(n).pow(e)}function qn(n){var e,i,r,s,o=0,u=new this(1),c=[];if(void 0===n?n=this.precision:q(n,1,t),r=Math.ceil(n/7),this.crypto)if(crypto.getRandomValues)for(e=crypto.getRandomValues(new Uint32Array(r));o<r;)(s=e[o])>=429e7?e[o]=crypto.getRandomValues(new Uint32Array(1))[0]:c[o++]=s%1e7;else{if(!crypto.randomBytes)throw Error(l);for(e=crypto.randomBytes(r*=4);o<r;)(s=e[o]+(e[o+1]<<8)+(e[o+2]<<16)+((127&e[o+3])<<24))>=214e7?crypto.randomBytes(4).copy(e,o):(c.push(s%1e7),o+=4);o=r/4}else for(;o<r;)c[o++]=1e7*Math.random()|0;for(n%=7,(r=c[--o])&&n&&(s=p(10,7-n),c[o]=(r/s|0)*s);0===c[o];o--)c.pop();if(o<0)i=0,c=[0];else{for(i=-1;0===c[0];i-=7)c.shift();for(r=1,s=c[0];s>=10;s/=10)r++;r<7&&(i-=7-r)}return u.e=i,u.d=c,u}function On(n){return Z(n=new this(n),n.e+1,this.rounding)}function Fn(n){return(n=new this(n)).d?n.d[0]?n.s:0*n.s:n.s||NaN}function An(n){return new this(n).sin()}function Zn(n){return new this(n).sinh()}function Dn(n){return new this(n).sqrt()}function Sn(n,e){return new this(n).sub(e)}function Pn(){var n=0,e=arguments,i=new this(e[n]);for(c=!1;i.s&&++n<e.length;)i=i.plus(e[n]);return c=!0,Z(i,this.precision,this.rounding)}function Rn(n){return new this(n).tan()}function Tn(n){return new this(n).tanh()}function _n(n){return Z(n=new this(n),n.e+1,1)}y[Symbol.for("nodejs.util.inspect.custom")]=y.toString,y[Symbol.toStringTag]="Decimal";var Ln=y.constructor=function n(e){var i,t,r;function s(n){var e,i,t,r=this;if(!(r instanceof s))return new s(n);if(r.constructor=s,pn(n))return r.s=n.s,void(c?!n.d||n.e>s.maxE?(r.e=NaN,r.d=null):n.e<s.minE?(r.e=0,r.d=[0]):(r.e=n.e,r.d=n.d.slice()):(r.e=n.e,r.d=n.d?n.d.slice():n.d));if("number"===(t=typeof n)){if(0===n)return r.s=1/n<0?-1:1,r.e=0,void(r.d=[0]);if(n<0?(n=-n,r.s=-1):r.s=1,n===~~n&&n<1e7){for(e=0,i=n;i>=10;i/=10)e++;return void(c?e>s.maxE?(r.e=NaN,r.d=null):e<s.minE?(r.e=0,r.d=[0]):(r.e=e,r.d=[n]):(r.e=e,r.d=[n]))}return 0*n!=0?(n||(r.s=NaN),r.e=NaN,void(r.d=null)):j(r,n.toString())}if("string"!==t)throw Error(a+n);return 45===(i=n.charCodeAt(0))?(n=n.slice(1),r.s=-1):(43===i&&(n=n.slice(1)),r.s=1),N.test(n)?j(r,n):B(r,n)}if(s.prototype=y,s.ROUND_UP=0,s.ROUND_DOWN=1,s.ROUND_CEIL=2,s.ROUND_FLOOR=3,s.ROUND_HALF_UP=4,s.ROUND_HALF_DOWN=5,s.ROUND_HALF_EVEN=6,s.ROUND_HALF_CEIL=7,s.ROUND_HALF_FLOOR=8,s.EUCLID=9,s.config=s.set=cn,s.clone=n,s.isDecimal=pn,s.abs=G,s.acos=K,s.acosh=Q,s.add=X,s.asin=Y,s.asinh=nn,s.atan=en,s.atanh=tn,s.atan2=rn,s.cbrt=sn,s.ceil=on,s.clamp=un,s.cos=fn,s.cosh=an,s.div=dn,s.exp=ln,s.floor=hn,s.hypot=gn,s.ln=mn,s.log=wn,s.log10=Nn,s.log2=vn,s.max=bn,s.min=xn,s.mod=En,s.mul=yn,s.pow=Mn,s.random=qn,s.round=On,s.sign=Fn,s.sin=An,s.sinh=Zn,s.sqrt=Dn,s.sub=Sn,s.sum=Pn,s.tan=Rn,s.tanh=Tn,s.trunc=_n,void 0===e&&(e={}),e&&!0!==e.defaults)for(r=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],i=0;i<r.length;)e.hasOwnProperty(t=r[i++])||(e[t]=this[t]);return s.config(e),s}(u);s=new Ln(s),o=new Ln(o);const Un=/^-?\d+(\.\d+)?$/,kn=(n={precision:1e3})=>{const e=Ln.clone(n);return{create:n=>("string"!=typeof n||Un.test(n)||(n=0),new e(n)),add:(n,e)=>n.plus(e),sub:(n,e)=>n.minus(e),mul:(n,e)=>n.times(e),div:(n,e)=>n.div(e),compare:(n,e)=>n.cmp(e),eq:(n,e)=>n.eq(e),gt:(n,e)=>n.gt(e),gte:(n,e)=>n.gte(e),lt:(n,e)=>n.lt(e),lte:(n,e)=>n.lte(e),isInteger:n=>n.isInteger(),isNegative:n=>n.isNegative(),isPositive:n=>n.isPositive(),isZero:n=>n.isZero(),isNaN:n=>n.isNaN(),isFinite:n=>n.isFinite(),abs:n=>n.abs(),ceil:n=>n.ceil(),floor:n=>n.floor(),round:n=>n.round(),max:(n,i)=>e.max(n,i),min:(n,i)=>e.min(n,i),toNumber:n=>n.toNumber(),toString:n=>n.toFixed()}};function In(n,e){n.registerNumberAdapter(["decimal.js","decimal-js","decimaljs"],(()=>kn(e)))}var Cn={register:In,DecimalJsAdapter:kn};export{kn as DecimalJsAdapter,Cn as default,In as register};
|
9
|
+
//# sourceMappingURL=decimal-js-number-adapter.esm-browser.js.map
|