compostjs 0.0.8 → 0.0.12

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 (141) hide show
  1. package/README.md +4 -4
  2. package/dist/fable_modules/fable-library-js.4.28.0/Array.d.ts +123 -0
  3. package/dist/fable_modules/fable-library-js.4.28.0/Array.js +1242 -0
  4. package/dist/fable_modules/fable-library-js.4.28.0/Async.d.ts +26 -0
  5. package/dist/fable_modules/fable-library-js.4.28.0/Async.js +145 -0
  6. package/dist/fable_modules/fable-library-js.4.28.0/AsyncBuilder.d.ts +59 -0
  7. package/dist/fable_modules/fable-library-js.4.28.0/AsyncBuilder.js +183 -0
  8. package/dist/fable_modules/fable-library-js.4.28.0/BigInt.d.ts +115 -0
  9. package/dist/fable_modules/fable-library-js.4.28.0/BigInt.js +283 -0
  10. package/dist/fable_modules/fable-library-js.4.28.0/BitConverter.d.ts +27 -0
  11. package/dist/fable_modules/fable-library-js.4.28.0/BitConverter.js +138 -0
  12. package/dist/fable_modules/fable-library-js.4.28.0/Boolean.d.ts +3 -0
  13. package/dist/fable_modules/fable-library-js.4.28.0/Boolean.js +21 -0
  14. package/dist/fable_modules/fable-library-js.4.28.0/CHANGELOG.md +100 -0
  15. package/dist/fable_modules/fable-library-js.4.28.0/Char.d.ts +65 -0
  16. package/dist/fable_modules/fable-library-js.4.28.0/Char.js +169 -0
  17. package/dist/fable_modules/fable-library-js.4.28.0/Choice.d.ts +121 -0
  18. package/dist/fable_modules/fable-library-js.4.28.0/Choice.js +184 -0
  19. package/dist/fable_modules/fable-library-js.4.28.0/CollectionUtil.d.ts +7 -0
  20. package/dist/fable_modules/fable-library-js.4.28.0/CollectionUtil.js +182 -0
  21. package/dist/fable_modules/fable-library-js.4.28.0/ConditionalWeakTable.d.ts +9 -0
  22. package/dist/fable_modules/fable-library-js.4.28.0/ConditionalWeakTable.js +21 -0
  23. package/dist/fable_modules/fable-library-js.4.28.0/Date.d.ts +70 -0
  24. package/dist/fable_modules/fable-library-js.4.28.0/Date.js +748 -0
  25. package/dist/fable_modules/fable-library-js.4.28.0/DateOffset.d.ts +63 -0
  26. package/dist/fable_modules/fable-library-js.4.28.0/DateOffset.js +268 -0
  27. package/dist/fable_modules/fable-library-js.4.28.0/DateOnly.d.ts +18 -0
  28. package/dist/fable_modules/fable-library-js.4.28.0/DateOnly.js +124 -0
  29. package/dist/fable_modules/fable-library-js.4.28.0/Decimal.d.ts +45 -0
  30. package/dist/fable_modules/fable-library-js.4.28.0/Decimal.js +212 -0
  31. package/dist/fable_modules/fable-library-js.4.28.0/Double.d.ts +11 -0
  32. package/dist/fable_modules/fable-library-js.4.28.0/Double.js +46 -0
  33. package/dist/fable_modules/fable-library-js.4.28.0/Encoding.d.ts +12 -0
  34. package/dist/fable_modules/fable-library-js.4.28.0/Encoding.js +173 -0
  35. package/dist/fable_modules/fable-library-js.4.28.0/Event.d.ts +31 -0
  36. package/dist/fable_modules/fable-library-js.4.28.0/Event.js +93 -0
  37. package/dist/fable_modules/fable-library-js.4.28.0/FSharp.Collections.d.ts +7 -0
  38. package/dist/fable_modules/fable-library-js.4.28.0/FSharp.Collections.js +27 -0
  39. package/dist/fable_modules/fable-library-js.4.28.0/FSharp.Core.CompilerServices.d.ts +12 -0
  40. package/dist/fable_modules/fable-library-js.4.28.0/FSharp.Core.CompilerServices.js +27 -0
  41. package/dist/fable_modules/fable-library-js.4.28.0/FSharp.Core.d.ts +17 -0
  42. package/dist/fable_modules/fable-library-js.4.28.0/FSharp.Core.js +69 -0
  43. package/dist/fable_modules/fable-library-js.4.28.0/Global.d.ts +24 -0
  44. package/dist/fable_modules/fable-library-js.4.28.0/Global.js +8 -0
  45. package/dist/fable_modules/fable-library-js.4.28.0/Guid.d.ts +10 -0
  46. package/dist/fable_modules/fable-library-js.4.28.0/Guid.js +142 -0
  47. package/dist/fable_modules/fable-library-js.4.28.0/Int32.d.ts +28 -0
  48. package/dist/fable_modules/fable-library-js.4.28.0/Int32.js +135 -0
  49. package/dist/fable_modules/fable-library-js.4.28.0/List.d.ts +143 -0
  50. package/dist/fable_modules/fable-library-js.4.28.0/List.js +1273 -0
  51. package/dist/fable_modules/fable-library-js.4.28.0/Long.d.ts +3 -0
  52. package/dist/fable_modules/fable-library-js.4.28.0/Long.js +46 -0
  53. package/dist/fable_modules/fable-library-js.4.28.0/MailboxProcessor.d.ts +25 -0
  54. package/dist/fable_modules/fable-library-js.4.28.0/MailboxProcessor.js +93 -0
  55. package/dist/fable_modules/fable-library-js.4.28.0/Map.d.ts +178 -0
  56. package/dist/fable_modules/fable-library-js.4.28.0/Map.js +1396 -0
  57. package/dist/fable_modules/fable-library-js.4.28.0/MapUtil.d.ts +12 -0
  58. package/dist/fable_modules/fable-library-js.4.28.0/MapUtil.js +127 -0
  59. package/dist/fable_modules/fable-library-js.4.28.0/MutableMap.d.ts +52 -0
  60. package/dist/fable_modules/fable-library-js.4.28.0/MutableMap.js +327 -0
  61. package/dist/fable_modules/fable-library-js.4.28.0/MutableSet.d.ts +39 -0
  62. package/dist/fable_modules/fable-library-js.4.28.0/MutableSet.js +233 -0
  63. package/dist/fable_modules/fable-library-js.4.28.0/Native.d.ts +2 -0
  64. package/dist/fable_modules/fable-library-js.4.28.0/Native.js +8 -0
  65. package/dist/fable_modules/fable-library-js.4.28.0/Numeric.d.ts +19 -0
  66. package/dist/fable_modules/fable-library-js.4.28.0/Numeric.js +71 -0
  67. package/dist/fable_modules/fable-library-js.4.28.0/Observable.d.ts +32 -0
  68. package/dist/fable_modules/fable-library-js.4.28.0/Observable.js +113 -0
  69. package/dist/fable_modules/fable-library-js.4.28.0/Option.d.ts +28 -0
  70. package/dist/fable_modules/fable-library-js.4.28.0/Option.js +96 -0
  71. package/dist/fable_modules/fable-library-js.4.28.0/README.md +3 -0
  72. package/dist/fable_modules/fable-library-js.4.28.0/Random.d.ts +37 -0
  73. package/dist/fable_modules/fable-library-js.4.28.0/Random.js +170 -0
  74. package/dist/fable_modules/fable-library-js.4.28.0/Range.d.ts +12 -0
  75. package/dist/fable_modules/fable-library-js.4.28.0/Range.js +45 -0
  76. package/dist/fable_modules/fable-library-js.4.28.0/Reflection.d.ts +119 -0
  77. package/dist/fable_modules/fable-library-js.4.28.0/Reflection.js +461 -0
  78. package/dist/fable_modules/fable-library-js.4.28.0/RegExp.d.ts +10 -0
  79. package/dist/fable_modules/fable-library-js.4.28.0/RegExp.js +131 -0
  80. package/dist/fable_modules/fable-library-js.4.28.0/Result.d.ts +37 -0
  81. package/dist/fable_modules/fable-library-js.4.28.0/Result.js +165 -0
  82. package/dist/fable_modules/fable-library-js.4.28.0/Seq.d.ts +165 -0
  83. package/dist/fable_modules/fable-library-js.4.28.0/Seq.js +1378 -0
  84. package/dist/fable_modules/fable-library-js.4.28.0/Seq2.d.ts +18 -0
  85. package/dist/fable_modules/fable-library-js.4.28.0/Seq2.js +111 -0
  86. package/dist/fable_modules/fable-library-js.4.28.0/Set.d.ts +190 -0
  87. package/dist/fable_modules/fable-library-js.4.28.0/Set.js +1789 -0
  88. package/dist/fable_modules/fable-library-js.4.28.0/String.d.ts +58 -0
  89. package/dist/fable_modules/fable-library-js.4.28.0/String.js +554 -0
  90. package/dist/fable_modules/fable-library-js.4.28.0/System.Collections.Generic.d.ts +79 -0
  91. package/dist/fable_modules/fable-library-js.4.28.0/System.Collections.Generic.js +317 -0
  92. package/dist/fable_modules/fable-library-js.4.28.0/System.Text.d.ts +38 -0
  93. package/dist/fable_modules/fable-library-js.4.28.0/System.Text.js +162 -0
  94. package/dist/fable_modules/fable-library-js.4.28.0/SystemException.d.ts +5 -0
  95. package/dist/fable_modules/fable-library-js.4.28.0/SystemException.js +5 -0
  96. package/dist/fable_modules/fable-library-js.4.28.0/TimeOnly.d.ts +15 -0
  97. package/dist/fable_modules/fable-library-js.4.28.0/TimeOnly.js +122 -0
  98. package/dist/fable_modules/fable-library-js.4.28.0/TimeSpan.d.ts +34 -0
  99. package/dist/fable_modules/fable-library-js.4.28.0/TimeSpan.js +177 -0
  100. package/dist/fable_modules/fable-library-js.4.28.0/Timer.d.ts +19 -0
  101. package/dist/fable_modules/fable-library-js.4.28.0/Timer.js +67 -0
  102. package/dist/fable_modules/fable-library-js.4.28.0/Types.d.ts +58 -0
  103. package/dist/fable_modules/fable-library-js.4.28.0/Types.js +208 -0
  104. package/dist/fable_modules/fable-library-js.4.28.0/Unicode.13.0.0.d.ts +2 -0
  105. package/dist/fable_modules/fable-library-js.4.28.0/Unicode.13.0.0.js +4 -0
  106. package/dist/fable_modules/fable-library-js.4.28.0/Uri.d.ts +31 -0
  107. package/dist/fable_modules/fable-library-js.4.28.0/Uri.js +159 -0
  108. package/dist/fable_modules/fable-library-js.4.28.0/Util.d.ts +210 -0
  109. package/dist/fable_modules/fable-library-js.4.28.0/Util.js +769 -0
  110. package/dist/fable_modules/fable-library-js.4.28.0/big.d.ts +338 -0
  111. package/dist/fable_modules/fable-library-js.4.28.0/lib/big.d.ts +5 -0
  112. package/dist/fable_modules/fable-library-js.4.28.0/lib/big.js +825 -0
  113. package/dist/fable_modules/fable-library-js.4.28.0/package.json +24 -0
  114. package/dist/fable_modules/project_cracked.json +1 -0
  115. package/package.json +6 -5
  116. package/.claude/settings.local.json +0 -11
  117. package/dist/fable-library.2.10.1/Array.js +0 -1336
  118. package/dist/fable-library.2.10.1/Async.js +0 -121
  119. package/dist/fable-library.2.10.1/AsyncBuilder.js +0 -200
  120. package/dist/fable-library.2.10.1/Date.js +0 -501
  121. package/dist/fable-library.2.10.1/Decimal.js +0 -208
  122. package/dist/fable-library.2.10.1/Event.js +0 -193
  123. package/dist/fable-library.2.10.1/Int32.js +0 -157
  124. package/dist/fable-library.2.10.1/List.js +0 -1234
  125. package/dist/fable-library.2.10.1/Long.js +0 -155
  126. package/dist/fable-library.2.10.1/Map.js +0 -1292
  127. package/dist/fable-library.2.10.1/MutableMap.js +0 -360
  128. package/dist/fable-library.2.10.1/MutableSet.js +0 -279
  129. package/dist/fable-library.2.10.1/Observable.js +0 -131
  130. package/dist/fable-library.2.10.1/Option.js +0 -118
  131. package/dist/fable-library.2.10.1/Reflection.js +0 -345
  132. package/dist/fable-library.2.10.1/RegExp.js +0 -118
  133. package/dist/fable-library.2.10.1/Seq.js +0 -917
  134. package/dist/fable-library.2.10.1/Set.js +0 -1692
  135. package/dist/fable-library.2.10.1/String.js +0 -679
  136. package/dist/fable-library.2.10.1/Types.js +0 -308
  137. package/dist/fable-library.2.10.1/Util.js +0 -761
  138. package/dist/helpers.js +0 -31
  139. package/dist/lib/big.js +0 -905
  140. package/dist/lib/long.js +0 -1375
  141. package/index.html +0 -49
