| OLD | NEW |
| (Empty) |
| 1 dart_library.library('dart/_interceptors', null, /* Imports */[ | |
| 2 'dart/_runtime', | |
| 3 'dart/core', | |
| 4 'dart/_internal', | |
| 5 'dart/collection', | |
| 6 'dart/math' | |
| 7 ], /* Lazy imports */[ | |
| 8 'dart/_js_helper' | |
| 9 ], function(exports, dart, core, _internal, collection, math, _js_helper) { | |
| 10 'use strict'; | |
| 11 let dartx = dart.dartx; | |
| 12 const JSArray$ = dart.generic(function(E) { | |
| 13 dart.defineExtensionNames([ | |
| 14 'checkGrowable', | |
| 15 'add', | |
| 16 'removeAt', | |
| 17 'insert', | |
| 18 'insertAll', | |
| 19 'setAll', | |
| 20 'removeLast', | |
| 21 'remove', | |
| 22 'removeWhere', | |
| 23 'retainWhere', | |
| 24 'where', | |
| 25 'expand', | |
| 26 'addAll', | |
| 27 'clear', | |
| 28 'forEach', | |
| 29 'map', | |
| 30 'join', | |
| 31 'take', | |
| 32 'takeWhile', | |
| 33 'skip', | |
| 34 'skipWhile', | |
| 35 'reduce', | |
| 36 'fold', | |
| 37 'firstWhere', | |
| 38 'lastWhere', | |
| 39 'singleWhere', | |
| 40 'elementAt', | |
| 41 'sublist', | |
| 42 'getRange', | |
| 43 'first', | |
| 44 'last', | |
| 45 'single', | |
| 46 'removeRange', | |
| 47 'setRange', | |
| 48 'fillRange', | |
| 49 'replaceRange', | |
| 50 'any', | |
| 51 'every', | |
| 52 'reversed', | |
| 53 'sort', | |
| 54 'shuffle', | |
| 55 'indexOf', | |
| 56 'lastIndexOf', | |
| 57 'contains', | |
| 58 'isEmpty', | |
| 59 'isNotEmpty', | |
| 60 'toString', | |
| 61 'toList', | |
| 62 'toSet', | |
| 63 'iterator', | |
| 64 'hashCode', | |
| 65 'length', | |
| 66 'length', | |
| 67 'get', | |
| 68 'set', | |
| 69 'asMap' | |
| 70 ]); | |
| 71 class JSArray extends core.Object { | |
| 72 JSArray() { | |
| 73 } | |
| 74 static typed(allocation) { | |
| 75 return dart.list(allocation, E); | |
| 76 } | |
| 77 static markFixed(allocation) { | |
| 78 return JSArray$(E).typed(JSArray$().markFixedList(dart.as(allocation, co
re.List))); | |
| 79 } | |
| 80 static markGrowable(allocation) { | |
| 81 return JSArray$(E).typed(allocation); | |
| 82 } | |
| 83 static markFixedList(list) { | |
| 84 list.fixed$length = Array; | |
| 85 return list; | |
| 86 } | |
| 87 [dartx.checkGrowable](reason) { | |
| 88 if (this.fixed$length) { | |
| 89 dart.throw(new core.UnsupportedError(dart.as(reason, core.String))); | |
| 90 } | |
| 91 } | |
| 92 [dartx.add](value) { | |
| 93 dart.as(value, E); | |
| 94 this[dartx.checkGrowable]('add'); | |
| 95 this.push(value); | |
| 96 } | |
| 97 [dartx.removeAt](index) { | |
| 98 if (!(typeof index == 'number')) dart.throw(new core.ArgumentError(index
)); | |
| 99 if (dart.notNull(index) < 0 || dart.notNull(index) >= dart.notNull(this[
dartx.length])) { | |
| 100 dart.throw(new core.RangeError.value(index)); | |
| 101 } | |
| 102 this[dartx.checkGrowable]('removeAt'); | |
| 103 return this.splice(index, 1)[0]; | |
| 104 } | |
| 105 [dartx.insert](index, value) { | |
| 106 dart.as(value, E); | |
| 107 if (!(typeof index == 'number')) dart.throw(new core.ArgumentError(index
)); | |
| 108 if (dart.notNull(index) < 0 || dart.notNull(index) > dart.notNull(this[d
artx.length])) { | |
| 109 dart.throw(new core.RangeError.value(index)); | |
| 110 } | |
| 111 this[dartx.checkGrowable]('insert'); | |
| 112 this.splice(index, 0, value); | |
| 113 } | |
| 114 [dartx.insertAll](index, iterable) { | |
| 115 dart.as(iterable, core.Iterable$(E)); | |
| 116 this[dartx.checkGrowable]('insertAll'); | |
| 117 _internal.IterableMixinWorkaround.insertAllList(this, index, iterable); | |
| 118 } | |
| 119 [dartx.setAll](index, iterable) { | |
| 120 dart.as(iterable, core.Iterable$(E)); | |
| 121 _internal.IterableMixinWorkaround.setAllList(this, index, iterable); | |
| 122 } | |
| 123 [dartx.removeLast]() { | |
| 124 this[dartx.checkGrowable]('removeLast'); | |
| 125 if (this[dartx.length] == 0) dart.throw(new core.RangeError.value(-1)); | |
| 126 return dart.as(this.pop(), E); | |
| 127 } | |
| 128 [dartx.remove](element) { | |
| 129 this[dartx.checkGrowable]('remove'); | |
| 130 for (let i = 0; i < dart.notNull(this[dartx.length]); i++) { | |
| 131 if (dart.equals(this[dartx.get](i), element)) { | |
| 132 this.splice(i, 1); | |
| 133 return true; | |
| 134 } | |
| 135 } | |
| 136 return false; | |
| 137 } | |
| 138 [dartx.removeWhere](test) { | |
| 139 dart.as(test, dart.functionType(core.bool, [E])); | |
| 140 _internal.IterableMixinWorkaround.removeWhereList(this, test); | |
| 141 } | |
| 142 [dartx.retainWhere](test) { | |
| 143 dart.as(test, dart.functionType(core.bool, [E])); | |
| 144 _internal.IterableMixinWorkaround.removeWhereList(this, dart.fn(element
=> { | |
| 145 dart.as(element, E); | |
| 146 return !dart.notNull(test(element)); | |
| 147 }, core.bool, [E])); | |
| 148 } | |
| 149 [dartx.where](f) { | |
| 150 dart.as(f, dart.functionType(core.bool, [E])); | |
| 151 return new (_internal.IterableMixinWorkaround$(E))().where(this, f); | |
| 152 } | |
| 153 [dartx.expand](f) { | |
| 154 dart.as(f, dart.functionType(core.Iterable, [E])); | |
| 155 return _internal.IterableMixinWorkaround.expand(this, f); | |
| 156 } | |
| 157 [dartx.addAll](collection) { | |
| 158 dart.as(collection, core.Iterable$(E)); | |
| 159 for (let e of collection) { | |
| 160 this[dartx.add](e); | |
| 161 } | |
| 162 } | |
| 163 [dartx.clear]() { | |
| 164 this[dartx.length] = 0; | |
| 165 } | |
| 166 [dartx.forEach](f) { | |
| 167 dart.as(f, dart.functionType(dart.void, [E])); | |
| 168 let length = this[dartx.length]; | |
| 169 for (let i = 0; i < dart.notNull(length); i++) { | |
| 170 f(dart.as(this[i], E)); | |
| 171 if (length != this[dartx.length]) { | |
| 172 dart.throw(new core.ConcurrentModificationError(this)); | |
| 173 } | |
| 174 } | |
| 175 } | |
| 176 [dartx.map](f) { | |
| 177 dart.as(f, dart.functionType(dart.dynamic, [E])); | |
| 178 return _internal.IterableMixinWorkaround.mapList(this, f); | |
| 179 } | |
| 180 [dartx.join](separator) { | |
| 181 if (separator === void 0) separator = ""; | |
| 182 let list = core.List.new(this[dartx.length]); | |
| 183 for (let i = 0; i < dart.notNull(this[dartx.length]); i++) { | |
| 184 list[dartx.set](i, `${this[dartx.get](i)}`); | |
| 185 } | |
| 186 return list.join(separator); | |
| 187 } | |
| 188 [dartx.take](n) { | |
| 189 return new (_internal.IterableMixinWorkaround$(E))().takeList(this, n); | |
| 190 } | |
| 191 [dartx.takeWhile](test) { | |
| 192 dart.as(test, dart.functionType(core.bool, [E])); | |
| 193 return new (_internal.IterableMixinWorkaround$(E))().takeWhile(this, tes
t); | |
| 194 } | |
| 195 [dartx.skip](n) { | |
| 196 return new (_internal.IterableMixinWorkaround$(E))().skipList(this, n); | |
| 197 } | |
| 198 [dartx.skipWhile](test) { | |
| 199 dart.as(test, dart.functionType(core.bool, [E])); | |
| 200 return new (_internal.IterableMixinWorkaround$(E))().skipWhile(this, tes
t); | |
| 201 } | |
| 202 [dartx.reduce](combine) { | |
| 203 dart.as(combine, dart.functionType(E, [E, E])); | |
| 204 return _internal.IterableMixinWorkaround.reduce(this, combine); | |
| 205 } | |
| 206 [dartx.fold](initialValue, combine) { | |
| 207 dart.as(combine, dart.functionType(dart.dynamic, [dart.dynamic, E])); | |
| 208 return _internal.IterableMixinWorkaround.fold(this, initialValue, combin
e); | |
| 209 } | |
| 210 [dartx.firstWhere](test, opts) { | |
| 211 dart.as(test, dart.functionType(core.bool, [E])); | |
| 212 let orElse = opts && 'orElse' in opts ? opts.orElse : null; | |
| 213 dart.as(orElse, dart.functionType(E, [])); | |
| 214 return _internal.IterableMixinWorkaround.firstWhere(this, test, orElse); | |
| 215 } | |
| 216 [dartx.lastWhere](test, opts) { | |
| 217 dart.as(test, dart.functionType(core.bool, [E])); | |
| 218 let orElse = opts && 'orElse' in opts ? opts.orElse : null; | |
| 219 dart.as(orElse, dart.functionType(E, [])); | |
| 220 return _internal.IterableMixinWorkaround.lastWhereList(this, test, orEls
e); | |
| 221 } | |
| 222 [dartx.singleWhere](test) { | |
| 223 dart.as(test, dart.functionType(core.bool, [E])); | |
| 224 return _internal.IterableMixinWorkaround.singleWhere(this, test); | |
| 225 } | |
| 226 [dartx.elementAt](index) { | |
| 227 return this[dartx.get](index); | |
| 228 } | |
| 229 [dartx.sublist](start, end) { | |
| 230 if (end === void 0) end = null; | |
| 231 _js_helper.checkNull(start); | |
| 232 if (!(typeof start == 'number')) dart.throw(new core.ArgumentError(start
)); | |
| 233 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(this[d
artx.length])) { | |
| 234 dart.throw(new core.RangeError.range(start, 0, this[dartx.length])); | |
| 235 } | |
| 236 if (end == null) { | |
| 237 end = this[dartx.length]; | |
| 238 } else { | |
| 239 if (!(typeof end == 'number')) dart.throw(new core.ArgumentError(end))
; | |
| 240 if (dart.notNull(end) < dart.notNull(start) || dart.notNull(end) > dar
t.notNull(this[dartx.length])) { | |
| 241 dart.throw(new core.RangeError.range(end, start, this[dartx.length])
); | |
| 242 } | |
| 243 } | |
| 244 if (start == end) return dart.list([], E); | |
| 245 return JSArray$(E).typed(this.slice(start, end)); | |
| 246 } | |
| 247 [dartx.getRange](start, end) { | |
| 248 return new (_internal.IterableMixinWorkaround$(E))().getRangeList(this,
start, end); | |
| 249 } | |
| 250 get [dartx.first]() { | |
| 251 if (dart.notNull(this[dartx.length]) > 0) return this[dartx.get](0); | |
| 252 dart.throw(new core.StateError("No elements")); | |
| 253 } | |
| 254 get [dartx.last]() { | |
| 255 if (dart.notNull(this[dartx.length]) > 0) return this[dartx.get](dart.no
tNull(this[dartx.length]) - 1); | |
| 256 dart.throw(new core.StateError("No elements")); | |
| 257 } | |
| 258 get [dartx.single]() { | |
| 259 if (this[dartx.length] == 1) return this[dartx.get](0); | |
| 260 if (this[dartx.length] == 0) dart.throw(new core.StateError("No elements
")); | |
| 261 dart.throw(new core.StateError("More than one element")); | |
| 262 } | |
| 263 [dartx.removeRange](start, end) { | |
| 264 this[dartx.checkGrowable]('removeRange'); | |
| 265 let receiverLength = this[dartx.length]; | |
| 266 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(receiv
erLength)) { | |
| 267 dart.throw(new core.RangeError.range(start, 0, receiverLength)); | |
| 268 } | |
| 269 if (dart.notNull(end) < dart.notNull(start) || dart.notNull(end) > dart.
notNull(receiverLength)) { | |
| 270 dart.throw(new core.RangeError.range(end, start, receiverLength)); | |
| 271 } | |
| 272 _internal.Lists.copy(this, end, this, start, dart.notNull(receiverLength
) - dart.notNull(end)); | |
| 273 this[dartx.length] = dart.notNull(receiverLength) - (dart.notNull(end) -
dart.notNull(start)); | |
| 274 } | |
| 275 [dartx.setRange](start, end, iterable, skipCount) { | |
| 276 dart.as(iterable, core.Iterable$(E)); | |
| 277 if (skipCount === void 0) skipCount = 0; | |
| 278 _internal.IterableMixinWorkaround.setRangeList(this, start, end, iterabl
e, skipCount); | |
| 279 } | |
| 280 [dartx.fillRange](start, end, fillValue) { | |
| 281 if (fillValue === void 0) fillValue = null; | |
| 282 dart.as(fillValue, E); | |
| 283 _internal.IterableMixinWorkaround.fillRangeList(this, start, end, fillVa
lue); | |
| 284 } | |
| 285 [dartx.replaceRange](start, end, iterable) { | |
| 286 dart.as(iterable, core.Iterable$(E)); | |
| 287 _internal.IterableMixinWorkaround.replaceRangeList(this, start, end, ite
rable); | |
| 288 } | |
| 289 [dartx.any](f) { | |
| 290 dart.as(f, dart.functionType(core.bool, [E])); | |
| 291 return _internal.IterableMixinWorkaround.any(this, f); | |
| 292 } | |
| 293 [dartx.every](f) { | |
| 294 dart.as(f, dart.functionType(core.bool, [E])); | |
| 295 return _internal.IterableMixinWorkaround.every(this, f); | |
| 296 } | |
| 297 get [dartx.reversed]() { | |
| 298 return new (_internal.IterableMixinWorkaround$(E))().reversedList(this); | |
| 299 } | |
| 300 [dartx.sort](compare) { | |
| 301 if (compare === void 0) compare = null; | |
| 302 dart.as(compare, dart.functionType(core.int, [E, E])); | |
| 303 _internal.IterableMixinWorkaround.sortList(this, compare); | |
| 304 } | |
| 305 [dartx.shuffle](random) { | |
| 306 if (random === void 0) random = null; | |
| 307 _internal.IterableMixinWorkaround.shuffleList(this, random); | |
| 308 } | |
| 309 [dartx.indexOf](element, start) { | |
| 310 if (start === void 0) start = 0; | |
| 311 return _internal.IterableMixinWorkaround.indexOfList(this, element, star
t); | |
| 312 } | |
| 313 [dartx.lastIndexOf](element, start) { | |
| 314 if (start === void 0) start = null; | |
| 315 return _internal.IterableMixinWorkaround.lastIndexOfList(this, element,
start); | |
| 316 } | |
| 317 [dartx.contains](other) { | |
| 318 for (let i = 0; i < dart.notNull(this[dartx.length]); i++) { | |
| 319 if (dart.equals(this[dartx.get](i), other)) return true; | |
| 320 } | |
| 321 return false; | |
| 322 } | |
| 323 get [dartx.isEmpty]() { | |
| 324 return this[dartx.length] == 0; | |
| 325 } | |
| 326 get [dartx.isNotEmpty]() { | |
| 327 return !dart.notNull(this[dartx.isEmpty]); | |
| 328 } | |
| 329 toString() { | |
| 330 return collection.ListBase.listToString(this); | |
| 331 } | |
| 332 [dartx.toList](opts) { | |
| 333 let growable = opts && 'growable' in opts ? opts.growable : true; | |
| 334 let list = this.slice(); | |
| 335 if (!dart.notNull(growable)) JSArray$().markFixedList(dart.as(list, core
.List)); | |
| 336 return JSArray$(E).typed(list); | |
| 337 } | |
| 338 [dartx.toSet]() { | |
| 339 return core.Set$(E).from(this); | |
| 340 } | |
| 341 get [dartx.iterator]() { | |
| 342 return new (_internal.ListIterator$(E))(this); | |
| 343 } | |
| 344 get hashCode() { | |
| 345 return _js_helper.Primitives.objectHashCode(this); | |
| 346 } | |
| 347 get [dartx.length]() { | |
| 348 return this.length; | |
| 349 } | |
| 350 set [dartx.length](newLength) { | |
| 351 if (!(typeof newLength == 'number')) dart.throw(new core.ArgumentError(n
ewLength)); | |
| 352 if (dart.notNull(newLength) < 0) dart.throw(new core.RangeError.value(ne
wLength)); | |
| 353 this[dartx.checkGrowable]('set length'); | |
| 354 this.length = newLength; | |
| 355 } | |
| 356 [dartx.get](index) { | |
| 357 if (!(typeof index == 'number')) dart.throw(new core.ArgumentError(index
)); | |
| 358 if (dart.notNull(index) >= dart.notNull(this[dartx.length]) || dart.notN
ull(index) < 0) dart.throw(new core.RangeError.value(index)); | |
| 359 return dart.as(this[index], E); | |
| 360 } | |
| 361 [dartx.set](index, value) { | |
| 362 dart.as(value, E); | |
| 363 if (!(typeof index == 'number')) dart.throw(new core.ArgumentError(index
)); | |
| 364 if (dart.notNull(index) >= dart.notNull(this[dartx.length]) || dart.notN
ull(index) < 0) dart.throw(new core.RangeError.value(index)); | |
| 365 this[index] = value; | |
| 366 return value; | |
| 367 } | |
| 368 [dartx.asMap]() { | |
| 369 return new (_internal.IterableMixinWorkaround$(E))().asMapList(this); | |
| 370 } | |
| 371 } | |
| 372 dart.setBaseClass(JSArray, dart.global.Array); | |
| 373 JSArray[dart.implements] = () => [core.List$(E), JSIndexable]; | |
| 374 dart.setSignature(JSArray, { | |
| 375 constructors: () => ({ | |
| 376 JSArray: [JSArray$(E), []], | |
| 377 typed: [JSArray$(E), [dart.dynamic]], | |
| 378 markFixed: [JSArray$(E), [dart.dynamic]], | |
| 379 markGrowable: [JSArray$(E), [dart.dynamic]] | |
| 380 }), | |
| 381 methods: () => ({ | |
| 382 [dartx.checkGrowable]: [dart.dynamic, [dart.dynamic]], | |
| 383 [dartx.add]: [dart.void, [E]], | |
| 384 [dartx.removeAt]: [E, [core.int]], | |
| 385 [dartx.insert]: [dart.void, [core.int, E]], | |
| 386 [dartx.insertAll]: [dart.void, [core.int, core.Iterable$(E)]], | |
| 387 [dartx.setAll]: [dart.void, [core.int, core.Iterable$(E)]], | |
| 388 [dartx.removeLast]: [E, []], | |
| 389 [dartx.remove]: [core.bool, [core.Object]], | |
| 390 [dartx.removeWhere]: [dart.void, [dart.functionType(core.bool, [E])]], | |
| 391 [dartx.retainWhere]: [dart.void, [dart.functionType(core.bool, [E])]], | |
| 392 [dartx.where]: [core.Iterable$(E), [dart.functionType(core.bool, [E])]], | |
| 393 [dartx.expand]: [core.Iterable, [dart.functionType(core.Iterable, [E])]]
, | |
| 394 [dartx.addAll]: [dart.void, [core.Iterable$(E)]], | |
| 395 [dartx.clear]: [dart.void, []], | |
| 396 [dartx.forEach]: [dart.void, [dart.functionType(dart.void, [E])]], | |
| 397 [dartx.map]: [core.Iterable, [dart.functionType(dart.dynamic, [E])]], | |
| 398 [dartx.join]: [core.String, [], [core.String]], | |
| 399 [dartx.take]: [core.Iterable$(E), [core.int]], | |
| 400 [dartx.takeWhile]: [core.Iterable$(E), [dart.functionType(core.bool, [E]
)]], | |
| 401 [dartx.skip]: [core.Iterable$(E), [core.int]], | |
| 402 [dartx.skipWhile]: [core.Iterable$(E), [dart.functionType(core.bool, [E]
)]], | |
| 403 [dartx.reduce]: [E, [dart.functionType(E, [E, E])]], | |
| 404 [dartx.fold]: [dart.dynamic, [dart.dynamic, dart.functionType(dart.dynam
ic, [dart.dynamic, E])]], | |
| 405 [dartx.firstWhere]: [E, [dart.functionType(core.bool, [E])], {orElse: da
rt.functionType(E, [])}], | |
| 406 [dartx.lastWhere]: [E, [dart.functionType(core.bool, [E])], {orElse: dar
t.functionType(E, [])}], | |
| 407 [dartx.singleWhere]: [E, [dart.functionType(core.bool, [E])]], | |
| 408 [dartx.elementAt]: [E, [core.int]], | |
| 409 [dartx.sublist]: [core.List$(E), [core.int], [core.int]], | |
| 410 [dartx.getRange]: [core.Iterable$(E), [core.int, core.int]], | |
| 411 [dartx.removeRange]: [dart.void, [core.int, core.int]], | |
| 412 [dartx.setRange]: [dart.void, [core.int, core.int, core.Iterable$(E)], [
core.int]], | |
| 413 [dartx.fillRange]: [dart.void, [core.int, core.int], [E]], | |
| 414 [dartx.replaceRange]: [dart.void, [core.int, core.int, core.Iterable$(E)
]], | |
| 415 [dartx.any]: [core.bool, [dart.functionType(core.bool, [E])]], | |
| 416 [dartx.every]: [core.bool, [dart.functionType(core.bool, [E])]], | |
| 417 [dartx.sort]: [dart.void, [], [dart.functionType(core.int, [E, E])]], | |
| 418 [dartx.shuffle]: [dart.void, [], [math.Random]], | |
| 419 [dartx.indexOf]: [core.int, [core.Object], [core.int]], | |
| 420 [dartx.lastIndexOf]: [core.int, [core.Object], [core.int]], | |
| 421 [dartx.contains]: [core.bool, [core.Object]], | |
| 422 [dartx.toList]: [core.List$(E), [], {growable: core.bool}], | |
| 423 [dartx.toSet]: [core.Set$(E), []], | |
| 424 [dartx.get]: [E, [core.int]], | |
| 425 [dartx.set]: [dart.void, [core.int, E]], | |
| 426 [dartx.asMap]: [core.Map$(core.int, E), []] | |
| 427 }), | |
| 428 statics: () => ({markFixedList: [core.List, [core.List]]}), | |
| 429 names: ['markFixedList'] | |
| 430 }); | |
| 431 JSArray[dart.metadata] = () => [dart.const(new _js_helper.JsPeerInterface({n
ame: 'Array'}))]; | |
| 432 return JSArray; | |
| 433 }); | |
| 434 let JSArray = JSArray$(); | |
| 435 dart.registerExtension(dart.global.Array, JSArray); | |
| 436 const JSMutableArray$ = dart.generic(function(E) { | |
| 437 class JSMutableArray extends JSArray$(E) { | |
| 438 JSMutableArray() { | |
| 439 super.JSArray(); | |
| 440 } | |
| 441 } | |
| 442 JSMutableArray[dart.implements] = () => [JSMutableIndexable]; | |
| 443 return JSMutableArray; | |
| 444 }); | |
| 445 let JSMutableArray = JSMutableArray$(); | |
| 446 const JSFixedArray$ = dart.generic(function(E) { | |
| 447 class JSFixedArray extends JSMutableArray$(E) {} | |
| 448 return JSFixedArray; | |
| 449 }); | |
| 450 let JSFixedArray = JSFixedArray$(); | |
| 451 const JSExtendableArray$ = dart.generic(function(E) { | |
| 452 class JSExtendableArray extends JSMutableArray$(E) {} | |
| 453 return JSExtendableArray; | |
| 454 }); | |
| 455 let JSExtendableArray = JSExtendableArray$(); | |
| 456 const _isInt32 = Symbol('_isInt32'); | |
| 457 const _tdivSlow = Symbol('_tdivSlow'); | |
| 458 const _shlPositive = Symbol('_shlPositive'); | |
| 459 const _shrOtherPositive = Symbol('_shrOtherPositive'); | |
| 460 const _shrBothPositive = Symbol('_shrBothPositive'); | |
| 461 class Interceptor extends core.Object { | |
| 462 Interceptor() { | |
| 463 } | |
| 464 } | |
| 465 dart.setSignature(Interceptor, { | |
| 466 constructors: () => ({Interceptor: [Interceptor, []]}) | |
| 467 }); | |
| 468 dart.defineExtensionNames([ | |
| 469 'compareTo', | |
| 470 'isNegative', | |
| 471 'isNaN', | |
| 472 'isInfinite', | |
| 473 'isFinite', | |
| 474 'remainder', | |
| 475 'abs', | |
| 476 'sign', | |
| 477 'toInt', | |
| 478 'truncate', | |
| 479 'ceil', | |
| 480 'floor', | |
| 481 'round', | |
| 482 'ceilToDouble', | |
| 483 'floorToDouble', | |
| 484 'roundToDouble', | |
| 485 'truncateToDouble', | |
| 486 'clamp', | |
| 487 'toDouble', | |
| 488 'toStringAsFixed', | |
| 489 'toStringAsExponential', | |
| 490 'toStringAsPrecision', | |
| 491 'toRadixString', | |
| 492 'toString', | |
| 493 'hashCode', | |
| 494 'unary-', | |
| 495 '+', | |
| 496 '-', | |
| 497 '/', | |
| 498 '*', | |
| 499 '%', | |
| 500 '~/', | |
| 501 '<<', | |
| 502 '>>', | |
| 503 '&', | |
| 504 '|', | |
| 505 '^', | |
| 506 '<', | |
| 507 '>', | |
| 508 '<=', | |
| 509 '>=', | |
| 510 'isEven', | |
| 511 'isOdd', | |
| 512 'toUnsigned', | |
| 513 'toSigned', | |
| 514 'bitLength', | |
| 515 '~' | |
| 516 ]); | |
| 517 class JSNumber extends Interceptor { | |
| 518 JSNumber() { | |
| 519 super.Interceptor(); | |
| 520 } | |
| 521 [dartx.compareTo](b) { | |
| 522 if (this < dart.notNull(b)) { | |
| 523 return -1; | |
| 524 } else if (this > dart.notNull(b)) { | |
| 525 return 1; | |
| 526 } else if (this == b) { | |
| 527 if (this == 0) { | |
| 528 let bIsNegative = b[dartx.isNegative]; | |
| 529 if (this[dartx.isNegative] == bIsNegative) return 0; | |
| 530 if (dart.notNull(this[dartx.isNegative])) return -1; | |
| 531 return 1; | |
| 532 } | |
| 533 return 0; | |
| 534 } else if (dart.notNull(this[dartx.isNaN])) { | |
| 535 if (dart.notNull(b[dartx.isNaN])) { | |
| 536 return 0; | |
| 537 } | |
| 538 return 1; | |
| 539 } else { | |
| 540 return -1; | |
| 541 } | |
| 542 } | |
| 543 get [dartx.isNegative]() { | |
| 544 return this == 0 ? 1 / this < 0 : this < 0; | |
| 545 } | |
| 546 get [dartx.isNaN]() { | |
| 547 return isNaN(this); | |
| 548 } | |
| 549 get [dartx.isInfinite]() { | |
| 550 return this == Infinity || this == -Infinity; | |
| 551 } | |
| 552 get [dartx.isFinite]() { | |
| 553 return isFinite(this); | |
| 554 } | |
| 555 [dartx.remainder](b) { | |
| 556 _js_helper.checkNull(b); | |
| 557 return this % b; | |
| 558 } | |
| 559 [dartx.abs]() { | |
| 560 return Math.abs(this); | |
| 561 } | |
| 562 get [dartx.sign]() { | |
| 563 return this > 0 ? 1 : this < 0 ? -1 : this; | |
| 564 } | |
| 565 [dartx.toInt]() { | |
| 566 if (this >= dart.notNull(JSNumber._MIN_INT32) && this <= dart.notNull(JSNu
mber._MAX_INT32)) { | |
| 567 return this | 0; | |
| 568 } | |
| 569 if (isFinite(this)) { | |
| 570 return this[dartx.truncateToDouble]() + 0; | |
| 571 } | |
| 572 dart.throw(new core.UnsupportedError('' + this)); | |
| 573 } | |
| 574 [dartx.truncate]() { | |
| 575 return this[dartx.toInt](); | |
| 576 } | |
| 577 [dartx.ceil]() { | |
| 578 return this[dartx.ceilToDouble]()[dartx.toInt](); | |
| 579 } | |
| 580 [dartx.floor]() { | |
| 581 return this[dartx.floorToDouble]()[dartx.toInt](); | |
| 582 } | |
| 583 [dartx.round]() { | |
| 584 return this[dartx.roundToDouble]()[dartx.toInt](); | |
| 585 } | |
| 586 [dartx.ceilToDouble]() { | |
| 587 return Math.ceil(this); | |
| 588 } | |
| 589 [dartx.floorToDouble]() { | |
| 590 return Math.floor(this); | |
| 591 } | |
| 592 [dartx.roundToDouble]() { | |
| 593 if (this < 0) { | |
| 594 return -Math.round(-this); | |
| 595 } else { | |
| 596 return Math.round(this); | |
| 597 } | |
| 598 } | |
| 599 [dartx.truncateToDouble]() { | |
| 600 return this < 0 ? this[dartx.ceilToDouble]() : this[dartx.floorToDouble]()
; | |
| 601 } | |
| 602 [dartx.clamp](lowerLimit, upperLimit) { | |
| 603 if (dart.notNull(lowerLimit[dartx.compareTo](upperLimit)) > 0) { | |
| 604 dart.throw(new core.ArgumentError(lowerLimit)); | |
| 605 } | |
| 606 if (dart.notNull(this[dartx.compareTo](lowerLimit)) < 0) return lowerLimit
; | |
| 607 if (dart.notNull(this[dartx.compareTo](upperLimit)) > 0) return upperLimit
; | |
| 608 return this; | |
| 609 } | |
| 610 [dartx.toDouble]() { | |
| 611 return this; | |
| 612 } | |
| 613 [dartx.toStringAsFixed](fractionDigits) { | |
| 614 _js_helper.checkInt(fractionDigits); | |
| 615 if (dart.notNull(fractionDigits) < 0 || dart.notNull(fractionDigits) > 20)
{ | |
| 616 dart.throw(new core.RangeError(fractionDigits)); | |
| 617 } | |
| 618 let result = this.toFixed(fractionDigits); | |
| 619 if (this == 0 && dart.notNull(this[dartx.isNegative])) return `-${result}`
; | |
| 620 return result; | |
| 621 } | |
| 622 [dartx.toStringAsExponential](fractionDigits) { | |
| 623 if (fractionDigits === void 0) fractionDigits = null; | |
| 624 let result = null; | |
| 625 if (fractionDigits != null) { | |
| 626 _js_helper.checkInt(fractionDigits); | |
| 627 if (dart.notNull(fractionDigits) < 0 || dart.notNull(fractionDigits) > 2
0) { | |
| 628 dart.throw(new core.RangeError(fractionDigits)); | |
| 629 } | |
| 630 result = this.toExponential(fractionDigits); | |
| 631 } else { | |
| 632 result = this.toExponential(); | |
| 633 } | |
| 634 if (this == 0 && dart.notNull(this[dartx.isNegative])) return `-${result}`
; | |
| 635 return result; | |
| 636 } | |
| 637 [dartx.toStringAsPrecision](precision) { | |
| 638 _js_helper.checkInt(precision); | |
| 639 if (dart.notNull(precision) < 1 || dart.notNull(precision) > 21) { | |
| 640 dart.throw(new core.RangeError(precision)); | |
| 641 } | |
| 642 let result = this.toPrecision(precision); | |
| 643 if (this == 0 && dart.notNull(this[dartx.isNegative])) return `-${result}`
; | |
| 644 return result; | |
| 645 } | |
| 646 [dartx.toRadixString](radix) { | |
| 647 _js_helper.checkInt(radix); | |
| 648 if (dart.notNull(radix) < 2 || dart.notNull(radix) > 36) dart.throw(new co
re.RangeError(radix)); | |
| 649 let result = this.toString(radix); | |
| 650 let rightParenCode = 41; | |
| 651 if (result[dartx.codeUnitAt](dart.notNull(result[dartx.length]) - 1) != ri
ghtParenCode) { | |
| 652 return result; | |
| 653 } | |
| 654 return JSNumber._handleIEtoString(result); | |
| 655 } | |
| 656 static _handleIEtoString(result) { | |
| 657 let match = /^([\da-z]+)(?:\.([\da-z]+))?\(e\+(\d+)\)$/.exec(result); | |
| 658 if (match == null) { | |
| 659 dart.throw(new core.UnsupportedError(`Unexpected toString result: ${resu
lt}`)); | |
| 660 } | |
| 661 result = dart.dindex(match, 1); | |
| 662 let exponent = +dart.dindex(match, 3); | |
| 663 if (dart.dindex(match, 2) != null) { | |
| 664 result = result + dart.dindex(match, 2); | |
| 665 exponent = exponent - dart.dindex(match, 2).length; | |
| 666 } | |
| 667 return dart.notNull(result) + "0"[dartx['*']](exponent); | |
| 668 } | |
| 669 toString() { | |
| 670 if (this == 0 && 1 / this < 0) { | |
| 671 return '-0.0'; | |
| 672 } else { | |
| 673 return "" + this; | |
| 674 } | |
| 675 } | |
| 676 get hashCode() { | |
| 677 return this & 0x1FFFFFFF; | |
| 678 } | |
| 679 [dartx['unary-']]() { | |
| 680 return -this; | |
| 681 } | |
| 682 [dartx['+']](other) { | |
| 683 _js_helper.checkNull(other); | |
| 684 return this + other; | |
| 685 } | |
| 686 [dartx['-']](other) { | |
| 687 _js_helper.checkNull(other); | |
| 688 return this - other; | |
| 689 } | |
| 690 [dartx['/']](other) { | |
| 691 _js_helper.checkNull(other); | |
| 692 return this / other; | |
| 693 } | |
| 694 [dartx['*']](other) { | |
| 695 _js_helper.checkNull(other); | |
| 696 return this * other; | |
| 697 } | |
| 698 [dartx['%']](other) { | |
| 699 _js_helper.checkNull(other); | |
| 700 let result = this % other; | |
| 701 if (result == 0) return 0; | |
| 702 if (result > 0) return result; | |
| 703 if (other < 0) { | |
| 704 return result - other; | |
| 705 } else { | |
| 706 return result + other; | |
| 707 } | |
| 708 } | |
| 709 [_isInt32](value) { | |
| 710 return (value | 0) === value; | |
| 711 } | |
| 712 [dartx['~/']](other) { | |
| 713 if (dart.notNull(this[_isInt32](this)) && dart.notNull(this[_isInt32](othe
r)) && 0 != other && -1 != other) { | |
| 714 return this / other | 0; | |
| 715 } else { | |
| 716 return this[_tdivSlow](other); | |
| 717 } | |
| 718 } | |
| 719 [_tdivSlow](other) { | |
| 720 _js_helper.checkNull(other); | |
| 721 return (this / other)[dartx.toInt](); | |
| 722 } | |
| 723 [dartx['<<']](other) { | |
| 724 if (dart.notNull(other) < 0) dart.throw(new core.ArgumentError(other)); | |
| 725 return this[_shlPositive](other); | |
| 726 } | |
| 727 [_shlPositive](other) { | |
| 728 return other > 31 ? 0 : this << other >>> 0; | |
| 729 } | |
| 730 [dartx['>>']](other) { | |
| 731 if (dart.notNull(other) < 0) dart.throw(new core.ArgumentError(other)); | |
| 732 return this[_shrOtherPositive](other); | |
| 733 } | |
| 734 [_shrOtherPositive](other) { | |
| 735 return this > 0 ? this[_shrBothPositive](other) : this >> (dart.notNull(ot
her) > 31 ? 31 : other) >>> 0; | |
| 736 } | |
| 737 [_shrBothPositive](other) { | |
| 738 return other > 31 ? 0 : this >>> other; | |
| 739 } | |
| 740 [dartx['&']](other) { | |
| 741 _js_helper.checkNull(other); | |
| 742 return (this & other) >>> 0; | |
| 743 } | |
| 744 [dartx['|']](other) { | |
| 745 _js_helper.checkNull(other); | |
| 746 return (this | other) >>> 0; | |
| 747 } | |
| 748 [dartx['^']](other) { | |
| 749 _js_helper.checkNull(other); | |
| 750 return (this ^ other) >>> 0; | |
| 751 } | |
| 752 [dartx['<']](other) { | |
| 753 _js_helper.checkNull(other); | |
| 754 return this < other; | |
| 755 } | |
| 756 [dartx['>']](other) { | |
| 757 _js_helper.checkNull(other); | |
| 758 return this > other; | |
| 759 } | |
| 760 [dartx['<=']](other) { | |
| 761 _js_helper.checkNull(other); | |
| 762 return this <= other; | |
| 763 } | |
| 764 [dartx['>=']](other) { | |
| 765 _js_helper.checkNull(other); | |
| 766 return this >= other; | |
| 767 } | |
| 768 get [dartx.isEven]() { | |
| 769 return (this & 1) == 0; | |
| 770 } | |
| 771 get [dartx.isOdd]() { | |
| 772 return (this & 1) == 1; | |
| 773 } | |
| 774 [dartx.toUnsigned](width) { | |
| 775 return this & (1 << dart.notNull(width)) - 1; | |
| 776 } | |
| 777 [dartx.toSigned](width) { | |
| 778 let signMask = 1 << dart.notNull(width) - 1; | |
| 779 return (this & signMask - 1) - (this & signMask); | |
| 780 } | |
| 781 get [dartx.bitLength]() { | |
| 782 let nonneg = this < 0 ? -this - 1 : this; | |
| 783 if (nonneg >= 4294967296) { | |
| 784 nonneg = (nonneg / 4294967296)[dartx.truncate](); | |
| 785 return dart.notNull(JSNumber._bitCount(JSNumber._spread(nonneg))) + 32; | |
| 786 } | |
| 787 return JSNumber._bitCount(JSNumber._spread(nonneg)); | |
| 788 } | |
| 789 static _bitCount(i) { | |
| 790 i = dart.notNull(JSNumber._shru(i, 0)) - (dart.notNull(JSNumber._shru(i, 1
)) & 1431655765); | |
| 791 i = (dart.notNull(i) & 858993459) + (dart.notNull(JSNumber._shru(i, 2)) &
858993459); | |
| 792 i = 252645135 & dart.notNull(i) + dart.notNull(JSNumber._shru(i, 4)); | |
| 793 i = dart.notNull(i) + dart.notNull(JSNumber._shru(i, 8)); | |
| 794 i = dart.notNull(i) + dart.notNull(JSNumber._shru(i, 16)); | |
| 795 return dart.notNull(i) & 63; | |
| 796 } | |
| 797 static _shru(value, shift) { | |
| 798 return value >>> shift; | |
| 799 } | |
| 800 static _shrs(value, shift) { | |
| 801 return value >> shift; | |
| 802 } | |
| 803 static _ors(a, b) { | |
| 804 return a | b; | |
| 805 } | |
| 806 static _spread(i) { | |
| 807 i = JSNumber._ors(i, JSNumber._shrs(i, 1)); | |
| 808 i = JSNumber._ors(i, JSNumber._shrs(i, 2)); | |
| 809 i = JSNumber._ors(i, JSNumber._shrs(i, 4)); | |
| 810 i = JSNumber._ors(i, JSNumber._shrs(i, 8)); | |
| 811 i = JSNumber._shru(JSNumber._ors(i, JSNumber._shrs(i, 16)), 0); | |
| 812 return i; | |
| 813 } | |
| 814 [dartx['~']]() { | |
| 815 return ~this >>> 0; | |
| 816 } | |
| 817 } | |
| 818 JSNumber[dart.implements] = () => [core.int, core.double]; | |
| 819 dart.setSignature(JSNumber, { | |
| 820 constructors: () => ({JSNumber: [JSNumber, []]}), | |
| 821 methods: () => ({ | |
| 822 [dartx.compareTo]: [core.int, [core.num]], | |
| 823 [dartx.remainder]: [JSNumber, [core.num]], | |
| 824 [dartx.abs]: [JSNumber, []], | |
| 825 [dartx.toInt]: [core.int, []], | |
| 826 [dartx.truncate]: [core.int, []], | |
| 827 [dartx.ceil]: [core.int, []], | |
| 828 [dartx.floor]: [core.int, []], | |
| 829 [dartx.round]: [core.int, []], | |
| 830 [dartx.ceilToDouble]: [core.double, []], | |
| 831 [dartx.floorToDouble]: [core.double, []], | |
| 832 [dartx.roundToDouble]: [core.double, []], | |
| 833 [dartx.truncateToDouble]: [core.double, []], | |
| 834 [dartx.clamp]: [core.num, [core.num, core.num]], | |
| 835 [dartx.toDouble]: [core.double, []], | |
| 836 [dartx.toStringAsFixed]: [core.String, [core.int]], | |
| 837 [dartx.toStringAsExponential]: [core.String, [], [core.int]], | |
| 838 [dartx.toStringAsPrecision]: [core.String, [core.int]], | |
| 839 [dartx.toRadixString]: [core.String, [core.int]], | |
| 840 [dartx['unary-']]: [JSNumber, []], | |
| 841 [dartx['+']]: [JSNumber, [core.num]], | |
| 842 [dartx['-']]: [JSNumber, [core.num]], | |
| 843 [dartx['/']]: [core.double, [core.num]], | |
| 844 [dartx['*']]: [JSNumber, [core.num]], | |
| 845 [dartx['%']]: [JSNumber, [core.num]], | |
| 846 [_isInt32]: [core.bool, [dart.dynamic]], | |
| 847 [dartx['~/']]: [core.int, [core.num]], | |
| 848 [_tdivSlow]: [core.int, [core.num]], | |
| 849 [dartx['<<']]: [core.int, [core.num]], | |
| 850 [_shlPositive]: [core.int, [core.num]], | |
| 851 [dartx['>>']]: [core.int, [core.num]], | |
| 852 [_shrOtherPositive]: [core.int, [core.num]], | |
| 853 [_shrBothPositive]: [core.int, [core.num]], | |
| 854 [dartx['&']]: [core.int, [core.num]], | |
| 855 [dartx['|']]: [core.int, [core.num]], | |
| 856 [dartx['^']]: [core.int, [core.num]], | |
| 857 [dartx['<']]: [core.bool, [core.num]], | |
| 858 [dartx['>']]: [core.bool, [core.num]], | |
| 859 [dartx['<=']]: [core.bool, [core.num]], | |
| 860 [dartx['>=']]: [core.bool, [core.num]], | |
| 861 [dartx.toUnsigned]: [core.int, [core.int]], | |
| 862 [dartx.toSigned]: [core.int, [core.int]], | |
| 863 [dartx['~']]: [core.int, []] | |
| 864 }), | |
| 865 statics: () => ({ | |
| 866 _handleIEtoString: [core.String, [core.String]], | |
| 867 _bitCount: [core.int, [core.int]], | |
| 868 _shru: [core.int, [core.int, core.int]], | |
| 869 _shrs: [core.int, [core.int, core.int]], | |
| 870 _ors: [core.int, [core.int, core.int]], | |
| 871 _spread: [core.int, [core.int]] | |
| 872 }), | |
| 873 names: ['_handleIEtoString', '_bitCount', '_shru', '_shrs', '_ors', '_spread
'] | |
| 874 }); | |
| 875 JSNumber[dart.metadata] = () => [dart.const(new _js_helper.JsPeerInterface({na
me: 'Number'}))]; | |
| 876 JSNumber._MIN_INT32 = -2147483648; | |
| 877 JSNumber._MAX_INT32 = 2147483647; | |
| 878 dart.registerExtension(dart.global.Number, JSNumber); | |
| 879 const _defaultSplit = Symbol('_defaultSplit'); | |
| 880 dart.defineExtensionNames([ | |
| 881 'codeUnitAt', | |
| 882 'allMatches', | |
| 883 'matchAsPrefix', | |
| 884 '+', | |
| 885 'endsWith', | |
| 886 'replaceAll', | |
| 887 'replaceAllMapped', | |
| 888 'splitMapJoin', | |
| 889 'replaceFirst', | |
| 890 'split', | |
| 891 'startsWith', | |
| 892 'substring', | |
| 893 'toLowerCase', | |
| 894 'toUpperCase', | |
| 895 'trim', | |
| 896 'trimLeft', | |
| 897 'trimRight', | |
| 898 '*', | |
| 899 'padLeft', | |
| 900 'padRight', | |
| 901 'codeUnits', | |
| 902 'runes', | |
| 903 'indexOf', | |
| 904 'lastIndexOf', | |
| 905 'contains', | |
| 906 'isEmpty', | |
| 907 'isNotEmpty', | |
| 908 'compareTo', | |
| 909 'toString', | |
| 910 'hashCode', | |
| 911 'runtimeType', | |
| 912 'length', | |
| 913 'get' | |
| 914 ]); | |
| 915 class JSString extends Interceptor { | |
| 916 JSString() { | |
| 917 super.Interceptor(); | |
| 918 } | |
| 919 [dartx.codeUnitAt](index) { | |
| 920 if (!(typeof index == 'number')) dart.throw(new core.ArgumentError(index))
; | |
| 921 if (dart.notNull(index) < 0) dart.throw(new core.RangeError.value(index)); | |
| 922 if (dart.notNull(index) >= dart.notNull(this[dartx.length])) dart.throw(ne
w core.RangeError.value(index)); | |
| 923 return this.charCodeAt(index); | |
| 924 } | |
| 925 [dartx.allMatches](string, start) { | |
| 926 if (start === void 0) start = 0; | |
| 927 _js_helper.checkString(string); | |
| 928 _js_helper.checkInt(start); | |
| 929 if (0 > dart.notNull(start) || dart.notNull(start) > dart.notNull(string[d
artx.length])) { | |
| 930 dart.throw(new core.RangeError.range(start, 0, string[dartx.length])); | |
| 931 } | |
| 932 return _js_helper.allMatchesInStringUnchecked(this, string, start); | |
| 933 } | |
| 934 [dartx.matchAsPrefix](string, start) { | |
| 935 if (start === void 0) start = 0; | |
| 936 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(string[d
artx.length])) { | |
| 937 dart.throw(new core.RangeError.range(start, 0, string[dartx.length])); | |
| 938 } | |
| 939 if (dart.notNull(start) + dart.notNull(this[dartx.length]) > dart.notNull(
string[dartx.length])) return null; | |
| 940 for (let i = 0; i < dart.notNull(this[dartx.length]); i++) { | |
| 941 if (string[dartx.codeUnitAt](dart.notNull(start) + i) != this[dartx.code
UnitAt](i)) { | |
| 942 return null; | |
| 943 } | |
| 944 } | |
| 945 return new _js_helper.StringMatch(start, string, this); | |
| 946 } | |
| 947 [dartx['+']](other) { | |
| 948 if (!(typeof other == 'string')) dart.throw(new core.ArgumentError(other))
; | |
| 949 return this + other; | |
| 950 } | |
| 951 [dartx.endsWith](other) { | |
| 952 _js_helper.checkString(other); | |
| 953 let otherLength = other[dartx.length]; | |
| 954 if (dart.notNull(otherLength) > dart.notNull(this[dartx.length])) return f
alse; | |
| 955 return other == this[dartx.substring](dart.notNull(this[dartx.length]) - d
art.notNull(otherLength)); | |
| 956 } | |
| 957 [dartx.replaceAll](from, to) { | |
| 958 _js_helper.checkString(to); | |
| 959 return dart.as(_js_helper.stringReplaceAllUnchecked(this, from, to), core.
String); | |
| 960 } | |
| 961 [dartx.replaceAllMapped](from, convert) { | |
| 962 return this[dartx.splitMapJoin](from, {onMatch: convert}); | |
| 963 } | |
| 964 [dartx.splitMapJoin](from, opts) { | |
| 965 let onMatch = opts && 'onMatch' in opts ? opts.onMatch : null; | |
| 966 let onNonMatch = opts && 'onNonMatch' in opts ? opts.onNonMatch : null; | |
| 967 return dart.as(_js_helper.stringReplaceAllFuncUnchecked(this, from, onMatc
h, onNonMatch), core.String); | |
| 968 } | |
| 969 [dartx.replaceFirst](from, to, startIndex) { | |
| 970 if (startIndex === void 0) startIndex = 0; | |
| 971 _js_helper.checkString(to); | |
| 972 _js_helper.checkInt(startIndex); | |
| 973 if (dart.notNull(startIndex) < 0 || dart.notNull(startIndex) > dart.notNul
l(this[dartx.length])) { | |
| 974 dart.throw(new core.RangeError.range(startIndex, 0, this[dartx.length]))
; | |
| 975 } | |
| 976 return dart.as(_js_helper.stringReplaceFirstUnchecked(this, from, to, star
tIndex), core.String); | |
| 977 } | |
| 978 [dartx.split](pattern) { | |
| 979 _js_helper.checkNull(pattern); | |
| 980 if (typeof pattern == 'string') { | |
| 981 return dart.as(this.split(pattern), core.List$(core.String)); | |
| 982 } else if (dart.is(pattern, _js_helper.JSSyntaxRegExp) && _js_helper.regEx
pCaptureCount(pattern) == 0) { | |
| 983 let re = _js_helper.regExpGetNative(pattern); | |
| 984 return dart.as(this.split(re), core.List$(core.String)); | |
| 985 } else { | |
| 986 return this[_defaultSplit](pattern); | |
| 987 } | |
| 988 } | |
| 989 [_defaultSplit](pattern) { | |
| 990 let result = dart.list([], core.String); | |
| 991 let start = 0; | |
| 992 let length = 1; | |
| 993 for (let match of pattern[dartx.allMatches](this)) { | |
| 994 let matchStart = match.start; | |
| 995 let matchEnd = match.end; | |
| 996 length = dart.notNull(matchEnd) - dart.notNull(matchStart); | |
| 997 if (length == 0 && start == matchStart) { | |
| 998 continue; | |
| 999 } | |
| 1000 let end = matchStart; | |
| 1001 result[dartx.add](this[dartx.substring](start, end)); | |
| 1002 start = matchEnd; | |
| 1003 } | |
| 1004 if (dart.notNull(start) < dart.notNull(this[dartx.length]) || length > 0)
{ | |
| 1005 result[dartx.add](this[dartx.substring](start)); | |
| 1006 } | |
| 1007 return result; | |
| 1008 } | |
| 1009 [dartx.startsWith](pattern, index) { | |
| 1010 if (index === void 0) index = 0; | |
| 1011 _js_helper.checkInt(index); | |
| 1012 if (dart.notNull(index) < 0 || dart.notNull(index) > dart.notNull(this[dar
tx.length])) { | |
| 1013 dart.throw(new core.RangeError.range(index, 0, this[dartx.length])); | |
| 1014 } | |
| 1015 if (typeof pattern == 'string') { | |
| 1016 let other = pattern; | |
| 1017 let otherLength = other[dartx.length]; | |
| 1018 let endIndex = dart.notNull(index) + dart.notNull(otherLength); | |
| 1019 if (endIndex > dart.notNull(this[dartx.length])) return false; | |
| 1020 return other == this.substring(index, endIndex); | |
| 1021 } | |
| 1022 return pattern[dartx.matchAsPrefix](this, index) != null; | |
| 1023 } | |
| 1024 [dartx.substring](startIndex, endIndex) { | |
| 1025 if (endIndex === void 0) endIndex = null; | |
| 1026 _js_helper.checkInt(startIndex); | |
| 1027 if (endIndex == null) endIndex = this[dartx.length]; | |
| 1028 _js_helper.checkInt(endIndex); | |
| 1029 if (dart.notNull(startIndex) < 0) dart.throw(new core.RangeError.value(sta
rtIndex)); | |
| 1030 if (dart.notNull(startIndex) > dart.notNull(endIndex)) dart.throw(new core
.RangeError.value(startIndex)); | |
| 1031 if (dart.notNull(endIndex) > dart.notNull(this[dartx.length])) dart.throw(
new core.RangeError.value(endIndex)); | |
| 1032 return this.substring(startIndex, endIndex); | |
| 1033 } | |
| 1034 [dartx.toLowerCase]() { | |
| 1035 return this.toLowerCase(); | |
| 1036 } | |
| 1037 [dartx.toUpperCase]() { | |
| 1038 return this.toUpperCase(); | |
| 1039 } | |
| 1040 static _isWhitespace(codeUnit) { | |
| 1041 if (dart.notNull(codeUnit) < 256) { | |
| 1042 switch (codeUnit) { | |
| 1043 case 9: | |
| 1044 case 10: | |
| 1045 case 11: | |
| 1046 case 12: | |
| 1047 case 13: | |
| 1048 case 32: | |
| 1049 case 133: | |
| 1050 case 160: | |
| 1051 { | |
| 1052 return true; | |
| 1053 } | |
| 1054 default: | |
| 1055 { | |
| 1056 return false; | |
| 1057 } | |
| 1058 } | |
| 1059 } | |
| 1060 switch (codeUnit) { | |
| 1061 case 5760: | |
| 1062 case 6158: | |
| 1063 case 8192: | |
| 1064 case 8193: | |
| 1065 case 8194: | |
| 1066 case 8195: | |
| 1067 case 8196: | |
| 1068 case 8197: | |
| 1069 case 8198: | |
| 1070 case 8199: | |
| 1071 case 8200: | |
| 1072 case 8201: | |
| 1073 case 8202: | |
| 1074 case 8232: | |
| 1075 case 8233: | |
| 1076 case 8239: | |
| 1077 case 8287: | |
| 1078 case 12288: | |
| 1079 case 65279: | |
| 1080 { | |
| 1081 return true; | |
| 1082 } | |
| 1083 default: | |
| 1084 { | |
| 1085 return false; | |
| 1086 } | |
| 1087 } | |
| 1088 } | |
| 1089 static _skipLeadingWhitespace(string, index) { | |
| 1090 let SPACE = 32; | |
| 1091 let CARRIAGE_RETURN = 13; | |
| 1092 while (dart.notNull(index) < dart.notNull(string[dartx.length])) { | |
| 1093 let codeUnit = string[dartx.codeUnitAt](index); | |
| 1094 if (codeUnit != SPACE && codeUnit != CARRIAGE_RETURN && !dart.notNull(JS
String._isWhitespace(codeUnit))) { | |
| 1095 break; | |
| 1096 } | |
| 1097 index = dart.notNull(index) + 1; | |
| 1098 } | |
| 1099 return index; | |
| 1100 } | |
| 1101 static _skipTrailingWhitespace(string, index) { | |
| 1102 let SPACE = 32; | |
| 1103 let CARRIAGE_RETURN = 13; | |
| 1104 while (dart.notNull(index) > 0) { | |
| 1105 let codeUnit = string[dartx.codeUnitAt](dart.notNull(index) - 1); | |
| 1106 if (codeUnit != SPACE && codeUnit != CARRIAGE_RETURN && !dart.notNull(JS
String._isWhitespace(codeUnit))) { | |
| 1107 break; | |
| 1108 } | |
| 1109 index = dart.notNull(index) - 1; | |
| 1110 } | |
| 1111 return index; | |
| 1112 } | |
| 1113 [dartx.trim]() { | |
| 1114 let NEL = 133; | |
| 1115 let result = this.trim(); | |
| 1116 if (result[dartx.length] == 0) return result; | |
| 1117 let firstCode = result[dartx.codeUnitAt](0); | |
| 1118 let startIndex = 0; | |
| 1119 if (firstCode == NEL) { | |
| 1120 startIndex = JSString._skipLeadingWhitespace(result, 1); | |
| 1121 if (startIndex == result[dartx.length]) return ""; | |
| 1122 } | |
| 1123 let endIndex = result[dartx.length]; | |
| 1124 let lastCode = result[dartx.codeUnitAt](dart.notNull(endIndex) - 1); | |
| 1125 if (lastCode == NEL) { | |
| 1126 endIndex = JSString._skipTrailingWhitespace(result, dart.notNull(endInde
x) - 1); | |
| 1127 } | |
| 1128 if (startIndex == 0 && endIndex == result[dartx.length]) return result; | |
| 1129 return result.substring(startIndex, endIndex); | |
| 1130 } | |
| 1131 [dartx.trimLeft]() { | |
| 1132 let NEL = 133; | |
| 1133 let result = null; | |
| 1134 let startIndex = 0; | |
| 1135 if (typeof this.trimLeft != "undefined") { | |
| 1136 result = this.trimLeft(); | |
| 1137 if (result[dartx.length] == 0) return result; | |
| 1138 let firstCode = result[dartx.codeUnitAt](0); | |
| 1139 if (firstCode == NEL) { | |
| 1140 startIndex = JSString._skipLeadingWhitespace(result, 1); | |
| 1141 } | |
| 1142 } else { | |
| 1143 result = this; | |
| 1144 startIndex = JSString._skipLeadingWhitespace(this, 0); | |
| 1145 } | |
| 1146 if (startIndex == 0) return result; | |
| 1147 if (startIndex == result[dartx.length]) return ""; | |
| 1148 return result.substring(startIndex); | |
| 1149 } | |
| 1150 [dartx.trimRight]() { | |
| 1151 let NEL = 133; | |
| 1152 let result = null; | |
| 1153 let endIndex = null; | |
| 1154 if (typeof this.trimRight != "undefined") { | |
| 1155 result = this.trimRight(); | |
| 1156 endIndex = result[dartx.length]; | |
| 1157 if (endIndex == 0) return result; | |
| 1158 let lastCode = result[dartx.codeUnitAt](dart.notNull(endIndex) - 1); | |
| 1159 if (lastCode == NEL) { | |
| 1160 endIndex = JSString._skipTrailingWhitespace(result, dart.notNull(endIn
dex) - 1); | |
| 1161 } | |
| 1162 } else { | |
| 1163 result = this; | |
| 1164 endIndex = JSString._skipTrailingWhitespace(this, this[dartx.length]); | |
| 1165 } | |
| 1166 if (endIndex == result[dartx.length]) return result; | |
| 1167 if (endIndex == 0) return ""; | |
| 1168 return result.substring(0, endIndex); | |
| 1169 } | |
| 1170 [dartx['*']](times) { | |
| 1171 if (0 >= dart.notNull(times)) return ''; | |
| 1172 if (times == 1 || this[dartx.length] == 0) return this; | |
| 1173 if (times != times >>> 0) { | |
| 1174 dart.throw(dart.const(new core.OutOfMemoryError())); | |
| 1175 } | |
| 1176 let result = ''; | |
| 1177 let s = this; | |
| 1178 while (true) { | |
| 1179 if ((dart.notNull(times) & 1) == 1) result = s + result; | |
| 1180 times = times >>> 1; | |
| 1181 if (times == 0) break; | |
| 1182 s = s + s; | |
| 1183 } | |
| 1184 return result; | |
| 1185 } | |
| 1186 [dartx.padLeft](width, padding) { | |
| 1187 if (padding === void 0) padding = ' '; | |
| 1188 let delta = dart.notNull(width) - dart.notNull(this[dartx.length]); | |
| 1189 if (delta <= 0) return this; | |
| 1190 return padding[dartx['*']](delta) + this; | |
| 1191 } | |
| 1192 [dartx.padRight](width, padding) { | |
| 1193 if (padding === void 0) padding = ' '; | |
| 1194 let delta = dart.notNull(width) - dart.notNull(this[dartx.length]); | |
| 1195 if (delta <= 0) return this; | |
| 1196 return this[dartx['+']](padding[dartx['*']](delta)); | |
| 1197 } | |
| 1198 get [dartx.codeUnits]() { | |
| 1199 return new _CodeUnits(this); | |
| 1200 } | |
| 1201 get [dartx.runes]() { | |
| 1202 return new core.Runes(this); | |
| 1203 } | |
| 1204 [dartx.indexOf](pattern, start) { | |
| 1205 if (start === void 0) start = 0; | |
| 1206 _js_helper.checkNull(pattern); | |
| 1207 if (!(typeof start == 'number')) dart.throw(new core.ArgumentError(start))
; | |
| 1208 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(this[dar
tx.length])) { | |
| 1209 dart.throw(new core.RangeError.range(start, 0, this[dartx.length])); | |
| 1210 } | |
| 1211 if (typeof pattern == 'string') { | |
| 1212 return this.indexOf(pattern, start); | |
| 1213 } | |
| 1214 if (dart.is(pattern, _js_helper.JSSyntaxRegExp)) { | |
| 1215 let re = pattern; | |
| 1216 let match = _js_helper.firstMatchAfter(re, this, start); | |
| 1217 return match == null ? -1 : match.start; | |
| 1218 } | |
| 1219 for (let i = start; dart.notNull(i) <= dart.notNull(this[dartx.length]); i
= dart.notNull(i) + 1) { | |
| 1220 if (pattern[dartx.matchAsPrefix](this, i) != null) return i; | |
| 1221 } | |
| 1222 return -1; | |
| 1223 } | |
| 1224 [dartx.lastIndexOf](pattern, start) { | |
| 1225 if (start === void 0) start = null; | |
| 1226 _js_helper.checkNull(pattern); | |
| 1227 if (start == null) { | |
| 1228 start = this[dartx.length]; | |
| 1229 } else if (!(typeof start == 'number')) { | |
| 1230 dart.throw(new core.ArgumentError(start)); | |
| 1231 } else if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(t
his[dartx.length])) { | |
| 1232 dart.throw(new core.RangeError.range(start, 0, this[dartx.length])); | |
| 1233 } | |
| 1234 if (typeof pattern == 'string') { | |
| 1235 let other = pattern; | |
| 1236 if (dart.notNull(start) + dart.notNull(other[dartx.length]) > dart.notNu
ll(this[dartx.length])) { | |
| 1237 start = dart.notNull(this[dartx.length]) - dart.notNull(other[dartx.le
ngth]); | |
| 1238 } | |
| 1239 return dart.as(_js_helper.stringLastIndexOfUnchecked(this, other, start)
, core.int); | |
| 1240 } | |
| 1241 for (let i = start; dart.notNull(i) >= 0; i = dart.notNull(i) - 1) { | |
| 1242 if (pattern[dartx.matchAsPrefix](this, i) != null) return i; | |
| 1243 } | |
| 1244 return -1; | |
| 1245 } | |
| 1246 [dartx.contains](other, startIndex) { | |
| 1247 if (startIndex === void 0) startIndex = 0; | |
| 1248 _js_helper.checkNull(other); | |
| 1249 if (dart.notNull(startIndex) < 0 || dart.notNull(startIndex) > dart.notNul
l(this[dartx.length])) { | |
| 1250 dart.throw(new core.RangeError.range(startIndex, 0, this[dartx.length]))
; | |
| 1251 } | |
| 1252 return dart.as(_js_helper.stringContainsUnchecked(this, other, startIndex)
, core.bool); | |
| 1253 } | |
| 1254 get [dartx.isEmpty]() { | |
| 1255 return this[dartx.length] == 0; | |
| 1256 } | |
| 1257 get [dartx.isNotEmpty]() { | |
| 1258 return !dart.notNull(this[dartx.isEmpty]); | |
| 1259 } | |
| 1260 [dartx.compareTo](other) { | |
| 1261 if (!(typeof other == 'string')) dart.throw(new core.ArgumentError(other))
; | |
| 1262 return dart.equals(this, other) ? 0 : this < other ? -1 : 1; | |
| 1263 } | |
| 1264 toString() { | |
| 1265 return this; | |
| 1266 } | |
| 1267 get hashCode() { | |
| 1268 let hash = 0; | |
| 1269 for (let i = 0; i < dart.notNull(this[dartx.length]); i++) { | |
| 1270 hash = 536870911 & hash + this.charCodeAt(i); | |
| 1271 hash = 536870911 & hash + ((524287 & hash) << 10); | |
| 1272 hash = hash ^ hash >> 6; | |
| 1273 } | |
| 1274 hash = 536870911 & hash + ((67108863 & hash) << 3); | |
| 1275 hash = hash ^ hash >> 11; | |
| 1276 return 536870911 & hash + ((16383 & hash) << 15); | |
| 1277 } | |
| 1278 get runtimeType() { | |
| 1279 return core.String; | |
| 1280 } | |
| 1281 get [dartx.length]() { | |
| 1282 return this.length; | |
| 1283 } | |
| 1284 [dartx.get](index) { | |
| 1285 if (!(typeof index == 'number')) dart.throw(new core.ArgumentError(index))
; | |
| 1286 if (dart.notNull(index) >= dart.notNull(this[dartx.length]) || dart.notNul
l(index) < 0) dart.throw(new core.RangeError.value(index)); | |
| 1287 return this[index]; | |
| 1288 } | |
| 1289 } | |
| 1290 JSString[dart.implements] = () => [core.String, JSIndexable]; | |
| 1291 dart.setSignature(JSString, { | |
| 1292 constructors: () => ({JSString: [JSString, []]}), | |
| 1293 methods: () => ({ | |
| 1294 [dartx.codeUnitAt]: [core.int, [core.int]], | |
| 1295 [dartx.allMatches]: [core.Iterable$(core.Match), [core.String], [core.int]
], | |
| 1296 [dartx.matchAsPrefix]: [core.Match, [core.String], [core.int]], | |
| 1297 [dartx['+']]: [core.String, [core.String]], | |
| 1298 [dartx.endsWith]: [core.bool, [core.String]], | |
| 1299 [dartx.replaceAll]: [core.String, [core.Pattern, core.String]], | |
| 1300 [dartx.replaceAllMapped]: [core.String, [core.Pattern, dart.functionType(c
ore.String, [core.Match])]], | |
| 1301 [dartx.splitMapJoin]: [core.String, [core.Pattern], {onMatch: dart.functio
nType(core.String, [core.Match]), onNonMatch: dart.functionType(core.String, [co
re.String])}], | |
| 1302 [dartx.replaceFirst]: [core.String, [core.Pattern, core.String], [core.int
]], | |
| 1303 [dartx.split]: [core.List$(core.String), [core.Pattern]], | |
| 1304 [_defaultSplit]: [core.List$(core.String), [core.Pattern]], | |
| 1305 [dartx.startsWith]: [core.bool, [core.Pattern], [core.int]], | |
| 1306 [dartx.substring]: [core.String, [core.int], [core.int]], | |
| 1307 [dartx.toLowerCase]: [core.String, []], | |
| 1308 [dartx.toUpperCase]: [core.String, []], | |
| 1309 [dartx.trim]: [core.String, []], | |
| 1310 [dartx.trimLeft]: [core.String, []], | |
| 1311 [dartx.trimRight]: [core.String, []], | |
| 1312 [dartx['*']]: [core.String, [core.int]], | |
| 1313 [dartx.padLeft]: [core.String, [core.int], [core.String]], | |
| 1314 [dartx.padRight]: [core.String, [core.int], [core.String]], | |
| 1315 [dartx.indexOf]: [core.int, [core.Pattern], [core.int]], | |
| 1316 [dartx.lastIndexOf]: [core.int, [core.Pattern], [core.int]], | |
| 1317 [dartx.contains]: [core.bool, [core.Pattern], [core.int]], | |
| 1318 [dartx.compareTo]: [core.int, [core.String]], | |
| 1319 [dartx.get]: [core.String, [core.int]] | |
| 1320 }), | |
| 1321 statics: () => ({ | |
| 1322 _isWhitespace: [core.bool, [core.int]], | |
| 1323 _skipLeadingWhitespace: [core.int, [core.String, core.int]], | |
| 1324 _skipTrailingWhitespace: [core.int, [core.String, core.int]] | |
| 1325 }), | |
| 1326 names: ['_isWhitespace', '_skipLeadingWhitespace', '_skipTrailingWhitespace'
] | |
| 1327 }); | |
| 1328 JSString[dart.metadata] = () => [dart.const(new _js_helper.JsPeerInterface({na
me: 'String'}))]; | |
| 1329 dart.registerExtension(dart.global.String, JSString); | |
| 1330 const _string = Symbol('_string'); | |
| 1331 class _CodeUnits extends _internal.UnmodifiableListBase$(core.int) { | |
| 1332 _CodeUnits(string) { | |
| 1333 this[_string] = string; | |
| 1334 } | |
| 1335 get length() { | |
| 1336 return this[_string][dartx.length]; | |
| 1337 } | |
| 1338 get(i) { | |
| 1339 return this[_string][dartx.codeUnitAt](i); | |
| 1340 } | |
| 1341 } | |
| 1342 dart.setSignature(_CodeUnits, { | |
| 1343 constructors: () => ({_CodeUnits: [_CodeUnits, [core.String]]}), | |
| 1344 methods: () => ({get: [core.int, [core.int]]}) | |
| 1345 }); | |
| 1346 dart.defineExtensionMembers(_CodeUnits, ['get', 'length']); | |
| 1347 function getInterceptor(obj) { | |
| 1348 return obj; | |
| 1349 } | |
| 1350 dart.fn(getInterceptor); | |
| 1351 dart.defineExtensionNames([ | |
| 1352 'toString', | |
| 1353 'hashCode', | |
| 1354 'runtimeType' | |
| 1355 ]); | |
| 1356 class JSBool extends Interceptor { | |
| 1357 JSBool() { | |
| 1358 super.Interceptor(); | |
| 1359 } | |
| 1360 toString() { | |
| 1361 return String(this); | |
| 1362 } | |
| 1363 get hashCode() { | |
| 1364 return this ? 2 * 3 * 23 * 3761 : 269 * 811; | |
| 1365 } | |
| 1366 get runtimeType() { | |
| 1367 return core.bool; | |
| 1368 } | |
| 1369 } | |
| 1370 JSBool[dart.implements] = () => [core.bool]; | |
| 1371 dart.setSignature(JSBool, { | |
| 1372 constructors: () => ({JSBool: [JSBool, []]}) | |
| 1373 }); | |
| 1374 JSBool[dart.metadata] = () => [dart.const(new _js_helper.JsPeerInterface({name
: 'Boolean'}))]; | |
| 1375 dart.registerExtension(dart.global.Boolean, JSBool); | |
| 1376 class JSIndexable extends core.Object {} | |
| 1377 class JSMutableIndexable extends JSIndexable {} | |
| 1378 class JSObject extends core.Object {} | |
| 1379 class JavaScriptObject extends Interceptor { | |
| 1380 JavaScriptObject() { | |
| 1381 super.Interceptor(); | |
| 1382 } | |
| 1383 get hashCode() { | |
| 1384 return 0; | |
| 1385 } | |
| 1386 get runtimeType() { | |
| 1387 return JSObject; | |
| 1388 } | |
| 1389 } | |
| 1390 JavaScriptObject[dart.implements] = () => [JSObject]; | |
| 1391 dart.setSignature(JavaScriptObject, { | |
| 1392 constructors: () => ({JavaScriptObject: [JavaScriptObject, []]}) | |
| 1393 }); | |
| 1394 class PlainJavaScriptObject extends JavaScriptObject { | |
| 1395 PlainJavaScriptObject() { | |
| 1396 super.JavaScriptObject(); | |
| 1397 } | |
| 1398 } | |
| 1399 dart.setSignature(PlainJavaScriptObject, { | |
| 1400 constructors: () => ({PlainJavaScriptObject: [PlainJavaScriptObject, []]}) | |
| 1401 }); | |
| 1402 class UnknownJavaScriptObject extends JavaScriptObject { | |
| 1403 UnknownJavaScriptObject() { | |
| 1404 super.JavaScriptObject(); | |
| 1405 } | |
| 1406 toString() { | |
| 1407 return String(this); | |
| 1408 } | |
| 1409 } | |
| 1410 dart.setSignature(UnknownJavaScriptObject, { | |
| 1411 constructors: () => ({UnknownJavaScriptObject: [UnknownJavaScriptObject, []]
}) | |
| 1412 }); | |
| 1413 // Exports: | |
| 1414 exports.JSArray$ = JSArray$; | |
| 1415 exports.JSArray = JSArray; | |
| 1416 exports.JSMutableArray$ = JSMutableArray$; | |
| 1417 exports.JSMutableArray = JSMutableArray; | |
| 1418 exports.JSFixedArray$ = JSFixedArray$; | |
| 1419 exports.JSFixedArray = JSFixedArray; | |
| 1420 exports.JSExtendableArray$ = JSExtendableArray$; | |
| 1421 exports.JSExtendableArray = JSExtendableArray; | |
| 1422 exports.Interceptor = Interceptor; | |
| 1423 exports.JSNumber = JSNumber; | |
| 1424 exports.JSString = JSString; | |
| 1425 exports.getInterceptor = getInterceptor; | |
| 1426 exports.JSBool = JSBool; | |
| 1427 exports.JSIndexable = JSIndexable; | |
| 1428 exports.JSMutableIndexable = JSMutableIndexable; | |
| 1429 exports.JSObject = JSObject; | |
| 1430 exports.JavaScriptObject = JavaScriptObject; | |
| 1431 exports.PlainJavaScriptObject = PlainJavaScriptObject; | |
| 1432 exports.UnknownJavaScriptObject = UnknownJavaScriptObject; | |
| 1433 }); | |
| OLD | NEW |