@formatjs/intl-segmenter 11.2.1 → 11.3.0

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.
@@ -38,7 +38,7 @@ var breaksAtResult = function (breaks, matchingRule) { return ({
38
38
  breaks: breaks,
39
39
  matchingRule: matchingRule,
40
40
  }); };
41
- var Segmenter = /** @class */ (function () {
41
+ export var Segmenter = /** @class */ (function () {
42
42
  function Segmenter(locales, options) {
43
43
  var _newTarget = this.constructor;
44
44
  if (_newTarget === undefined) {
@@ -75,6 +75,7 @@ var Segmenter = /** @class */ (function () {
75
75
  this.ruleSortedKeys = Object.keys(this.rules).sort(function (a, b) { return Number(a) - Number(b); });
76
76
  }
77
77
  Segmenter.prototype.breaksAt = function (position, input) {
78
+ var _a;
78
79
  var ruleSortedKeys = this.ruleSortedKeys;
79
80
  var rules = this.rules;
80
81
  var mergedSegmentationTypeValue = this.mergedSegmentationTypeValue;
@@ -95,17 +96,17 @@ var Segmenter = /** @class */ (function () {
95
96
  var stringAfterBreak = input.substring(position);
96
97
  //artificial rule 0.4: handle suppressions
97
98
  if ('suppressions' in mergedSegmentationTypeValue) {
98
- for (var _i = 0, _a = mergedSegmentationTypeValue.suppressions; _i < _a.length; _i++) {
99
- var suppressions = _a[_i];
99
+ for (var _i = 0, _b = mergedSegmentationTypeValue.suppressions; _i < _b.length; _i++) {
100
+ var suppressions = _b[_i];
100
101
  if (stringBeforeBreak.trim().endsWith(suppressions)) {
101
102
  return breaksAtResult(false, '0.4');
102
103
  }
103
104
  }
104
105
  }
105
106
  // loop through rules and find a match
106
- for (var _b = 0, ruleSortedKeys_1 = ruleSortedKeys; _b < ruleSortedKeys_1.length; _b++) {
107
- var ruleKey = ruleSortedKeys_1[_b];
108
- var _c = rules[ruleKey], before = _c.before, after = _c.after, breaks = _c.breaks;
107
+ for (var _c = 0, ruleSortedKeys_1 = ruleSortedKeys; _c < ruleSortedKeys_1.length; _c++) {
108
+ var ruleKey = ruleSortedKeys_1[_c];
109
+ var before = (_a = rules[ruleKey], _a.before), after = _a.after, breaks = _a.breaks;
109
110
  // for debugging
110
111
  // if (ruleKey === '16' && position === 4) {
111
112
  // console.log({before, after, stringBeforeBreak, stringAfterBreak})
@@ -142,7 +143,6 @@ var Segmenter = /** @class */ (function () {
142
143
  Segmenter.polyfilled = true;
143
144
  return Segmenter;
144
145
  }());
145
- export { Segmenter };
146
146
  var createSegmentDataObject = function (segmenter, segment, index, input, matchingRule) {
147
147
  var returnValue = {
148
148
  segment: segment,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formatjs/intl-segmenter",
3
- "version": "11.2.1",
3
+ "version": "11.3.0",
4
4
  "description": "Polyfill for Intl.Segmenter",
5
5
  "keywords": [
6
6
  "intl",
package/polyfill.iife.js CHANGED
@@ -1,495 +1,47 @@
1
1
  (() => {
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __commonJS = (cb, mod) => function __require() {
9
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
2
+ // ../../../../../../../../execroot/formatjs/bazel-out/darwin-fastbuild/bin/node_modules/.aspect_rules_js/tslib@2.4.0/node_modules/tslib/tslib.es6.js
3
+ var extendStatics = function(d, b) {
4
+ extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
5
+ d2.__proto__ = b2;
6
+ } || function(d2, b2) {
7
+ for (var p in b2)
8
+ if (Object.prototype.hasOwnProperty.call(b2, p))
9
+ d2[p] = b2[p];
10
+ };
11
+ return extendStatics(d, b);
10
12
  };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ function __extends(d, b) {
14
+ if (typeof b !== "function" && b !== null)
15
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
16
+ extendStatics(d, b);
17
+ function __() {
18
+ this.constructor = d;
16
19
  }
17
- return to;
20
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
21
+ }
22
+ var __assign = function() {
23
+ __assign = Object.assign || function __assign2(t) {
24
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
25
+ s = arguments[i];
26
+ for (var p in s)
27
+ if (Object.prototype.hasOwnProperty.call(s, p))
28
+ t[p] = s[p];
29
+ }
30
+ return t;
31
+ };
32
+ return __assign.apply(this, arguments);
18
33
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
- mod
22
- ));
23
-
24
- // ../../../../../../../../execroot/formatjs/bazel-out/darwin-fastbuild/bin/node_modules/.aspect_rules_js/tslib@2.4.0/node_modules/tslib/tslib.js
25
- var require_tslib = __commonJS({
26
- "../../../../../../../../execroot/formatjs/bazel-out/darwin-fastbuild/bin/node_modules/.aspect_rules_js/tslib@2.4.0/node_modules/tslib/tslib.js"(exports, module) {
27
- var __extends2;
28
- var __assign2;
29
- var __rest2;
30
- var __decorate2;
31
- var __param2;
32
- var __metadata2;
33
- var __awaiter2;
34
- var __generator2;
35
- var __exportStar2;
36
- var __values2;
37
- var __read2;
38
- var __spread2;
39
- var __spreadArrays2;
40
- var __spreadArray2;
41
- var __await2;
42
- var __asyncGenerator2;
43
- var __asyncDelegator2;
44
- var __asyncValues2;
45
- var __makeTemplateObject2;
46
- var __importStar2;
47
- var __importDefault2;
48
- var __classPrivateFieldGet2;
49
- var __classPrivateFieldSet2;
50
- var __classPrivateFieldIn2;
51
- var __createBinding2;
52
- (function(factory) {
53
- var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {};
54
- if (typeof define === "function" && define.amd) {
55
- define("tslib", ["exports"], function(exports2) {
56
- factory(createExporter(root, createExporter(exports2)));
57
- });
58
- } else if (typeof module === "object" && typeof module.exports === "object") {
59
- factory(createExporter(root, createExporter(module.exports)));
60
- } else {
61
- factory(createExporter(root));
34
+ function __spreadArray(to, from, pack) {
35
+ if (pack || arguments.length === 2)
36
+ for (var i = 0, l = from.length, ar; i < l; i++) {
37
+ if (ar || !(i in from)) {
38
+ if (!ar)
39
+ ar = Array.prototype.slice.call(from, 0, i);
40
+ ar[i] = from[i];
62
41
  }
63
- function createExporter(exports2, previous) {
64
- if (exports2 !== root) {
65
- if (typeof Object.create === "function") {
66
- Object.defineProperty(exports2, "__esModule", { value: true });
67
- } else {
68
- exports2.__esModule = true;
69
- }
70
- }
71
- return function(id, v) {
72
- return exports2[id] = previous ? previous(id, v) : v;
73
- };
74
- }
75
- })(function(exporter) {
76
- var extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d, b) {
77
- d.__proto__ = b;
78
- } || function(d, b) {
79
- for (var p in b)
80
- if (Object.prototype.hasOwnProperty.call(b, p))
81
- d[p] = b[p];
82
- };
83
- __extends2 = function(d, b) {
84
- if (typeof b !== "function" && b !== null)
85
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
86
- extendStatics(d, b);
87
- function __() {
88
- this.constructor = d;
89
- }
90
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
91
- };
92
- __assign2 = Object.assign || function(t) {
93
- for (var s, i = 1, n = arguments.length; i < n; i++) {
94
- s = arguments[i];
95
- for (var p in s)
96
- if (Object.prototype.hasOwnProperty.call(s, p))
97
- t[p] = s[p];
98
- }
99
- return t;
100
- };
101
- __rest2 = function(s, e) {
102
- var t = {};
103
- for (var p in s)
104
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
105
- t[p] = s[p];
106
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
107
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
108
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
109
- t[p[i]] = s[p[i]];
110
- }
111
- return t;
112
- };
113
- __decorate2 = function(decorators, target, key, desc) {
114
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
115
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
116
- r = Reflect.decorate(decorators, target, key, desc);
117
- else
118
- for (var i = decorators.length - 1; i >= 0; i--)
119
- if (d = decorators[i])
120
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
121
- return c > 3 && r && Object.defineProperty(target, key, r), r;
122
- };
123
- __param2 = function(paramIndex, decorator) {
124
- return function(target, key) {
125
- decorator(target, key, paramIndex);
126
- };
127
- };
128
- __metadata2 = function(metadataKey, metadataValue) {
129
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
130
- return Reflect.metadata(metadataKey, metadataValue);
131
- };
132
- __awaiter2 = function(thisArg, _arguments, P, generator) {
133
- function adopt(value) {
134
- return value instanceof P ? value : new P(function(resolve) {
135
- resolve(value);
136
- });
137
- }
138
- return new (P || (P = Promise))(function(resolve, reject) {
139
- function fulfilled(value) {
140
- try {
141
- step(generator.next(value));
142
- } catch (e) {
143
- reject(e);
144
- }
145
- }
146
- function rejected(value) {
147
- try {
148
- step(generator["throw"](value));
149
- } catch (e) {
150
- reject(e);
151
- }
152
- }
153
- function step(result) {
154
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
155
- }
156
- step((generator = generator.apply(thisArg, _arguments || [])).next());
157
- });
158
- };
159
- __generator2 = function(thisArg, body) {
160
- var _ = { label: 0, sent: function() {
161
- if (t[0] & 1)
162
- throw t[1];
163
- return t[1];
164
- }, trys: [], ops: [] }, f, y, t, g;
165
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
166
- return this;
167
- }), g;
168
- function verb(n) {
169
- return function(v) {
170
- return step([n, v]);
171
- };
172
- }
173
- function step(op) {
174
- if (f)
175
- throw new TypeError("Generator is already executing.");
176
- while (_)
177
- try {
178
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
179
- return t;
180
- if (y = 0, t)
181
- op = [op[0] & 2, t.value];
182
- switch (op[0]) {
183
- case 0:
184
- case 1:
185
- t = op;
186
- break;
187
- case 4:
188
- _.label++;
189
- return { value: op[1], done: false };
190
- case 5:
191
- _.label++;
192
- y = op[1];
193
- op = [0];
194
- continue;
195
- case 7:
196
- op = _.ops.pop();
197
- _.trys.pop();
198
- continue;
199
- default:
200
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
201
- _ = 0;
202
- continue;
203
- }
204
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
205
- _.label = op[1];
206
- break;
207
- }
208
- if (op[0] === 6 && _.label < t[1]) {
209
- _.label = t[1];
210
- t = op;
211
- break;
212
- }
213
- if (t && _.label < t[2]) {
214
- _.label = t[2];
215
- _.ops.push(op);
216
- break;
217
- }
218
- if (t[2])
219
- _.ops.pop();
220
- _.trys.pop();
221
- continue;
222
- }
223
- op = body.call(thisArg, _);
224
- } catch (e) {
225
- op = [6, e];
226
- y = 0;
227
- } finally {
228
- f = t = 0;
229
- }
230
- if (op[0] & 5)
231
- throw op[1];
232
- return { value: op[0] ? op[1] : void 0, done: true };
233
- }
234
- };
235
- __exportStar2 = function(m, o) {
236
- for (var p in m)
237
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
238
- __createBinding2(o, m, p);
239
- };
240
- __createBinding2 = Object.create ? function(o, m, k, k2) {
241
- if (k2 === void 0)
242
- k2 = k;
243
- var desc = Object.getOwnPropertyDescriptor(m, k);
244
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
245
- desc = { enumerable: true, get: function() {
246
- return m[k];
247
- } };
248
- }
249
- Object.defineProperty(o, k2, desc);
250
- } : function(o, m, k, k2) {
251
- if (k2 === void 0)
252
- k2 = k;
253
- o[k2] = m[k];
254
- };
255
- __values2 = function(o) {
256
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
257
- if (m)
258
- return m.call(o);
259
- if (o && typeof o.length === "number")
260
- return {
261
- next: function() {
262
- if (o && i >= o.length)
263
- o = void 0;
264
- return { value: o && o[i++], done: !o };
265
- }
266
- };
267
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
268
- };
269
- __read2 = function(o, n) {
270
- var m = typeof Symbol === "function" && o[Symbol.iterator];
271
- if (!m)
272
- return o;
273
- var i = m.call(o), r, ar = [], e;
274
- try {
275
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
276
- ar.push(r.value);
277
- } catch (error) {
278
- e = { error };
279
- } finally {
280
- try {
281
- if (r && !r.done && (m = i["return"]))
282
- m.call(i);
283
- } finally {
284
- if (e)
285
- throw e.error;
286
- }
287
- }
288
- return ar;
289
- };
290
- __spread2 = function() {
291
- for (var ar = [], i = 0; i < arguments.length; i++)
292
- ar = ar.concat(__read2(arguments[i]));
293
- return ar;
294
- };
295
- __spreadArrays2 = function() {
296
- for (var s = 0, i = 0, il = arguments.length; i < il; i++)
297
- s += arguments[i].length;
298
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
299
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
300
- r[k] = a[j];
301
- return r;
302
- };
303
- __spreadArray2 = function(to, from, pack) {
304
- if (pack || arguments.length === 2)
305
- for (var i = 0, l = from.length, ar; i < l; i++) {
306
- if (ar || !(i in from)) {
307
- if (!ar)
308
- ar = Array.prototype.slice.call(from, 0, i);
309
- ar[i] = from[i];
310
- }
311
- }
312
- return to.concat(ar || Array.prototype.slice.call(from));
313
- };
314
- __await2 = function(v) {
315
- return this instanceof __await2 ? (this.v = v, this) : new __await2(v);
316
- };
317
- __asyncGenerator2 = function(thisArg, _arguments, generator) {
318
- if (!Symbol.asyncIterator)
319
- throw new TypeError("Symbol.asyncIterator is not defined.");
320
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
321
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
322
- return this;
323
- }, i;
324
- function verb(n) {
325
- if (g[n])
326
- i[n] = function(v) {
327
- return new Promise(function(a, b) {
328
- q.push([n, v, a, b]) > 1 || resume(n, v);
329
- });
330
- };
331
- }
332
- function resume(n, v) {
333
- try {
334
- step(g[n](v));
335
- } catch (e) {
336
- settle(q[0][3], e);
337
- }
338
- }
339
- function step(r) {
340
- r.value instanceof __await2 ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);
341
- }
342
- function fulfill(value) {
343
- resume("next", value);
344
- }
345
- function reject(value) {
346
- resume("throw", value);
347
- }
348
- function settle(f, v) {
349
- if (f(v), q.shift(), q.length)
350
- resume(q[0][0], q[0][1]);
351
- }
352
- };
353
- __asyncDelegator2 = function(o) {
354
- var i, p;
355
- return i = {}, verb("next"), verb("throw", function(e) {
356
- throw e;
357
- }), verb("return"), i[Symbol.iterator] = function() {
358
- return this;
359
- }, i;
360
- function verb(n, f) {
361
- i[n] = o[n] ? function(v) {
362
- return (p = !p) ? { value: __await2(o[n](v)), done: n === "return" } : f ? f(v) : v;
363
- } : f;
364
- }
365
- };
366
- __asyncValues2 = function(o) {
367
- if (!Symbol.asyncIterator)
368
- throw new TypeError("Symbol.asyncIterator is not defined.");
369
- var m = o[Symbol.asyncIterator], i;
370
- return m ? m.call(o) : (o = typeof __values2 === "function" ? __values2(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
371
- return this;
372
- }, i);
373
- function verb(n) {
374
- i[n] = o[n] && function(v) {
375
- return new Promise(function(resolve, reject) {
376
- v = o[n](v), settle(resolve, reject, v.done, v.value);
377
- });
378
- };
379
- }
380
- function settle(resolve, reject, d, v) {
381
- Promise.resolve(v).then(function(v2) {
382
- resolve({ value: v2, done: d });
383
- }, reject);
384
- }
385
- };
386
- __makeTemplateObject2 = function(cooked, raw) {
387
- if (Object.defineProperty) {
388
- Object.defineProperty(cooked, "raw", { value: raw });
389
- } else {
390
- cooked.raw = raw;
391
- }
392
- return cooked;
393
- };
394
- var __setModuleDefault = Object.create ? function(o, v) {
395
- Object.defineProperty(o, "default", { enumerable: true, value: v });
396
- } : function(o, v) {
397
- o["default"] = v;
398
- };
399
- __importStar2 = function(mod) {
400
- if (mod && mod.__esModule)
401
- return mod;
402
- var result = {};
403
- if (mod != null) {
404
- for (var k in mod)
405
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
406
- __createBinding2(result, mod, k);
407
- }
408
- __setModuleDefault(result, mod);
409
- return result;
410
- };
411
- __importDefault2 = function(mod) {
412
- return mod && mod.__esModule ? mod : { "default": mod };
413
- };
414
- __classPrivateFieldGet2 = function(receiver, state, kind, f) {
415
- if (kind === "a" && !f)
416
- throw new TypeError("Private accessor was defined without a getter");
417
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
418
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
419
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
420
- };
421
- __classPrivateFieldSet2 = function(receiver, state, value, kind, f) {
422
- if (kind === "m")
423
- throw new TypeError("Private method is not writable");
424
- if (kind === "a" && !f)
425
- throw new TypeError("Private accessor was defined without a setter");
426
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
427
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
428
- return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
429
- };
430
- __classPrivateFieldIn2 = function(state, receiver) {
431
- if (receiver === null || typeof receiver !== "object" && typeof receiver !== "function")
432
- throw new TypeError("Cannot use 'in' operator on non-object");
433
- return typeof state === "function" ? receiver === state : state.has(receiver);
434
- };
435
- exporter("__extends", __extends2);
436
- exporter("__assign", __assign2);
437
- exporter("__rest", __rest2);
438
- exporter("__decorate", __decorate2);
439
- exporter("__param", __param2);
440
- exporter("__metadata", __metadata2);
441
- exporter("__awaiter", __awaiter2);
442
- exporter("__generator", __generator2);
443
- exporter("__exportStar", __exportStar2);
444
- exporter("__createBinding", __createBinding2);
445
- exporter("__values", __values2);
446
- exporter("__read", __read2);
447
- exporter("__spread", __spread2);
448
- exporter("__spreadArrays", __spreadArrays2);
449
- exporter("__spreadArray", __spreadArray2);
450
- exporter("__await", __await2);
451
- exporter("__asyncGenerator", __asyncGenerator2);
452
- exporter("__asyncDelegator", __asyncDelegator2);
453
- exporter("__asyncValues", __asyncValues2);
454
- exporter("__makeTemplateObject", __makeTemplateObject2);
455
- exporter("__importStar", __importStar2);
456
- exporter("__importDefault", __importDefault2);
457
- exporter("__classPrivateFieldGet", __classPrivateFieldGet2);
458
- exporter("__classPrivateFieldSet", __classPrivateFieldSet2);
459
- exporter("__classPrivateFieldIn", __classPrivateFieldIn2);
460
- });
461
- }
462
- });
463
-
464
- // ../../../../../../../../execroot/formatjs/bazel-out/darwin-fastbuild/bin/node_modules/.aspect_rules_js/tslib@2.4.0/node_modules/tslib/modules/index.js
465
- var import_tslib = __toESM(require_tslib(), 1);
466
- var {
467
- __extends,
468
- __assign,
469
- __rest,
470
- __decorate,
471
- __param,
472
- __metadata,
473
- __awaiter,
474
- __generator,
475
- __exportStar,
476
- __createBinding,
477
- __values,
478
- __read,
479
- __spread,
480
- __spreadArrays,
481
- __spreadArray,
482
- __await,
483
- __asyncGenerator,
484
- __asyncDelegator,
485
- __asyncValues,
486
- __makeTemplateObject,
487
- __importStar,
488
- __importDefault,
489
- __classPrivateFieldGet,
490
- __classPrivateFieldSet,
491
- __classPrivateFieldIn
492
- } = import_tslib.default;
42
+ }
43
+ return to.concat(ar || Array.prototype.slice.call(from));
44
+ }
493
45
 
494
46
  // ../../../../../../../../execroot/formatjs/bazel-out/darwin-fastbuild/bin/packages/intl-segmenter/lib/src/cldr-segmentation-rules.generated.js
495
47
  var SegmentationRules = {
@@ -2142,15 +1694,18 @@
2142
1694
  }
2143
1695
 
2144
1696
  // ../../../../../../../../execroot/formatjs/bazel-out/darwin-fastbuild/bin/node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/lib/data.js
2145
- var MissingLocaleDataError = function(_super) {
2146
- __extends(MissingLocaleDataError2, _super);
2147
- function MissingLocaleDataError2() {
2148
- var _this = _super !== null && _super.apply(this, arguments) || this;
2149
- _this.type = "MISSING_LOCALE_DATA";
2150
- return _this;
2151
- }
2152
- return MissingLocaleDataError2;
2153
- }(Error);
1697
+ var MissingLocaleDataError = (
1698
+ /** @class */
1699
+ function(_super) {
1700
+ __extends(MissingLocaleDataError2, _super);
1701
+ function MissingLocaleDataError2() {
1702
+ var _this = _super !== null && _super.apply(this, arguments) || this;
1703
+ _this.type = "MISSING_LOCALE_DATA";
1704
+ return _this;
1705
+ }
1706
+ return MissingLocaleDataError2;
1707
+ }(Error)
1708
+ );
2154
1709
 
2155
1710
  // ../../../../../../../../execroot/formatjs/bazel-out/darwin-fastbuild/bin/node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/lib/types/date-time.js
2156
1711
  var RangePatternType;
@@ -2188,102 +1743,109 @@
2188
1743
  matchingRule
2189
1744
  };
2190
1745
  };
2191
- var Segmenter = function() {
2192
- function Segmenter2(locales, options) {
2193
- var _newTarget = this.constructor;
2194
- if (_newTarget === void 0) {
2195
- throw TypeError("Constructor Intl.Segmenter requires 'new'");
2196
- }
2197
- var requestedLocales = CanonicalizeLocaleList(locales);
2198
- options = GetOptionsObject(options);
2199
- var opt = /* @__PURE__ */ Object.create(null);
2200
- var matcher = GetOption(options, "localeMatcher", "string", ["lookup", "best fit"], "best fit");
2201
- opt.localeMatcher = matcher;
2202
- var granularity = GetOption(options, "granularity", "string", ["word", "sentence", "grapheme"], "grapheme");
2203
- setSlot(this, "granularity", granularity);
2204
- var r = ResolveLocale(
2205
- Segmenter2.availableLocales,
2206
- requestedLocales,
2207
- opt,
2208
- [],
2209
- {},
2210
- function() {
2211
- return "";
2212
- }
2213
- );
2214
- setSlot(this, "locale", r.locale);
2215
- this.mergedSegmentationTypeValue = SegmentationRules.root[granularity];
2216
- if (r.locale.length) {
2217
- var localeOverrides = SegmentationRules[r.locale];
2218
- if (granularity in localeOverrides) {
2219
- var localeSegmentationTypeValue = localeOverrides[granularity];
2220
- this.mergedSegmentationTypeValue.variables = __assign(__assign({}, this.mergedSegmentationTypeValue.variables), localeSegmentationTypeValue.variables);
2221
- this.mergedSegmentationTypeValue.segmentRules = __assign(__assign({}, this.mergedSegmentationTypeValue.segmentRules), localeSegmentationTypeValue.segmentRules);
2222
- this.mergedSegmentationTypeValue.suppressions = __spreadArray(__spreadArray([], this.mergedSegmentationTypeValue.suppressions, true), localeSegmentationTypeValue.suppressions, true);
1746
+ var Segmenter = (
1747
+ /** @class */
1748
+ function() {
1749
+ function Segmenter2(locales, options) {
1750
+ var _newTarget = this.constructor;
1751
+ if (_newTarget === void 0) {
1752
+ throw TypeError("Constructor Intl.Segmenter requires 'new'");
2223
1753
  }
2224
- }
2225
- this.rules = prepareLocaleSegmentationRules(this.mergedSegmentationTypeValue);
2226
- this.ruleSortedKeys = Object.keys(this.rules).sort(function(a, b) {
2227
- return Number(a) - Number(b);
2228
- });
2229
- }
2230
- Segmenter2.prototype.breaksAt = function(position, input) {
2231
- var ruleSortedKeys = this.ruleSortedKeys;
2232
- var rules = this.rules;
2233
- var mergedSegmentationTypeValue = this.mergedSegmentationTypeValue;
2234
- if (position === 0) {
2235
- return breaksAtResult(true, "0.2");
2236
- }
2237
- if (position === input.length) {
2238
- return breaksAtResult(true, "0.3");
2239
- }
2240
- if (isSurrogate(input, position)) {
2241
- return breaksAtResult(false, "0.1");
2242
- }
2243
- var stringBeforeBreak = input.substring(0, position);
2244
- var stringAfterBreak = input.substring(position);
2245
- if ("suppressions" in mergedSegmentationTypeValue) {
2246
- for (var _i = 0, _a = mergedSegmentationTypeValue.suppressions; _i < _a.length; _i++) {
2247
- var suppressions = _a[_i];
2248
- if (stringBeforeBreak.trim().endsWith(suppressions)) {
2249
- return breaksAtResult(false, "0.4");
1754
+ var requestedLocales = CanonicalizeLocaleList(locales);
1755
+ options = GetOptionsObject(options);
1756
+ var opt = /* @__PURE__ */ Object.create(null);
1757
+ var matcher = GetOption(options, "localeMatcher", "string", ["lookup", "best fit"], "best fit");
1758
+ opt.localeMatcher = matcher;
1759
+ var granularity = GetOption(options, "granularity", "string", ["word", "sentence", "grapheme"], "grapheme");
1760
+ setSlot(this, "granularity", granularity);
1761
+ var r = ResolveLocale(
1762
+ Segmenter2.availableLocales,
1763
+ //availible locales
1764
+ requestedLocales,
1765
+ opt,
1766
+ [],
1767
+ // there is no relevantExtensionKeys
1768
+ {},
1769
+ function() {
1770
+ return "";
1771
+ }
1772
+ //use only root rules
1773
+ );
1774
+ setSlot(this, "locale", r.locale);
1775
+ this.mergedSegmentationTypeValue = SegmentationRules.root[granularity];
1776
+ if (r.locale.length) {
1777
+ var localeOverrides = SegmentationRules[r.locale];
1778
+ if (granularity in localeOverrides) {
1779
+ var localeSegmentationTypeValue = localeOverrides[granularity];
1780
+ this.mergedSegmentationTypeValue.variables = __assign(__assign({}, this.mergedSegmentationTypeValue.variables), localeSegmentationTypeValue.variables);
1781
+ this.mergedSegmentationTypeValue.segmentRules = __assign(__assign({}, this.mergedSegmentationTypeValue.segmentRules), localeSegmentationTypeValue.segmentRules);
1782
+ this.mergedSegmentationTypeValue.suppressions = __spreadArray(__spreadArray([], this.mergedSegmentationTypeValue.suppressions, true), localeSegmentationTypeValue.suppressions, true);
2250
1783
  }
2251
1784
  }
1785
+ this.rules = prepareLocaleSegmentationRules(this.mergedSegmentationTypeValue);
1786
+ this.ruleSortedKeys = Object.keys(this.rules).sort(function(a, b) {
1787
+ return Number(a) - Number(b);
1788
+ });
2252
1789
  }
2253
- for (var _b = 0, ruleSortedKeys_1 = ruleSortedKeys; _b < ruleSortedKeys_1.length; _b++) {
2254
- var ruleKey = ruleSortedKeys_1[_b];
2255
- var _c = rules[ruleKey], before = _c.before, after = _c.after, breaks = _c.breaks;
2256
- if (before) {
2257
- if (!before.test(stringBeforeBreak)) {
2258
- continue;
1790
+ Segmenter2.prototype.breaksAt = function(position, input) {
1791
+ var _a;
1792
+ var ruleSortedKeys = this.ruleSortedKeys;
1793
+ var rules = this.rules;
1794
+ var mergedSegmentationTypeValue = this.mergedSegmentationTypeValue;
1795
+ if (position === 0) {
1796
+ return breaksAtResult(true, "0.2");
1797
+ }
1798
+ if (position === input.length) {
1799
+ return breaksAtResult(true, "0.3");
1800
+ }
1801
+ if (isSurrogate(input, position)) {
1802
+ return breaksAtResult(false, "0.1");
1803
+ }
1804
+ var stringBeforeBreak = input.substring(0, position);
1805
+ var stringAfterBreak = input.substring(position);
1806
+ if ("suppressions" in mergedSegmentationTypeValue) {
1807
+ for (var _i = 0, _b = mergedSegmentationTypeValue.suppressions; _i < _b.length; _i++) {
1808
+ var suppressions = _b[_i];
1809
+ if (stringBeforeBreak.trim().endsWith(suppressions)) {
1810
+ return breaksAtResult(false, "0.4");
1811
+ }
2259
1812
  }
2260
1813
  }
2261
- if (after) {
2262
- if (!after.test(stringAfterBreak)) {
2263
- continue;
1814
+ for (var _c = 0, ruleSortedKeys_1 = ruleSortedKeys; _c < ruleSortedKeys_1.length; _c++) {
1815
+ var ruleKey = ruleSortedKeys_1[_c];
1816
+ var before = (_a = rules[ruleKey], _a.before), after = _a.after, breaks = _a.breaks;
1817
+ if (before) {
1818
+ if (!before.test(stringBeforeBreak)) {
1819
+ continue;
1820
+ }
1821
+ }
1822
+ if (after) {
1823
+ if (!after.test(stringAfterBreak)) {
1824
+ continue;
1825
+ }
2264
1826
  }
1827
+ return breaksAtResult(breaks, ruleKey);
2265
1828
  }
2266
- return breaksAtResult(breaks, ruleKey);
2267
- }
2268
- return breaksAtResult(true, "999");
2269
- };
2270
- Segmenter2.prototype.segment = function(input) {
2271
- checkReceiver(this, "segment");
2272
- return new SegmentIterator(this, input);
2273
- };
2274
- Segmenter2.prototype.resolvedOptions = function() {
2275
- checkReceiver(this, "resolvedOptions");
2276
- return __assign({}, getMultiInternalSlots(__INTERNAL_SLOT_MAP__, this, "locale", "granularity"));
2277
- };
2278
- Segmenter2.supportedLocalesOf = function(locales, options) {
2279
- return SupportedLocales(Segmenter2.availableLocales, CanonicalizeLocaleList(locales), options);
2280
- };
2281
- Segmenter2.availableLocales = new Set(Object.keys(SegmentationRules).filter(function(key) {
2282
- return key !== "root";
2283
- }));
2284
- Segmenter2.polyfilled = true;
2285
- return Segmenter2;
2286
- }();
1829
+ return breaksAtResult(true, "999");
1830
+ };
1831
+ Segmenter2.prototype.segment = function(input) {
1832
+ checkReceiver(this, "segment");
1833
+ return new SegmentIterator(this, input);
1834
+ };
1835
+ Segmenter2.prototype.resolvedOptions = function() {
1836
+ checkReceiver(this, "resolvedOptions");
1837
+ return __assign({}, getMultiInternalSlots(__INTERNAL_SLOT_MAP__, this, "locale", "granularity"));
1838
+ };
1839
+ Segmenter2.supportedLocalesOf = function(locales, options) {
1840
+ return SupportedLocales(Segmenter2.availableLocales, CanonicalizeLocaleList(locales), options);
1841
+ };
1842
+ Segmenter2.availableLocales = new Set(Object.keys(SegmentationRules).filter(function(key) {
1843
+ return key !== "root";
1844
+ }));
1845
+ Segmenter2.polyfilled = true;
1846
+ return Segmenter2;
1847
+ }()
1848
+ );
2287
1849
  var createSegmentDataObject = function(segmenter, segment, index, input, matchingRule) {
2288
1850
  var returnValue = {
2289
1851
  segment,
@@ -2295,70 +1857,73 @@
2295
1857
  }
2296
1858
  return returnValue;
2297
1859
  };
2298
- var SegmentIterator = function() {
2299
- function SegmentIterator2(segmenter, input) {
2300
- this.segmenter = segmenter;
2301
- this.lastSegmentIndex = 0;
2302
- if (typeof input == "symbol") {
2303
- throw TypeError("Input must not be a symbol");
2304
- }
2305
- this.input = String(input);
2306
- }
2307
- SegmentIterator2.prototype[Symbol.iterator] = function() {
2308
- return new SegmentIterator2(this.segmenter, this.input);
2309
- };
2310
- SegmentIterator2.prototype.next = function() {
2311
- var checkString = this.input.substring(this.lastSegmentIndex);
2312
- for (var position = 1; position <= checkString.length; position++) {
2313
- var _a = this.segmenter.breaksAt(position, checkString), breaks = _a.breaks, matchingRule = _a.matchingRule;
2314
- if (breaks) {
2315
- var segment = checkString.substring(0, position);
2316
- var index = this.lastSegmentIndex;
2317
- this.lastSegmentIndex += position;
2318
- return {
2319
- done: false,
2320
- value: createSegmentDataObject(this.segmenter, segment, index, this.input, matchingRule)
2321
- };
1860
+ var SegmentIterator = (
1861
+ /** @class */
1862
+ function() {
1863
+ function SegmentIterator2(segmenter, input) {
1864
+ this.segmenter = segmenter;
1865
+ this.lastSegmentIndex = 0;
1866
+ if (typeof input == "symbol") {
1867
+ throw TypeError("Input must not be a symbol");
2322
1868
  }
1869
+ this.input = String(input);
2323
1870
  }
2324
- return { done: true, value: void 0 };
2325
- };
2326
- SegmentIterator2.prototype.containing = function(positionInput) {
2327
- if (typeof positionInput === "bigint") {
2328
- throw TypeError("Index must not be a BigInt");
2329
- }
2330
- var position = Number(positionInput);
2331
- if (isNaN(position) || !position) {
2332
- position = 0;
2333
- }
2334
- position = Math.floor(Math.abs(position)) * (position < 0 ? -1 : 1);
2335
- if (position < 0 || position >= this.input.length) {
2336
- return void 0;
2337
- }
2338
- var previousBreakPoint = 0;
2339
- if (position === 0) {
2340
- previousBreakPoint = 0;
2341
- } else {
2342
- var checkString_1 = this.input;
2343
- for (var cursor = position; cursor >= 0; cursor--) {
2344
- var breaks = this.segmenter.breaksAt(cursor, checkString_1).breaks;
1871
+ SegmentIterator2.prototype[Symbol.iterator] = function() {
1872
+ return new SegmentIterator2(this.segmenter, this.input);
1873
+ };
1874
+ SegmentIterator2.prototype.next = function() {
1875
+ var checkString = this.input.substring(this.lastSegmentIndex);
1876
+ for (var position = 1; position <= checkString.length; position++) {
1877
+ var _a = this.segmenter.breaksAt(position, checkString), breaks = _a.breaks, matchingRule = _a.matchingRule;
2345
1878
  if (breaks) {
2346
- previousBreakPoint = cursor;
2347
- break;
1879
+ var segment = checkString.substring(0, position);
1880
+ var index = this.lastSegmentIndex;
1881
+ this.lastSegmentIndex += position;
1882
+ return {
1883
+ done: false,
1884
+ value: createSegmentDataObject(this.segmenter, segment, index, this.input, matchingRule)
1885
+ };
2348
1886
  }
2349
1887
  }
2350
- }
2351
- var checkString = this.input.substring(previousBreakPoint);
2352
- for (var cursor = 1; cursor <= checkString.length; cursor++) {
2353
- var _a = this.segmenter.breaksAt(cursor, checkString), breaks = _a.breaks, matchingRule = _a.matchingRule;
2354
- if (breaks) {
2355
- var segment = checkString.substring(0, cursor);
2356
- return createSegmentDataObject(this.segmenter, segment, previousBreakPoint, this.input, matchingRule);
1888
+ return { done: true, value: void 0 };
1889
+ };
1890
+ SegmentIterator2.prototype.containing = function(positionInput) {
1891
+ if (typeof positionInput === "bigint") {
1892
+ throw TypeError("Index must not be a BigInt");
2357
1893
  }
2358
- }
2359
- };
2360
- return SegmentIterator2;
2361
- }();
1894
+ var position = Number(positionInput);
1895
+ if (isNaN(position) || !position) {
1896
+ position = 0;
1897
+ }
1898
+ position = Math.floor(Math.abs(position)) * (position < 0 ? -1 : 1);
1899
+ if (position < 0 || position >= this.input.length) {
1900
+ return void 0;
1901
+ }
1902
+ var previousBreakPoint = 0;
1903
+ if (position === 0) {
1904
+ previousBreakPoint = 0;
1905
+ } else {
1906
+ var checkString_1 = this.input;
1907
+ for (var cursor = position; cursor >= 0; cursor--) {
1908
+ var breaks = this.segmenter.breaksAt(cursor, checkString_1).breaks;
1909
+ if (breaks) {
1910
+ previousBreakPoint = cursor;
1911
+ break;
1912
+ }
1913
+ }
1914
+ }
1915
+ var checkString = this.input.substring(previousBreakPoint);
1916
+ for (var cursor = 1; cursor <= checkString.length; cursor++) {
1917
+ var _a = this.segmenter.breaksAt(cursor, checkString), breaks = _a.breaks, matchingRule = _a.matchingRule;
1918
+ if (breaks) {
1919
+ var segment = checkString.substring(0, cursor);
1920
+ return createSegmentDataObject(this.segmenter, segment, previousBreakPoint, this.input, matchingRule);
1921
+ }
1922
+ }
1923
+ };
1924
+ return SegmentIterator2;
1925
+ }()
1926
+ );
2362
1927
  var __INTERNAL_SLOT_MAP__ = /* @__PURE__ */ new WeakMap();
2363
1928
  function getSlot(instance, key) {
2364
1929
  return getInternalSlot(__INTERNAL_SLOT_MAP__, instance, key);
@@ -1 +1 @@
1
- {"version":3,"file":"cldr-segmentation-rules.generated.d.ts","sourceRoot":"","sources":["cldr-segmentation-rules.generated.ts"],"names":[],"mappings":"AAEI,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8uCjC,CAAA"}
1
+ {"version":3,"file":"cldr-segmentation-rules.generated.d.ts","sourceRoot":"","sources":["../src/cldr-segmentation-rules.generated.ts"],"names":[],"mappings":"AAEI,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8uCjC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"segmentation-utils.d.ts","sourceRoot":"","sources":["segmentation-utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,cAChB,OAAO,MAAM,EAAE,MAAM,CAAC,SAC1B,MAAM,WASd,CAAA;AAED,eAAO,MAAM,WAAW,QAAS,MAAM,OAAO,MAAM,YAOnD,CAAA"}
1
+ {"version":3,"file":"segmentation-utils.d.ts","sourceRoot":"","sources":["../src/segmentation-utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,cAChB,OAAO,MAAM,EAAE,MAAM,CAAC,SAC1B,MAAM,WASd,CAAA;AAED,eAAO,MAAM,WAAW,QAAS,MAAM,OAAO,MAAM,YAOnD,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"segmenter.d.ts","sourceRoot":"","sources":["segmenter.ts"],"names":[],"mappings":"AA+BA,KAAK,aAAa,GACd;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAAC,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAA;CAAC,GACrE,SAAS,CAAA;AAEb,MAAM,WAAW,gBAAgB;IAC/B,aAAa,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAA;IACrC,WAAW,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,UAAU,CAAA;CAC/C;AAED,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,EAAE,WAAW,CAAC,gBAAgB,CAAC,aAAa,CAAC,CAAC,CAAA;CAC1D;AAoDD,QAAA,MAAM,cAAc,WAAY,OAAO,gBAAgB,MAAM;;;CAG3D,CAAA;AAEF,qBAAa,SAAS;IACpB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAA;IACtB,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAA;IAC/B,OAAO,CAAC,QAAQ,CAAC,2BAA2B,CAAyB;gBAGnE,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,EACtC,OAAO,EAAE,gBAAgB;IA0EpB,QAAQ,CACb,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,GACZ,UAAU,CAAC,OAAO,cAAc,CAAC;IA6DpC,OAAO,CAAC,KAAK,EAAE,MAAM;IAKrB,eAAe,IAAI,wBAAwB;IAY3C,MAAM,CAAC,gBAAgB,cAEtB;IACD,MAAM,CAAC,kBAAkB,CACvB,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,EAC3B,OAAO,CAAC,EAAE,IAAI,CAAC,gBAAgB,EAAE,eAAe,CAAC,GAChD,MAAM,EAAE;IAOX,gBAAuB,UAAU,QAAO;CACzC;AAwBD,cAAM,eACJ,YAAW,QAAQ,CAAC,aAAa,CAAC,EAAE,QAAQ,CAAC,aAAa,CAAC;IAE3D,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAA;IAC1B,OAAO,CAAC,gBAAgB,CAAA;IACxB,OAAO,CAAC,KAAK,CAAA;gBACD,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM;IAS/C,CAAC,MAAM,CAAC,QAAQ,CAAC;IAIjB,IAAI;;;;;;;;;;;;IA+BJ,UAAU,CAAC,aAAa,EAAE,MAAM;;;;;;CAqDjC;AAED,YAAY,EAAC,eAAe,EAAC,CAAA"}
1
+ {"version":3,"file":"segmenter.d.ts","sourceRoot":"","sources":["../src/segmenter.ts"],"names":[],"mappings":"AA+BA,KAAK,aAAa,GACd;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAAC,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAA;CAAC,GACrE,SAAS,CAAA;AAEb,MAAM,WAAW,gBAAgB;IAC/B,aAAa,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAA;IACrC,WAAW,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,UAAU,CAAA;CAC/C;AAED,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,EAAE,WAAW,CAAC,gBAAgB,CAAC,aAAa,CAAC,CAAC,CAAA;CAC1D;AAoDD,QAAA,MAAM,cAAc,WAAY,OAAO,gBAAgB,MAAM;;;CAG3D,CAAA;AAEF,qBAAa,SAAS;IACpB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAA;IACtB,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAA;IAC/B,OAAO,CAAC,QAAQ,CAAC,2BAA2B,CAAyB;gBAGnE,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,EACtC,OAAO,EAAE,gBAAgB;IA0EpB,QAAQ,CACb,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,GACZ,UAAU,CAAC,OAAO,cAAc,CAAC;IA6DpC,OAAO,CAAC,KAAK,EAAE,MAAM;IAKrB,eAAe,IAAI,wBAAwB;IAY3C,MAAM,CAAC,gBAAgB,cAEtB;IACD,MAAM,CAAC,kBAAkB,CACvB,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,EAC3B,OAAO,CAAC,EAAE,IAAI,CAAC,gBAAgB,EAAE,eAAe,CAAC,GAChD,MAAM,EAAE;IAOX,gBAAuB,UAAU,QAAO;CACzC;AAwBD,cAAM,eACJ,YAAW,QAAQ,CAAC,aAAa,CAAC,EAAE,QAAQ,CAAC,aAAa,CAAC;IAE3D,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAA;IAC1B,OAAO,CAAC,gBAAgB,CAAA;IACxB,OAAO,CAAC,KAAK,CAAA;gBACD,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM;IAS/C,CAAC,MAAM,CAAC,QAAQ,CAAC;IAIjB,IAAI;;;;;;;;;;;;IA+BJ,UAAU,CAAC,aAAa,EAAE,MAAM;;;;;;CAqDjC;AAED,YAAY,EAAC,eAAe,EAAC,CAAA"}
package/src/segmenter.js CHANGED
@@ -41,7 +41,7 @@ var breaksAtResult = function (breaks, matchingRule) { return ({
41
41
  breaks: breaks,
42
42
  matchingRule: matchingRule,
43
43
  }); };
44
- var Segmenter = /** @class */ (function () {
44
+ var Segmenter = exports.Segmenter = /** @class */ (function () {
45
45
  function Segmenter(locales, options) {
46
46
  var _newTarget = this.constructor;
47
47
  if (_newTarget === undefined) {
@@ -78,6 +78,7 @@ var Segmenter = /** @class */ (function () {
78
78
  this.ruleSortedKeys = Object.keys(this.rules).sort(function (a, b) { return Number(a) - Number(b); });
79
79
  }
80
80
  Segmenter.prototype.breaksAt = function (position, input) {
81
+ var _a;
81
82
  var ruleSortedKeys = this.ruleSortedKeys;
82
83
  var rules = this.rules;
83
84
  var mergedSegmentationTypeValue = this.mergedSegmentationTypeValue;
@@ -98,17 +99,17 @@ var Segmenter = /** @class */ (function () {
98
99
  var stringAfterBreak = input.substring(position);
99
100
  //artificial rule 0.4: handle suppressions
100
101
  if ('suppressions' in mergedSegmentationTypeValue) {
101
- for (var _i = 0, _a = mergedSegmentationTypeValue.suppressions; _i < _a.length; _i++) {
102
- var suppressions = _a[_i];
102
+ for (var _i = 0, _b = mergedSegmentationTypeValue.suppressions; _i < _b.length; _i++) {
103
+ var suppressions = _b[_i];
103
104
  if (stringBeforeBreak.trim().endsWith(suppressions)) {
104
105
  return breaksAtResult(false, '0.4');
105
106
  }
106
107
  }
107
108
  }
108
109
  // loop through rules and find a match
109
- for (var _b = 0, ruleSortedKeys_1 = ruleSortedKeys; _b < ruleSortedKeys_1.length; _b++) {
110
- var ruleKey = ruleSortedKeys_1[_b];
111
- var _c = rules[ruleKey], before = _c.before, after = _c.after, breaks = _c.breaks;
110
+ for (var _c = 0, ruleSortedKeys_1 = ruleSortedKeys; _c < ruleSortedKeys_1.length; _c++) {
111
+ var ruleKey = ruleSortedKeys_1[_c];
112
+ var before = (_a = rules[ruleKey], _a.before), after = _a.after, breaks = _a.breaks;
112
113
  // for debugging
113
114
  // if (ruleKey === '16' && position === 4) {
114
115
  // console.log({before, after, stringBeforeBreak, stringAfterBreak})
@@ -145,7 +146,6 @@ var Segmenter = /** @class */ (function () {
145
146
  Segmenter.polyfilled = true;
146
147
  return Segmenter;
147
148
  }());
148
- exports.Segmenter = Segmenter;
149
149
  var createSegmentDataObject = function (segmenter, segment, index, input, matchingRule) {
150
150
  var returnValue = {
151
151
  segment: segment,