@@ -0,0 +1,212 @@
1
+ import Decimal from "./lib/big.js";
2
+ import { symbol } from "./Numeric.js";
3
+ import { FSharpRef } from "./Types.js";
4
+ import { combineHashCodes } from "./Util.js";
5
+ Decimal.prototype.GetHashCode = function () {
6
+ return combineHashCodes([this.s, this.e].concat(this.c));
7
+ };
8
+ Decimal.prototype.Equals = function (x) {
9
+ return !this.cmp(x);
10
+ };
11
+ Decimal.prototype.CompareTo = function (x) {
12
+ return this.cmp(x);
13
+ };
14
+ Decimal.prototype[symbol] = function () {
15
+ const _this = this;
16
+ return {
17
+ multiply: (y) => _this.mul(y),
18
+ toPrecision: (sd) => _this.toPrecision(sd),
19
+ toExponential: (dp) => _this.toExponential(dp),
20
+ toFixed: (dp) => _this.toFixed(dp),
21
+ toHex: () => (Number(_this) >>> 0).toString(16),
22
+ };
23
+ };
24
+ export default Decimal;
25
+ export const get_Zero = new Decimal(0);
26
+ export const get_One = new Decimal(1);
27
+ export const get_MinusOne = new Decimal(-1);
28
+ export const get_MaxValue = new Decimal("79228162514264337593543950335");
29
+ export const get_MinValue = new Decimal("-79228162514264337593543950335");
30
+ export function compare(x, y) {
31
+ return x.cmp(y);
32
+ }
33
+ export function equals(x, y) {
34
+ return !x.cmp(y);
35
+ }
36
+ export function abs(x) { return x.abs(); }
37
+ export function sign(x) { return x.lt(get_Zero) ? -1 : x.gt(get_Zero) ? 1 : 0; }
38
+ export function max(x, y) { return x.gt(y) ? x : y; }
39
+ export function min(x, y) { return x.lt(y) ? x : y; }
40
+ export function maxMagnitude(x, y) { return abs(x).gt(abs(y)) ? x : y; }
41
+ export function minMagnitude(x, y) { return abs(x).lt(abs(y)) ? x : y; }
42
+ export function clamp(x, min, max) {
43
+ return x.lt(min) ? min : x.gt(max) ? max : x;
44
+ }
45
+ export function round(x, digits = 0) {
46
+ return x.round(digits, 2 /* ROUND_HALF_EVEN */);
47
+ }
48
+ export function truncate(x) {
49
+ return x.round(0, 0 /* ROUND_DOWN */);
50
+ }
51
+ export function ceiling(x) {
52
+ return x.round(0, x.cmp(0) >= 0 ? 3 /* ROUND_UP */ : 0 /* ROUND_DOWN */);
53
+ }
54
+ export function floor(x) {
55
+ return x.round(0, x.cmp(0) >= 0 ? 0 /* ROUND_DOWN */ : 3 /* ROUND_UP */);
56
+ }
57
+ export function pow(x, n) {
58
+ return x.pow(n);
59
+ }
60
+ export function sqrt(x) {
61
+ return x.sqrt();
62
+ }
63
+ export function op_Addition(x, y) {
64
+ return x.add(y);
65
+ }
66
+ export function op_Subtraction(x, y) {
67
+ return x.sub(y);
68
+ }
69
+ export function op_Multiply(x, y) {
70
+ return x.mul(y);
71
+ }
72
+ export function op_Division(x, y) {
73
+ return x.div(y);
74
+ }
75
+ export function op_Modulus(x, y) {
76
+ return x.mod(y);
77
+ }
78
+ export function op_UnaryNegation(x) {
79
+ const x2 = new Decimal(x);
80
+ x2.s = -x2.s || 0;
81
+ return x2;
82
+ }
83
+ export function op_UnaryPlus(x) {
84
+ return x;
85
+ }
86
+ export const add = op_Addition;
87
+ export const subtract = op_Subtraction;
88
+ export const multiply = op_Multiply;
89
+ export const divide = op_Division;
90
+ export const remainder = op_Modulus;
91
+ export const negate = op_UnaryNegation;
92
+ export function toString(x) {
93
+ return x.toString();
94
+ }
95
+ export function tryParse(str, defValue) {
96
+ try {
97
+ defValue.contents = new Decimal(str.trim());
98
+ return true;
99
+ }
100
+ catch {
101
+ return false;
102
+ }
103
+ }
104
+ export function parse(str) {
105
+ const defValue = new FSharpRef(get_Zero);
106
+ if (tryParse(str, defValue)) {
107
+ return defValue.contents;
108
+ }
109
+ else {
110
+ throw new Error(`The input string ${str} was not in a correct format.`);
111
+ }
112
+ }
113
+ export function toNumber(x) {
114
+ return +x;
115
+ }
116
+ function decimalToHex(dec, bitSize) {
117
+ const hex = new Uint8Array(bitSize / 4 | 0);
118
+ let hexCount = 1;
119
+ for (let d = 0; d < dec.length; d++) {
120
+ let value = dec[d];
121
+ for (let i = 0; i < hexCount; i++) {
122
+ const digit = hex[i] * 10 + value | 0;
123
+ hex[i] = digit & 0xF;
124
+ value = digit >> 4;
125
+ }
126
+ if (value !== 0) {
127
+ hex[hexCount++] = value;
128
+ }
129
+ }
130
+ return hex.slice(0, hexCount); // digits in reverse order
131
+ }
132
+ function hexToDecimal(hex, bitSize) {
133
+ const dec = new Uint8Array(bitSize * 301 / 1000 + 1 | 0);
134
+ let decCount = 1;
135
+ for (let d = hex.length - 1; d >= 0; d--) {
136
+ let carry = hex[d];
137
+ for (let i = 0; i < decCount; i++) {
138
+ const val = dec[i] * 16 + carry | 0;
139
+ dec[i] = (val % 10) | 0;
140
+ carry = (val / 10) | 0;
141
+ }
142
+ while (carry > 0) {
143
+ dec[decCount++] = (carry % 10) | 0;
144
+ carry = (carry / 10) | 0;
145
+ }
146
+ }
147
+ return dec.slice(0, decCount); // digits in reverse order
148
+ }
149
+ function setInt32Bits(hexDigits, bits, offset) {
150
+ for (let i = 0; i < 8; i++) {
151
+ hexDigits[offset + i] = (bits >> (i * 4)) & 0xF;
152
+ }
153
+ }
154
+ function getInt32Bits(hexDigits, offset) {
155
+ let bits = 0;
156
+ for (let i = 0; i < 8; i++) {
157
+ bits = bits | (hexDigits[offset + i] << (i * 4));
158
+ }
159
+ return bits;
160
+ }
161
+ export function fromIntArray(bits) {
162
+ return fromInts(bits[0], bits[1], bits[2], bits[3]);
163
+ }
164
+ export function fromInts(low, mid, high, signExp) {
165
+ const isNegative = signExp < 0;
166
+ const scale = (signExp >> 16) & 0x7F;
167
+ return fromParts(low, mid, high, isNegative, scale);
168
+ }
169
+ export function fromParts(low, mid, high, isNegative, scale) {
170
+ const bitSize = 96;
171
+ const hexDigits = new Uint8Array(bitSize / 4);
172
+ setInt32Bits(hexDigits, low, 0);
173
+ setInt32Bits(hexDigits, mid, 8);
174
+ setInt32Bits(hexDigits, high, 16);
175
+ const decDigits = hexToDecimal(hexDigits, bitSize);
176
+ scale = scale & 0x7F;
177
+ const big = new Decimal(0);
178
+ big.c = Array.from(decDigits.reverse());
179
+ big.e = decDigits.length - scale - 1;
180
+ big.s = isNegative ? -1 : 1;
181
+ const d = new Decimal(big);
182
+ return d;
183
+ }
184
+ export function getBits(d) {
185
+ const bitSize = 96;
186
+ const decDigits = Uint8Array.from(d.c);
187
+ const hexDigits = decimalToHex(decDigits, bitSize);
188
+ const low = getInt32Bits(hexDigits, 0);
189
+ const mid = getInt32Bits(hexDigits, 8);
190
+ const high = getInt32Bits(hexDigits, 16);
191
+ const decStr = d.toString();
192
+ const dotPos = decStr.indexOf(".");
193
+ const scale = dotPos < 0 ? 0 : decStr.length - dotPos - 1;
194
+ const signExp = ((scale & 0x7F) << 16) | (d.s < 0 ? 0x80000000 : 0);
195
+ return [low, mid, high, signExp];
196
+ }
197
+ // export function makeRangeStepFunction(step: Decimal, last: Decimal) {
198
+ // const stepComparedWithZero = step.cmp(get_Zero);
199
+ // if (stepComparedWithZero === 0) {
200
+ // throw new Error("The step of a range cannot be zero");
201
+ // }
202
+ // const stepGreaterThanZero = stepComparedWithZero > 0;
203
+ // return (x: Decimal) => {
204
+ // const comparedWithLast = x.cmp(last);
205
+ // if ((stepGreaterThanZero && comparedWithLast <= 0)
206
+ // || (!stepGreaterThanZero && comparedWithLast >= 0)) {
207
+ // return [x, op_Addition(x, step)];
208
+ // } else {
209
+ // return undefined;
210
+ // }
211
+ // };
212
+ // }
@@ -0,0 +1,11 @@
1
+ import { FSharpRef } from "./Types.js";
2
+ export declare function tryParse(str: string, defValue: FSharpRef<number>): boolean;
3
+ export declare function parse(str: string): number;
4
+ export declare function isPositiveInfinity(x: number): boolean;
5
+ export declare function isNegativeInfinity(x: number): boolean;
6
+ export declare function isInfinity(x: number): boolean;
7
+ export declare function max(x: number, y: number): number;
8
+ export declare function min(x: number, y: number): number;
9
+ export declare function maxMagnitude(x: number, y: number): number;
10
+ export declare function minMagnitude(x: number, y: number): number;
11
+ export declare function clamp(x: number, min: number, max: number): number;
@@ -0,0 +1,46 @@
1
+ import { FSharpRef } from "./Types.js";
2
+ export function tryParse(str, defValue) {
3
+ // TODO: test if value is valid and in range
4
+ if (str != null && /\S/.test(str)) {
5
+ const v = +str.replace("_", "");
6
+ if (!Number.isNaN(v)) {
7
+ defValue.contents = v;
8
+ return true;
9
+ }
10
+ }
11
+ return false;
12
+ }
13
+ export function parse(str) {
14
+ const defValue = new FSharpRef(0);
15
+ if (tryParse(str, defValue)) {
16
+ return defValue.contents;
17
+ }
18
+ else {
19
+ throw new Error(`The input string ${str} was not in a correct format.`);
20
+ }
21
+ }
22
+ // JS Number.isFinite function evals false for NaN
23
+ export function isPositiveInfinity(x) {
24
+ return x === Number.POSITIVE_INFINITY;
25
+ }
26
+ export function isNegativeInfinity(x) {
27
+ return x === Number.NEGATIVE_INFINITY;
28
+ }
29
+ export function isInfinity(x) {
30
+ return x === Number.POSITIVE_INFINITY || x === Number.NEGATIVE_INFINITY;
31
+ }
32
+ export function max(x, y) {
33
+ return x > y ? x : y;
34
+ }
35
+ export function min(x, y) {
36
+ return x < y ? x : y;
37
+ }
38
+ export function maxMagnitude(x, y) {
39
+ return Math.abs(x) > Math.abs(y) ? x : y;
40
+ }
41
+ export function minMagnitude(x, y) {
42
+ return Math.abs(x) < Math.abs(y) ? x : y;
43
+ }
44
+ export function clamp(x, min, max) {
45
+ return x < min ? min : x > max ? max : x;
46
+ }
@@ -0,0 +1,12 @@
1
+ import { uint8 } from "./Int32.js";
2
+ declare class UTF16LE {
3
+ getBytes(str: string | string[], index?: number, count?: number): Uint8Array;
4
+ getString(bytes: ArrayLike<uint8>, index?: number, count?: number): string;
5
+ }
6
+ declare class UTF8 {
7
+ getBytes(str: string | string[], index?: number, count?: number): Uint8Array;
8
+ getString(bytes: ArrayLike<uint8>, index?: number, count?: number): string;
9
+ }
10
+ export declare function get_Unicode(): UTF16LE;
11
+ export declare function get_UTF8(): UTF8;
12
+ export {};
@@ -0,0 +1,173 @@
1
+ const littleEndian = true;
2
+ function utf16le_encode(str) {
3
+ const bytes = new Uint8Array(str.length * 2);
4
+ const view = new DataView(bytes.buffer);
5
+ for (let i = 0; i < str.length; i++) {
6
+ const code = str.charCodeAt(i);
7
+ view.setUint16(i * 2, code, littleEndian);
8
+ }
9
+ return bytes;
10
+ }
11
+ function utf16le_decode(bytes) {
12
+ const array = ArrayBuffer.isView(bytes) ? bytes : Uint8Array.from(bytes);
13
+ const view = new DataView(array.buffer, array.byteOffset, array.byteLength);
14
+ const chars = new Array(view.byteLength / 2);
15
+ for (let i = 0; i < chars.length; i++) {
16
+ const code = view.getUint16(i * 2, littleEndian);
17
+ chars[i] = String.fromCharCode(code);
18
+ }
19
+ return chars.join("");
20
+ }
21
+ function utf8_encode(str) {
22
+ let pos = 0;
23
+ let buf = new Uint8Array(str.length * 3);
24
+ for (let i = 0; i < str.length; i++) {
25
+ let code = str.charCodeAt(i);
26
+ if (code >= 0xD800 && code <= 0xDBFF) {
27
+ const nextCode = (i < str.length) ? str.charCodeAt(i + 1) : 0;
28
+ if (nextCode >= 0xDC00 && nextCode <= 0xDFFF) {
29
+ i += 1;
30
+ code = (code - 0xD800) * 0x400 + nextCode - 0xDC00 + 0x10000;
31
+ if (code > 0xFFFF) {
32
+ buf[pos++] = (0x1E << 3) | (code >>> 18);
33
+ buf[pos++] = (0x2 << 6) | ((code >>> 12) & 0x3F);
34
+ buf[pos++] = (0x2 << 6) | ((code >>> 6) & 0x3F);
35
+ buf[pos++] = (0x2 << 6) | (code & 0x3F);
36
+ }
37
+ }
38
+ else {
39
+ buf[pos++] = 0xEF;
40
+ buf[pos++] = 0xBF;
41
+ buf[pos++] = 0xBD;
42
+ }
43
+ }
44
+ else if (code <= 0x007F) {
45
+ buf[pos++] = (0x0 << 7) | code;
46
+ }
47
+ else if (code <= 0x07FF) {
48
+ buf[pos++] = (0x6 << 5) | (code >>> 6);
49
+ buf[pos++] = (0x2 << 6) | (code & 0x3F);
50
+ }
51
+ else {
52
+ buf[pos++] = (0xE << 4) | (code >>> 12);
53
+ buf[pos++] = (0x2 << 6) | ((code >>> 6) & 0x3F);
54
+ buf[pos++] = (0x2 << 6) | (code & 0x3F);
55
+ }
56
+ }
57
+ buf = new Uint8Array(buf.buffer.slice(0, pos));
58
+ return buf;
59
+ }
60
+ function utf8_decode(bytes) {
61
+ let pos = 0;
62
+ const decodeUtf8 = () => {
63
+ const i1 = bytes[pos++];
64
+ if ((i1 & 0x80) === 0) {
65
+ return i1;
66
+ }
67
+ else if ((i1 & 0xE0) === 0xC0) {
68
+ const i2 = bytes[pos++];
69
+ return ((i1 & 0x1F) << 6) | (i2 & 0x3F);
70
+ }
71
+ else if ((i1 & 0xF0) === 0xE0) {
72
+ const i2 = bytes[pos++];
73
+ const i3 = bytes[pos++];
74
+ return ((i1 & 0x0F) << 12) | ((i2 & 0x3F) << 6) | (i3 & 0x3F);
75
+ }
76
+ else if ((i1 & 0xF8) === 0xF0) {
77
+ const i2 = bytes[pos++];
78
+ const i3 = bytes[pos++];
79
+ const i4 = bytes[pos++];
80
+ return ((i1 & 0x07) << 18) | ((i2 & 0x3F) << 12) | ((i3 & 0x3F) << 6) | (i4 & 0x3F);
81
+ }
82
+ else {
83
+ throw new RangeError("Invalid UTF8 byte: " + i1);
84
+ }
85
+ };
86
+ const chars = new Array();
87
+ while (pos < bytes.length) {
88
+ const code = decodeUtf8();
89
+ chars.push(String.fromCodePoint(code));
90
+ }
91
+ return chars.join("");
92
+ }
93
+ class UTF16LE {
94
+ getBytes(str, index, count) {
95
+ str = Array.isArray(str) ? str.join("") : str;
96
+ if (index != null && count != null) {
97
+ str = str.substring(index, index + count);
98
+ }
99
+ else if (index != null) {
100
+ str = str.substring(index);
101
+ }
102
+ if (typeof Buffer !== "undefined") {
103
+ const bytes = Buffer.from(str, "utf16le");
104
+ return new Uint8Array(bytes.buffer, bytes.byteOffset, bytes.byteLength);
105
+ }
106
+ else {
107
+ return utf16le_encode(str); // polyfill
108
+ }
109
+ }
110
+ getString(bytes, index, count) {
111
+ const array = ArrayBuffer.isView(bytes) ? bytes : Uint8Array.from(bytes);
112
+ let buffer = new Uint8Array(array.buffer, array.byteOffset, array.byteLength);
113
+ if (index != null && count != null) {
114
+ buffer = buffer.subarray(index, index + count);
115
+ }
116
+ else if (index != null) {
117
+ buffer = buffer.subarray(index);
118
+ }
119
+ if (typeof TextDecoder !== "undefined") {
120
+ return new TextDecoder("utf-16le").decode(buffer);
121
+ }
122
+ else if (typeof Buffer !== "undefined") {
123
+ return Buffer.from(buffer).toString("utf16le");
124
+ }
125
+ else {
126
+ return utf16le_decode(buffer); // polyfill
127
+ }
128
+ }
129
+ }
130
+ class UTF8 {
131
+ getBytes(str, index, count) {
132
+ str = Array.isArray(str) ? str.join("") : str;
133
+ if (index != null && count != null) {
134
+ str = str.substring(index, index + count);
135
+ }
136
+ else if (index != null) {
137
+ str = str.substring(index);
138
+ }
139
+ if (typeof TextEncoder !== "undefined") {
140
+ return new TextEncoder().encode(str);
141
+ }
142
+ else if (typeof Buffer !== "undefined") {
143
+ const bytes = Buffer.from(str, "utf8");
144
+ return new Uint8Array(bytes.buffer, bytes.byteOffset, bytes.byteLength);
145
+ }
146
+ else {
147
+ return utf8_encode(str); // polyfill
148
+ }
149
+ }
150
+ getString(bytes, index, count) {
151
+ const array = ArrayBuffer.isView(bytes) ? bytes : Uint8Array.from(bytes);
152
+ let buffer = new Uint8Array(array.buffer, array.byteOffset, array.byteLength);
153
+ if (index != null && count != null) {
154
+ buffer = buffer.subarray(index, index + count);
155
+ }
156
+ else if (index != null) {
157
+ buffer = buffer.subarray(index);
158
+ }
159
+ if (typeof TextDecoder !== "undefined") {
160
+ return new TextDecoder().decode(buffer);
161
+ }
162
+ else if (typeof Buffer !== "undefined") {
163
+ return Buffer.from(buffer).toString("utf8");
164
+ }
165
+ else {
166
+ return utf8_decode(buffer); // polyfill
167
+ }
168
+ }
169
+ }
170
+ const _UTF16 = new UTF16LE();
171
+ const _UTF8 = new UTF8();
172
+ export function get_Unicode() { return _UTF16; }
173
+ export function get_UTF8() { return _UTF8; }
@@ -0,0 +1,31 @@
1
+ import { IObservable } from "./Observable.js";
2
+ import { Option } from "./Option.js";
3
+ import { FSharpChoice$2_$union } from "./Choice.js";
4
+ export type Handler<T> = (sender: any, x: T) => void;
5
+ export interface IDelegateEvent<Delegate extends Function> {
6
+ AddHandler(d: Delegate): void;
7
+ RemoveHandler(d: Delegate): void;
8
+ }
9
+ export interface IEvent$2<Delegate extends Function, Args> extends IDelegateEvent<Delegate>, IObservable<Args> {
10
+ }
11
+ export type IEvent<T> = IEvent$2<Handler<T>, T>;
12
+ export declare class Event$2<Delegate extends Function, Args> {
13
+ private delegates;
14
+ private _add;
15
+ private _remove;
16
+ get Publish(): IEvent$2<Delegate, Args>;
17
+ Trigger(value: Args): void;
18
+ Trigger(sender: any, value: Args): void;
19
+ }
20
+ export declare class Event<T> extends Event$2<Handler<T>, T> {
21
+ }
22
+ export declare function add<Del extends Function, T>(callback: (x: T) => void, sourceEvent: IEvent$2<Del, T>): void;
23
+ export declare function choose<Del extends Function, T, U>(chooser: (x: T) => Option<U>, sourceEvent: IEvent$2<Del, T>): IEvent<U>;
24
+ export declare function filter<Del extends Function, T>(predicate: (x: T) => boolean, sourceEvent: IEvent$2<Del, T>): IEvent<T>;
25
+ export declare function map<Del extends Function, T, U>(mapping: (x: T) => U, sourceEvent: IEvent$2<Del, T>): IEvent<U>;
26
+ export declare function merge<Del1 extends Function, Del2 extends Function, T>(event1: IEvent$2<Del1, T>, event2: IEvent$2<Del2, T>): IEvent<T>;
27
+ export declare function pairwise<Del extends Function, T>(sourceEvent: IEvent$2<Del, T>): IEvent<[T, T]>;
28
+ export declare function partition<Del extends Function, T>(predicate: (x: T) => boolean, sourceEvent: IEvent$2<Del, T>): [IEvent<T>, IEvent<T>];
29
+ export declare function scan<Del extends Function, U, T>(collector: (u: U, t: T) => U, state: U, sourceEvent: IEvent$2<Del, T>): IEvent<U>;
30
+ export declare function split<Del extends Function, T, U1, U2>(splitter: (x: T) => FSharpChoice$2_$union<U1, U2>, sourceEvent: IEvent$2<Del, T>): [IEvent<U1>, IEvent<U2>];
31
+ export declare function createEvent<Del extends Function, T>(addHandler: (h: Del) => void, removeHandler: (h: Del) => void): IEvent$2<Del, T>;
@@ -0,0 +1,93 @@
1
+ import { subscribe } from "./Observable.js";
2
+ import { some, value } from "./Option.js";
3
+ import { Choice_tryValueIfChoice1Of2, Choice_tryValueIfChoice2Of2 } from "./Choice.js";
4
+ export class Event$2 {
5
+ constructor() {
6
+ this.delegates = [];
7
+ }
8
+ _add(d) {
9
+ this.delegates.push(d);
10
+ }
11
+ _remove(d) {
12
+ const index = this.delegates.indexOf(d);
13
+ if (index > -1) {
14
+ this.delegates.splice(index, 1);
15
+ }
16
+ }
17
+ get Publish() {
18
+ return createEvent(h => { this._add(h); }, h => { this._remove(h); });
19
+ }
20
+ Trigger(senderOrValue, valueOrUndefined) {
21
+ let sender = null;
22
+ const value = valueOrUndefined === undefined ? senderOrValue : (sender = senderOrValue, valueOrUndefined);
23
+ this.delegates.forEach(f => { f(sender, value); });
24
+ }
25
+ }
26
+ export class Event extends Event$2 {
27
+ }
28
+ export function add(callback, sourceEvent) {
29
+ subscribe(callback, sourceEvent);
30
+ }
31
+ export function choose(chooser, sourceEvent) {
32
+ const ev = new Event();
33
+ add((t) => {
34
+ const u = chooser(t);
35
+ if (u != null) {
36
+ ev.Trigger(value(u));
37
+ }
38
+ }, sourceEvent);
39
+ return ev.Publish;
40
+ }
41
+ export function filter(predicate, sourceEvent) {
42
+ return choose((x) => predicate(x) ? some(x) : undefined, sourceEvent);
43
+ }
44
+ export function map(mapping, sourceEvent) {
45
+ const ev = new Event();
46
+ add((t) => ev.Trigger(mapping(t)), sourceEvent);
47
+ return ev.Publish;
48
+ }
49
+ export function merge(event1, event2) {
50
+ const ev = new Event();
51
+ const fn = (x) => ev.Trigger(x);
52
+ add(fn, event1);
53
+ add(fn, event2);
54
+ return ev.Publish;
55
+ }
56
+ export function pairwise(sourceEvent) {
57
+ const ev = new Event();
58
+ let last;
59
+ let haveLast = false;
60
+ add((next) => {
61
+ if (haveLast) {
62
+ ev.Trigger([last, next]);
63
+ }
64
+ last = next;
65
+ haveLast = true;
66
+ }, sourceEvent);
67
+ return ev.Publish;
68
+ }
69
+ export function partition(predicate, sourceEvent) {
70
+ return [filter(predicate, sourceEvent), filter((x) => !predicate(x), sourceEvent)];
71
+ }
72
+ export function scan(collector, state, sourceEvent) {
73
+ return map((t) => state = collector(state, t), sourceEvent);
74
+ }
75
+ export function split(splitter, sourceEvent) {
76
+ return [
77
+ choose((v) => Choice_tryValueIfChoice1Of2(splitter(v)), sourceEvent),
78
+ choose((v) => Choice_tryValueIfChoice2Of2(splitter(v)), sourceEvent),
79
+ ];
80
+ }
81
+ export function createEvent(addHandler, removeHandler) {
82
+ return {
83
+ AddHandler(h) { addHandler(h); },
84
+ RemoveHandler(h) { removeHandler(h); },
85
+ Subscribe(r) {
86
+ const h = ((_, args) => r.OnNext(args));
87
+ addHandler(h);
88
+ return {
89
+ Dispose() { removeHandler(h); }
90
+ };
91
+ }
92
+ };
93
+ }
@@ -0,0 +1,7 @@
1
+ import { int32 } from "./Int32.js";
2
+ import { IComparer, IEqualityComparer } from "./Util.js";
3
+ export declare function HashIdentity_FromFunctions<T>(hash: ((arg0: T) => int32), eq: ((arg0: T, arg1: T) => boolean)): IEqualityComparer<T>;
4
+ export declare function HashIdentity_Structural<T>(): IEqualityComparer<T>;
5
+ export declare function HashIdentity_Reference<T>(): IEqualityComparer<T>;
6
+ export declare function ComparisonIdentity_FromFunction<T>(comparer: ((arg0: T, arg1: T) => int32)): IComparer<T>;
7
+ export declare function ComparisonIdentity_Structural<T>(): IComparer<T>;
@@ -0,0 +1,27 @@
1
+ import { compare, physicalHash, equals, structuralHash } from "./Util.js";
2
+ export function HashIdentity_FromFunctions(hash, eq) {
3
+ return {
4
+ Equals(x, y) {
5
+ return eq(x, y);
6
+ },
7
+ GetHashCode(x_1) {
8
+ return hash(x_1);
9
+ },
10
+ };
11
+ }
12
+ export function HashIdentity_Structural() {
13
+ return HashIdentity_FromFunctions(structuralHash, equals);
14
+ }
15
+ export function HashIdentity_Reference() {
16
+ return HashIdentity_FromFunctions(physicalHash, (e, e_1) => (e === e_1));
17
+ }
18
+ export function ComparisonIdentity_FromFunction(comparer) {
19
+ return {
20
+ Compare(x, y) {
21
+ return comparer(x, y);
22
+ },
23
+ };
24
+ }
25
+ export function ComparisonIdentity_Structural() {
26
+ return ComparisonIdentity_FromFunction(compare);
27
+ }
@@ -0,0 +1,12 @@
1
+ import { TypeInfo } from "./Reflection.js";
2
+ import { FSharpList } from "./List.js";
3
+ export declare class ListCollector$1<T> {
4
+ readonly collector: T[];
5
+ constructor();
6
+ }
7
+ export declare function ListCollector$1_$reflection(gen0: TypeInfo): TypeInfo;
8
+ export declare function ListCollector$1_$ctor<T>(): ListCollector$1<T>;
9
+ export declare function ListCollector$1__Add_2B595<T>(this$: ListCollector$1<T>, value: T): void;
10
+ export declare function ListCollector$1__AddMany_BB573A<T>(this$: ListCollector$1<T>, values: Iterable<T>): void;
11
+ export declare function ListCollector$1__AddManyAndClose_BB573A<T>(this$: ListCollector$1<T>, values: Iterable<T>): FSharpList<T>;
12
+ export declare function ListCollector$1__Close<T>(this$: ListCollector$1<T>): FSharpList<T>;
@@ -0,0 +1,27 @@
1
+ import { class_type } from "./Reflection.js";
2
+ import { addRangeInPlace } from "./Array.js";
3
+ import { toList } from "./Seq.js";
4
+ export class ListCollector$1 {
5
+ constructor() {
6
+ this.collector = [];
7
+ }
8
+ }
9
+ export function ListCollector$1_$reflection(gen0) {
10
+ return class_type("Microsoft.FSharp.Core.CompilerServices.ListCollector`1", [gen0], ListCollector$1);
11
+ }
12
+ export function ListCollector$1_$ctor() {
13
+ return new ListCollector$1();
14
+ }
15
+ export function ListCollector$1__Add_2B595(this$, value) {
16
+ void (this$.collector.push(value));
17
+ }
18
+ export function ListCollector$1__AddMany_BB573A(this$, values) {
19
+ addRangeInPlace(values, this$.collector);
20
+ }
21
+ export function ListCollector$1__AddManyAndClose_BB573A(this$, values) {
22
+ addRangeInPlace(values, this$.collector);
23
+ return toList(this$.collector);
24
+ }
25
+ export function ListCollector$1__Close(this$) {
26
+ return toList(this$.collector);
27
+ }
@@ -0,0 +1,17 @@
1
+ import { IDisposable, IEqualityComparer, IComparer } from "./Util.js";
2
+ import { Option } from "./Option.js";
3
+ import { StringBuilder } from "./System.Text.js";
4
+ export declare const LanguagePrimitives_GenericEqualityComparer: any;
5
+ export declare const LanguagePrimitives_GenericEqualityERComparer: any;
6
+ export declare function LanguagePrimitives_FastGenericComparer<T>(): IComparer<T>;
7
+ export declare function LanguagePrimitives_FastGenericComparerFromTable<T>(): IComparer<T>;
8
+ export declare function LanguagePrimitives_FastGenericEqualityComparer<T>(): IEqualityComparer<T>;
9
+ export declare function LanguagePrimitives_FastGenericEqualityComparerFromTable<T>(): IEqualityComparer<T>;
10
+ export declare function Operators_Failure(message: string): Error;
11
+ export declare function Operators_FailurePattern(exn: Error): Option<string>;
12
+ export declare function Operators_NullArg<$a>(x: string): $a;
13
+ export declare function Operators_Using<T extends IDisposable, R>(resource: T, action: ((arg0: T) => R)): R;
14
+ export declare function Operators_Lock<$a, $b>(_lockObj: $a, action: (() => $b)): $b;
15
+ export declare function ExtraTopLevelOperators_LazyPattern<$a>(input: any): $a;
16
+ export declare function PrintfModule_PrintFormatToStringBuilderThen<$a, $b>(continuation: (() => $a), builder: StringBuilder, format: any): $b;
17
+ export declare function PrintfModule_PrintFormatToStringBuilder<$a>(builder: StringBuilder, format: any): $a;