main.js
1 /* 2 THIS IS A GENERATED/BUNDLED FILE BY ESBUILD 3 if you want to view the source, please visit the github repository of this plugin 4 */ 5 6 var __create = Object.create; 7 var __defProp = Object.defineProperty; 8 var __getOwnPropDesc = Object.getOwnPropertyDescriptor; 9 var __getOwnPropNames = Object.getOwnPropertyNames; 10 var __getProtoOf = Object.getPrototypeOf; 11 var __hasOwnProp = Object.prototype.hasOwnProperty; 12 var __commonJS = (cb, mod) => function __require() { 13 return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; 14 }; 15 var __export = (target, all) => { 16 for (var name in all) 17 __defProp(target, name, { get: all[name], enumerable: true }); 18 }; 19 var __copyProps = (to, from, except, desc) => { 20 if (from && typeof from === "object" || typeof from === "function") { 21 for (let key of __getOwnPropNames(from)) 22 if (!__hasOwnProp.call(to, key) && key !== except) 23 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); 24 } 25 return to; 26 }; 27 var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( 28 // If the importer is in node compatibility mode or this is not an ESM 29 // file that has been converted to a CommonJS file using a Babel- 30 // compatible transform (i.e. "__esModule" has not been set), then set 31 // "default" to the CommonJS "module.exports" for node compatibility. 32 isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, 33 mod 34 )); 35 var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); 36 37 // node_modules/@tgrosinger/md-advanced-tables/lib/point.js 38 var require_point = __commonJS({ 39 "node_modules/@tgrosinger/md-advanced-tables/lib/point.js"(exports) { 40 "use strict"; 41 Object.defineProperty(exports, "__esModule", { value: true }); 42 exports.Point = void 0; 43 var Point2 = class { 44 /** 45 * Creates a new `Point` object. 46 * 47 * @param row - Row of the point, starts from 0. 48 * @param column - Column of the point, starts from 0. 49 */ 50 constructor(row, column) { 51 this.row = row; 52 this.column = column; 53 } 54 /** 55 * Checks if the point is equal to another point. 56 */ 57 equals(point) { 58 return this.row === point.row && this.column === point.column; 59 } 60 }; 61 exports.Point = Point2; 62 } 63 }); 64 65 // node_modules/@tgrosinger/md-advanced-tables/lib/range.js 66 var require_range = __commonJS({ 67 "node_modules/@tgrosinger/md-advanced-tables/lib/range.js"(exports) { 68 "use strict"; 69 Object.defineProperty(exports, "__esModule", { value: true }); 70 exports.Range = void 0; 71 var Range2 = class { 72 /** 73 * Creates a new `Range` object. 74 * 75 * @param start - The start point of the range. 76 * @param end - The end point of the range. 77 */ 78 constructor(start, end) { 79 this.start = start; 80 this.end = end; 81 } 82 }; 83 exports.Range = Range2; 84 } 85 }); 86 87 // node_modules/@tgrosinger/md-advanced-tables/lib/focus.js 88 var require_focus = __commonJS({ 89 "node_modules/@tgrosinger/md-advanced-tables/lib/focus.js"(exports) { 90 "use strict"; 91 Object.defineProperty(exports, "__esModule", { value: true }); 92 exports.Focus = void 0; 93 var Focus = class _Focus { 94 /** 95 * Creates a new `Focus` object. 96 * 97 * @param row - Row of the focused cell. 98 * @param column - Column of the focused cell. 99 * @param offset - Raw offset in the cell. 100 */ 101 constructor(row, column, offset) { 102 this.row = row; 103 this.column = column; 104 this.offset = offset; 105 } 106 /** 107 * Checks if two focuses point the same cell. 108 * Offsets are ignored. 109 */ 110 posEquals(focus) { 111 return this.row === focus.row && this.column === focus.column; 112 } 113 /** 114 * Creates a copy of the focus object by setting its row to the specified value. 115 * 116 * @param row - Row of the focused cell. 117 * @returns A new focus object with the specified row. 118 */ 119 setRow(row) { 120 return new _Focus(row, this.column, this.offset); 121 } 122 /** 123 * Creates a copy of the focus object by setting its column to the specified value. 124 * 125 * @param column - Column of the focused cell. 126 * @returns A new focus object with the specified column. 127 */ 128 setColumn(column) { 129 return new _Focus(this.row, column, this.offset); 130 } 131 /** 132 * Creates a copy of the focus object by setting its offset to the specified value. 133 * 134 * @param offset - Offset in the focused cell. 135 * @returns A new focus object with the specified offset. 136 */ 137 setOffset(offset) { 138 return new _Focus(this.row, this.column, offset); 139 } 140 }; 141 exports.Focus = Focus; 142 } 143 }); 144 145 // node_modules/@tgrosinger/md-advanced-tables/lib/alignment.js 146 var require_alignment = __commonJS({ 147 "node_modules/@tgrosinger/md-advanced-tables/lib/alignment.js"(exports) { 148 "use strict"; 149 Object.defineProperty(exports, "__esModule", { value: true }); 150 exports.HeaderAlignment = exports.DefaultAlignment = exports.Alignment = void 0; 151 var Alignment2; 152 (function(Alignment3) { 153 Alignment3["NONE"] = "none"; 154 Alignment3["LEFT"] = "left"; 155 Alignment3["RIGHT"] = "right"; 156 Alignment3["CENTER"] = "center"; 157 })(Alignment2 || (exports.Alignment = Alignment2 = {})); 158 var DefaultAlignment; 159 (function(DefaultAlignment2) { 160 DefaultAlignment2["LEFT"] = "left"; 161 DefaultAlignment2["RIGHT"] = "right"; 162 DefaultAlignment2["CENTER"] = "center"; 163 })(DefaultAlignment || (exports.DefaultAlignment = DefaultAlignment = {})); 164 var HeaderAlignment; 165 (function(HeaderAlignment2) { 166 HeaderAlignment2["FOLLOW"] = "follow"; 167 HeaderAlignment2["LEFT"] = "left"; 168 HeaderAlignment2["RIGHT"] = "right"; 169 HeaderAlignment2["CENTER"] = "center"; 170 })(HeaderAlignment || (exports.HeaderAlignment = HeaderAlignment = {})); 171 } 172 }); 173 174 // node_modules/@tgrosinger/md-advanced-tables/lib/table-cell.js 175 var require_table_cell = __commonJS({ 176 "node_modules/@tgrosinger/md-advanced-tables/lib/table-cell.js"(exports) { 177 "use strict"; 178 Object.defineProperty(exports, "__esModule", { value: true }); 179 exports.TableCell = void 0; 180 var alignment_1 = require_alignment(); 181 var TableCell = class { 182 /** 183 * Creates a new `TableCell` object. 184 * 185 * @param rawContent - Raw content of the cell. 186 */ 187 constructor(rawContent) { 188 this.rawContent = rawContent; 189 this.content = rawContent.trim(); 190 this.paddingLeft = this.content === "" ? this.rawContent === "" ? 0 : 1 : this.rawContent.length - this.rawContent.trimLeft().length; 191 this.paddingRight = this.rawContent.length - this.content.length - this.paddingLeft; 192 } 193 /** 194 * Convers the cell to a text representation. 195 * 196 * @returns The raw content of the cell. 197 */ 198 toText() { 199 return this.rawContent; 200 } 201 /** 202 * Checks if the cell is a delimiter i.e. it only contains hyphens `-` with optional one 203 * leading and trailing colons `:`. 204 * 205 * @returns `true` if the cell is a delimiter. 206 */ 207 isDelimiter() { 208 return /^\s*:?-+:?\s*$/.test(this.rawContent); 209 } 210 /** 211 * Returns the alignment the cell represents. 212 * 213 * @returns The alignment the cell represents; `undefined` if the cell is not a delimiter. 214 */ 215 getAlignment() { 216 if (!this.isDelimiter()) { 217 return void 0; 218 } 219 if (this.content[0] === ":") { 220 if (this.content[this.content.length - 1] === ":") { 221 return alignment_1.Alignment.CENTER; 222 } 223 return alignment_1.Alignment.LEFT; 224 } 225 if (this.content[this.content.length - 1] === ":") { 226 return alignment_1.Alignment.RIGHT; 227 } 228 return alignment_1.Alignment.NONE; 229 } 230 /** 231 * Computes a relative position in the trimmed content from that in the raw content. 232 * 233 * @param rawOffset - Relative position in the raw content. 234 * @returns - Relative position in the trimmed content. 235 */ 236 computeContentOffset(rawOffset) { 237 if (this.content === "") { 238 return 0; 239 } 240 if (rawOffset < this.paddingLeft) { 241 return 0; 242 } 243 if (rawOffset < this.paddingLeft + this.content.length) { 244 return rawOffset - this.paddingLeft; 245 } 246 return this.content.length; 247 } 248 /** 249 * Computes a relative position in the raw content from that in the trimmed content. 250 * 251 * @param contentOffset - Relative position in the trimmed content. 252 * @returns - Relative position in the raw content. 253 */ 254 computeRawOffset(contentOffset) { 255 return contentOffset + this.paddingLeft; 256 } 257 }; 258 exports.TableCell = TableCell; 259 } 260 }); 261 262 // node_modules/@tgrosinger/md-advanced-tables/lib/table-row.js 263 var require_table_row = __commonJS({ 264 "node_modules/@tgrosinger/md-advanced-tables/lib/table-row.js"(exports) { 265 "use strict"; 266 Object.defineProperty(exports, "__esModule", { value: true }); 267 exports.TableRow = void 0; 268 var table_cell_1 = require_table_cell(); 269 var TableRow = class _TableRow { 270 /** 271 * Creates a new `TableRow` objec. 272 * 273 * @param cells - Cells that the row contains. 274 * @param marginLeft - Margin string at the left of the row. 275 * @param marginRight - Margin string at the right of the row. 276 */ 277 constructor(cells, marginLeft, marginRight) { 278 this._cells = cells.slice(); 279 this.marginLeft = marginLeft; 280 this.marginRight = marginRight; 281 } 282 /** 283 * Gets the number of the cells in the row. 284 */ 285 getWidth() { 286 return this._cells.length; 287 } 288 /** 289 * Returns the cells that the row contains. 290 */ 291 getCells() { 292 return this._cells.slice(); 293 } 294 /** 295 * Gets a cell at the specified index. 296 * 297 * @param index - Index. 298 * @returns The cell at the specified index if exists; `undefined` if no cell is found. 299 */ 300 getCellAt(index) { 301 return this._cells[index]; 302 } 303 /** 304 * Sets a cell in the row to a new value, returning a copy of the row 305 * with the modified value. 306 * 307 * If an invalid index is provided, the row will be unchanged. 308 */ 309 setCellAt(index, value) { 310 const cells = this.getCells(); 311 cells[index] = new table_cell_1.TableCell(value); 312 return new _TableRow(cells, this.marginLeft, this.marginRight); 313 } 314 /** 315 * Convers the row to a text representation. 316 */ 317 toText() { 318 if (this._cells.length === 0) { 319 return this.marginLeft; 320 } 321 const cells = this._cells.map((cell) => cell.toText()).join("|"); 322 return `${this.marginLeft}|${cells}|${this.marginRight}`; 323 } 324 /** 325 * Checks if the row is a delimiter or not. 326 * 327 * @returns `true` if the row is a delimiter i.e. all the cells contained are delimiters. 328 */ 329 isDelimiter() { 330 return this._cells.every((cell) => cell.isDelimiter()); 331 } 332 }; 333 exports.TableRow = TableRow; 334 } 335 }); 336 337 // node_modules/@tgrosinger/md-advanced-tables/lib/neverthrow/neverthrow.js 338 var require_neverthrow = __commonJS({ 339 "node_modules/@tgrosinger/md-advanced-tables/lib/neverthrow/neverthrow.js"(exports) { 340 "use strict"; 341 Object.defineProperty(exports, "__esModule", { value: true }); 342 exports.Err = exports.Ok = exports.err = exports.ok = void 0; 343 var ok = (value) => new Ok(value); 344 exports.ok = ok; 345 var err = (err2) => new Err(err2); 346 exports.err = err; 347 var Ok = class { 348 constructor(value) { 349 this.value = value; 350 this.match = (ok2, _err) => ok2(this.value); 351 } 352 isOk() { 353 return true; 354 } 355 isErr() { 356 return !this.isOk(); 357 } 358 map(f) { 359 return (0, exports.ok)(f(this.value)); 360 } 361 mapErr(_f) { 362 return (0, exports.ok)(this.value); 363 } 364 // add info on how this is really useful for converting a 365 // Result<Result<T, E2>, E1> 366 // into a Result<T, E2> 367 andThen(f) { 368 return f(this.value); 369 } 370 unwrapOr(_v) { 371 return this.value; 372 } 373 _unsafeUnwrap() { 374 return this.value; 375 } 376 _unsafeUnwrapErr() { 377 throw new Error("Called `_unsafeUnwrapErr` on an Ok"); 378 } 379 }; 380 exports.Ok = Ok; 381 var Err = class { 382 constructor(error) { 383 this.error = error; 384 this.match = (_ok, err2) => err2(this.error); 385 } 386 isOk() { 387 return false; 388 } 389 isErr() { 390 return !this.isOk(); 391 } 392 map(_f) { 393 return (0, exports.err)(this.error); 394 } 395 mapErr(f) { 396 return (0, exports.err)(f(this.error)); 397 } 398 andThen(_f) { 399 return (0, exports.err)(this.error); 400 } 401 unwrapOr(v) { 402 return v; 403 } 404 _unsafeUnwrap() { 405 throw new Error("Called `_unsafeUnwrap` on an Err"); 406 } 407 _unsafeUnwrapErr() { 408 return this.error; 409 } 410 }; 411 exports.Err = Err; 412 } 413 }); 414 415 // node_modules/@tgrosinger/md-advanced-tables/lib/calc/ast_utils.js 416 var require_ast_utils = __commonJS({ 417 "node_modules/@tgrosinger/md-advanced-tables/lib/calc/ast_utils.js"(exports) { 418 "use strict"; 419 Object.defineProperty(exports, "__esModule", { value: true }); 420 exports.prettyPrintAST = exports.checkChildLength = exports.checkType = exports.errRelativeReferenceIndex = exports.errIndex0 = void 0; 421 exports.errIndex0 = new Error("Index 0 used to create a reference"); 422 exports.errRelativeReferenceIndex = new Error("Can not use relative reference where absolute reference is required"); 423 var checkType = (ast, ...expectedTypes) => { 424 if (expectedTypes.indexOf(ast.type) >= 0) { 425 return; 426 } 427 return new Error(`Formula element '${ast.text}' is a ${ast.type} but expected one of ${expectedTypes} in this position.`); 428 }; 429 exports.checkType = checkType; 430 var checkChildLength = (ast, len) => { 431 if (ast.children.length === len) { 432 return; 433 } 434 return new Error(`Formula element '${ast.text}' was expected to have ${len} elements, but had ${ast.children.length}`); 435 }; 436 exports.checkChildLength = checkChildLength; 437 var prettyPrintAST = (token, level = 0) => { 438 console.log(" ".repeat(level) + `|-${token.type}${token.children.length === 0 ? "=" + token.text : ""}`); 439 if (token.children) { 440 token.children.forEach((c) => { 441 (0, exports.prettyPrintAST)(c, level + 1); 442 }); 443 } 444 }; 445 exports.prettyPrintAST = prettyPrintAST; 446 } 447 }); 448 449 // node_modules/decimal.js/decimal.js 450 var require_decimal = __commonJS({ 451 "node_modules/decimal.js/decimal.js"(exports, module2) { 452 (function(globalScope) { 453 "use strict"; 454 var EXP_LIMIT = 9e15, MAX_DIGITS = 1e9, NUMERALS = "0123456789abcdef", LN10 = "2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058", PI = "3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789", DEFAULTS = { 455 // These values must be integers within the stated ranges (inclusive). 456 // Most of these values can be changed at run-time using the `Decimal.config` method. 457 // The maximum number of significant digits of the result of a calculation or base conversion. 458 // E.g. `Decimal.config({ precision: 20 });` 459 precision: 20, 460 // 1 to MAX_DIGITS 461 // The rounding mode used when rounding to `precision`. 462 // 463 // ROUND_UP 0 Away from zero. 464 // ROUND_DOWN 1 Towards zero. 465 // ROUND_CEIL 2 Towards +Infinity. 466 // ROUND_FLOOR 3 Towards -Infinity. 467 // ROUND_HALF_UP 4 Towards nearest neighbour. If equidistant, up. 468 // ROUND_HALF_DOWN 5 Towards nearest neighbour. If equidistant, down. 469 // ROUND_HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour. 470 // ROUND_HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity. 471 // ROUND_HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity. 472 // 473 // E.g. 474 // `Decimal.rounding = 4;` 475 // `Decimal.rounding = Decimal.ROUND_HALF_UP;` 476 rounding: 4, 477 // 0 to 8 478 // The modulo mode used when calculating the modulus: a mod n. 479 // The quotient (q = a / n) is calculated according to the corresponding rounding mode. 480 // The remainder (r) is calculated as: r = a - n * q. 481 // 482 // UP 0 The remainder is positive if the dividend is negative, else is negative. 483 // DOWN 1 The remainder has the same sign as the dividend (JavaScript %). 484 // FLOOR 3 The remainder has the same sign as the divisor (Python %). 485 // HALF_EVEN 6 The IEEE 754 remainder function. 486 // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)). Always positive. 487 // 488 // Truncated division (1), floored division (3), the IEEE 754 remainder (6), and Euclidian 489 // division (9) are commonly used for the modulus operation. The other rounding modes can also 490 // be used, but they may not give useful results. 491 modulo: 1, 492 // 0 to 9 493 // The exponent value at and beneath which `toString` returns exponential notation. 494 // JavaScript numbers: -7 495 toExpNeg: -7, 496 // 0 to -EXP_LIMIT 497 // The exponent value at and above which `toString` returns exponential notation. 498 // JavaScript numbers: 21 499 toExpPos: 21, 500 // 0 to EXP_LIMIT 501 // The minimum exponent value, beneath which underflow to zero occurs. 502 // JavaScript numbers: -324 (5e-324) 503 minE: -EXP_LIMIT, 504 // -1 to -EXP_LIMIT 505 // The maximum exponent value, above which overflow to Infinity occurs. 506 // JavaScript numbers: 308 (1.7976931348623157e+308) 507 maxE: EXP_LIMIT, 508 // 1 to EXP_LIMIT 509 // Whether to use cryptographically-secure random number generation, if available. 510 crypto: false 511 // true/false 512 }, Decimal, inexact, noConflict, quadrant, external = true, decimalError = "[DecimalError] ", invalidArgument = decimalError + "Invalid argument: ", precisionLimitExceeded = decimalError + "Precision limit exceeded", cryptoUnavailable = decimalError + "crypto unavailable", tag = "[object Decimal]", mathfloor = Math.floor, mathpow = Math.pow, isBinary = /^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i, isHex = /^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i, isOctal = /^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i, isDecimal = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i, BASE = 1e7, LOG_BASE = 7, MAX_SAFE_INTEGER = 9007199254740991, LN10_PRECISION = LN10.length - 1, PI_PRECISION = PI.length - 1, P = { toStringTag: tag }; 513 P.absoluteValue = P.abs = function() { 514 var x = new this.constructor(this); 515 if (x.s < 0) x.s = 1; 516 return finalise(x); 517 }; 518 P.ceil = function() { 519 return finalise(new this.constructor(this), this.e + 1, 2); 520 }; 521 P.clampedTo = P.clamp = function(min2, max2) { 522 var k, x = this, Ctor = x.constructor; 523 min2 = new Ctor(min2); 524 max2 = new Ctor(max2); 525 if (!min2.s || !max2.s) return new Ctor(NaN); 526 if (min2.gt(max2)) throw Error(invalidArgument + max2); 527 k = x.cmp(min2); 528 return k < 0 ? min2 : x.cmp(max2) > 0 ? max2 : new Ctor(x); 529 }; 530 P.comparedTo = P.cmp = function(y) { 531 var i, j, xdL, ydL, x = this, xd = x.d, yd = (y = new x.constructor(y)).d, xs = x.s, ys = y.s; 532 if (!xd || !yd) { 533 return !xs || !ys ? NaN : xs !== ys ? xs : xd === yd ? 0 : !xd ^ xs < 0 ? 1 : -1; 534 } 535 if (!xd[0] || !yd[0]) return xd[0] ? xs : yd[0] ? -ys : 0; 536 if (xs !== ys) return xs; 537 if (x.e !== y.e) return x.e > y.e ^ xs < 0 ? 1 : -1; 538 xdL = xd.length; 539 ydL = yd.length; 540 for (i = 0, j = xdL < ydL ? xdL : ydL; i < j; ++i) { 541 if (xd[i] !== yd[i]) return xd[i] > yd[i] ^ xs < 0 ? 1 : -1; 542 } 543 return xdL === ydL ? 0 : xdL > ydL ^ xs < 0 ? 1 : -1; 544 }; 545 P.cosine = P.cos = function() { 546 var pr, rm, x = this, Ctor = x.constructor; 547 if (!x.d) return new Ctor(NaN); 548 if (!x.d[0]) return new Ctor(1); 549 pr = Ctor.precision; 550 rm = Ctor.rounding; 551 Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE; 552 Ctor.rounding = 1; 553 x = cosine(Ctor, toLessThanHalfPi(Ctor, x)); 554 Ctor.precision = pr; 555 Ctor.rounding = rm; 556 return finalise(quadrant == 2 || quadrant == 3 ? x.neg() : x, pr, rm, true); 557 }; 558 P.cubeRoot = P.cbrt = function() { 559 var e, m, n, r, rep, s, sd, t, t3, t3plusx, x = this, Ctor = x.constructor; 560 if (!x.isFinite() || x.isZero()) return new Ctor(x); 561 external = false; 562 s = x.s * mathpow(x.s * x, 1 / 3); 563 if (!s || Math.abs(s) == 1 / 0) { 564 n = digitsToString(x.d); 565 e = x.e; 566 if (s = (e - n.length + 1) % 3) n += s == 1 || s == -2 ? "0" : "00"; 567 s = mathpow(n, 1 / 3); 568 e = mathfloor((e + 1) / 3) - (e % 3 == (e < 0 ? -1 : 2)); 569 if (s == 1 / 0) { 570 n = "5e" + e; 571 } else { 572 n = s.toExponential(); 573 n = n.slice(0, n.indexOf("e") + 1) + e; 574 } 575 r = new Ctor(n); 576 r.s = x.s; 577 } else { 578 r = new Ctor(s.toString()); 579 } 580 sd = (e = Ctor.precision) + 3; 581 for (; ; ) { 582 t = r; 583 t3 = t.times(t).times(t); 584 t3plusx = t3.plus(x); 585 r = divide(t3plusx.plus(x).times(t), t3plusx.plus(t3), sd + 2, 1); 586 if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) { 587 n = n.slice(sd - 3, sd + 1); 588 if (n == "9999" || !rep && n == "4999") { 589 if (!rep) { 590 finalise(t, e + 1, 0); 591 if (t.times(t).times(t).eq(x)) { 592 r = t; 593 break; 594 } 595 } 596 sd += 4; 597 rep = 1; 598 } else { 599 if (!+n || !+n.slice(1) && n.charAt(0) == "5") { 600 finalise(r, e + 1, 1); 601 m = !r.times(r).times(r).eq(x); 602 } 603 break; 604 } 605 } 606 } 607 external = true; 608 return finalise(r, e, Ctor.rounding, m); 609 }; 610 P.decimalPlaces = P.dp = function() { 611 var w, d = this.d, n = NaN; 612 if (d) { 613 w = d.length - 1; 614 n = (w - mathfloor(this.e / LOG_BASE)) * LOG_BASE; 615 w = d[w]; 616 if (w) for (; w % 10 == 0; w /= 10) n--; 617 if (n < 0) n = 0; 618 } 619 return n; 620 }; 621 P.dividedBy = P.div = function(y) { 622 return divide(this, new this.constructor(y)); 623 }; 624 P.dividedToIntegerBy = P.divToInt = function(y) { 625 var x = this, Ctor = x.constructor; 626 return finalise(divide(x, new Ctor(y), 0, 1, 1), Ctor.precision, Ctor.rounding); 627 }; 628 P.equals = P.eq = function(y) { 629 return this.cmp(y) === 0; 630 }; 631 P.floor = function() { 632 return finalise(new this.constructor(this), this.e + 1, 3); 633 }; 634 P.greaterThan = P.gt = function(y) { 635 return this.cmp(y) > 0; 636 }; 637 P.greaterThanOrEqualTo = P.gte = function(y) { 638 var k = this.cmp(y); 639 return k == 1 || k === 0; 640 }; 641 P.hyperbolicCosine = P.cosh = function() { 642 var k, n, pr, rm, len, x = this, Ctor = x.constructor, one = new Ctor(1); 643 if (!x.isFinite()) return new Ctor(x.s ? 1 / 0 : NaN); 644 if (x.isZero()) return one; 645 pr = Ctor.precision; 646 rm = Ctor.rounding; 647 Ctor.precision = pr + Math.max(x.e, x.sd()) + 4; 648 Ctor.rounding = 1; 649 len = x.d.length; 650 if (len < 32) { 651 k = Math.ceil(len / 3); 652 n = (1 / tinyPow(4, k)).toString(); 653 } else { 654 k = 16; 655 n = "2.3283064365386962890625e-10"; 656 } 657 x = taylorSeries(Ctor, 1, x.times(n), new Ctor(1), true); 658 var cosh2_x, i = k, d8 = new Ctor(8); 659 for (; i--; ) { 660 cosh2_x = x.times(x); 661 x = one.minus(cosh2_x.times(d8.minus(cosh2_x.times(d8)))); 662 } 663 return finalise(x, Ctor.precision = pr, Ctor.rounding = rm, true); 664 }; 665 P.hyperbolicSine = P.sinh = function() { 666 var k, pr, rm, len, x = this, Ctor = x.constructor; 667 if (!x.isFinite() || x.isZero()) return new Ctor(x); 668 pr = Ctor.precision; 669 rm = Ctor.rounding; 670 Ctor.precision = pr + Math.max(x.e, x.sd()) + 4; 671 Ctor.rounding = 1; 672 len = x.d.length; 673 if (len < 3) { 674 x = taylorSeries(Ctor, 2, x, x, true); 675 } else { 676 k = 1.4 * Math.sqrt(len); 677 k = k > 16 ? 16 : k | 0; 678 x = x.times(1 / tinyPow(5, k)); 679 x = taylorSeries(Ctor, 2, x, x, true); 680 var sinh2_x, d5 = new Ctor(5), d16 = new Ctor(16), d20 = new Ctor(20); 681 for (; k--; ) { 682 sinh2_x = x.times(x); 683 x = x.times(d5.plus(sinh2_x.times(d16.times(sinh2_x).plus(d20)))); 684 } 685 } 686 Ctor.precision = pr; 687 Ctor.rounding = rm; 688 return finalise(x, pr, rm, true); 689 }; 690 P.hyperbolicTangent = P.tanh = function() { 691 var pr, rm, x = this, Ctor = x.constructor; 692 if (!x.isFinite()) return new Ctor(x.s); 693 if (x.isZero()) return new Ctor(x); 694 pr = Ctor.precision; 695 rm = Ctor.rounding; 696 Ctor.precision = pr + 7; 697 Ctor.rounding = 1; 698 return divide(x.sinh(), x.cosh(), Ctor.precision = pr, Ctor.rounding = rm); 699 }; 700 P.inverseCosine = P.acos = function() { 701 var halfPi, x = this, Ctor = x.constructor, k = x.abs().cmp(1), pr = Ctor.precision, rm = Ctor.rounding; 702 if (k !== -1) { 703 return k === 0 ? x.isNeg() ? getPi(Ctor, pr, rm) : new Ctor(0) : new Ctor(NaN); 704 } 705 if (x.isZero()) return getPi(Ctor, pr + 4, rm).times(0.5); 706 Ctor.precision = pr + 6; 707 Ctor.rounding = 1; 708 x = x.asin(); 709 halfPi = getPi(Ctor, pr + 4, rm).times(0.5); 710 Ctor.precision = pr; 711 Ctor.rounding = rm; 712 return halfPi.minus(x); 713 }; 714 P.inverseHyperbolicCosine = P.acosh = function() { 715 var pr, rm, x = this, Ctor = x.constructor; 716 if (x.lte(1)) return new Ctor(x.eq(1) ? 0 : NaN); 717 if (!x.isFinite()) return new Ctor(x); 718 pr = Ctor.precision; 719 rm = Ctor.rounding; 720 Ctor.precision = pr + Math.max(Math.abs(x.e), x.sd()) + 4; 721 Ctor.rounding = 1; 722 external = false; 723 x = x.times(x).minus(1).sqrt().plus(x); 724 external = true; 725 Ctor.precision = pr; 726 Ctor.rounding = rm; 727 return x.ln(); 728 }; 729 P.inverseHyperbolicSine = P.asinh = function() { 730 var pr, rm, x = this, Ctor = x.constructor; 731 if (!x.isFinite() || x.isZero()) return new Ctor(x); 732 pr = Ctor.precision; 733 rm = Ctor.rounding; 734 Ctor.precision = pr + 2 * Math.max(Math.abs(x.e), x.sd()) + 6; 735 Ctor.rounding = 1; 736 external = false; 737 x = x.times(x).plus(1).sqrt().plus(x); 738 external = true; 739 Ctor.precision = pr; 740 Ctor.rounding = rm; 741 return x.ln(); 742 }; 743 P.inverseHyperbolicTangent = P.atanh = function() { 744 var pr, rm, wpr, xsd, x = this, Ctor = x.constructor; 745 if (!x.isFinite()) return new Ctor(NaN); 746 if (x.e >= 0) return new Ctor(x.abs().eq(1) ? x.s / 0 : x.isZero() ? x : NaN); 747 pr = Ctor.precision; 748 rm = Ctor.rounding; 749 xsd = x.sd(); 750 if (Math.max(xsd, pr) < 2 * -x.e - 1) return finalise(new Ctor(x), pr, rm, true); 751 Ctor.precision = wpr = xsd - x.e; 752 x = divide(x.plus(1), new Ctor(1).minus(x), wpr + pr, 1); 753 Ctor.precision = pr + 4; 754 Ctor.rounding = 1; 755 x = x.ln(); 756 Ctor.precision = pr; 757 Ctor.rounding = rm; 758 return x.times(0.5); 759 }; 760 P.inverseSine = P.asin = function() { 761 var halfPi, k, pr, rm, x = this, Ctor = x.constructor; 762 if (x.isZero()) return new Ctor(x); 763 k = x.abs().cmp(1); 764 pr = Ctor.precision; 765 rm = Ctor.rounding; 766 if (k !== -1) { 767 if (k === 0) { 768 halfPi = getPi(Ctor, pr + 4, rm).times(0.5); 769 halfPi.s = x.s; 770 return halfPi; 771 } 772 return new Ctor(NaN); 773 } 774 Ctor.precision = pr + 6; 775 Ctor.rounding = 1; 776 x = x.div(new Ctor(1).minus(x.times(x)).sqrt().plus(1)).atan(); 777 Ctor.precision = pr; 778 Ctor.rounding = rm; 779 return x.times(2); 780 }; 781 P.inverseTangent = P.atan = function() { 782 var i, j, k, n, px, t, r, wpr, x2, x = this, Ctor = x.constructor, pr = Ctor.precision, rm = Ctor.rounding; 783 if (!x.isFinite()) { 784 if (!x.s) return new Ctor(NaN); 785 if (pr + 4 <= PI_PRECISION) { 786 r = getPi(Ctor, pr + 4, rm).times(0.5); 787 r.s = x.s; 788 return r; 789 } 790 } else if (x.isZero()) { 791 return new Ctor(x); 792 } else if (x.abs().eq(1) && pr + 4 <= PI_PRECISION) { 793 r = getPi(Ctor, pr + 4, rm).times(0.25); 794 r.s = x.s; 795 return r; 796 } 797 Ctor.precision = wpr = pr + 10; 798 Ctor.rounding = 1; 799 k = Math.min(28, wpr / LOG_BASE + 2 | 0); 800 for (i = k; i; --i) x = x.div(x.times(x).plus(1).sqrt().plus(1)); 801 external = false; 802 j = Math.ceil(wpr / LOG_BASE); 803 n = 1; 804 x2 = x.times(x); 805 r = new Ctor(x); 806 px = x; 807 for (; i !== -1; ) { 808 px = px.times(x2); 809 t = r.minus(px.div(n += 2)); 810 px = px.times(x2); 811 r = t.plus(px.div(n += 2)); 812 if (r.d[j] !== void 0) for (i = j; r.d[i] === t.d[i] && i--; ) ; 813 } 814 if (k) r = r.times(2 << k - 1); 815 external = true; 816 return finalise(r, Ctor.precision = pr, Ctor.rounding = rm, true); 817 }; 818 P.isFinite = function() { 819 return !!this.d; 820 }; 821 P.isInteger = P.isInt = function() { 822 return !!this.d && mathfloor(this.e / LOG_BASE) > this.d.length - 2; 823 }; 824 P.isNaN = function() { 825 return !this.s; 826 }; 827 P.isNegative = P.isNeg = function() { 828 return this.s < 0; 829 }; 830 P.isPositive = P.isPos = function() { 831 return this.s > 0; 832 }; 833 P.isZero = function() { 834 return !!this.d && this.d[0] === 0; 835 }; 836 P.lessThan = P.lt = function(y) { 837 return this.cmp(y) < 0; 838 }; 839 P.lessThanOrEqualTo = P.lte = function(y) { 840 return this.cmp(y) < 1; 841 }; 842 P.logarithm = P.log = function(base) { 843 var isBase10, d, denominator, k, inf, num, sd, r, arg = this, Ctor = arg.constructor, pr = Ctor.precision, rm = Ctor.rounding, guard = 5; 844 if (base == null) { 845 base = new Ctor(10); 846 isBase10 = true; 847 } else { 848 base = new Ctor(base); 849 d = base.d; 850 if (base.s < 0 || !d || !d[0] || base.eq(1)) return new Ctor(NaN); 851 isBase10 = base.eq(10); 852 } 853 d = arg.d; 854 if (arg.s < 0 || !d || !d[0] || arg.eq(1)) { 855 return new Ctor(d && !d[0] ? -1 / 0 : arg.s != 1 ? NaN : d ? 0 : 1 / 0); 856 } 857 if (isBase10) { 858 if (d.length > 1) { 859 inf = true; 860 } else { 861 for (k = d[0]; k % 10 === 0; ) k /= 10; 862 inf = k !== 1; 863 } 864 } 865 external = false; 866 sd = pr + guard; 867 num = naturalLogarithm(arg, sd); 868 denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd); 869 r = divide(num, denominator, sd, 1); 870 if (checkRoundingDigits(r.d, k = pr, rm)) { 871 do { 872 sd += 10; 873 num = naturalLogarithm(arg, sd); 874 denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd); 875 r = divide(num, denominator, sd, 1); 876 if (!inf) { 877 if (+digitsToString(r.d).slice(k + 1, k + 15) + 1 == 1e14) { 878 r = finalise(r, pr + 1, 0); 879 } 880 break; 881 } 882 } while (checkRoundingDigits(r.d, k += 10, rm)); 883 } 884 external = true; 885 return finalise(r, pr, rm); 886 }; 887 P.minus = P.sub = function(y) { 888 var d, e, i, j, k, len, pr, rm, xd, xe, xLTy, yd, x = this, Ctor = x.constructor; 889 y = new Ctor(y); 890 if (!x.d || !y.d) { 891 if (!x.s || !y.s) y = new Ctor(NaN); 892 else if (x.d) y.s = -y.s; 893 else y = new Ctor(y.d || x.s !== y.s ? x : NaN); 894 return y; 895 } 896 if (x.s != y.s) { 897 y.s = -y.s; 898 return x.plus(y); 899 } 900 xd = x.d; 901 yd = y.d; 902 pr = Ctor.precision; 903 rm = Ctor.rounding; 904 if (!xd[0] || !yd[0]) { 905 if (yd[0]) y.s = -y.s; 906 else if (xd[0]) y = new Ctor(x); 907 else return new Ctor(rm === 3 ? -0 : 0); 908 return external ? finalise(y, pr, rm) : y; 909 } 910 e = mathfloor(y.e / LOG_BASE); 911 xe = mathfloor(x.e / LOG_BASE); 912 xd = xd.slice(); 913 k = xe - e; 914 if (k) { 915 xLTy = k < 0; 916 if (xLTy) { 917 d = xd; 918 k = -k; 919 len = yd.length; 920 } else { 921 d = yd; 922 e = xe; 923 len = xd.length; 924 } 925 i = Math.max(Math.ceil(pr / LOG_BASE), len) + 2; 926 if (k > i) { 927 k = i; 928 d.length = 1; 929 } 930 d.reverse(); 931 for (i = k; i--; ) d.push(0); 932 d.reverse(); 933 } else { 934 i = xd.length; 935 len = yd.length; 936 xLTy = i < len; 937 if (xLTy) len = i; 938 for (i = 0; i < len; i++) { 939 if (xd[i] != yd[i]) { 940 xLTy = xd[i] < yd[i]; 941 break; 942 } 943 } 944 k = 0; 945 } 946 if (xLTy) { 947 d = xd; 948 xd = yd; 949 yd = d; 950 y.s = -y.s; 951 } 952 len = xd.length; 953 for (i = yd.length - len; i > 0; --i) xd[len++] = 0; 954 for (i = yd.length; i > k; ) { 955 if (xd[--i] < yd[i]) { 956 for (j = i; j && xd[--j] === 0; ) xd[j] = BASE - 1; 957 --xd[j]; 958 xd[i] += BASE; 959 } 960 xd[i] -= yd[i]; 961 } 962 for (; xd[--len] === 0; ) xd.pop(); 963 for (; xd[0] === 0; xd.shift()) --e; 964 if (!xd[0]) return new Ctor(rm === 3 ? -0 : 0); 965 y.d = xd; 966 y.e = getBase10Exponent(xd, e); 967 return external ? finalise(y, pr, rm) : y; 968 }; 969 P.modulo = P.mod = function(y) { 970 var q, x = this, Ctor = x.constructor; 971 y = new Ctor(y); 972 if (!x.d || !y.s || y.d && !y.d[0]) return new Ctor(NaN); 973 if (!y.d || x.d && !x.d[0]) { 974 return finalise(new Ctor(x), Ctor.precision, Ctor.rounding); 975 } 976 external = false; 977 if (Ctor.modulo == 9) { 978 q = divide(x, y.abs(), 0, 3, 1); 979 q.s *= y.s; 980 } else { 981 q = divide(x, y, 0, Ctor.modulo, 1); 982 } 983 q = q.times(y); 984 external = true; 985 return x.minus(q); 986 }; 987 P.naturalExponential = P.exp = function() { 988 return naturalExponential(this); 989 }; 990 P.naturalLogarithm = P.ln = function() { 991 return naturalLogarithm(this); 992 }; 993 P.negated = P.neg = function() { 994 var x = new this.constructor(this); 995 x.s = -x.s; 996 return finalise(x); 997 }; 998 P.plus = P.add = function(y) { 999 var carry, d, e, i, k, len, pr, rm, xd, yd, x = this, Ctor = x.constructor; 1000 y = new Ctor(y); 1001 if (!x.d || !y.d) { 1002 if (!x.s || !y.s) y = new Ctor(NaN); 1003 else if (!x.d) y = new Ctor(y.d || x.s === y.s ? x : NaN); 1004 return y; 1005 } 1006 if (x.s != y.s) { 1007 y.s = -y.s; 1008 return x.minus(y); 1009 } 1010 xd = x.d; 1011 yd = y.d; 1012 pr = Ctor.precision; 1013 rm = Ctor.rounding; 1014 if (!xd[0] || !yd[0]) { 1015 if (!yd[0]) y = new Ctor(x); 1016 return external ? finalise(y, pr, rm) : y; 1017 } 1018 k = mathfloor(x.e / LOG_BASE); 1019 e = mathfloor(y.e / LOG_BASE); 1020 xd = xd.slice(); 1021 i = k - e; 1022 if (i) { 1023 if (i < 0) { 1024 d = xd; 1025 i = -i; 1026 len = yd.length; 1027 } else { 1028 d = yd; 1029 e = k; 1030 len = xd.length; 1031 } 1032 k = Math.ceil(pr / LOG_BASE); 1033 len = k > len ? k + 1 : len + 1; 1034 if (i > len) { 1035 i = len; 1036 d.length = 1; 1037 } 1038 d.reverse(); 1039 for (; i--; ) d.push(0); 1040 d.reverse(); 1041 } 1042 len = xd.length; 1043 i = yd.length; 1044 if (len - i < 0) { 1045 i = len; 1046 d = yd; 1047 yd = xd; 1048 xd = d; 1049 } 1050 for (carry = 0; i; ) { 1051 carry = (xd[--i] = xd[i] + yd[i] + carry) / BASE | 0; 1052 xd[i] %= BASE; 1053 } 1054 if (carry) { 1055 xd.unshift(carry); 1056 ++e; 1057 } 1058 for (len = xd.length; xd[--len] == 0; ) xd.pop(); 1059 y.d = xd; 1060 y.e = getBase10Exponent(xd, e); 1061 return external ? finalise(y, pr, rm) : y; 1062 }; 1063 P.precision = P.sd = function(z) { 1064 var k, x = this; 1065 if (z !== void 0 && z !== !!z && z !== 1 && z !== 0) throw Error(invalidArgument + z); 1066 if (x.d) { 1067 k = getPrecision(x.d); 1068 if (z && x.e + 1 > k) k = x.e + 1; 1069 } else { 1070 k = NaN; 1071 } 1072 return k; 1073 }; 1074 P.round = function() { 1075 var x = this, Ctor = x.constructor; 1076 return finalise(new Ctor(x), x.e + 1, Ctor.rounding); 1077 }; 1078 P.sine = P.sin = function() { 1079 var pr, rm, x = this, Ctor = x.constructor; 1080 if (!x.isFinite()) return new Ctor(NaN); 1081 if (x.isZero()) return new Ctor(x); 1082 pr = Ctor.precision; 1083 rm = Ctor.rounding; 1084 Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE; 1085 Ctor.rounding = 1; 1086 x = sine(Ctor, toLessThanHalfPi(Ctor, x)); 1087 Ctor.precision = pr; 1088 Ctor.rounding = rm; 1089 return finalise(quadrant > 2 ? x.neg() : x, pr, rm, true); 1090 }; 1091 P.squareRoot = P.sqrt = function() { 1092 var m, n, sd, r, rep, t, x = this, d = x.d, e = x.e, s = x.s, Ctor = x.constructor; 1093 if (s !== 1 || !d || !d[0]) { 1094 return new Ctor(!s || s < 0 && (!d || d[0]) ? NaN : d ? x : 1 / 0); 1095 } 1096 external = false; 1097 s = Math.sqrt(+x); 1098 if (s == 0 || s == 1 / 0) { 1099 n = digitsToString(d); 1100 if ((n.length + e) % 2 == 0) n += "0"; 1101 s = Math.sqrt(n); 1102 e = mathfloor((e + 1) / 2) - (e < 0 || e % 2); 1103 if (s == 1 / 0) { 1104 n = "5e" + e; 1105 } else { 1106 n = s.toExponential(); 1107 n = n.slice(0, n.indexOf("e") + 1) + e; 1108 } 1109 r = new Ctor(n); 1110 } else { 1111 r = new Ctor(s.toString()); 1112 } 1113 sd = (e = Ctor.precision) + 3; 1114 for (; ; ) { 1115 t = r; 1116 r = t.plus(divide(x, t, sd + 2, 1)).times(0.5); 1117 if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) { 1118 n = n.slice(sd - 3, sd + 1); 1119 if (n == "9999" || !rep && n == "4999") { 1120 if (!rep) { 1121 finalise(t, e + 1, 0); 1122 if (t.times(t).eq(x)) { 1123 r = t; 1124 break; 1125 } 1126 } 1127 sd += 4; 1128 rep = 1; 1129 } else { 1130 if (!+n || !+n.slice(1) && n.charAt(0) == "5") { 1131 finalise(r, e + 1, 1); 1132 m = !r.times(r).eq(x); 1133 } 1134 break; 1135 } 1136 } 1137 } 1138 external = true; 1139 return finalise(r, e, Ctor.rounding, m); 1140 }; 1141 P.tangent = P.tan = function() { 1142 var pr, rm, x = this, Ctor = x.constructor; 1143 if (!x.isFinite()) return new Ctor(NaN); 1144 if (x.isZero()) return new Ctor(x); 1145 pr = Ctor.precision; 1146 rm = Ctor.rounding; 1147 Ctor.precision = pr + 10; 1148 Ctor.rounding = 1; 1149 x = x.sin(); 1150 x.s = 1; 1151 x = divide(x, new Ctor(1).minus(x.times(x)).sqrt(), pr + 10, 0); 1152 Ctor.precision = pr; 1153 Ctor.rounding = rm; 1154 return finalise(quadrant == 2 || quadrant == 4 ? x.neg() : x, pr, rm, true); 1155 }; 1156 P.times = P.mul = function(y) { 1157 var carry, e, i, k, r, rL, t, xdL, ydL, x = this, Ctor = x.constructor, xd = x.d, yd = (y = new Ctor(y)).d; 1158 y.s *= x.s; 1159 if (!xd || !xd[0] || !yd || !yd[0]) { 1160 return new Ctor(!y.s || xd && !xd[0] && !yd || yd && !yd[0] && !xd ? NaN : !xd || !yd ? y.s / 0 : y.s * 0); 1161 } 1162 e = mathfloor(x.e / LOG_BASE) + mathfloor(y.e / LOG_BASE); 1163 xdL = xd.length; 1164 ydL = yd.length; 1165 if (xdL < ydL) { 1166 r = xd; 1167 xd = yd; 1168 yd = r; 1169 rL = xdL; 1170 xdL = ydL; 1171 ydL = rL; 1172 } 1173 r = []; 1174 rL = xdL + ydL; 1175 for (i = rL; i--; ) r.push(0); 1176 for (i = ydL; --i >= 0; ) { 1177 carry = 0; 1178 for (k = xdL + i; k > i; ) { 1179 t = r[k] + yd[i] * xd[k - i - 1] + carry; 1180 r[k--] = t % BASE | 0; 1181 carry = t / BASE | 0; 1182 } 1183 r[k] = (r[k] + carry) % BASE | 0; 1184 } 1185 for (; !r[--rL]; ) r.pop(); 1186 if (carry) ++e; 1187 else r.shift(); 1188 y.d = r; 1189 y.e = getBase10Exponent(r, e); 1190 return external ? finalise(y, Ctor.precision, Ctor.rounding) : y; 1191 }; 1192 P.toBinary = function(sd, rm) { 1193 return toStringBinary(this, 2, sd, rm); 1194 }; 1195 P.toDecimalPlaces = P.toDP = function(dp, rm) { 1196 var x = this, Ctor = x.constructor; 1197 x = new Ctor(x); 1198 if (dp === void 0) return x; 1199 checkInt32(dp, 0, MAX_DIGITS); 1200 if (rm === void 0) rm = Ctor.rounding; 1201 else checkInt32(rm, 0, 8); 1202 return finalise(x, dp + x.e + 1, rm); 1203 }; 1204 P.toExponential = function(dp, rm) { 1205 var str, x = this, Ctor = x.constructor; 1206 if (dp === void 0) { 1207 str = finiteToString(x, true); 1208 } else { 1209 checkInt32(dp, 0, MAX_DIGITS); 1210 if (rm === void 0) rm = Ctor.rounding; 1211 else checkInt32(rm, 0, 8); 1212 x = finalise(new Ctor(x), dp + 1, rm); 1213 str = finiteToString(x, true, dp + 1); 1214 } 1215 return x.isNeg() && !x.isZero() ? "-" + str : str; 1216 }; 1217 P.toFixed = function(dp, rm) { 1218 var str, y, x = this, Ctor = x.constructor; 1219 if (dp === void 0) { 1220 str = finiteToString(x); 1221 } else { 1222 checkInt32(dp, 0, MAX_DIGITS); 1223 if (rm === void 0) rm = Ctor.rounding; 1224 else checkInt32(rm, 0, 8); 1225 y = finalise(new Ctor(x), dp + x.e + 1, rm); 1226 str = finiteToString(y, false, dp + y.e + 1); 1227 } 1228 return x.isNeg() && !x.isZero() ? "-" + str : str; 1229 }; 1230 P.toFraction = function(maxD) { 1231 var d, d0, d1, d2, e, k, n, n0, n1, pr, q, r, x = this, xd = x.d, Ctor = x.constructor; 1232 if (!xd) return new Ctor(x); 1233 n1 = d0 = new Ctor(1); 1234 d1 = n0 = new Ctor(0); 1235 d = new Ctor(d1); 1236 e = d.e = getPrecision(xd) - x.e - 1; 1237 k = e % LOG_BASE; 1238 d.d[0] = mathpow(10, k < 0 ? LOG_BASE + k : k); 1239 if (maxD == null) { 1240 maxD = e > 0 ? d : n1; 1241 } else { 1242 n = new Ctor(maxD); 1243 if (!n.isInt() || n.lt(n1)) throw Error(invalidArgument + n); 1244 maxD = n.gt(d) ? e > 0 ? d : n1 : n; 1245 } 1246 external = false; 1247 n = new Ctor(digitsToString(xd)); 1248 pr = Ctor.precision; 1249 Ctor.precision = e = xd.length * LOG_BASE * 2; 1250 for (; ; ) { 1251 q = divide(n, d, 0, 1, 1); 1252 d2 = d0.plus(q.times(d1)); 1253 if (d2.cmp(maxD) == 1) break; 1254 d0 = d1; 1255 d1 = d2; 1256 d2 = n1; 1257 n1 = n0.plus(q.times(d2)); 1258 n0 = d2; 1259 d2 = d; 1260 d = n.minus(q.times(d2)); 1261 n = d2; 1262 } 1263 d2 = divide(maxD.minus(d0), d1, 0, 1, 1); 1264 n0 = n0.plus(d2.times(n1)); 1265 d0 = d0.plus(d2.times(d1)); 1266 n0.s = n1.s = x.s; 1267 r = divide(n1, d1, e, 1).minus(x).abs().cmp(divide(n0, d0, e, 1).minus(x).abs()) < 1 ? [n1, d1] : [n0, d0]; 1268 Ctor.precision = pr; 1269 external = true; 1270 return r; 1271 }; 1272 P.toHexadecimal = P.toHex = function(sd, rm) { 1273 return toStringBinary(this, 16, sd, rm); 1274 }; 1275 P.toNearest = function(y, rm) { 1276 var x = this, Ctor = x.constructor; 1277 x = new Ctor(x); 1278 if (y == null) { 1279 if (!x.d) return x; 1280 y = new Ctor(1); 1281 rm = Ctor.rounding; 1282 } else { 1283 y = new Ctor(y); 1284 if (rm === void 0) { 1285 rm = Ctor.rounding; 1286 } else { 1287 checkInt32(rm, 0, 8); 1288 } 1289 if (!x.d) return y.s ? x : y; 1290 if (!y.d) { 1291 if (y.s) y.s = x.s; 1292 return y; 1293 } 1294 } 1295 if (y.d[0]) { 1296 external = false; 1297 x = divide(x, y, 0, rm, 1).times(y); 1298 external = true; 1299 finalise(x); 1300 } else { 1301 y.s = x.s; 1302 x = y; 1303 } 1304 return x; 1305 }; 1306 P.toNumber = function() { 1307 return +this; 1308 }; 1309 P.toOctal = function(sd, rm) { 1310 return toStringBinary(this, 8, sd, rm); 1311 }; 1312 P.toPower = P.pow = function(y) { 1313 var e, k, pr, r, rm, s, x = this, Ctor = x.constructor, yn = +(y = new Ctor(y)); 1314 if (!x.d || !y.d || !x.d[0] || !y.d[0]) return new Ctor(mathpow(+x, yn)); 1315 x = new Ctor(x); 1316 if (x.eq(1)) return x; 1317 pr = Ctor.precision; 1318 rm = Ctor.rounding; 1319 if (y.eq(1)) return finalise(x, pr, rm); 1320 e = mathfloor(y.e / LOG_BASE); 1321 if (e >= y.d.length - 1 && (k = yn < 0 ? -yn : yn) <= MAX_SAFE_INTEGER) { 1322 r = intPow(Ctor, x, k, pr); 1323 return y.s < 0 ? new Ctor(1).div(r) : finalise(r, pr, rm); 1324 } 1325 s = x.s; 1326 if (s < 0) { 1327 if (e < y.d.length - 1) return new Ctor(NaN); 1328 if ((y.d[e] & 1) == 0) s = 1; 1329 if (x.e == 0 && x.d[0] == 1 && x.d.length == 1) { 1330 x.s = s; 1331 return x; 1332 } 1333 } 1334 k = mathpow(+x, yn); 1335 e = k == 0 || !isFinite(k) ? mathfloor(yn * (Math.log("0." + digitsToString(x.d)) / Math.LN10 + x.e + 1)) : new Ctor(k + "").e; 1336 if (e > Ctor.maxE + 1 || e < Ctor.minE - 1) return new Ctor(e > 0 ? s / 0 : 0); 1337 external = false; 1338 Ctor.rounding = x.s = 1; 1339 k = Math.min(12, (e + "").length); 1340 r = naturalExponential(y.times(naturalLogarithm(x, pr + k)), pr); 1341 if (r.d) { 1342 r = finalise(r, pr + 5, 1); 1343 if (checkRoundingDigits(r.d, pr, rm)) { 1344 e = pr + 10; 1345 r = finalise(naturalExponential(y.times(naturalLogarithm(x, e + k)), e), e + 5, 1); 1346 if (+digitsToString(r.d).slice(pr + 1, pr + 15) + 1 == 1e14) { 1347 r = finalise(r, pr + 1, 0); 1348 } 1349 } 1350 } 1351 r.s = s; 1352 external = true; 1353 Ctor.rounding = rm; 1354 return finalise(r, pr, rm); 1355 }; 1356 P.toPrecision = function(sd, rm) { 1357 var str, x = this, Ctor = x.constructor; 1358 if (sd === void 0) { 1359 str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos); 1360 } else { 1361 checkInt32(sd, 1, MAX_DIGITS); 1362 if (rm === void 0) rm = Ctor.rounding; 1363 else checkInt32(rm, 0, 8); 1364 x = finalise(new Ctor(x), sd, rm); 1365 str = finiteToString(x, sd <= x.e || x.e <= Ctor.toExpNeg, sd); 1366 } 1367 return x.isNeg() && !x.isZero() ? "-" + str : str; 1368 }; 1369 P.toSignificantDigits = P.toSD = function(sd, rm) { 1370 var x = this, Ctor = x.constructor; 1371 if (sd === void 0) { 1372 sd = Ctor.precision; 1373 rm = Ctor.rounding; 1374 } else { 1375 checkInt32(sd, 1, MAX_DIGITS); 1376 if (rm === void 0) rm = Ctor.rounding; 1377 else checkInt32(rm, 0, 8); 1378 } 1379 return finalise(new Ctor(x), sd, rm); 1380 }; 1381 P.toString = function() { 1382 var x = this, Ctor = x.constructor, str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos); 1383 return x.isNeg() && !x.isZero() ? "-" + str : str; 1384 }; 1385 P.truncated = P.trunc = function() { 1386 return finalise(new this.constructor(this), this.e + 1, 1); 1387 }; 1388 P.valueOf = P.toJSON = function() { 1389 var x = this, Ctor = x.constructor, str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos); 1390 return x.isNeg() ? "-" + str : str; 1391 }; 1392 function digitsToString(d) { 1393 var i, k, ws, indexOfLastWord = d.length - 1, str = "", w = d[0]; 1394 if (indexOfLastWord > 0) { 1395 str += w; 1396 for (i = 1; i < indexOfLastWord; i++) { 1397 ws = d[i] + ""; 1398 k = LOG_BASE - ws.length; 1399 if (k) str += getZeroString(k); 1400 str += ws; 1401 } 1402 w = d[i]; 1403 ws = w + ""; 1404 k = LOG_BASE - ws.length; 1405 if (k) str += getZeroString(k); 1406 } else if (w === 0) { 1407 return "0"; 1408 } 1409 for (; w % 10 === 0; ) w /= 10; 1410 return str + w; 1411 } 1412 function checkInt32(i, min2, max2) { 1413 if (i !== ~~i || i < min2 || i > max2) { 1414 throw Error(invalidArgument + i); 1415 } 1416 } 1417 function checkRoundingDigits(d, i, rm, repeating) { 1418 var di, k, r, rd; 1419 for (k = d[0]; k >= 10; k /= 10) --i; 1420 if (--i < 0) { 1421 i += LOG_BASE; 1422 di = 0; 1423 } else { 1424 di = Math.ceil((i + 1) / LOG_BASE); 1425 i %= LOG_BASE; 1426 } 1427 k = mathpow(10, LOG_BASE - i); 1428 rd = d[di] % k | 0; 1429 if (repeating == null) { 1430 if (i < 3) { 1431 if (i == 0) rd = rd / 100 | 0; 1432 else if (i == 1) rd = rd / 10 | 0; 1433 r = rm < 4 && rd == 99999 || rm > 3 && rd == 49999 || rd == 5e4 || rd == 0; 1434 } else { 1435 r = (rm < 4 && rd + 1 == k || rm > 3 && rd + 1 == k / 2) && (d[di + 1] / k / 100 | 0) == mathpow(10, i - 2) - 1 || (rd == k / 2 || rd == 0) && (d[di + 1] / k / 100 | 0) == 0; 1436 } 1437 } else { 1438 if (i < 4) { 1439 if (i == 0) rd = rd / 1e3 | 0; 1440 else if (i == 1) rd = rd / 100 | 0; 1441 else if (i == 2) rd = rd / 10 | 0; 1442 r = (repeating || rm < 4) && rd == 9999 || !repeating && rm > 3 && rd == 4999; 1443 } else { 1444 r = ((repeating || rm < 4) && rd + 1 == k || !repeating && rm > 3 && rd + 1 == k / 2) && (d[di + 1] / k / 1e3 | 0) == mathpow(10, i - 3) - 1; 1445 } 1446 } 1447 return r; 1448 } 1449 function convertBase(str, baseIn, baseOut) { 1450 var j, arr = [0], arrL, i = 0, strL = str.length; 1451 for (; i < strL; ) { 1452 for (arrL = arr.length; arrL--; ) arr[arrL] *= baseIn; 1453 arr[0] += NUMERALS.indexOf(str.charAt(i++)); 1454 for (j = 0; j < arr.length; j++) { 1455 if (arr[j] > baseOut - 1) { 1456 if (arr[j + 1] === void 0) arr[j + 1] = 0; 1457 arr[j + 1] += arr[j] / baseOut | 0; 1458 arr[j] %= baseOut; 1459 } 1460 } 1461 } 1462 return arr.reverse(); 1463 } 1464 function cosine(Ctor, x) { 1465 var k, len, y; 1466 if (x.isZero()) return x; 1467 len = x.d.length; 1468 if (len < 32) { 1469 k = Math.ceil(len / 3); 1470 y = (1 / tinyPow(4, k)).toString(); 1471 } else { 1472 k = 16; 1473 y = "2.3283064365386962890625e-10"; 1474 } 1475 Ctor.precision += k; 1476 x = taylorSeries(Ctor, 1, x.times(y), new Ctor(1)); 1477 for (var i = k; i--; ) { 1478 var cos2x = x.times(x); 1479 x = cos2x.times(cos2x).minus(cos2x).times(8).plus(1); 1480 } 1481 Ctor.precision -= k; 1482 return x; 1483 } 1484 var divide = /* @__PURE__ */ function() { 1485 function multiplyInteger(x, k, base) { 1486 var temp, carry = 0, i = x.length; 1487 for (x = x.slice(); i--; ) { 1488 temp = x[i] * k + carry; 1489 x[i] = temp % base | 0; 1490 carry = temp / base | 0; 1491 } 1492 if (carry) x.unshift(carry); 1493 return x; 1494 } 1495 function compare(a, b, aL, bL) { 1496 var i, r; 1497 if (aL != bL) { 1498 r = aL > bL ? 1 : -1; 1499 } else { 1500 for (i = r = 0; i < aL; i++) { 1501 if (a[i] != b[i]) { 1502 r = a[i] > b[i] ? 1 : -1; 1503 break; 1504 } 1505 } 1506 } 1507 return r; 1508 } 1509 function subtract(a, b, aL, base) { 1510 var i = 0; 1511 for (; aL--; ) { 1512 a[aL] -= i; 1513 i = a[aL] < b[aL] ? 1 : 0; 1514 a[aL] = i * base + a[aL] - b[aL]; 1515 } 1516 for (; !a[0] && a.length > 1; ) a.shift(); 1517 } 1518 return function(x, y, pr, rm, dp, base) { 1519 var cmp, e, i, k, logBase, more, prod, prodL, q, qd, rem, remL, rem0, sd, t, xi, xL, yd0, yL, yz, Ctor = x.constructor, sign2 = x.s == y.s ? 1 : -1, xd = x.d, yd = y.d; 1520 if (!xd || !xd[0] || !yd || !yd[0]) { 1521 return new Ctor( 1522 // Return NaN if either NaN, or both Infinity or 0. 1523 !x.s || !y.s || (xd ? yd && xd[0] == yd[0] : !yd) ? NaN : ( 1524 // Return ±0 if x is 0 or y is ±Infinity, or return ±Infinity as y is 0. 1525 xd && xd[0] == 0 || !yd ? sign2 * 0 : sign2 / 0 1526 ) 1527 ); 1528 } 1529 if (base) { 1530 logBase = 1; 1531 e = x.e - y.e; 1532 } else { 1533 base = BASE; 1534 logBase = LOG_BASE; 1535 e = mathfloor(x.e / logBase) - mathfloor(y.e / logBase); 1536 } 1537 yL = yd.length; 1538 xL = xd.length; 1539 q = new Ctor(sign2); 1540 qd = q.d = []; 1541 for (i = 0; yd[i] == (xd[i] || 0); i++) ; 1542 if (yd[i] > (xd[i] || 0)) e--; 1543 if (pr == null) { 1544 sd = pr = Ctor.precision; 1545 rm = Ctor.rounding; 1546 } else if (dp) { 1547 sd = pr + (x.e - y.e) + 1; 1548 } else { 1549 sd = pr; 1550 } 1551 if (sd < 0) { 1552 qd.push(1); 1553 more = true; 1554 } else { 1555 sd = sd / logBase + 2 | 0; 1556 i = 0; 1557 if (yL == 1) { 1558 k = 0; 1559 yd = yd[0]; 1560 sd++; 1561 for (; (i < xL || k) && sd--; i++) { 1562 t = k * base + (xd[i] || 0); 1563 qd[i] = t / yd | 0; 1564 k = t % yd | 0; 1565 } 1566 more = k || i < xL; 1567 } else { 1568 k = base / (yd[0] + 1) | 0; 1569 if (k > 1) { 1570 yd = multiplyInteger(yd, k, base); 1571 xd = multiplyInteger(xd, k, base); 1572 yL = yd.length; 1573 xL = xd.length; 1574 } 1575 xi = yL; 1576 rem = xd.slice(0, yL); 1577 remL = rem.length; 1578 for (; remL < yL; ) rem[remL++] = 0; 1579 yz = yd.slice(); 1580 yz.unshift(0); 1581 yd0 = yd[0]; 1582 if (yd[1] >= base / 2) ++yd0; 1583 do { 1584 k = 0; 1585 cmp = compare(yd, rem, yL, remL); 1586 if (cmp < 0) { 1587 rem0 = rem[0]; 1588 if (yL != remL) rem0 = rem0 * base + (rem[1] || 0); 1589 k = rem0 / yd0 | 0; 1590 if (k > 1) { 1591 if (k >= base) k = base - 1; 1592 prod = multiplyInteger(yd, k, base); 1593 prodL = prod.length; 1594 remL = rem.length; 1595 cmp = compare(prod, rem, prodL, remL); 1596 if (cmp == 1) { 1597 k--; 1598 subtract(prod, yL < prodL ? yz : yd, prodL, base); 1599 } 1600 } else { 1601 if (k == 0) cmp = k = 1; 1602 prod = yd.slice(); 1603 } 1604 prodL = prod.length; 1605 if (prodL < remL) prod.unshift(0); 1606 subtract(rem, prod, remL, base); 1607 if (cmp == -1) { 1608 remL = rem.length; 1609 cmp = compare(yd, rem, yL, remL); 1610 if (cmp < 1) { 1611 k++; 1612 subtract(rem, yL < remL ? yz : yd, remL, base); 1613 } 1614 } 1615 remL = rem.length; 1616 } else if (cmp === 0) { 1617 k++; 1618 rem = [0]; 1619 } 1620 qd[i++] = k; 1621 if (cmp && rem[0]) { 1622 rem[remL++] = xd[xi] || 0; 1623 } else { 1624 rem = [xd[xi]]; 1625 remL = 1; 1626 } 1627 } while ((xi++ < xL || rem[0] !== void 0) && sd--); 1628 more = rem[0] !== void 0; 1629 } 1630 if (!qd[0]) qd.shift(); 1631 } 1632 if (logBase == 1) { 1633 q.e = e; 1634 inexact = more; 1635 } else { 1636 for (i = 1, k = qd[0]; k >= 10; k /= 10) i++; 1637 q.e = i + e * logBase - 1; 1638 finalise(q, dp ? pr + q.e + 1 : pr, rm, more); 1639 } 1640 return q; 1641 }; 1642 }(); 1643 function finalise(x, sd, rm, isTruncated) { 1644 var digits, i, j, k, rd, roundUp, w, xd, xdi, Ctor = x.constructor; 1645 out: if (sd != null) { 1646 xd = x.d; 1647 if (!xd) return x; 1648 for (digits = 1, k = xd[0]; k >= 10; k /= 10) digits++; 1649 i = sd - digits; 1650 if (i < 0) { 1651 i += LOG_BASE; 1652 j = sd; 1653 w = xd[xdi = 0]; 1654 rd = w / mathpow(10, digits - j - 1) % 10 | 0; 1655 } else { 1656 xdi = Math.ceil((i + 1) / LOG_BASE); 1657 k = xd.length; 1658 if (xdi >= k) { 1659 if (isTruncated) { 1660 for (; k++ <= xdi; ) xd.push(0); 1661 w = rd = 0; 1662 digits = 1; 1663 i %= LOG_BASE; 1664 j = i - LOG_BASE + 1; 1665 } else { 1666 break out; 1667 } 1668 } else { 1669 w = k = xd[xdi]; 1670 for (digits = 1; k >= 10; k /= 10) digits++; 1671 i %= LOG_BASE; 1672 j = i - LOG_BASE + digits; 1673 rd = j < 0 ? 0 : w / mathpow(10, digits - j - 1) % 10 | 0; 1674 } 1675 } 1676 isTruncated = isTruncated || sd < 0 || xd[xdi + 1] !== void 0 || (j < 0 ? w : w % mathpow(10, digits - j - 1)); 1677 roundUp = rm < 4 ? (rd || isTruncated) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : rd > 5 || rd == 5 && (rm == 4 || isTruncated || rm == 6 && // Check whether the digit to the left of the rounding digit is odd. 1678 (i > 0 ? j > 0 ? w / mathpow(10, digits - j) : 0 : xd[xdi - 1]) % 10 & 1 || rm == (x.s < 0 ? 8 : 7)); 1679 if (sd < 1 || !xd[0]) { 1680 xd.length = 0; 1681 if (roundUp) { 1682 sd -= x.e + 1; 1683 xd[0] = mathpow(10, (LOG_BASE - sd % LOG_BASE) % LOG_BASE); 1684 x.e = -sd || 0; 1685 } else { 1686 xd[0] = x.e = 0; 1687 } 1688 return x; 1689 } 1690 if (i == 0) { 1691 xd.length = xdi; 1692 k = 1; 1693 xdi--; 1694 } else { 1695 xd.length = xdi + 1; 1696 k = mathpow(10, LOG_BASE - i); 1697 xd[xdi] = j > 0 ? (w / mathpow(10, digits - j) % mathpow(10, j) | 0) * k : 0; 1698 } 1699 if (roundUp) { 1700 for (; ; ) { 1701 if (xdi == 0) { 1702 for (i = 1, j = xd[0]; j >= 10; j /= 10) i++; 1703 j = xd[0] += k; 1704 for (k = 1; j >= 10; j /= 10) k++; 1705 if (i != k) { 1706 x.e++; 1707 if (xd[0] == BASE) xd[0] = 1; 1708 } 1709 break; 1710 } else { 1711 xd[xdi] += k; 1712 if (xd[xdi] != BASE) break; 1713 xd[xdi--] = 0; 1714 k = 1; 1715 } 1716 } 1717 } 1718 for (i = xd.length; xd[--i] === 0; ) xd.pop(); 1719 } 1720 if (external) { 1721 if (x.e > Ctor.maxE) { 1722 x.d = null; 1723 x.e = NaN; 1724 } else if (x.e < Ctor.minE) { 1725 x.e = 0; 1726 x.d = [0]; 1727 } 1728 } 1729 return x; 1730 } 1731 function finiteToString(x, isExp, sd) { 1732 if (!x.isFinite()) return nonFiniteToString(x); 1733 var k, e = x.e, str = digitsToString(x.d), len = str.length; 1734 if (isExp) { 1735 if (sd && (k = sd - len) > 0) { 1736 str = str.charAt(0) + "." + str.slice(1) + getZeroString(k); 1737 } else if (len > 1) { 1738 str = str.charAt(0) + "." + str.slice(1); 1739 } 1740 str = str + (x.e < 0 ? "e" : "e+") + x.e; 1741 } else if (e < 0) { 1742 str = "0." + getZeroString(-e - 1) + str; 1743 if (sd && (k = sd - len) > 0) str += getZeroString(k); 1744 } else if (e >= len) { 1745 str += getZeroString(e + 1 - len); 1746 if (sd && (k = sd - e - 1) > 0) str = str + "." + getZeroString(k); 1747 } else { 1748 if ((k = e + 1) < len) str = str.slice(0, k) + "." + str.slice(k); 1749 if (sd && (k = sd - len) > 0) { 1750 if (e + 1 === len) str += "."; 1751 str += getZeroString(k); 1752 } 1753 } 1754 return str; 1755 } 1756 function getBase10Exponent(digits, e) { 1757 var w = digits[0]; 1758 for (e *= LOG_BASE; w >= 10; w /= 10) e++; 1759 return e; 1760 } 1761 function getLn10(Ctor, sd, pr) { 1762 if (sd > LN10_PRECISION) { 1763 external = true; 1764 if (pr) Ctor.precision = pr; 1765 throw Error(precisionLimitExceeded); 1766 } 1767 return finalise(new Ctor(LN10), sd, 1, true); 1768 } 1769 function getPi(Ctor, sd, rm) { 1770 if (sd > PI_PRECISION) throw Error(precisionLimitExceeded); 1771 return finalise(new Ctor(PI), sd, rm, true); 1772 } 1773 function getPrecision(digits) { 1774 var w = digits.length - 1, len = w * LOG_BASE + 1; 1775 w = digits[w]; 1776 if (w) { 1777 for (; w % 10 == 0; w /= 10) len--; 1778 for (w = digits[0]; w >= 10; w /= 10) len++; 1779 } 1780 return len; 1781 } 1782 function getZeroString(k) { 1783 var zs = ""; 1784 for (; k--; ) zs += "0"; 1785 return zs; 1786 } 1787 function intPow(Ctor, x, n, pr) { 1788 var isTruncated, r = new Ctor(1), k = Math.ceil(pr / LOG_BASE + 4); 1789 external = false; 1790 for (; ; ) { 1791 if (n % 2) { 1792 r = r.times(x); 1793 if (truncate(r.d, k)) isTruncated = true; 1794 } 1795 n = mathfloor(n / 2); 1796 if (n === 0) { 1797 n = r.d.length - 1; 1798 if (isTruncated && r.d[n] === 0) ++r.d[n]; 1799 break; 1800 } 1801 x = x.times(x); 1802 truncate(x.d, k); 1803 } 1804 external = true; 1805 return r; 1806 } 1807 function isOdd(n) { 1808 return n.d[n.d.length - 1] & 1; 1809 } 1810 function maxOrMin(Ctor, args, ltgt) { 1811 var y, x = new Ctor(args[0]), i = 0; 1812 for (; ++i < args.length; ) { 1813 y = new Ctor(args[i]); 1814 if (!y.s) { 1815 x = y; 1816 break; 1817 } else if (x[ltgt](y)) { 1818 x = y; 1819 } 1820 } 1821 return x; 1822 } 1823 function naturalExponential(x, sd) { 1824 var denominator, guard, j, pow2, sum2, t, wpr, rep = 0, i = 0, k = 0, Ctor = x.constructor, rm = Ctor.rounding, pr = Ctor.precision; 1825 if (!x.d || !x.d[0] || x.e > 17) { 1826 return new Ctor(x.d ? !x.d[0] ? 1 : x.s < 0 ? 0 : 1 / 0 : x.s ? x.s < 0 ? 0 : x : 0 / 0); 1827 } 1828 if (sd == null) { 1829 external = false; 1830 wpr = pr; 1831 } else { 1832 wpr = sd; 1833 } 1834 t = new Ctor(0.03125); 1835 while (x.e > -2) { 1836 x = x.times(t); 1837 k += 5; 1838 } 1839 guard = Math.log(mathpow(2, k)) / Math.LN10 * 2 + 5 | 0; 1840 wpr += guard; 1841 denominator = pow2 = sum2 = new Ctor(1); 1842 Ctor.precision = wpr; 1843 for (; ; ) { 1844 pow2 = finalise(pow2.times(x), wpr, 1); 1845 denominator = denominator.times(++i); 1846 t = sum2.plus(divide(pow2, denominator, wpr, 1)); 1847 if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum2.d).slice(0, wpr)) { 1848 j = k; 1849 while (j--) sum2 = finalise(sum2.times(sum2), wpr, 1); 1850 if (sd == null) { 1851 if (rep < 3 && checkRoundingDigits(sum2.d, wpr - guard, rm, rep)) { 1852 Ctor.precision = wpr += 10; 1853 denominator = pow2 = t = new Ctor(1); 1854 i = 0; 1855 rep++; 1856 } else { 1857 return finalise(sum2, Ctor.precision = pr, rm, external = true); 1858 } 1859 } else { 1860 Ctor.precision = pr; 1861 return sum2; 1862 } 1863 } 1864 sum2 = t; 1865 } 1866 } 1867 function naturalLogarithm(y, sd) { 1868 var c, c0, denominator, e, numerator, rep, sum2, t, wpr, x1, x2, n = 1, guard = 10, x = y, xd = x.d, Ctor = x.constructor, rm = Ctor.rounding, pr = Ctor.precision; 1869 if (x.s < 0 || !xd || !xd[0] || !x.e && xd[0] == 1 && xd.length == 1) { 1870 return new Ctor(xd && !xd[0] ? -1 / 0 : x.s != 1 ? NaN : xd ? 0 : x); 1871 } 1872 if (sd == null) { 1873 external = false; 1874 wpr = pr; 1875 } else { 1876 wpr = sd; 1877 } 1878 Ctor.precision = wpr += guard; 1879 c = digitsToString(xd); 1880 c0 = c.charAt(0); 1881 if (Math.abs(e = x.e) < 15e14) { 1882 while (c0 < 7 && c0 != 1 || c0 == 1 && c.charAt(1) > 3) { 1883 x = x.times(y); 1884 c = digitsToString(x.d); 1885 c0 = c.charAt(0); 1886 n++; 1887 } 1888 e = x.e; 1889 if (c0 > 1) { 1890 x = new Ctor("0." + c); 1891 e++; 1892 } else { 1893 x = new Ctor(c0 + "." + c.slice(1)); 1894 } 1895 } else { 1896 t = getLn10(Ctor, wpr + 2, pr).times(e + ""); 1897 x = naturalLogarithm(new Ctor(c0 + "." + c.slice(1)), wpr - guard).plus(t); 1898 Ctor.precision = pr; 1899 return sd == null ? finalise(x, pr, rm, external = true) : x; 1900 } 1901 x1 = x; 1902 sum2 = numerator = x = divide(x.minus(1), x.plus(1), wpr, 1); 1903 x2 = finalise(x.times(x), wpr, 1); 1904 denominator = 3; 1905 for (; ; ) { 1906 numerator = finalise(numerator.times(x2), wpr, 1); 1907 t = sum2.plus(divide(numerator, new Ctor(denominator), wpr, 1)); 1908 if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum2.d).slice(0, wpr)) { 1909 sum2 = sum2.times(2); 1910 if (e !== 0) sum2 = sum2.plus(getLn10(Ctor, wpr + 2, pr).times(e + "")); 1911 sum2 = divide(sum2, new Ctor(n), wpr, 1); 1912 if (sd == null) { 1913 if (checkRoundingDigits(sum2.d, wpr - guard, rm, rep)) { 1914 Ctor.precision = wpr += guard; 1915 t = numerator = x = divide(x1.minus(1), x1.plus(1), wpr, 1); 1916 x2 = finalise(x.times(x), wpr, 1); 1917 denominator = rep = 1; 1918 } else { 1919 return finalise(sum2, Ctor.precision = pr, rm, external = true); 1920 } 1921 } else { 1922 Ctor.precision = pr; 1923 return sum2; 1924 } 1925 } 1926 sum2 = t; 1927 denominator += 2; 1928 } 1929 } 1930 function nonFiniteToString(x) { 1931 return String(x.s * x.s / 0); 1932 } 1933 function parseDecimal(x, str) { 1934 var e, i, len; 1935 if ((e = str.indexOf(".")) > -1) str = str.replace(".", ""); 1936 if ((i = str.search(/e/i)) > 0) { 1937 if (e < 0) e = i; 1938 e += +str.slice(i + 1); 1939 str = str.substring(0, i); 1940 } else if (e < 0) { 1941 e = str.length; 1942 } 1943 for (i = 0; str.charCodeAt(i) === 48; i++) ; 1944 for (len = str.length; str.charCodeAt(len - 1) === 48; --len) ; 1945 str = str.slice(i, len); 1946 if (str) { 1947 len -= i; 1948 x.e = e = e - i - 1; 1949 x.d = []; 1950 i = (e + 1) % LOG_BASE; 1951 if (e < 0) i += LOG_BASE; 1952 if (i < len) { 1953 if (i) x.d.push(+str.slice(0, i)); 1954 for (len -= LOG_BASE; i < len; ) x.d.push(+str.slice(i, i += LOG_BASE)); 1955 str = str.slice(i); 1956 i = LOG_BASE - str.length; 1957 } else { 1958 i -= len; 1959 } 1960 for (; i--; ) str += "0"; 1961 x.d.push(+str); 1962 if (external) { 1963 if (x.e > x.constructor.maxE) { 1964 x.d = null; 1965 x.e = NaN; 1966 } else if (x.e < x.constructor.minE) { 1967 x.e = 0; 1968 x.d = [0]; 1969 } 1970 } 1971 } else { 1972 x.e = 0; 1973 x.d = [0]; 1974 } 1975 return x; 1976 } 1977 function parseOther(x, str) { 1978 var base, Ctor, divisor, i, isFloat, len, p, xd, xe; 1979 if (str.indexOf("_") > -1) { 1980 str = str.replace(/(\d)_(?=\d)/g, "$1"); 1981 if (isDecimal.test(str)) return parseDecimal(x, str); 1982 } else if (str === "Infinity" || str === "NaN") { 1983 if (!+str) x.s = NaN; 1984 x.e = NaN; 1985 x.d = null; 1986 return x; 1987 } 1988 if (isHex.test(str)) { 1989 base = 16; 1990 str = str.toLowerCase(); 1991 } else if (isBinary.test(str)) { 1992 base = 2; 1993 } else if (isOctal.test(str)) { 1994 base = 8; 1995 } else { 1996 throw Error(invalidArgument + str); 1997 } 1998 i = str.search(/p/i); 1999 if (i > 0) { 2000 p = +str.slice(i + 1); 2001 str = str.substring(2, i); 2002 } else { 2003 str = str.slice(2); 2004 } 2005 i = str.indexOf("."); 2006 isFloat = i >= 0; 2007 Ctor = x.constructor; 2008 if (isFloat) { 2009 str = str.replace(".", ""); 2010 len = str.length; 2011 i = len - i; 2012 divisor = intPow(Ctor, new Ctor(base), i, i * 2); 2013 } 2014 xd = convertBase(str, base, BASE); 2015 xe = xd.length - 1; 2016 for (i = xe; xd[i] === 0; --i) xd.pop(); 2017 if (i < 0) return new Ctor(x.s * 0); 2018 x.e = getBase10Exponent(xd, xe); 2019 x.d = xd; 2020 external = false; 2021 if (isFloat) x = divide(x, divisor, len * 4); 2022 if (p) x = x.times(Math.abs(p) < 54 ? mathpow(2, p) : Decimal.pow(2, p)); 2023 external = true; 2024 return x; 2025 } 2026 function sine(Ctor, x) { 2027 var k, len = x.d.length; 2028 if (len < 3) { 2029 return x.isZero() ? x : taylorSeries(Ctor, 2, x, x); 2030 } 2031 k = 1.4 * Math.sqrt(len); 2032 k = k > 16 ? 16 : k | 0; 2033 x = x.times(1 / tinyPow(5, k)); 2034 x = taylorSeries(Ctor, 2, x, x); 2035 var sin2_x, d5 = new Ctor(5), d16 = new Ctor(16), d20 = new Ctor(20); 2036 for (; k--; ) { 2037 sin2_x = x.times(x); 2038 x = x.times(d5.plus(sin2_x.times(d16.times(sin2_x).minus(d20)))); 2039 } 2040 return x; 2041 } 2042 function taylorSeries(Ctor, n, x, y, isHyperbolic) { 2043 var j, t, u, x2, i = 1, pr = Ctor.precision, k = Math.ceil(pr / LOG_BASE); 2044 external = false; 2045 x2 = x.times(x); 2046 u = new Ctor(y); 2047 for (; ; ) { 2048 t = divide(u.times(x2), new Ctor(n++ * n++), pr, 1); 2049 u = isHyperbolic ? y.plus(t) : y.minus(t); 2050 y = divide(t.times(x2), new Ctor(n++ * n++), pr, 1); 2051 t = u.plus(y); 2052 if (t.d[k] !== void 0) { 2053 for (j = k; t.d[j] === u.d[j] && j--; ) ; 2054 if (j == -1) break; 2055 } 2056 j = u; 2057 u = y; 2058 y = t; 2059 t = j; 2060 i++; 2061 } 2062 external = true; 2063 t.d.length = k + 1; 2064 return t; 2065 } 2066 function tinyPow(b, e) { 2067 var n = b; 2068 while (--e) n *= b; 2069 return n; 2070 } 2071 function toLessThanHalfPi(Ctor, x) { 2072 var t, isNeg = x.s < 0, pi = getPi(Ctor, Ctor.precision, 1), halfPi = pi.times(0.5); 2073 x = x.abs(); 2074 if (x.lte(halfPi)) { 2075 quadrant = isNeg ? 4 : 1; 2076 return x; 2077 } 2078 t = x.divToInt(pi); 2079 if (t.isZero()) { 2080 quadrant = isNeg ? 3 : 2; 2081 } else { 2082 x = x.minus(t.times(pi)); 2083 if (x.lte(halfPi)) { 2084 quadrant = isOdd(t) ? isNeg ? 2 : 3 : isNeg ? 4 : 1; 2085 return x; 2086 } 2087 quadrant = isOdd(t) ? isNeg ? 1 : 4 : isNeg ? 3 : 2; 2088 } 2089 return x.minus(pi).abs(); 2090 } 2091 function toStringBinary(x, baseOut, sd, rm) { 2092 var base, e, i, k, len, roundUp, str, xd, y, Ctor = x.constructor, isExp = sd !== void 0; 2093 if (isExp) { 2094 checkInt32(sd, 1, MAX_DIGITS); 2095 if (rm === void 0) rm = Ctor.rounding; 2096 else checkInt32(rm, 0, 8); 2097 } else { 2098 sd = Ctor.precision; 2099 rm = Ctor.rounding; 2100 } 2101 if (!x.isFinite()) { 2102 str = nonFiniteToString(x); 2103 } else { 2104 str = finiteToString(x); 2105 i = str.indexOf("."); 2106 if (isExp) { 2107 base = 2; 2108 if (baseOut == 16) { 2109 sd = sd * 4 - 3; 2110 } else if (baseOut == 8) { 2111 sd = sd * 3 - 2; 2112 } 2113 } else { 2114 base = baseOut; 2115 } 2116 if (i >= 0) { 2117 str = str.replace(".", ""); 2118 y = new Ctor(1); 2119 y.e = str.length - i; 2120 y.d = convertBase(finiteToString(y), 10, base); 2121 y.e = y.d.length; 2122 } 2123 xd = convertBase(str, 10, base); 2124 e = len = xd.length; 2125 for (; xd[--len] == 0; ) xd.pop(); 2126 if (!xd[0]) { 2127 str = isExp ? "0p+0" : "0"; 2128 } else { 2129 if (i < 0) { 2130 e--; 2131 } else { 2132 x = new Ctor(x); 2133 x.d = xd; 2134 x.e = e; 2135 x = divide(x, y, sd, rm, 0, base); 2136 xd = x.d; 2137 e = x.e; 2138 roundUp = inexact; 2139 } 2140 i = xd[sd]; 2141 k = base / 2; 2142 roundUp = roundUp || xd[sd + 1] !== void 0; 2143 roundUp = rm < 4 ? (i !== void 0 || roundUp) && (rm === 0 || rm === (x.s < 0 ? 3 : 2)) : i > k || i === k && (rm === 4 || roundUp || rm === 6 && xd[sd - 1] & 1 || rm === (x.s < 0 ? 8 : 7)); 2144 xd.length = sd; 2145 if (roundUp) { 2146 for (; ++xd[--sd] > base - 1; ) { 2147 xd[sd] = 0; 2148 if (!sd) { 2149 ++e; 2150 xd.unshift(1); 2151 } 2152 } 2153 } 2154 for (len = xd.length; !xd[len - 1]; --len) ; 2155 for (i = 0, str = ""; i < len; i++) str += NUMERALS.charAt(xd[i]); 2156 if (isExp) { 2157 if (len > 1) { 2158 if (baseOut == 16 || baseOut == 8) { 2159 i = baseOut == 16 ? 4 : 3; 2160 for (--len; len % i; len++) str += "0"; 2161 xd = convertBase(str, base, baseOut); 2162 for (len = xd.length; !xd[len - 1]; --len) ; 2163 for (i = 1, str = "1."; i < len; i++) str += NUMERALS.charAt(xd[i]); 2164 } else { 2165 str = str.charAt(0) + "." + str.slice(1); 2166 } 2167 } 2168 str = str + (e < 0 ? "p" : "p+") + e; 2169 } else if (e < 0) { 2170 for (; ++e; ) str = "0" + str; 2171 str = "0." + str; 2172 } else { 2173 if (++e > len) for (e -= len; e--; ) str += "0"; 2174 else if (e < len) str = str.slice(0, e) + "." + str.slice(e); 2175 } 2176 } 2177 str = (baseOut == 16 ? "0x" : baseOut == 2 ? "0b" : baseOut == 8 ? "0o" : "") + str; 2178 } 2179 return x.s < 0 ? "-" + str : str; 2180 } 2181 function truncate(arr, len) { 2182 if (arr.length > len) { 2183 arr.length = len; 2184 return true; 2185 } 2186 } 2187 function abs(x) { 2188 return new this(x).abs(); 2189 } 2190 function acos(x) { 2191 return new this(x).acos(); 2192 } 2193 function acosh(x) { 2194 return new this(x).acosh(); 2195 } 2196 function add(x, y) { 2197 return new this(x).plus(y); 2198 } 2199 function asin(x) { 2200 return new this(x).asin(); 2201 } 2202 function asinh(x) { 2203 return new this(x).asinh(); 2204 } 2205 function atan(x) { 2206 return new this(x).atan(); 2207 } 2208 function atanh(x) { 2209 return new this(x).atanh(); 2210 } 2211 function atan2(y, x) { 2212 y = new this(y); 2213 x = new this(x); 2214 var r, pr = this.precision, rm = this.rounding, wpr = pr + 4; 2215 if (!y.s || !x.s) { 2216 r = new this(NaN); 2217 } else if (!y.d && !x.d) { 2218 r = getPi(this, wpr, 1).times(x.s > 0 ? 0.25 : 0.75); 2219 r.s = y.s; 2220 } else if (!x.d || y.isZero()) { 2221 r = x.s < 0 ? getPi(this, pr, rm) : new this(0); 2222 r.s = y.s; 2223 } else if (!y.d || x.isZero()) { 2224 r = getPi(this, wpr, 1).times(0.5); 2225 r.s = y.s; 2226 } else if (x.s < 0) { 2227 this.precision = wpr; 2228 this.rounding = 1; 2229 r = this.atan(divide(y, x, wpr, 1)); 2230 x = getPi(this, wpr, 1); 2231 this.precision = pr; 2232 this.rounding = rm; 2233 r = y.s < 0 ? r.minus(x) : r.plus(x); 2234 } else { 2235 r = this.atan(divide(y, x, wpr, 1)); 2236 } 2237 return r; 2238 } 2239 function cbrt(x) { 2240 return new this(x).cbrt(); 2241 } 2242 function ceil(x) { 2243 return finalise(x = new this(x), x.e + 1, 2); 2244 } 2245 function clamp(x, min2, max2) { 2246 return new this(x).clamp(min2, max2); 2247 } 2248 function config(obj) { 2249 if (!obj || typeof obj !== "object") throw Error(decimalError + "Object expected"); 2250 var i, p, v, useDefaults = obj.defaults === true, ps = [ 2251 "precision", 2252 1, 2253 MAX_DIGITS, 2254 "rounding", 2255 0, 2256 8, 2257 "toExpNeg", 2258 -EXP_LIMIT, 2259 0, 2260 "toExpPos", 2261 0, 2262 EXP_LIMIT, 2263 "maxE", 2264 0, 2265 EXP_LIMIT, 2266 "minE", 2267 -EXP_LIMIT, 2268 0, 2269 "modulo", 2270 0, 2271 9 2272 ]; 2273 for (i = 0; i < ps.length; i += 3) { 2274 if (p = ps[i], useDefaults) this[p] = DEFAULTS[p]; 2275 if ((v = obj[p]) !== void 0) { 2276 if (mathfloor(v) === v && v >= ps[i + 1] && v <= ps[i + 2]) this[p] = v; 2277 else throw Error(invalidArgument + p + ": " + v); 2278 } 2279 } 2280 if (p = "crypto", useDefaults) this[p] = DEFAULTS[p]; 2281 if ((v = obj[p]) !== void 0) { 2282 if (v === true || v === false || v === 0 || v === 1) { 2283 if (v) { 2284 if (typeof crypto != "undefined" && crypto && (crypto.getRandomValues || crypto.randomBytes)) { 2285 this[p] = true; 2286 } else { 2287 throw Error(cryptoUnavailable); 2288 } 2289 } else { 2290 this[p] = false; 2291 } 2292 } else { 2293 throw Error(invalidArgument + p + ": " + v); 2294 } 2295 } 2296 return this; 2297 } 2298 function cos(x) { 2299 return new this(x).cos(); 2300 } 2301 function cosh(x) { 2302 return new this(x).cosh(); 2303 } 2304 function clone(obj) { 2305 var i, p, ps; 2306 function Decimal2(v) { 2307 var e, i2, t, x = this; 2308 if (!(x instanceof Decimal2)) return new Decimal2(v); 2309 x.constructor = Decimal2; 2310 if (isDecimalInstance(v)) { 2311 x.s = v.s; 2312 if (external) { 2313 if (!v.d || v.e > Decimal2.maxE) { 2314 x.e = NaN; 2315 x.d = null; 2316 } else if (v.e < Decimal2.minE) { 2317 x.e = 0; 2318 x.d = [0]; 2319 } else { 2320 x.e = v.e; 2321 x.d = v.d.slice(); 2322 } 2323 } else { 2324 x.e = v.e; 2325 x.d = v.d ? v.d.slice() : v.d; 2326 } 2327 return; 2328 } 2329 t = typeof v; 2330 if (t === "number") { 2331 if (v === 0) { 2332 x.s = 1 / v < 0 ? -1 : 1; 2333 x.e = 0; 2334 x.d = [0]; 2335 return; 2336 } 2337 if (v < 0) { 2338 v = -v; 2339 x.s = -1; 2340 } else { 2341 x.s = 1; 2342 } 2343 if (v === ~~v && v < 1e7) { 2344 for (e = 0, i2 = v; i2 >= 10; i2 /= 10) e++; 2345 if (external) { 2346 if (e > Decimal2.maxE) { 2347 x.e = NaN; 2348 x.d = null; 2349 } else if (e < Decimal2.minE) { 2350 x.e = 0; 2351 x.d = [0]; 2352 } else { 2353 x.e = e; 2354 x.d = [v]; 2355 } 2356 } else { 2357 x.e = e; 2358 x.d = [v]; 2359 } 2360 return; 2361 } else if (v * 0 !== 0) { 2362 if (!v) x.s = NaN; 2363 x.e = NaN; 2364 x.d = null; 2365 return; 2366 } 2367 return parseDecimal(x, v.toString()); 2368 } else if (t !== "string") { 2369 throw Error(invalidArgument + v); 2370 } 2371 if ((i2 = v.charCodeAt(0)) === 45) { 2372 v = v.slice(1); 2373 x.s = -1; 2374 } else { 2375 if (i2 === 43) v = v.slice(1); 2376 x.s = 1; 2377 } 2378 return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v); 2379 } 2380 Decimal2.prototype = P; 2381 Decimal2.ROUND_UP = 0; 2382 Decimal2.ROUND_DOWN = 1; 2383 Decimal2.ROUND_CEIL = 2; 2384 Decimal2.ROUND_FLOOR = 3; 2385 Decimal2.ROUND_HALF_UP = 4; 2386 Decimal2.ROUND_HALF_DOWN = 5; 2387 Decimal2.ROUND_HALF_EVEN = 6; 2388 Decimal2.ROUND_HALF_CEIL = 7; 2389 Decimal2.ROUND_HALF_FLOOR = 8; 2390 Decimal2.EUCLID = 9; 2391 Decimal2.config = Decimal2.set = config; 2392 Decimal2.clone = clone; 2393 Decimal2.isDecimal = isDecimalInstance; 2394 Decimal2.abs = abs; 2395 Decimal2.acos = acos; 2396 Decimal2.acosh = acosh; 2397 Decimal2.add = add; 2398 Decimal2.asin = asin; 2399 Decimal2.asinh = asinh; 2400 Decimal2.atan = atan; 2401 Decimal2.atanh = atanh; 2402 Decimal2.atan2 = atan2; 2403 Decimal2.cbrt = cbrt; 2404 Decimal2.ceil = ceil; 2405 Decimal2.clamp = clamp; 2406 Decimal2.cos = cos; 2407 Decimal2.cosh = cosh; 2408 Decimal2.div = div; 2409 Decimal2.exp = exp; 2410 Decimal2.floor = floor; 2411 Decimal2.hypot = hypot; 2412 Decimal2.ln = ln; 2413 Decimal2.log = log; 2414 Decimal2.log10 = log10; 2415 Decimal2.log2 = log2; 2416 Decimal2.max = max; 2417 Decimal2.min = min; 2418 Decimal2.mod = mod; 2419 Decimal2.mul = mul; 2420 Decimal2.pow = pow; 2421 Decimal2.random = random; 2422 Decimal2.round = round; 2423 Decimal2.sign = sign; 2424 Decimal2.sin = sin; 2425 Decimal2.sinh = sinh; 2426 Decimal2.sqrt = sqrt; 2427 Decimal2.sub = sub; 2428 Decimal2.sum = sum; 2429 Decimal2.tan = tan; 2430 Decimal2.tanh = tanh; 2431 Decimal2.trunc = trunc; 2432 if (obj === void 0) obj = {}; 2433 if (obj) { 2434 if (obj.defaults !== true) { 2435 ps = ["precision", "rounding", "toExpNeg", "toExpPos", "maxE", "minE", "modulo", "crypto"]; 2436 for (i = 0; i < ps.length; ) if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p]; 2437 } 2438 } 2439 Decimal2.config(obj); 2440 return Decimal2; 2441 } 2442 function div(x, y) { 2443 return new this(x).div(y); 2444 } 2445 function exp(x) { 2446 return new this(x).exp(); 2447 } 2448 function floor(x) { 2449 return finalise(x = new this(x), x.e + 1, 3); 2450 } 2451 function hypot() { 2452 var i, n, t = new this(0); 2453 external = false; 2454 for (i = 0; i < arguments.length; ) { 2455 n = new this(arguments[i++]); 2456 if (!n.d) { 2457 if (n.s) { 2458 external = true; 2459 return new this(1 / 0); 2460 } 2461 t = n; 2462 } else if (t.d) { 2463 t = t.plus(n.times(n)); 2464 } 2465 } 2466 external = true; 2467 return t.sqrt(); 2468 } 2469 function isDecimalInstance(obj) { 2470 return obj instanceof Decimal || obj && obj.toStringTag === tag || false; 2471 } 2472 function ln(x) { 2473 return new this(x).ln(); 2474 } 2475 function log(x, y) { 2476 return new this(x).log(y); 2477 } 2478 function log2(x) { 2479 return new this(x).log(2); 2480 } 2481 function log10(x) { 2482 return new this(x).log(10); 2483 } 2484 function max() { 2485 return maxOrMin(this, arguments, "lt"); 2486 } 2487 function min() { 2488 return maxOrMin(this, arguments, "gt"); 2489 } 2490 function mod(x, y) { 2491 return new this(x).mod(y); 2492 } 2493 function mul(x, y) { 2494 return new this(x).mul(y); 2495 } 2496 function pow(x, y) { 2497 return new this(x).pow(y); 2498 } 2499 function random(sd) { 2500 var d, e, k, n, i = 0, r = new this(1), rd = []; 2501 if (sd === void 0) sd = this.precision; 2502 else checkInt32(sd, 1, MAX_DIGITS); 2503 k = Math.ceil(sd / LOG_BASE); 2504 if (!this.crypto) { 2505 for (; i < k; ) rd[i++] = Math.random() * 1e7 | 0; 2506 } else if (crypto.getRandomValues) { 2507 d = crypto.getRandomValues(new Uint32Array(k)); 2508 for (; i < k; ) { 2509 n = d[i]; 2510 if (n >= 429e7) { 2511 d[i] = crypto.getRandomValues(new Uint32Array(1))[0]; 2512 } else { 2513 rd[i++] = n % 1e7; 2514 } 2515 } 2516 } else if (crypto.randomBytes) { 2517 d = crypto.randomBytes(k *= 4); 2518 for (; i < k; ) { 2519 n = d[i] + (d[i + 1] << 8) + (d[i + 2] << 16) + ((d[i + 3] & 127) << 24); 2520 if (n >= 214e7) { 2521 crypto.randomBytes(4).copy(d, i); 2522 } else { 2523 rd.push(n % 1e7); 2524 i += 4; 2525 } 2526 } 2527 i = k / 4; 2528 } else { 2529 throw Error(cryptoUnavailable); 2530 } 2531 k = rd[--i]; 2532 sd %= LOG_BASE; 2533 if (k && sd) { 2534 n = mathpow(10, LOG_BASE - sd); 2535 rd[i] = (k / n | 0) * n; 2536 } 2537 for (; rd[i] === 0; i--) rd.pop(); 2538 if (i < 0) { 2539 e = 0; 2540 rd = [0]; 2541 } else { 2542 e = -1; 2543 for (; rd[0] === 0; e -= LOG_BASE) rd.shift(); 2544 for (k = 1, n = rd[0]; n >= 10; n /= 10) k++; 2545 if (k < LOG_BASE) e -= LOG_BASE - k; 2546 } 2547 r.e = e; 2548 r.d = rd; 2549 return r; 2550 } 2551 function round(x) { 2552 return finalise(x = new this(x), x.e + 1, this.rounding); 2553 } 2554 function sign(x) { 2555 x = new this(x); 2556 return x.d ? x.d[0] ? x.s : 0 * x.s : x.s || NaN; 2557 } 2558 function sin(x) { 2559 return new this(x).sin(); 2560 } 2561 function sinh(x) { 2562 return new this(x).sinh(); 2563 } 2564 function sqrt(x) { 2565 return new this(x).sqrt(); 2566 } 2567 function sub(x, y) { 2568 return new this(x).sub(y); 2569 } 2570 function sum() { 2571 var i = 0, args = arguments, x = new this(args[i]); 2572 external = false; 2573 for (; x.s && ++i < args.length; ) x = x.plus(args[i]); 2574 external = true; 2575 return finalise(x, this.precision, this.rounding); 2576 } 2577 function tan(x) { 2578 return new this(x).tan(); 2579 } 2580 function tanh(x) { 2581 return new this(x).tanh(); 2582 } 2583 function trunc(x) { 2584 return finalise(x = new this(x), x.e + 1, 1); 2585 } 2586 Decimal = clone(DEFAULTS); 2587 Decimal.prototype.constructor = Decimal; 2588 Decimal["default"] = Decimal.Decimal = Decimal; 2589 LN10 = new Decimal(LN10); 2590 PI = new Decimal(PI); 2591 if (typeof define == "function" && define.amd) { 2592 define(function() { 2593 return Decimal; 2594 }); 2595 } else if (typeof module2 != "undefined" && module2.exports) { 2596 if (typeof Symbol == "function" && typeof Symbol.iterator == "symbol") { 2597 P[Symbol["for"]("nodejs.util.inspect.custom")] = P.toString; 2598 P[Symbol.toStringTag] = "Decimal"; 2599 } 2600 module2.exports = Decimal; 2601 } else { 2602 if (!globalScope) { 2603 globalScope = typeof self != "undefined" && self && self.self == self ? self : window; 2604 } 2605 noConflict = globalScope.Decimal; 2606 Decimal.noConflict = function() { 2607 globalScope.Decimal = noConflict; 2608 return Decimal; 2609 }; 2610 globalScope.Decimal = Decimal; 2611 } 2612 })(exports); 2613 } 2614 }); 2615 2616 // node_modules/lodash/lodash.js 2617 var require_lodash = __commonJS({ 2618 "node_modules/lodash/lodash.js"(exports, module2) { 2619 (function() { 2620 var undefined2; 2621 var VERSION = "4.17.21"; 2622 var LARGE_ARRAY_SIZE = 200; 2623 var CORE_ERROR_TEXT = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", FUNC_ERROR_TEXT = "Expected a function", INVALID_TEMPL_VAR_ERROR_TEXT = "Invalid `variable` option passed into `_.template`"; 2624 var HASH_UNDEFINED = "__lodash_hash_undefined__"; 2625 var MAX_MEMOIZE_SIZE = 500; 2626 var PLACEHOLDER = "__lodash_placeholder__"; 2627 var CLONE_DEEP_FLAG = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG = 4; 2628 var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2; 2629 var WRAP_BIND_FLAG = 1, WRAP_BIND_KEY_FLAG = 2, WRAP_CURRY_BOUND_FLAG = 4, WRAP_CURRY_FLAG = 8, WRAP_CURRY_RIGHT_FLAG = 16, WRAP_PARTIAL_FLAG = 32, WRAP_PARTIAL_RIGHT_FLAG = 64, WRAP_ARY_FLAG = 128, WRAP_REARG_FLAG = 256, WRAP_FLIP_FLAG = 512; 2630 var DEFAULT_TRUNC_LENGTH = 30, DEFAULT_TRUNC_OMISSION = "..."; 2631 var HOT_COUNT = 800, HOT_SPAN = 16; 2632 var LAZY_FILTER_FLAG = 1, LAZY_MAP_FLAG = 2, LAZY_WHILE_FLAG = 3; 2633 var INFINITY = 1 / 0, MAX_SAFE_INTEGER = 9007199254740991, MAX_INTEGER = 17976931348623157e292, NAN = 0 / 0; 2634 var MAX_ARRAY_LENGTH = 4294967295, MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1; 2635 var wrapFlags = [ 2636 ["ary", WRAP_ARY_FLAG], 2637 ["bind", WRAP_BIND_FLAG], 2638 ["bindKey", WRAP_BIND_KEY_FLAG], 2639 ["curry", WRAP_CURRY_FLAG], 2640 ["curryRight", WRAP_CURRY_RIGHT_FLAG], 2641 ["flip", WRAP_FLIP_FLAG], 2642 ["partial", WRAP_PARTIAL_FLAG], 2643 ["partialRight", WRAP_PARTIAL_RIGHT_FLAG], 2644 ["rearg", WRAP_REARG_FLAG] 2645 ]; 2646 var argsTag = "[object Arguments]", arrayTag = "[object Array]", asyncTag = "[object AsyncFunction]", boolTag = "[object Boolean]", dateTag = "[object Date]", domExcTag = "[object DOMException]", errorTag = "[object Error]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", mapTag = "[object Map]", numberTag = "[object Number]", nullTag = "[object Null]", objectTag = "[object Object]", promiseTag = "[object Promise]", proxyTag = "[object Proxy]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag = "[object String]", symbolTag = "[object Symbol]", undefinedTag = "[object Undefined]", weakMapTag = "[object WeakMap]", weakSetTag = "[object WeakSet]"; 2647 var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]"; 2648 var reEmptyStringLeading = /\b__p \+= '';/g, reEmptyStringMiddle = /\b(__p \+=) '' \+/g, reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g; 2649 var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g, reUnescapedHtml = /[&<>"']/g, reHasEscapedHtml = RegExp(reEscapedHtml.source), reHasUnescapedHtml = RegExp(reUnescapedHtml.source); 2650 var reEscape = /<%-([\s\S]+?)%>/g, reEvaluate = /<%([\s\S]+?)%>/g, reInterpolate = /<%=([\s\S]+?)%>/g; 2651 var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; 2652 var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, reHasRegExpChar = RegExp(reRegExpChar.source); 2653 var reTrimStart = /^\s+/; 2654 var reWhitespace = /\s/; 2655 var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, reSplitDetails = /,? & /; 2656 var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g; 2657 var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/; 2658 var reEscapeChar = /\\(\\)?/g; 2659 var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; 2660 var reFlags = /\w*$/; 2661 var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; 2662 var reIsBinary = /^0b[01]+$/i; 2663 var reIsHostCtor = /^\[object .+?Constructor\]$/; 2664 var reIsOctal = /^0o[0-7]+$/i; 2665 var reIsUint = /^(?:0|[1-9]\d*)$/; 2666 var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g; 2667 var reNoMatch = /($^)/; 2668 var reUnescapedString = /['\n\r\u2028\u2029\\]/g; 2669 var rsAstralRange = "\\ud800-\\udfff", rsComboMarksRange = "\\u0300-\\u036f", reComboHalfMarksRange = "\\ufe20-\\ufe2f", rsComboSymbolsRange = "\\u20d0-\\u20ff", rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, rsDingbatRange = "\\u2700-\\u27bf", rsLowerRange = "a-z\\xdf-\\xf6\\xf8-\\xff", rsMathOpRange = "\\xac\\xb1\\xd7\\xf7", rsNonCharRange = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", rsPunctuationRange = "\\u2000-\\u206f", rsSpaceRange = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", rsUpperRange = "A-Z\\xc0-\\xd6\\xd8-\\xde", rsVarRange = "\\ufe0e\\ufe0f", rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange; 2670 var rsApos = "['\u2019]", rsAstral = "[" + rsAstralRange + "]", rsBreak = "[" + rsBreakRange + "]", rsCombo = "[" + rsComboRange + "]", rsDigits = "\\d+", rsDingbat = "[" + rsDingbatRange + "]", rsLower = "[" + rsLowerRange + "]", rsMisc = "[^" + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + "]", rsFitz = "\\ud83c[\\udffb-\\udfff]", rsModifier = "(?:" + rsCombo + "|" + rsFitz + ")", rsNonAstral = "[^" + rsAstralRange + "]", rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}", rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]", rsUpper = "[" + rsUpperRange + "]", rsZWJ = "\\u200d"; 2671 var rsMiscLower = "(?:" + rsLower + "|" + rsMisc + ")", rsMiscUpper = "(?:" + rsUpper + "|" + rsMisc + ")", rsOptContrLower = "(?:" + rsApos + "(?:d|ll|m|re|s|t|ve))?", rsOptContrUpper = "(?:" + rsApos + "(?:D|LL|M|RE|S|T|VE))?", reOptMod = rsModifier + "?", rsOptVar = "[" + rsVarRange + "]?", rsOptJoin = "(?:" + rsZWJ + "(?:" + [rsNonAstral, rsRegional, rsSurrPair].join("|") + ")" + rsOptVar + reOptMod + ")*", rsOrdLower = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", rsOrdUpper = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", rsSeq = rsOptVar + reOptMod + rsOptJoin, rsEmoji = "(?:" + [rsDingbat, rsRegional, rsSurrPair].join("|") + ")" + rsSeq, rsSymbol = "(?:" + [rsNonAstral + rsCombo + "?", rsCombo, rsRegional, rsSurrPair, rsAstral].join("|") + ")"; 2672 var reApos = RegExp(rsApos, "g"); 2673 var reComboMark = RegExp(rsCombo, "g"); 2674 var reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g"); 2675 var reUnicodeWord = RegExp([ 2676 rsUpper + "?" + rsLower + "+" + rsOptContrLower + "(?=" + [rsBreak, rsUpper, "$"].join("|") + ")", 2677 rsMiscUpper + "+" + rsOptContrUpper + "(?=" + [rsBreak, rsUpper + rsMiscLower, "$"].join("|") + ")", 2678 rsUpper + "?" + rsMiscLower + "+" + rsOptContrLower, 2679 rsUpper + "+" + rsOptContrUpper, 2680 rsOrdUpper, 2681 rsOrdLower, 2682 rsDigits, 2683 rsEmoji 2684 ].join("|"), "g"); 2685 var reHasUnicode = RegExp("[" + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + "]"); 2686 var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/; 2687 var contextProps = [ 2688 "Array", 2689 "Buffer", 2690 "DataView", 2691 "Date", 2692 "Error", 2693 "Float32Array", 2694 "Float64Array", 2695 "Function", 2696 "Int8Array", 2697 "Int16Array", 2698 "Int32Array", 2699 "Map", 2700 "Math", 2701 "Object", 2702 "Promise", 2703 "RegExp", 2704 "Set", 2705 "String", 2706 "Symbol", 2707 "TypeError", 2708 "Uint8Array", 2709 "Uint8ClampedArray", 2710 "Uint16Array", 2711 "Uint32Array", 2712 "WeakMap", 2713 "_", 2714 "clearTimeout", 2715 "isFinite", 2716 "parseInt", 2717 "setTimeout" 2718 ]; 2719 var templateCounter = -1; 2720 var typedArrayTags = {}; 2721 typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true; 2722 typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false; 2723 var cloneableTags = {}; 2724 cloneableTags[argsTag] = cloneableTags[arrayTag] = cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = cloneableTags[boolTag] = cloneableTags[dateTag] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag] = cloneableTags[numberTag] = cloneableTags[objectTag] = cloneableTags[regexpTag] = cloneableTags[setTag] = cloneableTags[stringTag] = cloneableTags[symbolTag] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; 2725 cloneableTags[errorTag] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false; 2726 var deburredLetters = { 2727 // Latin-1 Supplement block. 2728 "\xC0": "A", 2729 "\xC1": "A", 2730 "\xC2": "A", 2731 "\xC3": "A", 2732 "\xC4": "A", 2733 "\xC5": "A", 2734 "\xE0": "a", 2735 "\xE1": "a", 2736 "\xE2": "a", 2737 "\xE3": "a", 2738 "\xE4": "a", 2739 "\xE5": "a", 2740 "\xC7": "C", 2741 "\xE7": "c", 2742 "\xD0": "D", 2743 "\xF0": "d", 2744 "\xC8": "E", 2745 "\xC9": "E", 2746 "\xCA": "E", 2747 "\xCB": "E", 2748 "\xE8": "e", 2749 "\xE9": "e", 2750 "\xEA": "e", 2751 "\xEB": "e", 2752 "\xCC": "I", 2753 "\xCD": "I", 2754 "\xCE": "I", 2755 "\xCF": "I", 2756 "\xEC": "i", 2757 "\xED": "i", 2758 "\xEE": "i", 2759 "\xEF": "i", 2760 "\xD1": "N", 2761 "\xF1": "n", 2762 "\xD2": "O", 2763 "\xD3": "O", 2764 "\xD4": "O", 2765 "\xD5": "O", 2766 "\xD6": "O", 2767 "\xD8": "O", 2768 "\xF2": "o", 2769 "\xF3": "o", 2770 "\xF4": "o", 2771 "\xF5": "o", 2772 "\xF6": "o", 2773 "\xF8": "o", 2774 "\xD9": "U", 2775 "\xDA": "U", 2776 "\xDB": "U", 2777 "\xDC": "U", 2778 "\xF9": "u", 2779 "\xFA": "u", 2780 "\xFB": "u", 2781 "\xFC": "u", 2782 "\xDD": "Y", 2783 "\xFD": "y", 2784 "\xFF": "y", 2785 "\xC6": "Ae", 2786 "\xE6": "ae", 2787 "\xDE": "Th", 2788 "\xFE": "th", 2789 "\xDF": "ss", 2790 // Latin Extended-A block. 2791 "\u0100": "A", 2792 "\u0102": "A", 2793 "\u0104": "A", 2794 "\u0101": "a", 2795 "\u0103": "a", 2796 "\u0105": "a", 2797 "\u0106": "C", 2798 "\u0108": "C", 2799 "\u010A": "C", 2800 "\u010C": "C", 2801 "\u0107": "c", 2802 "\u0109": "c", 2803 "\u010B": "c", 2804 "\u010D": "c", 2805 "\u010E": "D", 2806 "\u0110": "D", 2807 "\u010F": "d", 2808 "\u0111": "d", 2809 "\u0112": "E", 2810 "\u0114": "E", 2811 "\u0116": "E", 2812 "\u0118": "E", 2813 "\u011A": "E", 2814 "\u0113": "e", 2815 "\u0115": "e", 2816 "\u0117": "e", 2817 "\u0119": "e", 2818 "\u011B": "e", 2819 "\u011C": "G", 2820 "\u011E": "G", 2821 "\u0120": "G", 2822 "\u0122": "G", 2823 "\u011D": "g", 2824 "\u011F": "g", 2825 "\u0121": "g", 2826 "\u0123": "g", 2827 "\u0124": "H", 2828 "\u0126": "H", 2829 "\u0125": "h", 2830 "\u0127": "h", 2831 "\u0128": "I", 2832 "\u012A": "I", 2833 "\u012C": "I", 2834 "\u012E": "I", 2835 "\u0130": "I", 2836 "\u0129": "i", 2837 "\u012B": "i", 2838 "\u012D": "i", 2839 "\u012F": "i", 2840 "\u0131": "i", 2841 "\u0134": "J", 2842 "\u0135": "j", 2843 "\u0136": "K", 2844 "\u0137": "k", 2845 "\u0138": "k", 2846 "\u0139": "L", 2847 "\u013B": "L", 2848 "\u013D": "L", 2849 "\u013F": "L", 2850 "\u0141": "L", 2851 "\u013A": "l", 2852 "\u013C": "l", 2853 "\u013E": "l", 2854 "\u0140": "l", 2855 "\u0142": "l", 2856 "\u0143": "N", 2857 "\u0145": "N", 2858 "\u0147": "N", 2859 "\u014A": "N", 2860 "\u0144": "n", 2861 "\u0146": "n", 2862 "\u0148": "n", 2863 "\u014B": "n", 2864 "\u014C": "O", 2865 "\u014E": "O", 2866 "\u0150": "O", 2867 "\u014D": "o", 2868 "\u014F": "o", 2869 "\u0151": "o", 2870 "\u0154": "R", 2871 "\u0156": "R", 2872 "\u0158": "R", 2873 "\u0155": "r", 2874 "\u0157": "r", 2875 "\u0159": "r", 2876 "\u015A": "S", 2877 "\u015C": "S", 2878 "\u015E": "S", 2879 "\u0160": "S", 2880 "\u015B": "s", 2881 "\u015D": "s", 2882 "\u015F": "s", 2883 "\u0161": "s", 2884 "\u0162": "T", 2885 "\u0164": "T", 2886 "\u0166": "T", 2887 "\u0163": "t", 2888 "\u0165": "t", 2889 "\u0167": "t", 2890 "\u0168": "U", 2891 "\u016A": "U", 2892 "\u016C": "U", 2893 "\u016E": "U", 2894 "\u0170": "U", 2895 "\u0172": "U", 2896 "\u0169": "u", 2897 "\u016B": "u", 2898 "\u016D": "u", 2899 "\u016F": "u", 2900 "\u0171": "u", 2901 "\u0173": "u", 2902 "\u0174": "W", 2903 "\u0175": "w", 2904 "\u0176": "Y", 2905 "\u0177": "y", 2906 "\u0178": "Y", 2907 "\u0179": "Z", 2908 "\u017B": "Z", 2909 "\u017D": "Z", 2910 "\u017A": "z", 2911 "\u017C": "z", 2912 "\u017E": "z", 2913 "\u0132": "IJ", 2914 "\u0133": "ij", 2915 "\u0152": "Oe", 2916 "\u0153": "oe", 2917 "\u0149": "'n", 2918 "\u017F": "s" 2919 }; 2920 var htmlEscapes = { 2921 "&": "&", 2922 "<": "<", 2923 ">": ">", 2924 '"': """, 2925 "'": "'" 2926 }; 2927 var htmlUnescapes = { 2928 "&": "&", 2929 "<": "<", 2930 ">": ">", 2931 """: '"', 2932 "'": "'" 2933 }; 2934 var stringEscapes = { 2935 "\\": "\\", 2936 "'": "'", 2937 "\n": "n", 2938 "\r": "r", 2939 "\u2028": "u2028", 2940 "\u2029": "u2029" 2941 }; 2942 var freeParseFloat = parseFloat, freeParseInt = parseInt; 2943 var freeGlobal = typeof global == "object" && global && global.Object === Object && global; 2944 var freeSelf = typeof self == "object" && self && self.Object === Object && self; 2945 var root = freeGlobal || freeSelf || Function("return this")(); 2946 var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports; 2947 var freeModule = freeExports && typeof module2 == "object" && module2 && !module2.nodeType && module2; 2948 var moduleExports = freeModule && freeModule.exports === freeExports; 2949 var freeProcess = moduleExports && freeGlobal.process; 2950 var nodeUtil = function() { 2951 try { 2952 var types = freeModule && freeModule.require && freeModule.require("util").types; 2953 if (types) { 2954 return types; 2955 } 2956 return freeProcess && freeProcess.binding && freeProcess.binding("util"); 2957 } catch (e) { 2958 } 2959 }(); 2960 var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer, nodeIsDate = nodeUtil && nodeUtil.isDate, nodeIsMap = nodeUtil && nodeUtil.isMap, nodeIsRegExp = nodeUtil && nodeUtil.isRegExp, nodeIsSet = nodeUtil && nodeUtil.isSet, nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; 2961 function apply(func, thisArg, args) { 2962 switch (args.length) { 2963 case 0: 2964 return func.call(thisArg); 2965 case 1: 2966 return func.call(thisArg, args[0]); 2967 case 2: 2968 return func.call(thisArg, args[0], args[1]); 2969 case 3: 2970 return func.call(thisArg, args[0], args[1], args[2]); 2971 } 2972 return func.apply(thisArg, args); 2973 } 2974 function arrayAggregator(array, setter, iteratee, accumulator) { 2975 var index = -1, length = array == null ? 0 : array.length; 2976 while (++index < length) { 2977 var value = array[index]; 2978 setter(accumulator, value, iteratee(value), array); 2979 } 2980 return accumulator; 2981 } 2982 function arrayEach(array, iteratee) { 2983 var index = -1, length = array == null ? 0 : array.length; 2984 while (++index < length) { 2985 if (iteratee(array[index], index, array) === false) { 2986 break; 2987 } 2988 } 2989 return array; 2990 } 2991 function arrayEachRight(array, iteratee) { 2992 var length = array == null ? 0 : array.length; 2993 while (length--) { 2994 if (iteratee(array[length], length, array) === false) { 2995 break; 2996 } 2997 } 2998 return array; 2999 } 3000 function arrayEvery(array, predicate) { 3001 var index = -1, length = array == null ? 0 : array.length; 3002 while (++index < length) { 3003 if (!predicate(array[index], index, array)) { 3004 return false; 3005 } 3006 } 3007 return true; 3008 } 3009 function arrayFilter(array, predicate) { 3010 var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = []; 3011 while (++index < length) { 3012 var value = array[index]; 3013 if (predicate(value, index, array)) { 3014 result[resIndex++] = value; 3015 } 3016 } 3017 return result; 3018 } 3019 function arrayIncludes(array, value) { 3020 var length = array == null ? 0 : array.length; 3021 return !!length && baseIndexOf(array, value, 0) > -1; 3022 } 3023 function arrayIncludesWith(array, value, comparator) { 3024 var index = -1, length = array == null ? 0 : array.length; 3025 while (++index < length) { 3026 if (comparator(value, array[index])) { 3027 return true; 3028 } 3029 } 3030 return false; 3031 } 3032 function arrayMap(array, iteratee) { 3033 var index = -1, length = array == null ? 0 : array.length, result = Array(length); 3034 while (++index < length) { 3035 result[index] = iteratee(array[index], index, array); 3036 } 3037 return result; 3038 } 3039 function arrayPush(array, values) { 3040 var index = -1, length = values.length, offset = array.length; 3041 while (++index < length) { 3042 array[offset + index] = values[index]; 3043 } 3044 return array; 3045 } 3046 function arrayReduce(array, iteratee, accumulator, initAccum) { 3047 var index = -1, length = array == null ? 0 : array.length; 3048 if (initAccum && length) { 3049 accumulator = array[++index]; 3050 } 3051 while (++index < length) { 3052 accumulator = iteratee(accumulator, array[index], index, array); 3053 } 3054 return accumulator; 3055 } 3056 function arrayReduceRight(array, iteratee, accumulator, initAccum) { 3057 var length = array == null ? 0 : array.length; 3058 if (initAccum && length) { 3059 accumulator = array[--length]; 3060 } 3061 while (length--) { 3062 accumulator = iteratee(accumulator, array[length], length, array); 3063 } 3064 return accumulator; 3065 } 3066 function arraySome(array, predicate) { 3067 var index = -1, length = array == null ? 0 : array.length; 3068 while (++index < length) { 3069 if (predicate(array[index], index, array)) { 3070 return true; 3071 } 3072 } 3073 return false; 3074 } 3075 var asciiSize = baseProperty("length"); 3076 function asciiToArray(string) { 3077 return string.split(""); 3078 } 3079 function asciiWords(string) { 3080 return string.match(reAsciiWord) || []; 3081 } 3082 function baseFindKey(collection, predicate, eachFunc) { 3083 var result; 3084 eachFunc(collection, function(value, key, collection2) { 3085 if (predicate(value, key, collection2)) { 3086 result = key; 3087 return false; 3088 } 3089 }); 3090 return result; 3091 } 3092 function baseFindIndex(array, predicate, fromIndex, fromRight) { 3093 var length = array.length, index = fromIndex + (fromRight ? 1 : -1); 3094 while (fromRight ? index-- : ++index < length) { 3095 if (predicate(array[index], index, array)) { 3096 return index; 3097 } 3098 } 3099 return -1; 3100 } 3101 function baseIndexOf(array, value, fromIndex) { 3102 return value === value ? strictIndexOf(array, value, fromIndex) : baseFindIndex(array, baseIsNaN, fromIndex); 3103 } 3104 function baseIndexOfWith(array, value, fromIndex, comparator) { 3105 var index = fromIndex - 1, length = array.length; 3106 while (++index < length) { 3107 if (comparator(array[index], value)) { 3108 return index; 3109 } 3110 } 3111 return -1; 3112 } 3113 function baseIsNaN(value) { 3114 return value !== value; 3115 } 3116 function baseMean(array, iteratee) { 3117 var length = array == null ? 0 : array.length; 3118 return length ? baseSum(array, iteratee) / length : NAN; 3119 } 3120 function baseProperty(key) { 3121 return function(object) { 3122 return object == null ? undefined2 : object[key]; 3123 }; 3124 } 3125 function basePropertyOf(object) { 3126 return function(key) { 3127 return object == null ? undefined2 : object[key]; 3128 }; 3129 } 3130 function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) { 3131 eachFunc(collection, function(value, index, collection2) { 3132 accumulator = initAccum ? (initAccum = false, value) : iteratee(accumulator, value, index, collection2); 3133 }); 3134 return accumulator; 3135 } 3136 function baseSortBy(array, comparer) { 3137 var length = array.length; 3138 array.sort(comparer); 3139 while (length--) { 3140 array[length] = array[length].value; 3141 } 3142 return array; 3143 } 3144 function baseSum(array, iteratee) { 3145 var result, index = -1, length = array.length; 3146 while (++index < length) { 3147 var current = iteratee(array[index]); 3148 if (current !== undefined2) { 3149 result = result === undefined2 ? current : result + current; 3150 } 3151 } 3152 return result; 3153 } 3154 function baseTimes(n, iteratee) { 3155 var index = -1, result = Array(n); 3156 while (++index < n) { 3157 result[index] = iteratee(index); 3158 } 3159 return result; 3160 } 3161 function baseToPairs(object, props) { 3162 return arrayMap(props, function(key) { 3163 return [key, object[key]]; 3164 }); 3165 } 3166 function baseTrim(string) { 3167 return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, "") : string; 3168 } 3169 function baseUnary(func) { 3170 return function(value) { 3171 return func(value); 3172 }; 3173 } 3174 function baseValues(object, props) { 3175 return arrayMap(props, function(key) { 3176 return object[key]; 3177 }); 3178 } 3179 function cacheHas(cache, key) { 3180 return cache.has(key); 3181 } 3182 function charsStartIndex(strSymbols, chrSymbols) { 3183 var index = -1, length = strSymbols.length; 3184 while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) { 3185 } 3186 return index; 3187 } 3188 function charsEndIndex(strSymbols, chrSymbols) { 3189 var index = strSymbols.length; 3190 while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) { 3191 } 3192 return index; 3193 } 3194 function countHolders(array, placeholder) { 3195 var length = array.length, result = 0; 3196 while (length--) { 3197 if (array[length] === placeholder) { 3198 ++result; 3199 } 3200 } 3201 return result; 3202 } 3203 var deburrLetter = basePropertyOf(deburredLetters); 3204 var escapeHtmlChar = basePropertyOf(htmlEscapes); 3205 function escapeStringChar(chr) { 3206 return "\\" + stringEscapes[chr]; 3207 } 3208 function getValue(object, key) { 3209 return object == null ? undefined2 : object[key]; 3210 } 3211 function hasUnicode(string) { 3212 return reHasUnicode.test(string); 3213 } 3214 function hasUnicodeWord(string) { 3215 return reHasUnicodeWord.test(string); 3216 } 3217 function iteratorToArray(iterator) { 3218 var data, result = []; 3219 while (!(data = iterator.next()).done) { 3220 result.push(data.value); 3221 } 3222 return result; 3223 } 3224 function mapToArray(map) { 3225 var index = -1, result = Array(map.size); 3226 map.forEach(function(value, key) { 3227 result[++index] = [key, value]; 3228 }); 3229 return result; 3230 } 3231 function overArg(func, transform) { 3232 return function(arg) { 3233 return func(transform(arg)); 3234 }; 3235 } 3236 function replaceHolders(array, placeholder) { 3237 var index = -1, length = array.length, resIndex = 0, result = []; 3238 while (++index < length) { 3239 var value = array[index]; 3240 if (value === placeholder || value === PLACEHOLDER) { 3241 array[index] = PLACEHOLDER; 3242 result[resIndex++] = index; 3243 } 3244 } 3245 return result; 3246 } 3247 function setToArray(set) { 3248 var index = -1, result = Array(set.size); 3249 set.forEach(function(value) { 3250 result[++index] = value; 3251 }); 3252 return result; 3253 } 3254 function setToPairs(set) { 3255 var index = -1, result = Array(set.size); 3256 set.forEach(function(value) { 3257 result[++index] = [value, value]; 3258 }); 3259 return result; 3260 } 3261 function strictIndexOf(array, value, fromIndex) { 3262 var index = fromIndex - 1, length = array.length; 3263 while (++index < length) { 3264 if (array[index] === value) { 3265 return index; 3266 } 3267 } 3268 return -1; 3269 } 3270 function strictLastIndexOf(array, value, fromIndex) { 3271 var index = fromIndex + 1; 3272 while (index--) { 3273 if (array[index] === value) { 3274 return index; 3275 } 3276 } 3277 return index; 3278 } 3279 function stringSize(string) { 3280 return hasUnicode(string) ? unicodeSize(string) : asciiSize(string); 3281 } 3282 function stringToArray(string) { 3283 return hasUnicode(string) ? unicodeToArray(string) : asciiToArray(string); 3284 } 3285 function trimmedEndIndex(string) { 3286 var index = string.length; 3287 while (index-- && reWhitespace.test(string.charAt(index))) { 3288 } 3289 return index; 3290 } 3291 var unescapeHtmlChar = basePropertyOf(htmlUnescapes); 3292 function unicodeSize(string) { 3293 var result = reUnicode.lastIndex = 0; 3294 while (reUnicode.test(string)) { 3295 ++result; 3296 } 3297 return result; 3298 } 3299 function unicodeToArray(string) { 3300 return string.match(reUnicode) || []; 3301 } 3302 function unicodeWords(string) { 3303 return string.match(reUnicodeWord) || []; 3304 } 3305 var runInContext = function runInContext2(context) { 3306 context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps)); 3307 var Array2 = context.Array, Date2 = context.Date, Error2 = context.Error, Function2 = context.Function, Math2 = context.Math, Object2 = context.Object, RegExp2 = context.RegExp, String2 = context.String, TypeError2 = context.TypeError; 3308 var arrayProto = Array2.prototype, funcProto = Function2.prototype, objectProto = Object2.prototype; 3309 var coreJsData = context["__core-js_shared__"]; 3310 var funcToString = funcProto.toString; 3311 var hasOwnProperty = objectProto.hasOwnProperty; 3312 var idCounter = 0; 3313 var maskSrcKey = function() { 3314 var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ""); 3315 return uid ? "Symbol(src)_1." + uid : ""; 3316 }(); 3317 var nativeObjectToString = objectProto.toString; 3318 var objectCtorString = funcToString.call(Object2); 3319 var oldDash = root._; 3320 var reIsNative = RegExp2( 3321 "^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" 3322 ); 3323 var Buffer2 = moduleExports ? context.Buffer : undefined2, Symbol2 = context.Symbol, Uint8Array2 = context.Uint8Array, allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : undefined2, getPrototype = overArg(Object2.getPrototypeOf, Object2), objectCreate = Object2.create, propertyIsEnumerable = objectProto.propertyIsEnumerable, splice = arrayProto.splice, spreadableSymbol = Symbol2 ? Symbol2.isConcatSpreadable : undefined2, symIterator = Symbol2 ? Symbol2.iterator : undefined2, symToStringTag = Symbol2 ? Symbol2.toStringTag : undefined2; 3324 var defineProperty = function() { 3325 try { 3326 var func = getNative(Object2, "defineProperty"); 3327 func({}, "", {}); 3328 return func; 3329 } catch (e) { 3330 } 3331 }(); 3332 var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout, ctxNow = Date2 && Date2.now !== root.Date.now && Date2.now, ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout; 3333 var nativeCeil = Math2.ceil, nativeFloor = Math2.floor, nativeGetSymbols = Object2.getOwnPropertySymbols, nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : undefined2, nativeIsFinite = context.isFinite, nativeJoin = arrayProto.join, nativeKeys = overArg(Object2.keys, Object2), nativeMax = Math2.max, nativeMin = Math2.min, nativeNow = Date2.now, nativeParseInt = context.parseInt, nativeRandom = Math2.random, nativeReverse = arrayProto.reverse; 3334 var DataView = getNative(context, "DataView"), Map = getNative(context, "Map"), Promise2 = getNative(context, "Promise"), Set2 = getNative(context, "Set"), WeakMap = getNative(context, "WeakMap"), nativeCreate = getNative(Object2, "create"); 3335 var metaMap = WeakMap && new WeakMap(); 3336 var realNames = {}; 3337 var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map), promiseCtorString = toSource(Promise2), setCtorString = toSource(Set2), weakMapCtorString = toSource(WeakMap); 3338 var symbolProto = Symbol2 ? Symbol2.prototype : undefined2, symbolValueOf = symbolProto ? symbolProto.valueOf : undefined2, symbolToString = symbolProto ? symbolProto.toString : undefined2; 3339 function lodash(value) { 3340 if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) { 3341 if (value instanceof LodashWrapper) { 3342 return value; 3343 } 3344 if (hasOwnProperty.call(value, "__wrapped__")) { 3345 return wrapperClone(value); 3346 } 3347 } 3348 return new LodashWrapper(value); 3349 } 3350 var baseCreate = /* @__PURE__ */ function() { 3351 function object() { 3352 } 3353 return function(proto) { 3354 if (!isObject(proto)) { 3355 return {}; 3356 } 3357 if (objectCreate) { 3358 return objectCreate(proto); 3359 } 3360 object.prototype = proto; 3361 var result2 = new object(); 3362 object.prototype = undefined2; 3363 return result2; 3364 }; 3365 }(); 3366 function baseLodash() { 3367 } 3368 function LodashWrapper(value, chainAll) { 3369 this.__wrapped__ = value; 3370 this.__actions__ = []; 3371 this.__chain__ = !!chainAll; 3372 this.__index__ = 0; 3373 this.__values__ = undefined2; 3374 } 3375 lodash.templateSettings = { 3376 /** 3377 * Used to detect `data` property values to be HTML-escaped. 3378 * 3379 * @memberOf _.templateSettings 3380 * @type {RegExp} 3381 */ 3382 "escape": reEscape, 3383 /** 3384 * Used to detect code to be evaluated. 3385 * 3386 * @memberOf _.templateSettings 3387 * @type {RegExp} 3388 */ 3389 "evaluate": reEvaluate, 3390 /** 3391 * Used to detect `data` property values to inject. 3392 * 3393 * @memberOf _.templateSettings 3394 * @type {RegExp} 3395 */ 3396 "interpolate": reInterpolate, 3397 /** 3398 * Used to reference the data object in the template text. 3399 * 3400 * @memberOf _.templateSettings 3401 * @type {string} 3402 */ 3403 "variable": "", 3404 /** 3405 * Used to import variables into the compiled template. 3406 * 3407 * @memberOf _.templateSettings 3408 * @type {Object} 3409 */ 3410 "imports": { 3411 /** 3412 * A reference to the `lodash` function. 3413 * 3414 * @memberOf _.templateSettings.imports 3415 * @type {Function} 3416 */ 3417 "_": lodash 3418 } 3419 }; 3420 lodash.prototype = baseLodash.prototype; 3421 lodash.prototype.constructor = lodash; 3422 LodashWrapper.prototype = baseCreate(baseLodash.prototype); 3423 LodashWrapper.prototype.constructor = LodashWrapper; 3424 function LazyWrapper(value) { 3425 this.__wrapped__ = value; 3426 this.__actions__ = []; 3427 this.__dir__ = 1; 3428 this.__filtered__ = false; 3429 this.__iteratees__ = []; 3430 this.__takeCount__ = MAX_ARRAY_LENGTH; 3431 this.__views__ = []; 3432 } 3433 function lazyClone() { 3434 var result2 = new LazyWrapper(this.__wrapped__); 3435 result2.__actions__ = copyArray(this.__actions__); 3436 result2.__dir__ = this.__dir__; 3437 result2.__filtered__ = this.__filtered__; 3438 result2.__iteratees__ = copyArray(this.__iteratees__); 3439 result2.__takeCount__ = this.__takeCount__; 3440 result2.__views__ = copyArray(this.__views__); 3441 return result2; 3442 } 3443 function lazyReverse() { 3444 if (this.__filtered__) { 3445 var result2 = new LazyWrapper(this); 3446 result2.__dir__ = -1; 3447 result2.__filtered__ = true; 3448 } else { 3449 result2 = this.clone(); 3450 result2.__dir__ *= -1; 3451 } 3452 return result2; 3453 } 3454 function lazyValue() { 3455 var array = this.__wrapped__.value(), dir = this.__dir__, isArr = isArray(array), isRight = dir < 0, arrLength = isArr ? array.length : 0, view = getView(0, arrLength, this.__views__), start = view.start, end = view.end, length = end - start, index = isRight ? end : start - 1, iteratees = this.__iteratees__, iterLength = iteratees.length, resIndex = 0, takeCount = nativeMin(length, this.__takeCount__); 3456 if (!isArr || !isRight && arrLength == length && takeCount == length) { 3457 return baseWrapperValue(array, this.__actions__); 3458 } 3459 var result2 = []; 3460 outer: 3461 while (length-- && resIndex < takeCount) { 3462 index += dir; 3463 var iterIndex = -1, value = array[index]; 3464 while (++iterIndex < iterLength) { 3465 var data = iteratees[iterIndex], iteratee2 = data.iteratee, type = data.type, computed = iteratee2(value); 3466 if (type == LAZY_MAP_FLAG) { 3467 value = computed; 3468 } else if (!computed) { 3469 if (type == LAZY_FILTER_FLAG) { 3470 continue outer; 3471 } else { 3472 break outer; 3473 } 3474 } 3475 } 3476 result2[resIndex++] = value; 3477 } 3478 return result2; 3479 } 3480 LazyWrapper.prototype = baseCreate(baseLodash.prototype); 3481 LazyWrapper.prototype.constructor = LazyWrapper; 3482 function Hash(entries) { 3483 var index = -1, length = entries == null ? 0 : entries.length; 3484 this.clear(); 3485 while (++index < length) { 3486 var entry = entries[index]; 3487 this.set(entry[0], entry[1]); 3488 } 3489 } 3490 function hashClear() { 3491 this.__data__ = nativeCreate ? nativeCreate(null) : {}; 3492 this.size = 0; 3493 } 3494 function hashDelete(key) { 3495 var result2 = this.has(key) && delete this.__data__[key]; 3496 this.size -= result2 ? 1 : 0; 3497 return result2; 3498 } 3499 function hashGet(key) { 3500 var data = this.__data__; 3501 if (nativeCreate) { 3502 var result2 = data[key]; 3503 return result2 === HASH_UNDEFINED ? undefined2 : result2; 3504 } 3505 return hasOwnProperty.call(data, key) ? data[key] : undefined2; 3506 } 3507 function hashHas(key) { 3508 var data = this.__data__; 3509 return nativeCreate ? data[key] !== undefined2 : hasOwnProperty.call(data, key); 3510 } 3511 function hashSet(key, value) { 3512 var data = this.__data__; 3513 this.size += this.has(key) ? 0 : 1; 3514 data[key] = nativeCreate && value === undefined2 ? HASH_UNDEFINED : value; 3515 return this; 3516 } 3517 Hash.prototype.clear = hashClear; 3518 Hash.prototype["delete"] = hashDelete; 3519 Hash.prototype.get = hashGet; 3520 Hash.prototype.has = hashHas; 3521 Hash.prototype.set = hashSet; 3522 function ListCache(entries) { 3523 var index = -1, length = entries == null ? 0 : entries.length; 3524 this.clear(); 3525 while (++index < length) { 3526 var entry = entries[index]; 3527 this.set(entry[0], entry[1]); 3528 } 3529 } 3530 function listCacheClear() { 3531 this.__data__ = []; 3532 this.size = 0; 3533 } 3534 function listCacheDelete(key) { 3535 var data = this.__data__, index = assocIndexOf(data, key); 3536 if (index < 0) { 3537 return false; 3538 } 3539 var lastIndex = data.length - 1; 3540 if (index == lastIndex) { 3541 data.pop(); 3542 } else { 3543 splice.call(data, index, 1); 3544 } 3545 --this.size; 3546 return true; 3547 } 3548 function listCacheGet(key) { 3549 var data = this.__data__, index = assocIndexOf(data, key); 3550 return index < 0 ? undefined2 : data[index][1]; 3551 } 3552 function listCacheHas(key) { 3553 return assocIndexOf(this.__data__, key) > -1; 3554 } 3555 function listCacheSet(key, value) { 3556 var data = this.__data__, index = assocIndexOf(data, key); 3557 if (index < 0) { 3558 ++this.size; 3559 data.push([key, value]); 3560 } else { 3561 data[index][1] = value; 3562 } 3563 return this; 3564 } 3565 ListCache.prototype.clear = listCacheClear; 3566 ListCache.prototype["delete"] = listCacheDelete; 3567 ListCache.prototype.get = listCacheGet; 3568 ListCache.prototype.has = listCacheHas; 3569 ListCache.prototype.set = listCacheSet; 3570 function MapCache(entries) { 3571 var index = -1, length = entries == null ? 0 : entries.length; 3572 this.clear(); 3573 while (++index < length) { 3574 var entry = entries[index]; 3575 this.set(entry[0], entry[1]); 3576 } 3577 } 3578 function mapCacheClear() { 3579 this.size = 0; 3580 this.__data__ = { 3581 "hash": new Hash(), 3582 "map": new (Map || ListCache)(), 3583 "string": new Hash() 3584 }; 3585 } 3586 function mapCacheDelete(key) { 3587 var result2 = getMapData(this, key)["delete"](key); 3588 this.size -= result2 ? 1 : 0; 3589 return result2; 3590 } 3591 function mapCacheGet(key) { 3592 return getMapData(this, key).get(key); 3593 } 3594 function mapCacheHas(key) { 3595 return getMapData(this, key).has(key); 3596 } 3597 function mapCacheSet(key, value) { 3598 var data = getMapData(this, key), size2 = data.size; 3599 data.set(key, value); 3600 this.size += data.size == size2 ? 0 : 1; 3601 return this; 3602 } 3603 MapCache.prototype.clear = mapCacheClear; 3604 MapCache.prototype["delete"] = mapCacheDelete; 3605 MapCache.prototype.get = mapCacheGet; 3606 MapCache.prototype.has = mapCacheHas; 3607 MapCache.prototype.set = mapCacheSet; 3608 function SetCache(values2) { 3609 var index = -1, length = values2 == null ? 0 : values2.length; 3610 this.__data__ = new MapCache(); 3611 while (++index < length) { 3612 this.add(values2[index]); 3613 } 3614 } 3615 function setCacheAdd(value) { 3616 this.__data__.set(value, HASH_UNDEFINED); 3617 return this; 3618 } 3619 function setCacheHas(value) { 3620 return this.__data__.has(value); 3621 } 3622 SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; 3623 SetCache.prototype.has = setCacheHas; 3624 function Stack(entries) { 3625 var data = this.__data__ = new ListCache(entries); 3626 this.size = data.size; 3627 } 3628 function stackClear() { 3629 this.__data__ = new ListCache(); 3630 this.size = 0; 3631 } 3632 function stackDelete(key) { 3633 var data = this.__data__, result2 = data["delete"](key); 3634 this.size = data.size; 3635 return result2; 3636 } 3637 function stackGet(key) { 3638 return this.__data__.get(key); 3639 } 3640 function stackHas(key) { 3641 return this.__data__.has(key); 3642 } 3643 function stackSet(key, value) { 3644 var data = this.__data__; 3645 if (data instanceof ListCache) { 3646 var pairs = data.__data__; 3647 if (!Map || pairs.length < LARGE_ARRAY_SIZE - 1) { 3648 pairs.push([key, value]); 3649 this.size = ++data.size; 3650 return this; 3651 } 3652 data = this.__data__ = new MapCache(pairs); 3653 } 3654 data.set(key, value); 3655 this.size = data.size; 3656 return this; 3657 } 3658 Stack.prototype.clear = stackClear; 3659 Stack.prototype["delete"] = stackDelete; 3660 Stack.prototype.get = stackGet; 3661 Stack.prototype.has = stackHas; 3662 Stack.prototype.set = stackSet; 3663 function arrayLikeKeys(value, inherited) { 3664 var isArr = isArray(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result2 = skipIndexes ? baseTimes(value.length, String2) : [], length = result2.length; 3665 for (var key in value) { 3666 if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode. 3667 (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers. 3668 isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays. 3669 isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties. 3670 isIndex(key, length)))) { 3671 result2.push(key); 3672 } 3673 } 3674 return result2; 3675 } 3676 function arraySample(array) { 3677 var length = array.length; 3678 return length ? array[baseRandom(0, length - 1)] : undefined2; 3679 } 3680 function arraySampleSize(array, n) { 3681 return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length)); 3682 } 3683 function arrayShuffle(array) { 3684 return shuffleSelf(copyArray(array)); 3685 } 3686 function assignMergeValue(object, key, value) { 3687 if (value !== undefined2 && !eq(object[key], value) || value === undefined2 && !(key in object)) { 3688 baseAssignValue(object, key, value); 3689 } 3690 } 3691 function assignValue(object, key, value) { 3692 var objValue = object[key]; 3693 if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || value === undefined2 && !(key in object)) { 3694 baseAssignValue(object, key, value); 3695 } 3696 } 3697 function assocIndexOf(array, key) { 3698 var length = array.length; 3699 while (length--) { 3700 if (eq(array[length][0], key)) { 3701 return length; 3702 } 3703 } 3704 return -1; 3705 } 3706 function baseAggregator(collection, setter, iteratee2, accumulator) { 3707 baseEach(collection, function(value, key, collection2) { 3708 setter(accumulator, value, iteratee2(value), collection2); 3709 }); 3710 return accumulator; 3711 } 3712 function baseAssign(object, source) { 3713 return object && copyObject(source, keys(source), object); 3714 } 3715 function baseAssignIn(object, source) { 3716 return object && copyObject(source, keysIn(source), object); 3717 } 3718 function baseAssignValue(object, key, value) { 3719 if (key == "__proto__" && defineProperty) { 3720 defineProperty(object, key, { 3721 "configurable": true, 3722 "enumerable": true, 3723 "value": value, 3724 "writable": true 3725 }); 3726 } else { 3727 object[key] = value; 3728 } 3729 } 3730 function baseAt(object, paths) { 3731 var index = -1, length = paths.length, result2 = Array2(length), skip = object == null; 3732 while (++index < length) { 3733 result2[index] = skip ? undefined2 : get(object, paths[index]); 3734 } 3735 return result2; 3736 } 3737 function baseClamp(number, lower, upper) { 3738 if (number === number) { 3739 if (upper !== undefined2) { 3740 number = number <= upper ? number : upper; 3741 } 3742 if (lower !== undefined2) { 3743 number = number >= lower ? number : lower; 3744 } 3745 } 3746 return number; 3747 } 3748 function baseClone(value, bitmask, customizer, key, object, stack) { 3749 var result2, isDeep = bitmask & CLONE_DEEP_FLAG, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG; 3750 if (customizer) { 3751 result2 = object ? customizer(value, key, object, stack) : customizer(value); 3752 } 3753 if (result2 !== undefined2) { 3754 return result2; 3755 } 3756 if (!isObject(value)) { 3757 return value; 3758 } 3759 var isArr = isArray(value); 3760 if (isArr) { 3761 result2 = initCloneArray(value); 3762 if (!isDeep) { 3763 return copyArray(value, result2); 3764 } 3765 } else { 3766 var tag = getTag(value), isFunc = tag == funcTag || tag == genTag; 3767 if (isBuffer(value)) { 3768 return cloneBuffer(value, isDeep); 3769 } 3770 if (tag == objectTag || tag == argsTag || isFunc && !object) { 3771 result2 = isFlat || isFunc ? {} : initCloneObject(value); 3772 if (!isDeep) { 3773 return isFlat ? copySymbolsIn(value, baseAssignIn(result2, value)) : copySymbols(value, baseAssign(result2, value)); 3774 } 3775 } else { 3776 if (!cloneableTags[tag]) { 3777 return object ? value : {}; 3778 } 3779 result2 = initCloneByTag(value, tag, isDeep); 3780 } 3781 } 3782 stack || (stack = new Stack()); 3783 var stacked = stack.get(value); 3784 if (stacked) { 3785 return stacked; 3786 } 3787 stack.set(value, result2); 3788 if (isSet(value)) { 3789 value.forEach(function(subValue) { 3790 result2.add(baseClone(subValue, bitmask, customizer, subValue, value, stack)); 3791 }); 3792 } else if (isMap(value)) { 3793 value.forEach(function(subValue, key2) { 3794 result2.set(key2, baseClone(subValue, bitmask, customizer, key2, value, stack)); 3795 }); 3796 } 3797 var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys; 3798 var props = isArr ? undefined2 : keysFunc(value); 3799 arrayEach(props || value, function(subValue, key2) { 3800 if (props) { 3801 key2 = subValue; 3802 subValue = value[key2]; 3803 } 3804 assignValue(result2, key2, baseClone(subValue, bitmask, customizer, key2, value, stack)); 3805 }); 3806 return result2; 3807 } 3808 function baseConforms(source) { 3809 var props = keys(source); 3810 return function(object) { 3811 return baseConformsTo(object, source, props); 3812 }; 3813 } 3814 function baseConformsTo(object, source, props) { 3815 var length = props.length; 3816 if (object == null) { 3817 return !length; 3818 } 3819 object = Object2(object); 3820 while (length--) { 3821 var key = props[length], predicate = source[key], value = object[key]; 3822 if (value === undefined2 && !(key in object) || !predicate(value)) { 3823 return false; 3824 } 3825 } 3826 return true; 3827 } 3828 function baseDelay(func, wait, args) { 3829 if (typeof func != "function") { 3830 throw new TypeError2(FUNC_ERROR_TEXT); 3831 } 3832 return setTimeout(function() { 3833 func.apply(undefined2, args); 3834 }, wait); 3835 } 3836 function baseDifference(array, values2, iteratee2, comparator) { 3837 var index = -1, includes2 = arrayIncludes, isCommon = true, length = array.length, result2 = [], valuesLength = values2.length; 3838 if (!length) { 3839 return result2; 3840 } 3841 if (iteratee2) { 3842 values2 = arrayMap(values2, baseUnary(iteratee2)); 3843 } 3844 if (comparator) { 3845 includes2 = arrayIncludesWith; 3846 isCommon = false; 3847 } else if (values2.length >= LARGE_ARRAY_SIZE) { 3848 includes2 = cacheHas; 3849 isCommon = false; 3850 values2 = new SetCache(values2); 3851 } 3852 outer: 3853 while (++index < length) { 3854 var value = array[index], computed = iteratee2 == null ? value : iteratee2(value); 3855 value = comparator || value !== 0 ? value : 0; 3856 if (isCommon && computed === computed) { 3857 var valuesIndex = valuesLength; 3858 while (valuesIndex--) { 3859 if (values2[valuesIndex] === computed) { 3860 continue outer; 3861 } 3862 } 3863 result2.push(value); 3864 } else if (!includes2(values2, computed, comparator)) { 3865 result2.push(value); 3866 } 3867 } 3868 return result2; 3869 } 3870 var baseEach = createBaseEach(baseForOwn); 3871 var baseEachRight = createBaseEach(baseForOwnRight, true); 3872 function baseEvery(collection, predicate) { 3873 var result2 = true; 3874 baseEach(collection, function(value, index, collection2) { 3875 result2 = !!predicate(value, index, collection2); 3876 return result2; 3877 }); 3878 return result2; 3879 } 3880 function baseExtremum(array, iteratee2, comparator) { 3881 var index = -1, length = array.length; 3882 while (++index < length) { 3883 var value = array[index], current = iteratee2(value); 3884 if (current != null && (computed === undefined2 ? current === current && !isSymbol(current) : comparator(current, computed))) { 3885 var computed = current, result2 = value; 3886 } 3887 } 3888 return result2; 3889 } 3890 function baseFill(array, value, start, end) { 3891 var length = array.length; 3892 start = toInteger(start); 3893 if (start < 0) { 3894 start = -start > length ? 0 : length + start; 3895 } 3896 end = end === undefined2 || end > length ? length : toInteger(end); 3897 if (end < 0) { 3898 end += length; 3899 } 3900 end = start > end ? 0 : toLength(end); 3901 while (start < end) { 3902 array[start++] = value; 3903 } 3904 return array; 3905 } 3906 function baseFilter(collection, predicate) { 3907 var result2 = []; 3908 baseEach(collection, function(value, index, collection2) { 3909 if (predicate(value, index, collection2)) { 3910 result2.push(value); 3911 } 3912 }); 3913 return result2; 3914 } 3915 function baseFlatten(array, depth, predicate, isStrict, result2) { 3916 var index = -1, length = array.length; 3917 predicate || (predicate = isFlattenable); 3918 result2 || (result2 = []); 3919 while (++index < length) { 3920 var value = array[index]; 3921 if (depth > 0 && predicate(value)) { 3922 if (depth > 1) { 3923 baseFlatten(value, depth - 1, predicate, isStrict, result2); 3924 } else { 3925 arrayPush(result2, value); 3926 } 3927 } else if (!isStrict) { 3928 result2[result2.length] = value; 3929 } 3930 } 3931 return result2; 3932 } 3933 var baseFor = createBaseFor(); 3934 var baseForRight = createBaseFor(true); 3935 function baseForOwn(object, iteratee2) { 3936 return object && baseFor(object, iteratee2, keys); 3937 } 3938 function baseForOwnRight(object, iteratee2) { 3939 return object && baseForRight(object, iteratee2, keys); 3940 } 3941 function baseFunctions(object, props) { 3942 return arrayFilter(props, function(key) { 3943 return isFunction(object[key]); 3944 }); 3945 } 3946 function baseGet(object, path) { 3947 path = castPath(path, object); 3948 var index = 0, length = path.length; 3949 while (object != null && index < length) { 3950 object = object[toKey(path[index++])]; 3951 } 3952 return index && index == length ? object : undefined2; 3953 } 3954 function baseGetAllKeys(object, keysFunc, symbolsFunc) { 3955 var result2 = keysFunc(object); 3956 return isArray(object) ? result2 : arrayPush(result2, symbolsFunc(object)); 3957 } 3958 function baseGetTag(value) { 3959 if (value == null) { 3960 return value === undefined2 ? undefinedTag : nullTag; 3961 } 3962 return symToStringTag && symToStringTag in Object2(value) ? getRawTag(value) : objectToString(value); 3963 } 3964 function baseGt(value, other) { 3965 return value > other; 3966 } 3967 function baseHas(object, key) { 3968 return object != null && hasOwnProperty.call(object, key); 3969 } 3970 function baseHasIn(object, key) { 3971 return object != null && key in Object2(object); 3972 } 3973 function baseInRange(number, start, end) { 3974 return number >= nativeMin(start, end) && number < nativeMax(start, end); 3975 } 3976 function baseIntersection(arrays, iteratee2, comparator) { 3977 var includes2 = comparator ? arrayIncludesWith : arrayIncludes, length = arrays[0].length, othLength = arrays.length, othIndex = othLength, caches = Array2(othLength), maxLength = Infinity, result2 = []; 3978 while (othIndex--) { 3979 var array = arrays[othIndex]; 3980 if (othIndex && iteratee2) { 3981 array = arrayMap(array, baseUnary(iteratee2)); 3982 } 3983 maxLength = nativeMin(array.length, maxLength); 3984 caches[othIndex] = !comparator && (iteratee2 || length >= 120 && array.length >= 120) ? new SetCache(othIndex && array) : undefined2; 3985 } 3986 array = arrays[0]; 3987 var index = -1, seen = caches[0]; 3988 outer: 3989 while (++index < length && result2.length < maxLength) { 3990 var value = array[index], computed = iteratee2 ? iteratee2(value) : value; 3991 value = comparator || value !== 0 ? value : 0; 3992 if (!(seen ? cacheHas(seen, computed) : includes2(result2, computed, comparator))) { 3993 othIndex = othLength; 3994 while (--othIndex) { 3995 var cache = caches[othIndex]; 3996 if (!(cache ? cacheHas(cache, computed) : includes2(arrays[othIndex], computed, comparator))) { 3997 continue outer; 3998 } 3999 } 4000 if (seen) { 4001 seen.push(computed); 4002 } 4003 result2.push(value); 4004 } 4005 } 4006 return result2; 4007 } 4008 function baseInverter(object, setter, iteratee2, accumulator) { 4009 baseForOwn(object, function(value, key, object2) { 4010 setter(accumulator, iteratee2(value), key, object2); 4011 }); 4012 return accumulator; 4013 } 4014 function baseInvoke(object, path, args) { 4015 path = castPath(path, object); 4016 object = parent(object, path); 4017 var func = object == null ? object : object[toKey(last(path))]; 4018 return func == null ? undefined2 : apply(func, object, args); 4019 } 4020 function baseIsArguments(value) { 4021 return isObjectLike(value) && baseGetTag(value) == argsTag; 4022 } 4023 function baseIsArrayBuffer(value) { 4024 return isObjectLike(value) && baseGetTag(value) == arrayBufferTag; 4025 } 4026 function baseIsDate(value) { 4027 return isObjectLike(value) && baseGetTag(value) == dateTag; 4028 } 4029 function baseIsEqual(value, other, bitmask, customizer, stack) { 4030 if (value === other) { 4031 return true; 4032 } 4033 if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) { 4034 return value !== value && other !== other; 4035 } 4036 return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack); 4037 } 4038 function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { 4039 var objIsArr = isArray(object), othIsArr = isArray(other), objTag = objIsArr ? arrayTag : getTag(object), othTag = othIsArr ? arrayTag : getTag(other); 4040 objTag = objTag == argsTag ? objectTag : objTag; 4041 othTag = othTag == argsTag ? objectTag : othTag; 4042 var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag; 4043 if (isSameTag && isBuffer(object)) { 4044 if (!isBuffer(other)) { 4045 return false; 4046 } 4047 objIsArr = true; 4048 objIsObj = false; 4049 } 4050 if (isSameTag && !objIsObj) { 4051 stack || (stack = new Stack()); 4052 return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); 4053 } 4054 if (!(bitmask & COMPARE_PARTIAL_FLAG)) { 4055 var objIsWrapped = objIsObj && hasOwnProperty.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty.call(other, "__wrapped__"); 4056 if (objIsWrapped || othIsWrapped) { 4057 var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other; 4058 stack || (stack = new Stack()); 4059 return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); 4060 } 4061 } 4062 if (!isSameTag) { 4063 return false; 4064 } 4065 stack || (stack = new Stack()); 4066 return equalObjects(object, other, bitmask, customizer, equalFunc, stack); 4067 } 4068 function baseIsMap(value) { 4069 return isObjectLike(value) && getTag(value) == mapTag; 4070 } 4071 function baseIsMatch(object, source, matchData, customizer) { 4072 var index = matchData.length, length = index, noCustomizer = !customizer; 4073 if (object == null) { 4074 return !length; 4075 } 4076 object = Object2(object); 4077 while (index--) { 4078 var data = matchData[index]; 4079 if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) { 4080 return false; 4081 } 4082 } 4083 while (++index < length) { 4084 data = matchData[index]; 4085 var key = data[0], objValue = object[key], srcValue = data[1]; 4086 if (noCustomizer && data[2]) { 4087 if (objValue === undefined2 && !(key in object)) { 4088 return false; 4089 } 4090 } else { 4091 var stack = new Stack(); 4092 if (customizer) { 4093 var result2 = customizer(objValue, srcValue, key, object, source, stack); 4094 } 4095 if (!(result2 === undefined2 ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) : result2)) { 4096 return false; 4097 } 4098 } 4099 } 4100 return true; 4101 } 4102 function baseIsNative(value) { 4103 if (!isObject(value) || isMasked(value)) { 4104 return false; 4105 } 4106 var pattern = isFunction(value) ? reIsNative : reIsHostCtor; 4107 return pattern.test(toSource(value)); 4108 } 4109 function baseIsRegExp(value) { 4110 return isObjectLike(value) && baseGetTag(value) == regexpTag; 4111 } 4112 function baseIsSet(value) { 4113 return isObjectLike(value) && getTag(value) == setTag; 4114 } 4115 function baseIsTypedArray(value) { 4116 return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; 4117 } 4118 function baseIteratee(value) { 4119 if (typeof value == "function") { 4120 return value; 4121 } 4122 if (value == null) { 4123 return identity; 4124 } 4125 if (typeof value == "object") { 4126 return isArray(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value); 4127 } 4128 return property(value); 4129 } 4130 function baseKeys(object) { 4131 if (!isPrototype(object)) { 4132 return nativeKeys(object); 4133 } 4134 var result2 = []; 4135 for (var key in Object2(object)) { 4136 if (hasOwnProperty.call(object, key) && key != "constructor") { 4137 result2.push(key); 4138 } 4139 } 4140 return result2; 4141 } 4142 function baseKeysIn(object) { 4143 if (!isObject(object)) { 4144 return nativeKeysIn(object); 4145 } 4146 var isProto = isPrototype(object), result2 = []; 4147 for (var key in object) { 4148 if (!(key == "constructor" && (isProto || !hasOwnProperty.call(object, key)))) { 4149 result2.push(key); 4150 } 4151 } 4152 return result2; 4153 } 4154 function baseLt(value, other) { 4155 return value < other; 4156 } 4157 function baseMap(collection, iteratee2) { 4158 var index = -1, result2 = isArrayLike(collection) ? Array2(collection.length) : []; 4159 baseEach(collection, function(value, key, collection2) { 4160 result2[++index] = iteratee2(value, key, collection2); 4161 }); 4162 return result2; 4163 } 4164 function baseMatches(source) { 4165 var matchData = getMatchData(source); 4166 if (matchData.length == 1 && matchData[0][2]) { 4167 return matchesStrictComparable(matchData[0][0], matchData[0][1]); 4168 } 4169 return function(object) { 4170 return object === source || baseIsMatch(object, source, matchData); 4171 }; 4172 } 4173 function baseMatchesProperty(path, srcValue) { 4174 if (isKey(path) && isStrictComparable(srcValue)) { 4175 return matchesStrictComparable(toKey(path), srcValue); 4176 } 4177 return function(object) { 4178 var objValue = get(object, path); 4179 return objValue === undefined2 && objValue === srcValue ? hasIn(object, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); 4180 }; 4181 } 4182 function baseMerge(object, source, srcIndex, customizer, stack) { 4183 if (object === source) { 4184 return; 4185 } 4186 baseFor(source, function(srcValue, key) { 4187 stack || (stack = new Stack()); 4188 if (isObject(srcValue)) { 4189 baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack); 4190 } else { 4191 var newValue = customizer ? customizer(safeGet(object, key), srcValue, key + "", object, source, stack) : undefined2; 4192 if (newValue === undefined2) { 4193 newValue = srcValue; 4194 } 4195 assignMergeValue(object, key, newValue); 4196 } 4197 }, keysIn); 4198 } 4199 function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) { 4200 var objValue = safeGet(object, key), srcValue = safeGet(source, key), stacked = stack.get(srcValue); 4201 if (stacked) { 4202 assignMergeValue(object, key, stacked); 4203 return; 4204 } 4205 var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : undefined2; 4206 var isCommon = newValue === undefined2; 4207 if (isCommon) { 4208 var isArr = isArray(srcValue), isBuff = !isArr && isBuffer(srcValue), isTyped = !isArr && !isBuff && isTypedArray(srcValue); 4209 newValue = srcValue; 4210 if (isArr || isBuff || isTyped) { 4211 if (isArray(objValue)) { 4212 newValue = objValue; 4213 } else if (isArrayLikeObject(objValue)) { 4214 newValue = copyArray(objValue); 4215 } else if (isBuff) { 4216 isCommon = false; 4217 newValue = cloneBuffer(srcValue, true); 4218 } else if (isTyped) { 4219 isCommon = false; 4220 newValue = cloneTypedArray(srcValue, true); 4221 } else { 4222 newValue = []; 4223 } 4224 } else if (isPlainObject(srcValue) || isArguments(srcValue)) { 4225 newValue = objValue; 4226 if (isArguments(objValue)) { 4227 newValue = toPlainObject(objValue); 4228 } else if (!isObject(objValue) || isFunction(objValue)) { 4229 newValue = initCloneObject(srcValue); 4230 } 4231 } else { 4232 isCommon = false; 4233 } 4234 } 4235 if (isCommon) { 4236 stack.set(srcValue, newValue); 4237 mergeFunc(newValue, srcValue, srcIndex, customizer, stack); 4238 stack["delete"](srcValue); 4239 } 4240 assignMergeValue(object, key, newValue); 4241 } 4242 function baseNth(array, n) { 4243 var length = array.length; 4244 if (!length) { 4245 return; 4246 } 4247 n += n < 0 ? length : 0; 4248 return isIndex(n, length) ? array[n] : undefined2; 4249 } 4250 function baseOrderBy(collection, iteratees, orders) { 4251 if (iteratees.length) { 4252 iteratees = arrayMap(iteratees, function(iteratee2) { 4253 if (isArray(iteratee2)) { 4254 return function(value) { 4255 return baseGet(value, iteratee2.length === 1 ? iteratee2[0] : iteratee2); 4256 }; 4257 } 4258 return iteratee2; 4259 }); 4260 } else { 4261 iteratees = [identity]; 4262 } 4263 var index = -1; 4264 iteratees = arrayMap(iteratees, baseUnary(getIteratee())); 4265 var result2 = baseMap(collection, function(value, key, collection2) { 4266 var criteria = arrayMap(iteratees, function(iteratee2) { 4267 return iteratee2(value); 4268 }); 4269 return { "criteria": criteria, "index": ++index, "value": value }; 4270 }); 4271 return baseSortBy(result2, function(object, other) { 4272 return compareMultiple(object, other, orders); 4273 }); 4274 } 4275 function basePick(object, paths) { 4276 return basePickBy(object, paths, function(value, path) { 4277 return hasIn(object, path); 4278 }); 4279 } 4280 function basePickBy(object, paths, predicate) { 4281 var index = -1, length = paths.length, result2 = {}; 4282 while (++index < length) { 4283 var path = paths[index], value = baseGet(object, path); 4284 if (predicate(value, path)) { 4285 baseSet(result2, castPath(path, object), value); 4286 } 4287 } 4288 return result2; 4289 } 4290 function basePropertyDeep(path) { 4291 return function(object) { 4292 return baseGet(object, path); 4293 }; 4294 } 4295 function basePullAll(array, values2, iteratee2, comparator) { 4296 var indexOf2 = comparator ? baseIndexOfWith : baseIndexOf, index = -1, length = values2.length, seen = array; 4297 if (array === values2) { 4298 values2 = copyArray(values2); 4299 } 4300 if (iteratee2) { 4301 seen = arrayMap(array, baseUnary(iteratee2)); 4302 } 4303 while (++index < length) { 4304 var fromIndex = 0, value = values2[index], computed = iteratee2 ? iteratee2(value) : value; 4305 while ((fromIndex = indexOf2(seen, computed, fromIndex, comparator)) > -1) { 4306 if (seen !== array) { 4307 splice.call(seen, fromIndex, 1); 4308 } 4309 splice.call(array, fromIndex, 1); 4310 } 4311 } 4312 return array; 4313 } 4314 function basePullAt(array, indexes) { 4315 var length = array ? indexes.length : 0, lastIndex = length - 1; 4316 while (length--) { 4317 var index = indexes[length]; 4318 if (length == lastIndex || index !== previous) { 4319 var previous = index; 4320 if (isIndex(index)) { 4321 splice.call(array, index, 1); 4322 } else { 4323 baseUnset(array, index); 4324 } 4325 } 4326 } 4327 return array; 4328 } 4329 function baseRandom(lower, upper) { 4330 return lower + nativeFloor(nativeRandom() * (upper - lower + 1)); 4331 } 4332 function baseRange(start, end, step, fromRight) { 4333 var index = -1, length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), result2 = Array2(length); 4334 while (length--) { 4335 result2[fromRight ? length : ++index] = start; 4336 start += step; 4337 } 4338 return result2; 4339 } 4340 function baseRepeat(string, n) { 4341 var result2 = ""; 4342 if (!string || n < 1 || n > MAX_SAFE_INTEGER) { 4343 return result2; 4344 } 4345 do { 4346 if (n % 2) { 4347 result2 += string; 4348 } 4349 n = nativeFloor(n / 2); 4350 if (n) { 4351 string += string; 4352 } 4353 } while (n); 4354 return result2; 4355 } 4356 function baseRest(func, start) { 4357 return setToString(overRest(func, start, identity), func + ""); 4358 } 4359 function baseSample(collection) { 4360 return arraySample(values(collection)); 4361 } 4362 function baseSampleSize(collection, n) { 4363 var array = values(collection); 4364 return shuffleSelf(array, baseClamp(n, 0, array.length)); 4365 } 4366 function baseSet(object, path, value, customizer) { 4367 if (!isObject(object)) { 4368 return object; 4369 } 4370 path = castPath(path, object); 4371 var index = -1, length = path.length, lastIndex = length - 1, nested = object; 4372 while (nested != null && ++index < length) { 4373 var key = toKey(path[index]), newValue = value; 4374 if (key === "__proto__" || key === "constructor" || key === "prototype") { 4375 return object; 4376 } 4377 if (index != lastIndex) { 4378 var objValue = nested[key]; 4379 newValue = customizer ? customizer(objValue, key, nested) : undefined2; 4380 if (newValue === undefined2) { 4381 newValue = isObject(objValue) ? objValue : isIndex(path[index + 1]) ? [] : {}; 4382 } 4383 } 4384 assignValue(nested, key, newValue); 4385 nested = nested[key]; 4386 } 4387 return object; 4388 } 4389 var baseSetData = !metaMap ? identity : function(func, data) { 4390 metaMap.set(func, data); 4391 return func; 4392 }; 4393 var baseSetToString = !defineProperty ? identity : function(func, string) { 4394 return defineProperty(func, "toString", { 4395 "configurable": true, 4396 "enumerable": false, 4397 "value": constant(string), 4398 "writable": true 4399 }); 4400 }; 4401 function baseShuffle(collection) { 4402 return shuffleSelf(values(collection)); 4403 } 4404 function baseSlice(array, start, end) { 4405 var index = -1, length = array.length; 4406 if (start < 0) { 4407 start = -start > length ? 0 : length + start; 4408 } 4409 end = end > length ? length : end; 4410 if (end < 0) { 4411 end += length; 4412 } 4413 length = start > end ? 0 : end - start >>> 0; 4414 start >>>= 0; 4415 var result2 = Array2(length); 4416 while (++index < length) { 4417 result2[index] = array[index + start]; 4418 } 4419 return result2; 4420 } 4421 function baseSome(collection, predicate) { 4422 var result2; 4423 baseEach(collection, function(value, index, collection2) { 4424 result2 = predicate(value, index, collection2); 4425 return !result2; 4426 }); 4427 return !!result2; 4428 } 4429 function baseSortedIndex(array, value, retHighest) { 4430 var low = 0, high = array == null ? low : array.length; 4431 if (typeof value == "number" && value === value && high <= HALF_MAX_ARRAY_LENGTH) { 4432 while (low < high) { 4433 var mid = low + high >>> 1, computed = array[mid]; 4434 if (computed !== null && !isSymbol(computed) && (retHighest ? computed <= value : computed < value)) { 4435 low = mid + 1; 4436 } else { 4437 high = mid; 4438 } 4439 } 4440 return high; 4441 } 4442 return baseSortedIndexBy(array, value, identity, retHighest); 4443 } 4444 function baseSortedIndexBy(array, value, iteratee2, retHighest) { 4445 var low = 0, high = array == null ? 0 : array.length; 4446 if (high === 0) { 4447 return 0; 4448 } 4449 value = iteratee2(value); 4450 var valIsNaN = value !== value, valIsNull = value === null, valIsSymbol = isSymbol(value), valIsUndefined = value === undefined2; 4451 while (low < high) { 4452 var mid = nativeFloor((low + high) / 2), computed = iteratee2(array[mid]), othIsDefined = computed !== undefined2, othIsNull = computed === null, othIsReflexive = computed === computed, othIsSymbol = isSymbol(computed); 4453 if (valIsNaN) { 4454 var setLow = retHighest || othIsReflexive; 4455 } else if (valIsUndefined) { 4456 setLow = othIsReflexive && (retHighest || othIsDefined); 4457 } else if (valIsNull) { 4458 setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull); 4459 } else if (valIsSymbol) { 4460 setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol); 4461 } else if (othIsNull || othIsSymbol) { 4462 setLow = false; 4463 } else { 4464 setLow = retHighest ? computed <= value : computed < value; 4465 } 4466 if (setLow) { 4467 low = mid + 1; 4468 } else { 4469 high = mid; 4470 } 4471 } 4472 return nativeMin(high, MAX_ARRAY_INDEX); 4473 } 4474 function baseSortedUniq(array, iteratee2) { 4475 var index = -1, length = array.length, resIndex = 0, result2 = []; 4476 while (++index < length) { 4477 var value = array[index], computed = iteratee2 ? iteratee2(value) : value; 4478 if (!index || !eq(computed, seen)) { 4479 var seen = computed; 4480 result2[resIndex++] = value === 0 ? 0 : value; 4481 } 4482 } 4483 return result2; 4484 } 4485 function baseToNumber(value) { 4486 if (typeof value == "number") { 4487 return value; 4488 } 4489 if (isSymbol(value)) { 4490 return NAN; 4491 } 4492 return +value; 4493 } 4494 function baseToString(value) { 4495 if (typeof value == "string") { 4496 return value; 4497 } 4498 if (isArray(value)) { 4499 return arrayMap(value, baseToString) + ""; 4500 } 4501 if (isSymbol(value)) { 4502 return symbolToString ? symbolToString.call(value) : ""; 4503 } 4504 var result2 = value + ""; 4505 return result2 == "0" && 1 / value == -INFINITY ? "-0" : result2; 4506 } 4507 function baseUniq(array, iteratee2, comparator) { 4508 var index = -1, includes2 = arrayIncludes, length = array.length, isCommon = true, result2 = [], seen = result2; 4509 if (comparator) { 4510 isCommon = false; 4511 includes2 = arrayIncludesWith; 4512 } else if (length >= LARGE_ARRAY_SIZE) { 4513 var set2 = iteratee2 ? null : createSet(array); 4514 if (set2) { 4515 return setToArray(set2); 4516 } 4517 isCommon = false; 4518 includes2 = cacheHas; 4519 seen = new SetCache(); 4520 } else { 4521 seen = iteratee2 ? [] : result2; 4522 } 4523 outer: 4524 while (++index < length) { 4525 var value = array[index], computed = iteratee2 ? iteratee2(value) : value; 4526 value = comparator || value !== 0 ? value : 0; 4527 if (isCommon && computed === computed) { 4528 var seenIndex = seen.length; 4529 while (seenIndex--) { 4530 if (seen[seenIndex] === computed) { 4531 continue outer; 4532 } 4533 } 4534 if (iteratee2) { 4535 seen.push(computed); 4536 } 4537 result2.push(value); 4538 } else if (!includes2(seen, computed, comparator)) { 4539 if (seen !== result2) { 4540 seen.push(computed); 4541 } 4542 result2.push(value); 4543 } 4544 } 4545 return result2; 4546 } 4547 function baseUnset(object, path) { 4548 path = castPath(path, object); 4549 object = parent(object, path); 4550 return object == null || delete object[toKey(last(path))]; 4551 } 4552 function baseUpdate(object, path, updater, customizer) { 4553 return baseSet(object, path, updater(baseGet(object, path)), customizer); 4554 } 4555 function baseWhile(array, predicate, isDrop, fromRight) { 4556 var length = array.length, index = fromRight ? length : -1; 4557 while ((fromRight ? index-- : ++index < length) && predicate(array[index], index, array)) { 4558 } 4559 return isDrop ? baseSlice(array, fromRight ? 0 : index, fromRight ? index + 1 : length) : baseSlice(array, fromRight ? index + 1 : 0, fromRight ? length : index); 4560 } 4561 function baseWrapperValue(value, actions) { 4562 var result2 = value; 4563 if (result2 instanceof LazyWrapper) { 4564 result2 = result2.value(); 4565 } 4566 return arrayReduce(actions, function(result3, action) { 4567 return action.func.apply(action.thisArg, arrayPush([result3], action.args)); 4568 }, result2); 4569 } 4570 function baseXor(arrays, iteratee2, comparator) { 4571 var length = arrays.length; 4572 if (length < 2) { 4573 return length ? baseUniq(arrays[0]) : []; 4574 } 4575 var index = -1, result2 = Array2(length); 4576 while (++index < length) { 4577 var array = arrays[index], othIndex = -1; 4578 while (++othIndex < length) { 4579 if (othIndex != index) { 4580 result2[index] = baseDifference(result2[index] || array, arrays[othIndex], iteratee2, comparator); 4581 } 4582 } 4583 } 4584 return baseUniq(baseFlatten(result2, 1), iteratee2, comparator); 4585 } 4586 function baseZipObject(props, values2, assignFunc) { 4587 var index = -1, length = props.length, valsLength = values2.length, result2 = {}; 4588 while (++index < length) { 4589 var value = index < valsLength ? values2[index] : undefined2; 4590 assignFunc(result2, props[index], value); 4591 } 4592 return result2; 4593 } 4594 function castArrayLikeObject(value) { 4595 return isArrayLikeObject(value) ? value : []; 4596 } 4597 function castFunction(value) { 4598 return typeof value == "function" ? value : identity; 4599 } 4600 function castPath(value, object) { 4601 if (isArray(value)) { 4602 return value; 4603 } 4604 return isKey(value, object) ? [value] : stringToPath(toString(value)); 4605 } 4606 var castRest = baseRest; 4607 function castSlice(array, start, end) { 4608 var length = array.length; 4609 end = end === undefined2 ? length : end; 4610 return !start && end >= length ? array : baseSlice(array, start, end); 4611 } 4612 var clearTimeout = ctxClearTimeout || function(id) { 4613 return root.clearTimeout(id); 4614 }; 4615 function cloneBuffer(buffer, isDeep) { 4616 if (isDeep) { 4617 return buffer.slice(); 4618 } 4619 var length = buffer.length, result2 = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length); 4620 buffer.copy(result2); 4621 return result2; 4622 } 4623 function cloneArrayBuffer(arrayBuffer) { 4624 var result2 = new arrayBuffer.constructor(arrayBuffer.byteLength); 4625 new Uint8Array2(result2).set(new Uint8Array2(arrayBuffer)); 4626 return result2; 4627 } 4628 function cloneDataView(dataView, isDeep) { 4629 var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer; 4630 return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength); 4631 } 4632 function cloneRegExp(regexp) { 4633 var result2 = new regexp.constructor(regexp.source, reFlags.exec(regexp)); 4634 result2.lastIndex = regexp.lastIndex; 4635 return result2; 4636 } 4637 function cloneSymbol(symbol) { 4638 return symbolValueOf ? Object2(symbolValueOf.call(symbol)) : {}; 4639 } 4640 function cloneTypedArray(typedArray, isDeep) { 4641 var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer; 4642 return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length); 4643 } 4644 function compareAscending(value, other) { 4645 if (value !== other) { 4646 var valIsDefined = value !== undefined2, valIsNull = value === null, valIsReflexive = value === value, valIsSymbol = isSymbol(value); 4647 var othIsDefined = other !== undefined2, othIsNull = other === null, othIsReflexive = other === other, othIsSymbol = isSymbol(other); 4648 if (!othIsNull && !othIsSymbol && !valIsSymbol && value > other || valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol || valIsNull && othIsDefined && othIsReflexive || !valIsDefined && othIsReflexive || !valIsReflexive) { 4649 return 1; 4650 } 4651 if (!valIsNull && !valIsSymbol && !othIsSymbol && value < other || othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol || othIsNull && valIsDefined && valIsReflexive || !othIsDefined && valIsReflexive || !othIsReflexive) { 4652 return -1; 4653 } 4654 } 4655 return 0; 4656 } 4657 function compareMultiple(object, other, orders) { 4658 var index = -1, objCriteria = object.criteria, othCriteria = other.criteria, length = objCriteria.length, ordersLength = orders.length; 4659 while (++index < length) { 4660 var result2 = compareAscending(objCriteria[index], othCriteria[index]); 4661 if (result2) { 4662 if (index >= ordersLength) { 4663 return result2; 4664 } 4665 var order = orders[index]; 4666 return result2 * (order == "desc" ? -1 : 1); 4667 } 4668 } 4669 return object.index - other.index; 4670 } 4671 function composeArgs(args, partials, holders, isCurried) { 4672 var argsIndex = -1, argsLength = args.length, holdersLength = holders.length, leftIndex = -1, leftLength = partials.length, rangeLength = nativeMax(argsLength - holdersLength, 0), result2 = Array2(leftLength + rangeLength), isUncurried = !isCurried; 4673 while (++leftIndex < leftLength) { 4674 result2[leftIndex] = partials[leftIndex]; 4675 } 4676 while (++argsIndex < holdersLength) { 4677 if (isUncurried || argsIndex < argsLength) { 4678 result2[holders[argsIndex]] = args[argsIndex]; 4679 } 4680 } 4681 while (rangeLength--) { 4682 result2[leftIndex++] = args[argsIndex++]; 4683 } 4684 return result2; 4685 } 4686 function composeArgsRight(args, partials, holders, isCurried) { 4687 var argsIndex = -1, argsLength = args.length, holdersIndex = -1, holdersLength = holders.length, rightIndex = -1, rightLength = partials.length, rangeLength = nativeMax(argsLength - holdersLength, 0), result2 = Array2(rangeLength + rightLength), isUncurried = !isCurried; 4688 while (++argsIndex < rangeLength) { 4689 result2[argsIndex] = args[argsIndex]; 4690 } 4691 var offset = argsIndex; 4692 while (++rightIndex < rightLength) { 4693 result2[offset + rightIndex] = partials[rightIndex]; 4694 } 4695 while (++holdersIndex < holdersLength) { 4696 if (isUncurried || argsIndex < argsLength) { 4697 result2[offset + holders[holdersIndex]] = args[argsIndex++]; 4698 } 4699 } 4700 return result2; 4701 } 4702 function copyArray(source, array) { 4703 var index = -1, length = source.length; 4704 array || (array = Array2(length)); 4705 while (++index < length) { 4706 array[index] = source[index]; 4707 } 4708 return array; 4709 } 4710 function copyObject(source, props, object, customizer) { 4711 var isNew = !object; 4712 object || (object = {}); 4713 var index = -1, length = props.length; 4714 while (++index < length) { 4715 var key = props[index]; 4716 var newValue = customizer ? customizer(object[key], source[key], key, object, source) : undefined2; 4717 if (newValue === undefined2) { 4718 newValue = source[key]; 4719 } 4720 if (isNew) { 4721 baseAssignValue(object, key, newValue); 4722 } else { 4723 assignValue(object, key, newValue); 4724 } 4725 } 4726 return object; 4727 } 4728 function copySymbols(source, object) { 4729 return copyObject(source, getSymbols(source), object); 4730 } 4731 function copySymbolsIn(source, object) { 4732 return copyObject(source, getSymbolsIn(source), object); 4733 } 4734 function createAggregator(setter, initializer) { 4735 return function(collection, iteratee2) { 4736 var func = isArray(collection) ? arrayAggregator : baseAggregator, accumulator = initializer ? initializer() : {}; 4737 return func(collection, setter, getIteratee(iteratee2, 2), accumulator); 4738 }; 4739 } 4740 function createAssigner(assigner) { 4741 return baseRest(function(object, sources) { 4742 var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : undefined2, guard = length > 2 ? sources[2] : undefined2; 4743 customizer = assigner.length > 3 && typeof customizer == "function" ? (length--, customizer) : undefined2; 4744 if (guard && isIterateeCall(sources[0], sources[1], guard)) { 4745 customizer = length < 3 ? undefined2 : customizer; 4746 length = 1; 4747 } 4748 object = Object2(object); 4749 while (++index < length) { 4750 var source = sources[index]; 4751 if (source) { 4752 assigner(object, source, index, customizer); 4753 } 4754 } 4755 return object; 4756 }); 4757 } 4758 function createBaseEach(eachFunc, fromRight) { 4759 return function(collection, iteratee2) { 4760 if (collection == null) { 4761 return collection; 4762 } 4763 if (!isArrayLike(collection)) { 4764 return eachFunc(collection, iteratee2); 4765 } 4766 var length = collection.length, index = fromRight ? length : -1, iterable = Object2(collection); 4767 while (fromRight ? index-- : ++index < length) { 4768 if (iteratee2(iterable[index], index, iterable) === false) { 4769 break; 4770 } 4771 } 4772 return collection; 4773 }; 4774 } 4775 function createBaseFor(fromRight) { 4776 return function(object, iteratee2, keysFunc) { 4777 var index = -1, iterable = Object2(object), props = keysFunc(object), length = props.length; 4778 while (length--) { 4779 var key = props[fromRight ? length : ++index]; 4780 if (iteratee2(iterable[key], key, iterable) === false) { 4781 break; 4782 } 4783 } 4784 return object; 4785 }; 4786 } 4787 function createBind(func, bitmask, thisArg) { 4788 var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func); 4789 function wrapper() { 4790 var fn = this && this !== root && this instanceof wrapper ? Ctor : func; 4791 return fn.apply(isBind ? thisArg : this, arguments); 4792 } 4793 return wrapper; 4794 } 4795 function createCaseFirst(methodName) { 4796 return function(string) { 4797 string = toString(string); 4798 var strSymbols = hasUnicode(string) ? stringToArray(string) : undefined2; 4799 var chr = strSymbols ? strSymbols[0] : string.charAt(0); 4800 var trailing = strSymbols ? castSlice(strSymbols, 1).join("") : string.slice(1); 4801 return chr[methodName]() + trailing; 4802 }; 4803 } 4804 function createCompounder(callback) { 4805 return function(string) { 4806 return arrayReduce(words(deburr(string).replace(reApos, "")), callback, ""); 4807 }; 4808 } 4809 function createCtor(Ctor) { 4810 return function() { 4811 var args = arguments; 4812 switch (args.length) { 4813 case 0: 4814 return new Ctor(); 4815 case 1: 4816 return new Ctor(args[0]); 4817 case 2: 4818 return new Ctor(args[0], args[1]); 4819 case 3: 4820 return new Ctor(args[0], args[1], args[2]); 4821 case 4: 4822 return new Ctor(args[0], args[1], args[2], args[3]); 4823 case 5: 4824 return new Ctor(args[0], args[1], args[2], args[3], args[4]); 4825 case 6: 4826 return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]); 4827 case 7: 4828 return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); 4829 } 4830 var thisBinding = baseCreate(Ctor.prototype), result2 = Ctor.apply(thisBinding, args); 4831 return isObject(result2) ? result2 : thisBinding; 4832 }; 4833 } 4834 function createCurry(func, bitmask, arity) { 4835 var Ctor = createCtor(func); 4836 function wrapper() { 4837 var length = arguments.length, args = Array2(length), index = length, placeholder = getHolder(wrapper); 4838 while (index--) { 4839 args[index] = arguments[index]; 4840 } 4841 var holders = length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder ? [] : replaceHolders(args, placeholder); 4842 length -= holders.length; 4843 if (length < arity) { 4844 return createRecurry( 4845 func, 4846 bitmask, 4847 createHybrid, 4848 wrapper.placeholder, 4849 undefined2, 4850 args, 4851 holders, 4852 undefined2, 4853 undefined2, 4854 arity - length 4855 ); 4856 } 4857 var fn = this && this !== root && this instanceof wrapper ? Ctor : func; 4858 return apply(fn, this, args); 4859 } 4860 return wrapper; 4861 } 4862 function createFind(findIndexFunc) { 4863 return function(collection, predicate, fromIndex) { 4864 var iterable = Object2(collection); 4865 if (!isArrayLike(collection)) { 4866 var iteratee2 = getIteratee(predicate, 3); 4867 collection = keys(collection); 4868 predicate = function(key) { 4869 return iteratee2(iterable[key], key, iterable); 4870 }; 4871 } 4872 var index = findIndexFunc(collection, predicate, fromIndex); 4873 return index > -1 ? iterable[iteratee2 ? collection[index] : index] : undefined2; 4874 }; 4875 } 4876 function createFlow(fromRight) { 4877 return flatRest(function(funcs) { 4878 var length = funcs.length, index = length, prereq = LodashWrapper.prototype.thru; 4879 if (fromRight) { 4880 funcs.reverse(); 4881 } 4882 while (index--) { 4883 var func = funcs[index]; 4884 if (typeof func != "function") { 4885 throw new TypeError2(FUNC_ERROR_TEXT); 4886 } 4887 if (prereq && !wrapper && getFuncName(func) == "wrapper") { 4888 var wrapper = new LodashWrapper([], true); 4889 } 4890 } 4891 index = wrapper ? index : length; 4892 while (++index < length) { 4893 func = funcs[index]; 4894 var funcName = getFuncName(func), data = funcName == "wrapper" ? getData(func) : undefined2; 4895 if (data && isLaziable(data[0]) && data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) && !data[4].length && data[9] == 1) { 4896 wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]); 4897 } else { 4898 wrapper = func.length == 1 && isLaziable(func) ? wrapper[funcName]() : wrapper.thru(func); 4899 } 4900 } 4901 return function() { 4902 var args = arguments, value = args[0]; 4903 if (wrapper && args.length == 1 && isArray(value)) { 4904 return wrapper.plant(value).value(); 4905 } 4906 var index2 = 0, result2 = length ? funcs[index2].apply(this, args) : value; 4907 while (++index2 < length) { 4908 result2 = funcs[index2].call(this, result2); 4909 } 4910 return result2; 4911 }; 4912 }); 4913 } 4914 function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary2, arity) { 4915 var isAry = bitmask & WRAP_ARY_FLAG, isBind = bitmask & WRAP_BIND_FLAG, isBindKey = bitmask & WRAP_BIND_KEY_FLAG, isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG), isFlip = bitmask & WRAP_FLIP_FLAG, Ctor = isBindKey ? undefined2 : createCtor(func); 4916 function wrapper() { 4917 var length = arguments.length, args = Array2(length), index = length; 4918 while (index--) { 4919 args[index] = arguments[index]; 4920 } 4921 if (isCurried) { 4922 var placeholder = getHolder(wrapper), holdersCount = countHolders(args, placeholder); 4923 } 4924 if (partials) { 4925 args = composeArgs(args, partials, holders, isCurried); 4926 } 4927 if (partialsRight) { 4928 args = composeArgsRight(args, partialsRight, holdersRight, isCurried); 4929 } 4930 length -= holdersCount; 4931 if (isCurried && length < arity) { 4932 var newHolders = replaceHolders(args, placeholder); 4933 return createRecurry( 4934 func, 4935 bitmask, 4936 createHybrid, 4937 wrapper.placeholder, 4938 thisArg, 4939 args, 4940 newHolders, 4941 argPos, 4942 ary2, 4943 arity - length 4944 ); 4945 } 4946 var thisBinding = isBind ? thisArg : this, fn = isBindKey ? thisBinding[func] : func; 4947 length = args.length; 4948 if (argPos) { 4949 args = reorder(args, argPos); 4950 } else if (isFlip && length > 1) { 4951 args.reverse(); 4952 } 4953 if (isAry && ary2 < length) { 4954 args.length = ary2; 4955 } 4956 if (this && this !== root && this instanceof wrapper) { 4957 fn = Ctor || createCtor(fn); 4958 } 4959 return fn.apply(thisBinding, args); 4960 } 4961 return wrapper; 4962 } 4963 function createInverter(setter, toIteratee) { 4964 return function(object, iteratee2) { 4965 return baseInverter(object, setter, toIteratee(iteratee2), {}); 4966 }; 4967 } 4968 function createMathOperation(operator, defaultValue) { 4969 return function(value, other) { 4970 var result2; 4971 if (value === undefined2 && other === undefined2) { 4972 return defaultValue; 4973 } 4974 if (value !== undefined2) { 4975 result2 = value; 4976 } 4977 if (other !== undefined2) { 4978 if (result2 === undefined2) { 4979 return other; 4980 } 4981 if (typeof value == "string" || typeof other == "string") { 4982 value = baseToString(value); 4983 other = baseToString(other); 4984 } else { 4985 value = baseToNumber(value); 4986 other = baseToNumber(other); 4987 } 4988 result2 = operator(value, other); 4989 } 4990 return result2; 4991 }; 4992 } 4993 function createOver(arrayFunc) { 4994 return flatRest(function(iteratees) { 4995 iteratees = arrayMap(iteratees, baseUnary(getIteratee())); 4996 return baseRest(function(args) { 4997 var thisArg = this; 4998 return arrayFunc(iteratees, function(iteratee2) { 4999 return apply(iteratee2, thisArg, args); 5000 }); 5001 }); 5002 }); 5003 } 5004 function createPadding(length, chars) { 5005 chars = chars === undefined2 ? " " : baseToString(chars); 5006 var charsLength = chars.length; 5007 if (charsLength < 2) { 5008 return charsLength ? baseRepeat(chars, length) : chars; 5009 } 5010 var result2 = baseRepeat(chars, nativeCeil(length / stringSize(chars))); 5011 return hasUnicode(chars) ? castSlice(stringToArray(result2), 0, length).join("") : result2.slice(0, length); 5012 } 5013 function createPartial(func, bitmask, thisArg, partials) { 5014 var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func); 5015 function wrapper() { 5016 var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array2(leftLength + argsLength), fn = this && this !== root && this instanceof wrapper ? Ctor : func; 5017 while (++leftIndex < leftLength) { 5018 args[leftIndex] = partials[leftIndex]; 5019 } 5020 while (argsLength--) { 5021 args[leftIndex++] = arguments[++argsIndex]; 5022 } 5023 return apply(fn, isBind ? thisArg : this, args); 5024 } 5025 return wrapper; 5026 } 5027 function createRange(fromRight) { 5028 return function(start, end, step) { 5029 if (step && typeof step != "number" && isIterateeCall(start, end, step)) { 5030 end = step = undefined2; 5031 } 5032 start = toFinite(start); 5033 if (end === undefined2) { 5034 end = start; 5035 start = 0; 5036 } else { 5037 end = toFinite(end); 5038 } 5039 step = step === undefined2 ? start < end ? 1 : -1 : toFinite(step); 5040 return baseRange(start, end, step, fromRight); 5041 }; 5042 } 5043 function createRelationalOperation(operator) { 5044 return function(value, other) { 5045 if (!(typeof value == "string" && typeof other == "string")) { 5046 value = toNumber(value); 5047 other = toNumber(other); 5048 } 5049 return operator(value, other); 5050 }; 5051 } 5052 function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary2, arity) { 5053 var isCurry = bitmask & WRAP_CURRY_FLAG, newHolders = isCurry ? holders : undefined2, newHoldersRight = isCurry ? undefined2 : holders, newPartials = isCurry ? partials : undefined2, newPartialsRight = isCurry ? undefined2 : partials; 5054 bitmask |= isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG; 5055 bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG); 5056 if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) { 5057 bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG); 5058 } 5059 var newData = [ 5060 func, 5061 bitmask, 5062 thisArg, 5063 newPartials, 5064 newHolders, 5065 newPartialsRight, 5066 newHoldersRight, 5067 argPos, 5068 ary2, 5069 arity 5070 ]; 5071 var result2 = wrapFunc.apply(undefined2, newData); 5072 if (isLaziable(func)) { 5073 setData(result2, newData); 5074 } 5075 result2.placeholder = placeholder; 5076 return setWrapToString(result2, func, bitmask); 5077 } 5078 function createRound(methodName) { 5079 var func = Math2[methodName]; 5080 return function(number, precision) { 5081 number = toNumber(number); 5082 precision = precision == null ? 0 : nativeMin(toInteger(precision), 292); 5083 if (precision && nativeIsFinite(number)) { 5084 var pair = (toString(number) + "e").split("e"), value = func(pair[0] + "e" + (+pair[1] + precision)); 5085 pair = (toString(value) + "e").split("e"); 5086 return +(pair[0] + "e" + (+pair[1] - precision)); 5087 } 5088 return func(number); 5089 }; 5090 } 5091 var createSet = !(Set2 && 1 / setToArray(new Set2([, -0]))[1] == INFINITY) ? noop : function(values2) { 5092 return new Set2(values2); 5093 }; 5094 function createToPairs(keysFunc) { 5095 return function(object) { 5096 var tag = getTag(object); 5097 if (tag == mapTag) { 5098 return mapToArray(object); 5099 } 5100 if (tag == setTag) { 5101 return setToPairs(object); 5102 } 5103 return baseToPairs(object, keysFunc(object)); 5104 }; 5105 } 5106 function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary2, arity) { 5107 var isBindKey = bitmask & WRAP_BIND_KEY_FLAG; 5108 if (!isBindKey && typeof func != "function") { 5109 throw new TypeError2(FUNC_ERROR_TEXT); 5110 } 5111 var length = partials ? partials.length : 0; 5112 if (!length) { 5113 bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG); 5114 partials = holders = undefined2; 5115 } 5116 ary2 = ary2 === undefined2 ? ary2 : nativeMax(toInteger(ary2), 0); 5117 arity = arity === undefined2 ? arity : toInteger(arity); 5118 length -= holders ? holders.length : 0; 5119 if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) { 5120 var partialsRight = partials, holdersRight = holders; 5121 partials = holders = undefined2; 5122 } 5123 var data = isBindKey ? undefined2 : getData(func); 5124 var newData = [ 5125 func, 5126 bitmask, 5127 thisArg, 5128 partials, 5129 holders, 5130 partialsRight, 5131 holdersRight, 5132 argPos, 5133 ary2, 5134 arity 5135 ]; 5136 if (data) { 5137 mergeData(newData, data); 5138 } 5139 func = newData[0]; 5140 bitmask = newData[1]; 5141 thisArg = newData[2]; 5142 partials = newData[3]; 5143 holders = newData[4]; 5144 arity = newData[9] = newData[9] === undefined2 ? isBindKey ? 0 : func.length : nativeMax(newData[9] - length, 0); 5145 if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) { 5146 bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG); 5147 } 5148 if (!bitmask || bitmask == WRAP_BIND_FLAG) { 5149 var result2 = createBind(func, bitmask, thisArg); 5150 } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) { 5151 result2 = createCurry(func, bitmask, arity); 5152 } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) { 5153 result2 = createPartial(func, bitmask, thisArg, partials); 5154 } else { 5155 result2 = createHybrid.apply(undefined2, newData); 5156 } 5157 var setter = data ? baseSetData : setData; 5158 return setWrapToString(setter(result2, newData), func, bitmask); 5159 } 5160 function customDefaultsAssignIn(objValue, srcValue, key, object) { 5161 if (objValue === undefined2 || eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key)) { 5162 return srcValue; 5163 } 5164 return objValue; 5165 } 5166 function customDefaultsMerge(objValue, srcValue, key, object, source, stack) { 5167 if (isObject(objValue) && isObject(srcValue)) { 5168 stack.set(srcValue, objValue); 5169 baseMerge(objValue, srcValue, undefined2, customDefaultsMerge, stack); 5170 stack["delete"](srcValue); 5171 } 5172 return objValue; 5173 } 5174 function customOmitClone(value) { 5175 return isPlainObject(value) ? undefined2 : value; 5176 } 5177 function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { 5178 var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array.length, othLength = other.length; 5179 if (arrLength != othLength && !(isPartial && othLength > arrLength)) { 5180 return false; 5181 } 5182 var arrStacked = stack.get(array); 5183 var othStacked = stack.get(other); 5184 if (arrStacked && othStacked) { 5185 return arrStacked == other && othStacked == array; 5186 } 5187 var index = -1, result2 = true, seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache() : undefined2; 5188 stack.set(array, other); 5189 stack.set(other, array); 5190 while (++index < arrLength) { 5191 var arrValue = array[index], othValue = other[index]; 5192 if (customizer) { 5193 var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack); 5194 } 5195 if (compared !== undefined2) { 5196 if (compared) { 5197 continue; 5198 } 5199 result2 = false; 5200 break; 5201 } 5202 if (seen) { 5203 if (!arraySome(other, function(othValue2, othIndex) { 5204 if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) { 5205 return seen.push(othIndex); 5206 } 5207 })) { 5208 result2 = false; 5209 break; 5210 } 5211 } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { 5212 result2 = false; 5213 break; 5214 } 5215 } 5216 stack["delete"](array); 5217 stack["delete"](other); 5218 return result2; 5219 } 5220 function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { 5221 switch (tag) { 5222 case dataViewTag: 5223 if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) { 5224 return false; 5225 } 5226 object = object.buffer; 5227 other = other.buffer; 5228 case arrayBufferTag: 5229 if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array2(object), new Uint8Array2(other))) { 5230 return false; 5231 } 5232 return true; 5233 case boolTag: 5234 case dateTag: 5235 case numberTag: 5236 return eq(+object, +other); 5237 case errorTag: 5238 return object.name == other.name && object.message == other.message; 5239 case regexpTag: 5240 case stringTag: 5241 return object == other + ""; 5242 case mapTag: 5243 var convert = mapToArray; 5244 case setTag: 5245 var isPartial = bitmask & COMPARE_PARTIAL_FLAG; 5246 convert || (convert = setToArray); 5247 if (object.size != other.size && !isPartial) { 5248 return false; 5249 } 5250 var stacked = stack.get(object); 5251 if (stacked) { 5252 return stacked == other; 5253 } 5254 bitmask |= COMPARE_UNORDERED_FLAG; 5255 stack.set(object, other); 5256 var result2 = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack); 5257 stack["delete"](object); 5258 return result2; 5259 case symbolTag: 5260 if (symbolValueOf) { 5261 return symbolValueOf.call(object) == symbolValueOf.call(other); 5262 } 5263 } 5264 return false; 5265 } 5266 function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { 5267 var isPartial = bitmask & COMPARE_PARTIAL_FLAG, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length; 5268 if (objLength != othLength && !isPartial) { 5269 return false; 5270 } 5271 var index = objLength; 5272 while (index--) { 5273 var key = objProps[index]; 5274 if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) { 5275 return false; 5276 } 5277 } 5278 var objStacked = stack.get(object); 5279 var othStacked = stack.get(other); 5280 if (objStacked && othStacked) { 5281 return objStacked == other && othStacked == object; 5282 } 5283 var result2 = true; 5284 stack.set(object, other); 5285 stack.set(other, object); 5286 var skipCtor = isPartial; 5287 while (++index < objLength) { 5288 key = objProps[index]; 5289 var objValue = object[key], othValue = other[key]; 5290 if (customizer) { 5291 var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack); 5292 } 5293 if (!(compared === undefined2 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) { 5294 result2 = false; 5295 break; 5296 } 5297 skipCtor || (skipCtor = key == "constructor"); 5298 } 5299 if (result2 && !skipCtor) { 5300 var objCtor = object.constructor, othCtor = other.constructor; 5301 if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) { 5302 result2 = false; 5303 } 5304 } 5305 stack["delete"](object); 5306 stack["delete"](other); 5307 return result2; 5308 } 5309 function flatRest(func) { 5310 return setToString(overRest(func, undefined2, flatten), func + ""); 5311 } 5312 function getAllKeys(object) { 5313 return baseGetAllKeys(object, keys, getSymbols); 5314 } 5315 function getAllKeysIn(object) { 5316 return baseGetAllKeys(object, keysIn, getSymbolsIn); 5317 } 5318 var getData = !metaMap ? noop : function(func) { 5319 return metaMap.get(func); 5320 }; 5321 function getFuncName(func) { 5322 var result2 = func.name + "", array = realNames[result2], length = hasOwnProperty.call(realNames, result2) ? array.length : 0; 5323 while (length--) { 5324 var data = array[length], otherFunc = data.func; 5325 if (otherFunc == null || otherFunc == func) { 5326 return data.name; 5327 } 5328 } 5329 return result2; 5330 } 5331 function getHolder(func) { 5332 var object = hasOwnProperty.call(lodash, "placeholder") ? lodash : func; 5333 return object.placeholder; 5334 } 5335 function getIteratee() { 5336 var result2 = lodash.iteratee || iteratee; 5337 result2 = result2 === iteratee ? baseIteratee : result2; 5338 return arguments.length ? result2(arguments[0], arguments[1]) : result2; 5339 } 5340 function getMapData(map2, key) { 5341 var data = map2.__data__; 5342 return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map; 5343 } 5344 function getMatchData(object) { 5345 var result2 = keys(object), length = result2.length; 5346 while (length--) { 5347 var key = result2[length], value = object[key]; 5348 result2[length] = [key, value, isStrictComparable(value)]; 5349 } 5350 return result2; 5351 } 5352 function getNative(object, key) { 5353 var value = getValue(object, key); 5354 return baseIsNative(value) ? value : undefined2; 5355 } 5356 function getRawTag(value) { 5357 var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag]; 5358 try { 5359 value[symToStringTag] = undefined2; 5360 var unmasked = true; 5361 } catch (e) { 5362 } 5363 var result2 = nativeObjectToString.call(value); 5364 if (unmasked) { 5365 if (isOwn) { 5366 value[symToStringTag] = tag; 5367 } else { 5368 delete value[symToStringTag]; 5369 } 5370 } 5371 return result2; 5372 } 5373 var getSymbols = !nativeGetSymbols ? stubArray : function(object) { 5374 if (object == null) { 5375 return []; 5376 } 5377 object = Object2(object); 5378 return arrayFilter(nativeGetSymbols(object), function(symbol) { 5379 return propertyIsEnumerable.call(object, symbol); 5380 }); 5381 }; 5382 var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) { 5383 var result2 = []; 5384 while (object) { 5385 arrayPush(result2, getSymbols(object)); 5386 object = getPrototype(object); 5387 } 5388 return result2; 5389 }; 5390 var getTag = baseGetTag; 5391 if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map && getTag(new Map()) != mapTag || Promise2 && getTag(Promise2.resolve()) != promiseTag || Set2 && getTag(new Set2()) != setTag || WeakMap && getTag(new WeakMap()) != weakMapTag) { 5392 getTag = function(value) { 5393 var result2 = baseGetTag(value), Ctor = result2 == objectTag ? value.constructor : undefined2, ctorString = Ctor ? toSource(Ctor) : ""; 5394 if (ctorString) { 5395 switch (ctorString) { 5396 case dataViewCtorString: 5397 return dataViewTag; 5398 case mapCtorString: 5399 return mapTag; 5400 case promiseCtorString: 5401 return promiseTag; 5402 case setCtorString: 5403 return setTag; 5404 case weakMapCtorString: 5405 return weakMapTag; 5406 } 5407 } 5408 return result2; 5409 }; 5410 } 5411 function getView(start, end, transforms) { 5412 var index = -1, length = transforms.length; 5413 while (++index < length) { 5414 var data = transforms[index], size2 = data.size; 5415 switch (data.type) { 5416 case "drop": 5417 start += size2; 5418 break; 5419 case "dropRight": 5420 end -= size2; 5421 break; 5422 case "take": 5423 end = nativeMin(end, start + size2); 5424 break; 5425 case "takeRight": 5426 start = nativeMax(start, end - size2); 5427 break; 5428 } 5429 } 5430 return { "start": start, "end": end }; 5431 } 5432 function getWrapDetails(source) { 5433 var match = source.match(reWrapDetails); 5434 return match ? match[1].split(reSplitDetails) : []; 5435 } 5436 function hasPath(object, path, hasFunc) { 5437 path = castPath(path, object); 5438 var index = -1, length = path.length, result2 = false; 5439 while (++index < length) { 5440 var key = toKey(path[index]); 5441 if (!(result2 = object != null && hasFunc(object, key))) { 5442 break; 5443 } 5444 object = object[key]; 5445 } 5446 if (result2 || ++index != length) { 5447 return result2; 5448 } 5449 length = object == null ? 0 : object.length; 5450 return !!length && isLength(length) && isIndex(key, length) && (isArray(object) || isArguments(object)); 5451 } 5452 function initCloneArray(array) { 5453 var length = array.length, result2 = new array.constructor(length); 5454 if (length && typeof array[0] == "string" && hasOwnProperty.call(array, "index")) { 5455 result2.index = array.index; 5456 result2.input = array.input; 5457 } 5458 return result2; 5459 } 5460 function initCloneObject(object) { 5461 return typeof object.constructor == "function" && !isPrototype(object) ? baseCreate(getPrototype(object)) : {}; 5462 } 5463 function initCloneByTag(object, tag, isDeep) { 5464 var Ctor = object.constructor; 5465 switch (tag) { 5466 case arrayBufferTag: 5467 return cloneArrayBuffer(object); 5468 case boolTag: 5469 case dateTag: 5470 return new Ctor(+object); 5471 case dataViewTag: 5472 return cloneDataView(object, isDeep); 5473 case float32Tag: 5474 case float64Tag: 5475 case int8Tag: 5476 case int16Tag: 5477 case int32Tag: 5478 case uint8Tag: 5479 case uint8ClampedTag: 5480 case uint16Tag: 5481 case uint32Tag: 5482 return cloneTypedArray(object, isDeep); 5483 case mapTag: 5484 return new Ctor(); 5485 case numberTag: 5486 case stringTag: 5487 return new Ctor(object); 5488 case regexpTag: 5489 return cloneRegExp(object); 5490 case setTag: 5491 return new Ctor(); 5492 case symbolTag: 5493 return cloneSymbol(object); 5494 } 5495 } 5496 function insertWrapDetails(source, details) { 5497 var length = details.length; 5498 if (!length) { 5499 return source; 5500 } 5501 var lastIndex = length - 1; 5502 details[lastIndex] = (length > 1 ? "& " : "") + details[lastIndex]; 5503 details = details.join(length > 2 ? ", " : " "); 5504 return source.replace(reWrapComment, "{\n/* [wrapped with " + details + "] */\n"); 5505 } 5506 function isFlattenable(value) { 5507 return isArray(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]); 5508 } 5509 function isIndex(value, length) { 5510 var type = typeof value; 5511 length = length == null ? MAX_SAFE_INTEGER : length; 5512 return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length); 5513 } 5514 function isIterateeCall(value, index, object) { 5515 if (!isObject(object)) { 5516 return false; 5517 } 5518 var type = typeof index; 5519 if (type == "number" ? isArrayLike(object) && isIndex(index, object.length) : type == "string" && index in object) { 5520 return eq(object[index], value); 5521 } 5522 return false; 5523 } 5524 function isKey(value, object) { 5525 if (isArray(value)) { 5526 return false; 5527 } 5528 var type = typeof value; 5529 if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol(value)) { 5530 return true; 5531 } 5532 return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object2(object); 5533 } 5534 function isKeyable(value) { 5535 var type = typeof value; 5536 return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null; 5537 } 5538 function isLaziable(func) { 5539 var funcName = getFuncName(func), other = lodash[funcName]; 5540 if (typeof other != "function" || !(funcName in LazyWrapper.prototype)) { 5541 return false; 5542 } 5543 if (func === other) { 5544 return true; 5545 } 5546 var data = getData(other); 5547 return !!data && func === data[0]; 5548 } 5549 function isMasked(func) { 5550 return !!maskSrcKey && maskSrcKey in func; 5551 } 5552 var isMaskable = coreJsData ? isFunction : stubFalse; 5553 function isPrototype(value) { 5554 var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto; 5555 return value === proto; 5556 } 5557 function isStrictComparable(value) { 5558 return value === value && !isObject(value); 5559 } 5560 function matchesStrictComparable(key, srcValue) { 5561 return function(object) { 5562 if (object == null) { 5563 return false; 5564 } 5565 return object[key] === srcValue && (srcValue !== undefined2 || key in Object2(object)); 5566 }; 5567 } 5568 function memoizeCapped(func) { 5569 var result2 = memoize(func, function(key) { 5570 if (cache.size === MAX_MEMOIZE_SIZE) { 5571 cache.clear(); 5572 } 5573 return key; 5574 }); 5575 var cache = result2.cache; 5576 return result2; 5577 } 5578 function mergeData(data, source) { 5579 var bitmask = data[1], srcBitmask = source[1], newBitmask = bitmask | srcBitmask, isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG); 5580 var isCombo = srcBitmask == WRAP_ARY_FLAG && bitmask == WRAP_CURRY_FLAG || srcBitmask == WRAP_ARY_FLAG && bitmask == WRAP_REARG_FLAG && data[7].length <= source[8] || srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG) && source[7].length <= source[8] && bitmask == WRAP_CURRY_FLAG; 5581 if (!(isCommon || isCombo)) { 5582 return data; 5583 } 5584 if (srcBitmask & WRAP_BIND_FLAG) { 5585 data[2] = source[2]; 5586 newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG; 5587 } 5588 var value = source[3]; 5589 if (value) { 5590 var partials = data[3]; 5591 data[3] = partials ? composeArgs(partials, value, source[4]) : value; 5592 data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4]; 5593 } 5594 value = source[5]; 5595 if (value) { 5596 partials = data[5]; 5597 data[5] = partials ? composeArgsRight(partials, value, source[6]) : value; 5598 data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6]; 5599 } 5600 value = source[7]; 5601 if (value) { 5602 data[7] = value; 5603 } 5604 if (srcBitmask & WRAP_ARY_FLAG) { 5605 data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]); 5606 } 5607 if (data[9] == null) { 5608 data[9] = source[9]; 5609 } 5610 data[0] = source[0]; 5611 data[1] = newBitmask; 5612 return data; 5613 } 5614 function nativeKeysIn(object) { 5615 var result2 = []; 5616 if (object != null) { 5617 for (var key in Object2(object)) { 5618 result2.push(key); 5619 } 5620 } 5621 return result2; 5622 } 5623 function objectToString(value) { 5624 return nativeObjectToString.call(value); 5625 } 5626 function overRest(func, start, transform2) { 5627 start = nativeMax(start === undefined2 ? func.length - 1 : start, 0); 5628 return function() { 5629 var args = arguments, index = -1, length = nativeMax(args.length - start, 0), array = Array2(length); 5630 while (++index < length) { 5631 array[index] = args[start + index]; 5632 } 5633 index = -1; 5634 var otherArgs = Array2(start + 1); 5635 while (++index < start) { 5636 otherArgs[index] = args[index]; 5637 } 5638 otherArgs[start] = transform2(array); 5639 return apply(func, this, otherArgs); 5640 }; 5641 } 5642 function parent(object, path) { 5643 return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1)); 5644 } 5645 function reorder(array, indexes) { 5646 var arrLength = array.length, length = nativeMin(indexes.length, arrLength), oldArray = copyArray(array); 5647 while (length--) { 5648 var index = indexes[length]; 5649 array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined2; 5650 } 5651 return array; 5652 } 5653 function safeGet(object, key) { 5654 if (key === "constructor" && typeof object[key] === "function") { 5655 return; 5656 } 5657 if (key == "__proto__") { 5658 return; 5659 } 5660 return object[key]; 5661 } 5662 var setData = shortOut(baseSetData); 5663 var setTimeout = ctxSetTimeout || function(func, wait) { 5664 return root.setTimeout(func, wait); 5665 }; 5666 var setToString = shortOut(baseSetToString); 5667 function setWrapToString(wrapper, reference, bitmask) { 5668 var source = reference + ""; 5669 return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask))); 5670 } 5671 function shortOut(func) { 5672 var count = 0, lastCalled = 0; 5673 return function() { 5674 var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled); 5675 lastCalled = stamp; 5676 if (remaining > 0) { 5677 if (++count >= HOT_COUNT) { 5678 return arguments[0]; 5679 } 5680 } else { 5681 count = 0; 5682 } 5683 return func.apply(undefined2, arguments); 5684 }; 5685 } 5686 function shuffleSelf(array, size2) { 5687 var index = -1, length = array.length, lastIndex = length - 1; 5688 size2 = size2 === undefined2 ? length : size2; 5689 while (++index < size2) { 5690 var rand = baseRandom(index, lastIndex), value = array[rand]; 5691 array[rand] = array[index]; 5692 array[index] = value; 5693 } 5694 array.length = size2; 5695 return array; 5696 } 5697 var stringToPath = memoizeCapped(function(string) { 5698 var result2 = []; 5699 if (string.charCodeAt(0) === 46) { 5700 result2.push(""); 5701 } 5702 string.replace(rePropName, function(match, number, quote, subString) { 5703 result2.push(quote ? subString.replace(reEscapeChar, "$1") : number || match); 5704 }); 5705 return result2; 5706 }); 5707 function toKey(value) { 5708 if (typeof value == "string" || isSymbol(value)) { 5709 return value; 5710 } 5711 var result2 = value + ""; 5712 return result2 == "0" && 1 / value == -INFINITY ? "-0" : result2; 5713 } 5714 function toSource(func) { 5715 if (func != null) { 5716 try { 5717 return funcToString.call(func); 5718 } catch (e) { 5719 } 5720 try { 5721 return func + ""; 5722 } catch (e) { 5723 } 5724 } 5725 return ""; 5726 } 5727 function updateWrapDetails(details, bitmask) { 5728 arrayEach(wrapFlags, function(pair) { 5729 var value = "_." + pair[0]; 5730 if (bitmask & pair[1] && !arrayIncludes(details, value)) { 5731 details.push(value); 5732 } 5733 }); 5734 return details.sort(); 5735 } 5736 function wrapperClone(wrapper) { 5737 if (wrapper instanceof LazyWrapper) { 5738 return wrapper.clone(); 5739 } 5740 var result2 = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__); 5741 result2.__actions__ = copyArray(wrapper.__actions__); 5742 result2.__index__ = wrapper.__index__; 5743 result2.__values__ = wrapper.__values__; 5744 return result2; 5745 } 5746 function chunk(array, size2, guard) { 5747 if (guard ? isIterateeCall(array, size2, guard) : size2 === undefined2) { 5748 size2 = 1; 5749 } else { 5750 size2 = nativeMax(toInteger(size2), 0); 5751 } 5752 var length = array == null ? 0 : array.length; 5753 if (!length || size2 < 1) { 5754 return []; 5755 } 5756 var index = 0, resIndex = 0, result2 = Array2(nativeCeil(length / size2)); 5757 while (index < length) { 5758 result2[resIndex++] = baseSlice(array, index, index += size2); 5759 } 5760 return result2; 5761 } 5762 function compact(array) { 5763 var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result2 = []; 5764 while (++index < length) { 5765 var value = array[index]; 5766 if (value) { 5767 result2[resIndex++] = value; 5768 } 5769 } 5770 return result2; 5771 } 5772 function concat() { 5773 var length = arguments.length; 5774 if (!length) { 5775 return []; 5776 } 5777 var args = Array2(length - 1), array = arguments[0], index = length; 5778 while (index--) { 5779 args[index - 1] = arguments[index]; 5780 } 5781 return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1)); 5782 } 5783 var difference = baseRest(function(array, values2) { 5784 return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values2, 1, isArrayLikeObject, true)) : []; 5785 }); 5786 var differenceBy = baseRest(function(array, values2) { 5787 var iteratee2 = last(values2); 5788 if (isArrayLikeObject(iteratee2)) { 5789 iteratee2 = undefined2; 5790 } 5791 return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values2, 1, isArrayLikeObject, true), getIteratee(iteratee2, 2)) : []; 5792 }); 5793 var differenceWith = baseRest(function(array, values2) { 5794 var comparator = last(values2); 5795 if (isArrayLikeObject(comparator)) { 5796 comparator = undefined2; 5797 } 5798 return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values2, 1, isArrayLikeObject, true), undefined2, comparator) : []; 5799 }); 5800 function drop(array, n, guard) { 5801 var length = array == null ? 0 : array.length; 5802 if (!length) { 5803 return []; 5804 } 5805 n = guard || n === undefined2 ? 1 : toInteger(n); 5806 return baseSlice(array, n < 0 ? 0 : n, length); 5807 } 5808 function dropRight(array, n, guard) { 5809 var length = array == null ? 0 : array.length; 5810 if (!length) { 5811 return []; 5812 } 5813 n = guard || n === undefined2 ? 1 : toInteger(n); 5814 n = length - n; 5815 return baseSlice(array, 0, n < 0 ? 0 : n); 5816 } 5817 function dropRightWhile(array, predicate) { 5818 return array && array.length ? baseWhile(array, getIteratee(predicate, 3), true, true) : []; 5819 } 5820 function dropWhile(array, predicate) { 5821 return array && array.length ? baseWhile(array, getIteratee(predicate, 3), true) : []; 5822 } 5823 function fill(array, value, start, end) { 5824 var length = array == null ? 0 : array.length; 5825 if (!length) { 5826 return []; 5827 } 5828 if (start && typeof start != "number" && isIterateeCall(array, value, start)) { 5829 start = 0; 5830 end = length; 5831 } 5832 return baseFill(array, value, start, end); 5833 } 5834 function findIndex(array, predicate, fromIndex) { 5835 var length = array == null ? 0 : array.length; 5836 if (!length) { 5837 return -1; 5838 } 5839 var index = fromIndex == null ? 0 : toInteger(fromIndex); 5840 if (index < 0) { 5841 index = nativeMax(length + index, 0); 5842 } 5843 return baseFindIndex(array, getIteratee(predicate, 3), index); 5844 } 5845 function findLastIndex(array, predicate, fromIndex) { 5846 var length = array == null ? 0 : array.length; 5847 if (!length) { 5848 return -1; 5849 } 5850 var index = length - 1; 5851 if (fromIndex !== undefined2) { 5852 index = toInteger(fromIndex); 5853 index = fromIndex < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1); 5854 } 5855 return baseFindIndex(array, getIteratee(predicate, 3), index, true); 5856 } 5857 function flatten(array) { 5858 var length = array == null ? 0 : array.length; 5859 return length ? baseFlatten(array, 1) : []; 5860 } 5861 function flattenDeep(array) { 5862 var length = array == null ? 0 : array.length; 5863 return length ? baseFlatten(array, INFINITY) : []; 5864 } 5865 function flattenDepth(array, depth) { 5866 var length = array == null ? 0 : array.length; 5867 if (!length) { 5868 return []; 5869 } 5870 depth = depth === undefined2 ? 1 : toInteger(depth); 5871 return baseFlatten(array, depth); 5872 } 5873 function fromPairs(pairs) { 5874 var index = -1, length = pairs == null ? 0 : pairs.length, result2 = {}; 5875 while (++index < length) { 5876 var pair = pairs[index]; 5877 result2[pair[0]] = pair[1]; 5878 } 5879 return result2; 5880 } 5881 function head(array) { 5882 return array && array.length ? array[0] : undefined2; 5883 } 5884 function indexOf(array, value, fromIndex) { 5885 var length = array == null ? 0 : array.length; 5886 if (!length) { 5887 return -1; 5888 } 5889 var index = fromIndex == null ? 0 : toInteger(fromIndex); 5890 if (index < 0) { 5891 index = nativeMax(length + index, 0); 5892 } 5893 return baseIndexOf(array, value, index); 5894 } 5895 function initial(array) { 5896 var length = array == null ? 0 : array.length; 5897 return length ? baseSlice(array, 0, -1) : []; 5898 } 5899 var intersection = baseRest(function(arrays) { 5900 var mapped = arrayMap(arrays, castArrayLikeObject); 5901 return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped) : []; 5902 }); 5903 var intersectionBy = baseRest(function(arrays) { 5904 var iteratee2 = last(arrays), mapped = arrayMap(arrays, castArrayLikeObject); 5905 if (iteratee2 === last(mapped)) { 5906 iteratee2 = undefined2; 5907 } else { 5908 mapped.pop(); 5909 } 5910 return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, getIteratee(iteratee2, 2)) : []; 5911 }); 5912 var intersectionWith = baseRest(function(arrays) { 5913 var comparator = last(arrays), mapped = arrayMap(arrays, castArrayLikeObject); 5914 comparator = typeof comparator == "function" ? comparator : undefined2; 5915 if (comparator) { 5916 mapped.pop(); 5917 } 5918 return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : []; 5919 }); 5920 function join(array, separator) { 5921 return array == null ? "" : nativeJoin.call(array, separator); 5922 } 5923 function last(array) { 5924 var length = array == null ? 0 : array.length; 5925 return length ? array[length - 1] : undefined2; 5926 } 5927 function lastIndexOf(array, value, fromIndex) { 5928 var length = array == null ? 0 : array.length; 5929 if (!length) { 5930 return -1; 5931 } 5932 var index = length; 5933 if (fromIndex !== undefined2) { 5934 index = toInteger(fromIndex); 5935 index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1); 5936 } 5937 return value === value ? strictLastIndexOf(array, value, index) : baseFindIndex(array, baseIsNaN, index, true); 5938 } 5939 function nth(array, n) { 5940 return array && array.length ? baseNth(array, toInteger(n)) : undefined2; 5941 } 5942 var pull = baseRest(pullAll); 5943 function pullAll(array, values2) { 5944 return array && array.length && values2 && values2.length ? basePullAll(array, values2) : array; 5945 } 5946 function pullAllBy(array, values2, iteratee2) { 5947 return array && array.length && values2 && values2.length ? basePullAll(array, values2, getIteratee(iteratee2, 2)) : array; 5948 } 5949 function pullAllWith(array, values2, comparator) { 5950 return array && array.length && values2 && values2.length ? basePullAll(array, values2, undefined2, comparator) : array; 5951 } 5952 var pullAt = flatRest(function(array, indexes) { 5953 var length = array == null ? 0 : array.length, result2 = baseAt(array, indexes); 5954 basePullAt(array, arrayMap(indexes, function(index) { 5955 return isIndex(index, length) ? +index : index; 5956 }).sort(compareAscending)); 5957 return result2; 5958 }); 5959 function remove(array, predicate) { 5960 var result2 = []; 5961 if (!(array && array.length)) { 5962 return result2; 5963 } 5964 var index = -1, indexes = [], length = array.length; 5965 predicate = getIteratee(predicate, 3); 5966 while (++index < length) { 5967 var value = array[index]; 5968 if (predicate(value, index, array)) { 5969 result2.push(value); 5970 indexes.push(index); 5971 } 5972 } 5973 basePullAt(array, indexes); 5974 return result2; 5975 } 5976 function reverse(array) { 5977 return array == null ? array : nativeReverse.call(array); 5978 } 5979 function slice(array, start, end) { 5980 var length = array == null ? 0 : array.length; 5981 if (!length) { 5982 return []; 5983 } 5984 if (end && typeof end != "number" && isIterateeCall(array, start, end)) { 5985 start = 0; 5986 end = length; 5987 } else { 5988 start = start == null ? 0 : toInteger(start); 5989 end = end === undefined2 ? length : toInteger(end); 5990 } 5991 return baseSlice(array, start, end); 5992 } 5993 function sortedIndex(array, value) { 5994 return baseSortedIndex(array, value); 5995 } 5996 function sortedIndexBy(array, value, iteratee2) { 5997 return baseSortedIndexBy(array, value, getIteratee(iteratee2, 2)); 5998 } 5999 function sortedIndexOf(array, value) { 6000 var length = array == null ? 0 : array.length; 6001 if (length) { 6002 var index = baseSortedIndex(array, value); 6003 if (index < length && eq(array[index], value)) { 6004 return index; 6005 } 6006 } 6007 return -1; 6008 } 6009 function sortedLastIndex(array, value) { 6010 return baseSortedIndex(array, value, true); 6011 } 6012 function sortedLastIndexBy(array, value, iteratee2) { 6013 return baseSortedIndexBy(array, value, getIteratee(iteratee2, 2), true); 6014 } 6015 function sortedLastIndexOf(array, value) { 6016 var length = array == null ? 0 : array.length; 6017 if (length) { 6018 var index = baseSortedIndex(array, value, true) - 1; 6019 if (eq(array[index], value)) { 6020 return index; 6021 } 6022 } 6023 return -1; 6024 } 6025 function sortedUniq(array) { 6026 return array && array.length ? baseSortedUniq(array) : []; 6027 } 6028 function sortedUniqBy(array, iteratee2) { 6029 return array && array.length ? baseSortedUniq(array, getIteratee(iteratee2, 2)) : []; 6030 } 6031 function tail(array) { 6032 var length = array == null ? 0 : array.length; 6033 return length ? baseSlice(array, 1, length) : []; 6034 } 6035 function take(array, n, guard) { 6036 if (!(array && array.length)) { 6037 return []; 6038 } 6039 n = guard || n === undefined2 ? 1 : toInteger(n); 6040 return baseSlice(array, 0, n < 0 ? 0 : n); 6041 } 6042 function takeRight(array, n, guard) { 6043 var length = array == null ? 0 : array.length; 6044 if (!length) { 6045 return []; 6046 } 6047 n = guard || n === undefined2 ? 1 : toInteger(n); 6048 n = length - n; 6049 return baseSlice(array, n < 0 ? 0 : n, length); 6050 } 6051 function takeRightWhile(array, predicate) { 6052 return array && array.length ? baseWhile(array, getIteratee(predicate, 3), false, true) : []; 6053 } 6054 function takeWhile(array, predicate) { 6055 return array && array.length ? baseWhile(array, getIteratee(predicate, 3)) : []; 6056 } 6057 var union = baseRest(function(arrays) { 6058 return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true)); 6059 }); 6060 var unionBy = baseRest(function(arrays) { 6061 var iteratee2 = last(arrays); 6062 if (isArrayLikeObject(iteratee2)) { 6063 iteratee2 = undefined2; 6064 } 6065 return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee2, 2)); 6066 }); 6067 var unionWith = baseRest(function(arrays) { 6068 var comparator = last(arrays); 6069 comparator = typeof comparator == "function" ? comparator : undefined2; 6070 return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined2, comparator); 6071 }); 6072 function uniq(array) { 6073 return array && array.length ? baseUniq(array) : []; 6074 } 6075 function uniqBy(array, iteratee2) { 6076 return array && array.length ? baseUniq(array, getIteratee(iteratee2, 2)) : []; 6077 } 6078 function uniqWith(array, comparator) { 6079 comparator = typeof comparator == "function" ? comparator : undefined2; 6080 return array && array.length ? baseUniq(array, undefined2, comparator) : []; 6081 } 6082 function unzip(array) { 6083 if (!(array && array.length)) { 6084 return []; 6085 } 6086 var length = 0; 6087 array = arrayFilter(array, function(group) { 6088 if (isArrayLikeObject(group)) { 6089 length = nativeMax(group.length, length); 6090 return true; 6091 } 6092 }); 6093 return baseTimes(length, function(index) { 6094 return arrayMap(array, baseProperty(index)); 6095 }); 6096 } 6097 function unzipWith(array, iteratee2) { 6098 if (!(array && array.length)) { 6099 return []; 6100 } 6101 var result2 = unzip(array); 6102 if (iteratee2 == null) { 6103 return result2; 6104 } 6105 return arrayMap(result2, function(group) { 6106 return apply(iteratee2, undefined2, group); 6107 }); 6108 } 6109 var without = baseRest(function(array, values2) { 6110 return isArrayLikeObject(array) ? baseDifference(array, values2) : []; 6111 }); 6112 var xor = baseRest(function(arrays) { 6113 return baseXor(arrayFilter(arrays, isArrayLikeObject)); 6114 }); 6115 var xorBy = baseRest(function(arrays) { 6116 var iteratee2 = last(arrays); 6117 if (isArrayLikeObject(iteratee2)) { 6118 iteratee2 = undefined2; 6119 } 6120 return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee2, 2)); 6121 }); 6122 var xorWith = baseRest(function(arrays) { 6123 var comparator = last(arrays); 6124 comparator = typeof comparator == "function" ? comparator : undefined2; 6125 return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined2, comparator); 6126 }); 6127 var zip = baseRest(unzip); 6128 function zipObject(props, values2) { 6129 return baseZipObject(props || [], values2 || [], assignValue); 6130 } 6131 function zipObjectDeep(props, values2) { 6132 return baseZipObject(props || [], values2 || [], baseSet); 6133 } 6134 var zipWith = baseRest(function(arrays) { 6135 var length = arrays.length, iteratee2 = length > 1 ? arrays[length - 1] : undefined2; 6136 iteratee2 = typeof iteratee2 == "function" ? (arrays.pop(), iteratee2) : undefined2; 6137 return unzipWith(arrays, iteratee2); 6138 }); 6139 function chain(value) { 6140 var result2 = lodash(value); 6141 result2.__chain__ = true; 6142 return result2; 6143 } 6144 function tap(value, interceptor) { 6145 interceptor(value); 6146 return value; 6147 } 6148 function thru(value, interceptor) { 6149 return interceptor(value); 6150 } 6151 var wrapperAt = flatRest(function(paths) { 6152 var length = paths.length, start = length ? paths[0] : 0, value = this.__wrapped__, interceptor = function(object) { 6153 return baseAt(object, paths); 6154 }; 6155 if (length > 1 || this.__actions__.length || !(value instanceof LazyWrapper) || !isIndex(start)) { 6156 return this.thru(interceptor); 6157 } 6158 value = value.slice(start, +start + (length ? 1 : 0)); 6159 value.__actions__.push({ 6160 "func": thru, 6161 "args": [interceptor], 6162 "thisArg": undefined2 6163 }); 6164 return new LodashWrapper(value, this.__chain__).thru(function(array) { 6165 if (length && !array.length) { 6166 array.push(undefined2); 6167 } 6168 return array; 6169 }); 6170 }); 6171 function wrapperChain() { 6172 return chain(this); 6173 } 6174 function wrapperCommit() { 6175 return new LodashWrapper(this.value(), this.__chain__); 6176 } 6177 function wrapperNext() { 6178 if (this.__values__ === undefined2) { 6179 this.__values__ = toArray(this.value()); 6180 } 6181 var done = this.__index__ >= this.__values__.length, value = done ? undefined2 : this.__values__[this.__index__++]; 6182 return { "done": done, "value": value }; 6183 } 6184 function wrapperToIterator() { 6185 return this; 6186 } 6187 function wrapperPlant(value) { 6188 var result2, parent2 = this; 6189 while (parent2 instanceof baseLodash) { 6190 var clone2 = wrapperClone(parent2); 6191 clone2.__index__ = 0; 6192 clone2.__values__ = undefined2; 6193 if (result2) { 6194 previous.__wrapped__ = clone2; 6195 } else { 6196 result2 = clone2; 6197 } 6198 var previous = clone2; 6199 parent2 = parent2.__wrapped__; 6200 } 6201 previous.__wrapped__ = value; 6202 return result2; 6203 } 6204 function wrapperReverse() { 6205 var value = this.__wrapped__; 6206 if (value instanceof LazyWrapper) { 6207 var wrapped = value; 6208 if (this.__actions__.length) { 6209 wrapped = new LazyWrapper(this); 6210 } 6211 wrapped = wrapped.reverse(); 6212 wrapped.__actions__.push({ 6213 "func": thru, 6214 "args": [reverse], 6215 "thisArg": undefined2 6216 }); 6217 return new LodashWrapper(wrapped, this.__chain__); 6218 } 6219 return this.thru(reverse); 6220 } 6221 function wrapperValue() { 6222 return baseWrapperValue(this.__wrapped__, this.__actions__); 6223 } 6224 var countBy = createAggregator(function(result2, value, key) { 6225 if (hasOwnProperty.call(result2, key)) { 6226 ++result2[key]; 6227 } else { 6228 baseAssignValue(result2, key, 1); 6229 } 6230 }); 6231 function every(collection, predicate, guard) { 6232 var func = isArray(collection) ? arrayEvery : baseEvery; 6233 if (guard && isIterateeCall(collection, predicate, guard)) { 6234 predicate = undefined2; 6235 } 6236 return func(collection, getIteratee(predicate, 3)); 6237 } 6238 function filter(collection, predicate) { 6239 var func = isArray(collection) ? arrayFilter : baseFilter; 6240 return func(collection, getIteratee(predicate, 3)); 6241 } 6242 var find = createFind(findIndex); 6243 var findLast = createFind(findLastIndex); 6244 function flatMap(collection, iteratee2) { 6245 return baseFlatten(map(collection, iteratee2), 1); 6246 } 6247 function flatMapDeep(collection, iteratee2) { 6248 return baseFlatten(map(collection, iteratee2), INFINITY); 6249 } 6250 function flatMapDepth(collection, iteratee2, depth) { 6251 depth = depth === undefined2 ? 1 : toInteger(depth); 6252 return baseFlatten(map(collection, iteratee2), depth); 6253 } 6254 function forEach(collection, iteratee2) { 6255 var func = isArray(collection) ? arrayEach : baseEach; 6256 return func(collection, getIteratee(iteratee2, 3)); 6257 } 6258 function forEachRight(collection, iteratee2) { 6259 var func = isArray(collection) ? arrayEachRight : baseEachRight; 6260 return func(collection, getIteratee(iteratee2, 3)); 6261 } 6262 var groupBy = createAggregator(function(result2, value, key) { 6263 if (hasOwnProperty.call(result2, key)) { 6264 result2[key].push(value); 6265 } else { 6266 baseAssignValue(result2, key, [value]); 6267 } 6268 }); 6269 function includes(collection, value, fromIndex, guard) { 6270 collection = isArrayLike(collection) ? collection : values(collection); 6271 fromIndex = fromIndex && !guard ? toInteger(fromIndex) : 0; 6272 var length = collection.length; 6273 if (fromIndex < 0) { 6274 fromIndex = nativeMax(length + fromIndex, 0); 6275 } 6276 return isString(collection) ? fromIndex <= length && collection.indexOf(value, fromIndex) > -1 : !!length && baseIndexOf(collection, value, fromIndex) > -1; 6277 } 6278 var invokeMap = baseRest(function(collection, path, args) { 6279 var index = -1, isFunc = typeof path == "function", result2 = isArrayLike(collection) ? Array2(collection.length) : []; 6280 baseEach(collection, function(value) { 6281 result2[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args); 6282 }); 6283 return result2; 6284 }); 6285 var keyBy = createAggregator(function(result2, value, key) { 6286 baseAssignValue(result2, key, value); 6287 }); 6288 function map(collection, iteratee2) { 6289 var func = isArray(collection) ? arrayMap : baseMap; 6290 return func(collection, getIteratee(iteratee2, 3)); 6291 } 6292 function orderBy(collection, iteratees, orders, guard) { 6293 if (collection == null) { 6294 return []; 6295 } 6296 if (!isArray(iteratees)) { 6297 iteratees = iteratees == null ? [] : [iteratees]; 6298 } 6299 orders = guard ? undefined2 : orders; 6300 if (!isArray(orders)) { 6301 orders = orders == null ? [] : [orders]; 6302 } 6303 return baseOrderBy(collection, iteratees, orders); 6304 } 6305 var partition = createAggregator(function(result2, value, key) { 6306 result2[key ? 0 : 1].push(value); 6307 }, function() { 6308 return [[], []]; 6309 }); 6310 function reduce(collection, iteratee2, accumulator) { 6311 var func = isArray(collection) ? arrayReduce : baseReduce, initAccum = arguments.length < 3; 6312 return func(collection, getIteratee(iteratee2, 4), accumulator, initAccum, baseEach); 6313 } 6314 function reduceRight(collection, iteratee2, accumulator) { 6315 var func = isArray(collection) ? arrayReduceRight : baseReduce, initAccum = arguments.length < 3; 6316 return func(collection, getIteratee(iteratee2, 4), accumulator, initAccum, baseEachRight); 6317 } 6318 function reject(collection, predicate) { 6319 var func = isArray(collection) ? arrayFilter : baseFilter; 6320 return func(collection, negate(getIteratee(predicate, 3))); 6321 } 6322 function sample(collection) { 6323 var func = isArray(collection) ? arraySample : baseSample; 6324 return func(collection); 6325 } 6326 function sampleSize(collection, n, guard) { 6327 if (guard ? isIterateeCall(collection, n, guard) : n === undefined2) { 6328 n = 1; 6329 } else { 6330 n = toInteger(n); 6331 } 6332 var func = isArray(collection) ? arraySampleSize : baseSampleSize; 6333 return func(collection, n); 6334 } 6335 function shuffle(collection) { 6336 var func = isArray(collection) ? arrayShuffle : baseShuffle; 6337 return func(collection); 6338 } 6339 function size(collection) { 6340 if (collection == null) { 6341 return 0; 6342 } 6343 if (isArrayLike(collection)) { 6344 return isString(collection) ? stringSize(collection) : collection.length; 6345 } 6346 var tag = getTag(collection); 6347 if (tag == mapTag || tag == setTag) { 6348 return collection.size; 6349 } 6350 return baseKeys(collection).length; 6351 } 6352 function some(collection, predicate, guard) { 6353 var func = isArray(collection) ? arraySome : baseSome; 6354 if (guard && isIterateeCall(collection, predicate, guard)) { 6355 predicate = undefined2; 6356 } 6357 return func(collection, getIteratee(predicate, 3)); 6358 } 6359 var sortBy = baseRest(function(collection, iteratees) { 6360 if (collection == null) { 6361 return []; 6362 } 6363 var length = iteratees.length; 6364 if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) { 6365 iteratees = []; 6366 } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) { 6367 iteratees = [iteratees[0]]; 6368 } 6369 return baseOrderBy(collection, baseFlatten(iteratees, 1), []); 6370 }); 6371 var now = ctxNow || function() { 6372 return root.Date.now(); 6373 }; 6374 function after(n, func) { 6375 if (typeof func != "function") { 6376 throw new TypeError2(FUNC_ERROR_TEXT); 6377 } 6378 n = toInteger(n); 6379 return function() { 6380 if (--n < 1) { 6381 return func.apply(this, arguments); 6382 } 6383 }; 6384 } 6385 function ary(func, n, guard) { 6386 n = guard ? undefined2 : n; 6387 n = func && n == null ? func.length : n; 6388 return createWrap(func, WRAP_ARY_FLAG, undefined2, undefined2, undefined2, undefined2, n); 6389 } 6390 function before(n, func) { 6391 var result2; 6392 if (typeof func != "function") { 6393 throw new TypeError2(FUNC_ERROR_TEXT); 6394 } 6395 n = toInteger(n); 6396 return function() { 6397 if (--n > 0) { 6398 result2 = func.apply(this, arguments); 6399 } 6400 if (n <= 1) { 6401 func = undefined2; 6402 } 6403 return result2; 6404 }; 6405 } 6406 var bind = baseRest(function(func, thisArg, partials) { 6407 var bitmask = WRAP_BIND_FLAG; 6408 if (partials.length) { 6409 var holders = replaceHolders(partials, getHolder(bind)); 6410 bitmask |= WRAP_PARTIAL_FLAG; 6411 } 6412 return createWrap(func, bitmask, thisArg, partials, holders); 6413 }); 6414 var bindKey = baseRest(function(object, key, partials) { 6415 var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG; 6416 if (partials.length) { 6417 var holders = replaceHolders(partials, getHolder(bindKey)); 6418 bitmask |= WRAP_PARTIAL_FLAG; 6419 } 6420 return createWrap(key, bitmask, object, partials, holders); 6421 }); 6422 function curry(func, arity, guard) { 6423 arity = guard ? undefined2 : arity; 6424 var result2 = createWrap(func, WRAP_CURRY_FLAG, undefined2, undefined2, undefined2, undefined2, undefined2, arity); 6425 result2.placeholder = curry.placeholder; 6426 return result2; 6427 } 6428 function curryRight(func, arity, guard) { 6429 arity = guard ? undefined2 : arity; 6430 var result2 = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined2, undefined2, undefined2, undefined2, undefined2, arity); 6431 result2.placeholder = curryRight.placeholder; 6432 return result2; 6433 } 6434 function debounce(func, wait, options) { 6435 var lastArgs, lastThis, maxWait, result2, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true; 6436 if (typeof func != "function") { 6437 throw new TypeError2(FUNC_ERROR_TEXT); 6438 } 6439 wait = toNumber(wait) || 0; 6440 if (isObject(options)) { 6441 leading = !!options.leading; 6442 maxing = "maxWait" in options; 6443 maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait; 6444 trailing = "trailing" in options ? !!options.trailing : trailing; 6445 } 6446 function invokeFunc(time) { 6447 var args = lastArgs, thisArg = lastThis; 6448 lastArgs = lastThis = undefined2; 6449 lastInvokeTime = time; 6450 result2 = func.apply(thisArg, args); 6451 return result2; 6452 } 6453 function leadingEdge(time) { 6454 lastInvokeTime = time; 6455 timerId = setTimeout(timerExpired, wait); 6456 return leading ? invokeFunc(time) : result2; 6457 } 6458 function remainingWait(time) { 6459 var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall; 6460 return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting; 6461 } 6462 function shouldInvoke(time) { 6463 var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime; 6464 return lastCallTime === undefined2 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait; 6465 } 6466 function timerExpired() { 6467 var time = now(); 6468 if (shouldInvoke(time)) { 6469 return trailingEdge(time); 6470 } 6471 timerId = setTimeout(timerExpired, remainingWait(time)); 6472 } 6473 function trailingEdge(time) { 6474 timerId = undefined2; 6475 if (trailing && lastArgs) { 6476 return invokeFunc(time); 6477 } 6478 lastArgs = lastThis = undefined2; 6479 return result2; 6480 } 6481 function cancel() { 6482 if (timerId !== undefined2) { 6483 clearTimeout(timerId); 6484 } 6485 lastInvokeTime = 0; 6486 lastArgs = lastCallTime = lastThis = timerId = undefined2; 6487 } 6488 function flush() { 6489 return timerId === undefined2 ? result2 : trailingEdge(now()); 6490 } 6491 function debounced() { 6492 var time = now(), isInvoking = shouldInvoke(time); 6493 lastArgs = arguments; 6494 lastThis = this; 6495 lastCallTime = time; 6496 if (isInvoking) { 6497 if (timerId === undefined2) { 6498 return leadingEdge(lastCallTime); 6499 } 6500 if (maxing) { 6501 clearTimeout(timerId); 6502 timerId = setTimeout(timerExpired, wait); 6503 return invokeFunc(lastCallTime); 6504 } 6505 } 6506 if (timerId === undefined2) { 6507 timerId = setTimeout(timerExpired, wait); 6508 } 6509 return result2; 6510 } 6511 debounced.cancel = cancel; 6512 debounced.flush = flush; 6513 return debounced; 6514 } 6515 var defer = baseRest(function(func, args) { 6516 return baseDelay(func, 1, args); 6517 }); 6518 var delay = baseRest(function(func, wait, args) { 6519 return baseDelay(func, toNumber(wait) || 0, args); 6520 }); 6521 function flip(func) { 6522 return createWrap(func, WRAP_FLIP_FLAG); 6523 } 6524 function memoize(func, resolver) { 6525 if (typeof func != "function" || resolver != null && typeof resolver != "function") { 6526 throw new TypeError2(FUNC_ERROR_TEXT); 6527 } 6528 var memoized = function() { 6529 var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache; 6530 if (cache.has(key)) { 6531 return cache.get(key); 6532 } 6533 var result2 = func.apply(this, args); 6534 memoized.cache = cache.set(key, result2) || cache; 6535 return result2; 6536 }; 6537 memoized.cache = new (memoize.Cache || MapCache)(); 6538 return memoized; 6539 } 6540 memoize.Cache = MapCache; 6541 function negate(predicate) { 6542 if (typeof predicate != "function") { 6543 throw new TypeError2(FUNC_ERROR_TEXT); 6544 } 6545 return function() { 6546 var args = arguments; 6547 switch (args.length) { 6548 case 0: 6549 return !predicate.call(this); 6550 case 1: 6551 return !predicate.call(this, args[0]); 6552 case 2: 6553 return !predicate.call(this, args[0], args[1]); 6554 case 3: 6555 return !predicate.call(this, args[0], args[1], args[2]); 6556 } 6557 return !predicate.apply(this, args); 6558 }; 6559 } 6560 function once(func) { 6561 return before(2, func); 6562 } 6563 var overArgs = castRest(function(func, transforms) { 6564 transforms = transforms.length == 1 && isArray(transforms[0]) ? arrayMap(transforms[0], baseUnary(getIteratee())) : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee())); 6565 var funcsLength = transforms.length; 6566 return baseRest(function(args) { 6567 var index = -1, length = nativeMin(args.length, funcsLength); 6568 while (++index < length) { 6569 args[index] = transforms[index].call(this, args[index]); 6570 } 6571 return apply(func, this, args); 6572 }); 6573 }); 6574 var partial = baseRest(function(func, partials) { 6575 var holders = replaceHolders(partials, getHolder(partial)); 6576 return createWrap(func, WRAP_PARTIAL_FLAG, undefined2, partials, holders); 6577 }); 6578 var partialRight = baseRest(function(func, partials) { 6579 var holders = replaceHolders(partials, getHolder(partialRight)); 6580 return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined2, partials, holders); 6581 }); 6582 var rearg = flatRest(function(func, indexes) { 6583 return createWrap(func, WRAP_REARG_FLAG, undefined2, undefined2, undefined2, indexes); 6584 }); 6585 function rest(func, start) { 6586 if (typeof func != "function") { 6587 throw new TypeError2(FUNC_ERROR_TEXT); 6588 } 6589 start = start === undefined2 ? start : toInteger(start); 6590 return baseRest(func, start); 6591 } 6592 function spread(func, start) { 6593 if (typeof func != "function") { 6594 throw new TypeError2(FUNC_ERROR_TEXT); 6595 } 6596 start = start == null ? 0 : nativeMax(toInteger(start), 0); 6597 return baseRest(function(args) { 6598 var array = args[start], otherArgs = castSlice(args, 0, start); 6599 if (array) { 6600 arrayPush(otherArgs, array); 6601 } 6602 return apply(func, this, otherArgs); 6603 }); 6604 } 6605 function throttle(func, wait, options) { 6606 var leading = true, trailing = true; 6607 if (typeof func != "function") { 6608 throw new TypeError2(FUNC_ERROR_TEXT); 6609 } 6610 if (isObject(options)) { 6611 leading = "leading" in options ? !!options.leading : leading; 6612 trailing = "trailing" in options ? !!options.trailing : trailing; 6613 } 6614 return debounce(func, wait, { 6615 "leading": leading, 6616 "maxWait": wait, 6617 "trailing": trailing 6618 }); 6619 } 6620 function unary(func) { 6621 return ary(func, 1); 6622 } 6623 function wrap(value, wrapper) { 6624 return partial(castFunction(wrapper), value); 6625 } 6626 function castArray() { 6627 if (!arguments.length) { 6628 return []; 6629 } 6630 var value = arguments[0]; 6631 return isArray(value) ? value : [value]; 6632 } 6633 function clone(value) { 6634 return baseClone(value, CLONE_SYMBOLS_FLAG); 6635 } 6636 function cloneWith(value, customizer) { 6637 customizer = typeof customizer == "function" ? customizer : undefined2; 6638 return baseClone(value, CLONE_SYMBOLS_FLAG, customizer); 6639 } 6640 function cloneDeep(value) { 6641 return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG); 6642 } 6643 function cloneDeepWith(value, customizer) { 6644 customizer = typeof customizer == "function" ? customizer : undefined2; 6645 return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer); 6646 } 6647 function conformsTo(object, source) { 6648 return source == null || baseConformsTo(object, source, keys(source)); 6649 } 6650 function eq(value, other) { 6651 return value === other || value !== value && other !== other; 6652 } 6653 var gt = createRelationalOperation(baseGt); 6654 var gte = createRelationalOperation(function(value, other) { 6655 return value >= other; 6656 }); 6657 var isArguments = baseIsArguments(/* @__PURE__ */ function() { 6658 return arguments; 6659 }()) ? baseIsArguments : function(value) { 6660 return isObjectLike(value) && hasOwnProperty.call(value, "callee") && !propertyIsEnumerable.call(value, "callee"); 6661 }; 6662 var isArray = Array2.isArray; 6663 var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer; 6664 function isArrayLike(value) { 6665 return value != null && isLength(value.length) && !isFunction(value); 6666 } 6667 function isArrayLikeObject(value) { 6668 return isObjectLike(value) && isArrayLike(value); 6669 } 6670 function isBoolean(value) { 6671 return value === true || value === false || isObjectLike(value) && baseGetTag(value) == boolTag; 6672 } 6673 var isBuffer = nativeIsBuffer || stubFalse; 6674 var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate; 6675 function isElement(value) { 6676 return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value); 6677 } 6678 function isEmpty(value) { 6679 if (value == null) { 6680 return true; 6681 } 6682 if (isArrayLike(value) && (isArray(value) || typeof value == "string" || typeof value.splice == "function" || isBuffer(value) || isTypedArray(value) || isArguments(value))) { 6683 return !value.length; 6684 } 6685 var tag = getTag(value); 6686 if (tag == mapTag || tag == setTag) { 6687 return !value.size; 6688 } 6689 if (isPrototype(value)) { 6690 return !baseKeys(value).length; 6691 } 6692 for (var key in value) { 6693 if (hasOwnProperty.call(value, key)) { 6694 return false; 6695 } 6696 } 6697 return true; 6698 } 6699 function isEqual(value, other) { 6700 return baseIsEqual(value, other); 6701 } 6702 function isEqualWith(value, other, customizer) { 6703 customizer = typeof customizer == "function" ? customizer : undefined2; 6704 var result2 = customizer ? customizer(value, other) : undefined2; 6705 return result2 === undefined2 ? baseIsEqual(value, other, undefined2, customizer) : !!result2; 6706 } 6707 function isError(value) { 6708 if (!isObjectLike(value)) { 6709 return false; 6710 } 6711 var tag = baseGetTag(value); 6712 return tag == errorTag || tag == domExcTag || typeof value.message == "string" && typeof value.name == "string" && !isPlainObject(value); 6713 } 6714 function isFinite2(value) { 6715 return typeof value == "number" && nativeIsFinite(value); 6716 } 6717 function isFunction(value) { 6718 if (!isObject(value)) { 6719 return false; 6720 } 6721 var tag = baseGetTag(value); 6722 return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; 6723 } 6724 function isInteger(value) { 6725 return typeof value == "number" && value == toInteger(value); 6726 } 6727 function isLength(value) { 6728 return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; 6729 } 6730 function isObject(value) { 6731 var type = typeof value; 6732 return value != null && (type == "object" || type == "function"); 6733 } 6734 function isObjectLike(value) { 6735 return value != null && typeof value == "object"; 6736 } 6737 var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap; 6738 function isMatch(object, source) { 6739 return object === source || baseIsMatch(object, source, getMatchData(source)); 6740 } 6741 function isMatchWith(object, source, customizer) { 6742 customizer = typeof customizer == "function" ? customizer : undefined2; 6743 return baseIsMatch(object, source, getMatchData(source), customizer); 6744 } 6745 function isNaN2(value) { 6746 return isNumber(value) && value != +value; 6747 } 6748 function isNative(value) { 6749 if (isMaskable(value)) { 6750 throw new Error2(CORE_ERROR_TEXT); 6751 } 6752 return baseIsNative(value); 6753 } 6754 function isNull(value) { 6755 return value === null; 6756 } 6757 function isNil(value) { 6758 return value == null; 6759 } 6760 function isNumber(value) { 6761 return typeof value == "number" || isObjectLike(value) && baseGetTag(value) == numberTag; 6762 } 6763 function isPlainObject(value) { 6764 if (!isObjectLike(value) || baseGetTag(value) != objectTag) { 6765 return false; 6766 } 6767 var proto = getPrototype(value); 6768 if (proto === null) { 6769 return true; 6770 } 6771 var Ctor = hasOwnProperty.call(proto, "constructor") && proto.constructor; 6772 return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString; 6773 } 6774 var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp; 6775 function isSafeInteger(value) { 6776 return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER; 6777 } 6778 var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet; 6779 function isString(value) { 6780 return typeof value == "string" || !isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag; 6781 } 6782 function isSymbol(value) { 6783 return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag; 6784 } 6785 var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; 6786 function isUndefined(value) { 6787 return value === undefined2; 6788 } 6789 function isWeakMap(value) { 6790 return isObjectLike(value) && getTag(value) == weakMapTag; 6791 } 6792 function isWeakSet(value) { 6793 return isObjectLike(value) && baseGetTag(value) == weakSetTag; 6794 } 6795 var lt = createRelationalOperation(baseLt); 6796 var lte = createRelationalOperation(function(value, other) { 6797 return value <= other; 6798 }); 6799 function toArray(value) { 6800 if (!value) { 6801 return []; 6802 } 6803 if (isArrayLike(value)) { 6804 return isString(value) ? stringToArray(value) : copyArray(value); 6805 } 6806 if (symIterator && value[symIterator]) { 6807 return iteratorToArray(value[symIterator]()); 6808 } 6809 var tag = getTag(value), func = tag == mapTag ? mapToArray : tag == setTag ? setToArray : values; 6810 return func(value); 6811 } 6812 function toFinite(value) { 6813 if (!value) { 6814 return value === 0 ? value : 0; 6815 } 6816 value = toNumber(value); 6817 if (value === INFINITY || value === -INFINITY) { 6818 var sign = value < 0 ? -1 : 1; 6819 return sign * MAX_INTEGER; 6820 } 6821 return value === value ? value : 0; 6822 } 6823 function toInteger(value) { 6824 var result2 = toFinite(value), remainder = result2 % 1; 6825 return result2 === result2 ? remainder ? result2 - remainder : result2 : 0; 6826 } 6827 function toLength(value) { 6828 return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0; 6829 } 6830 function toNumber(value) { 6831 if (typeof value == "number") { 6832 return value; 6833 } 6834 if (isSymbol(value)) { 6835 return NAN; 6836 } 6837 if (isObject(value)) { 6838 var other = typeof value.valueOf == "function" ? value.valueOf() : value; 6839 value = isObject(other) ? other + "" : other; 6840 } 6841 if (typeof value != "string") { 6842 return value === 0 ? value : +value; 6843 } 6844 value = baseTrim(value); 6845 var isBinary = reIsBinary.test(value); 6846 return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value; 6847 } 6848 function toPlainObject(value) { 6849 return copyObject(value, keysIn(value)); 6850 } 6851 function toSafeInteger(value) { 6852 return value ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER) : value === 0 ? value : 0; 6853 } 6854 function toString(value) { 6855 return value == null ? "" : baseToString(value); 6856 } 6857 var assign = createAssigner(function(object, source) { 6858 if (isPrototype(source) || isArrayLike(source)) { 6859 copyObject(source, keys(source), object); 6860 return; 6861 } 6862 for (var key in source) { 6863 if (hasOwnProperty.call(source, key)) { 6864 assignValue(object, key, source[key]); 6865 } 6866 } 6867 }); 6868 var assignIn = createAssigner(function(object, source) { 6869 copyObject(source, keysIn(source), object); 6870 }); 6871 var assignInWith = createAssigner(function(object, source, srcIndex, customizer) { 6872 copyObject(source, keysIn(source), object, customizer); 6873 }); 6874 var assignWith = createAssigner(function(object, source, srcIndex, customizer) { 6875 copyObject(source, keys(source), object, customizer); 6876 }); 6877 var at = flatRest(baseAt); 6878 function create(prototype, properties) { 6879 var result2 = baseCreate(prototype); 6880 return properties == null ? result2 : baseAssign(result2, properties); 6881 } 6882 var defaults = baseRest(function(object, sources) { 6883 object = Object2(object); 6884 var index = -1; 6885 var length = sources.length; 6886 var guard = length > 2 ? sources[2] : undefined2; 6887 if (guard && isIterateeCall(sources[0], sources[1], guard)) { 6888 length = 1; 6889 } 6890 while (++index < length) { 6891 var source = sources[index]; 6892 var props = keysIn(source); 6893 var propsIndex = -1; 6894 var propsLength = props.length; 6895 while (++propsIndex < propsLength) { 6896 var key = props[propsIndex]; 6897 var value = object[key]; 6898 if (value === undefined2 || eq(value, objectProto[key]) && !hasOwnProperty.call(object, key)) { 6899 object[key] = source[key]; 6900 } 6901 } 6902 } 6903 return object; 6904 }); 6905 var defaultsDeep = baseRest(function(args) { 6906 args.push(undefined2, customDefaultsMerge); 6907 return apply(mergeWith, undefined2, args); 6908 }); 6909 function findKey(object, predicate) { 6910 return baseFindKey(object, getIteratee(predicate, 3), baseForOwn); 6911 } 6912 function findLastKey(object, predicate) { 6913 return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight); 6914 } 6915 function forIn(object, iteratee2) { 6916 return object == null ? object : baseFor(object, getIteratee(iteratee2, 3), keysIn); 6917 } 6918 function forInRight(object, iteratee2) { 6919 return object == null ? object : baseForRight(object, getIteratee(iteratee2, 3), keysIn); 6920 } 6921 function forOwn(object, iteratee2) { 6922 return object && baseForOwn(object, getIteratee(iteratee2, 3)); 6923 } 6924 function forOwnRight(object, iteratee2) { 6925 return object && baseForOwnRight(object, getIteratee(iteratee2, 3)); 6926 } 6927 function functions(object) { 6928 return object == null ? [] : baseFunctions(object, keys(object)); 6929 } 6930 function functionsIn(object) { 6931 return object == null ? [] : baseFunctions(object, keysIn(object)); 6932 } 6933 function get(object, path, defaultValue) { 6934 var result2 = object == null ? undefined2 : baseGet(object, path); 6935 return result2 === undefined2 ? defaultValue : result2; 6936 } 6937 function has(object, path) { 6938 return object != null && hasPath(object, path, baseHas); 6939 } 6940 function hasIn(object, path) { 6941 return object != null && hasPath(object, path, baseHasIn); 6942 } 6943 var invert = createInverter(function(result2, value, key) { 6944 if (value != null && typeof value.toString != "function") { 6945 value = nativeObjectToString.call(value); 6946 } 6947 result2[value] = key; 6948 }, constant(identity)); 6949 var invertBy = createInverter(function(result2, value, key) { 6950 if (value != null && typeof value.toString != "function") { 6951 value = nativeObjectToString.call(value); 6952 } 6953 if (hasOwnProperty.call(result2, value)) { 6954 result2[value].push(key); 6955 } else { 6956 result2[value] = [key]; 6957 } 6958 }, getIteratee); 6959 var invoke = baseRest(baseInvoke); 6960 function keys(object) { 6961 return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); 6962 } 6963 function keysIn(object) { 6964 return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); 6965 } 6966 function mapKeys(object, iteratee2) { 6967 var result2 = {}; 6968 iteratee2 = getIteratee(iteratee2, 3); 6969 baseForOwn(object, function(value, key, object2) { 6970 baseAssignValue(result2, iteratee2(value, key, object2), value); 6971 }); 6972 return result2; 6973 } 6974 function mapValues(object, iteratee2) { 6975 var result2 = {}; 6976 iteratee2 = getIteratee(iteratee2, 3); 6977 baseForOwn(object, function(value, key, object2) { 6978 baseAssignValue(result2, key, iteratee2(value, key, object2)); 6979 }); 6980 return result2; 6981 } 6982 var merge = createAssigner(function(object, source, srcIndex) { 6983 baseMerge(object, source, srcIndex); 6984 }); 6985 var mergeWith = createAssigner(function(object, source, srcIndex, customizer) { 6986 baseMerge(object, source, srcIndex, customizer); 6987 }); 6988 var omit = flatRest(function(object, paths) { 6989 var result2 = {}; 6990 if (object == null) { 6991 return result2; 6992 } 6993 var isDeep = false; 6994 paths = arrayMap(paths, function(path) { 6995 path = castPath(path, object); 6996 isDeep || (isDeep = path.length > 1); 6997 return path; 6998 }); 6999 copyObject(object, getAllKeysIn(object), result2); 7000 if (isDeep) { 7001 result2 = baseClone(result2, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone); 7002 } 7003 var length = paths.length; 7004 while (length--) { 7005 baseUnset(result2, paths[length]); 7006 } 7007 return result2; 7008 }); 7009 function omitBy(object, predicate) { 7010 return pickBy(object, negate(getIteratee(predicate))); 7011 } 7012 var pick = flatRest(function(object, paths) { 7013 return object == null ? {} : basePick(object, paths); 7014 }); 7015 function pickBy(object, predicate) { 7016 if (object == null) { 7017 return {}; 7018 } 7019 var props = arrayMap(getAllKeysIn(object), function(prop) { 7020 return [prop]; 7021 }); 7022 predicate = getIteratee(predicate); 7023 return basePickBy(object, props, function(value, path) { 7024 return predicate(value, path[0]); 7025 }); 7026 } 7027 function result(object, path, defaultValue) { 7028 path = castPath(path, object); 7029 var index = -1, length = path.length; 7030 if (!length) { 7031 length = 1; 7032 object = undefined2; 7033 } 7034 while (++index < length) { 7035 var value = object == null ? undefined2 : object[toKey(path[index])]; 7036 if (value === undefined2) { 7037 index = length; 7038 value = defaultValue; 7039 } 7040 object = isFunction(value) ? value.call(object) : value; 7041 } 7042 return object; 7043 } 7044 function set(object, path, value) { 7045 return object == null ? object : baseSet(object, path, value); 7046 } 7047 function setWith(object, path, value, customizer) { 7048 customizer = typeof customizer == "function" ? customizer : undefined2; 7049 return object == null ? object : baseSet(object, path, value, customizer); 7050 } 7051 var toPairs = createToPairs(keys); 7052 var toPairsIn = createToPairs(keysIn); 7053 function transform(object, iteratee2, accumulator) { 7054 var isArr = isArray(object), isArrLike = isArr || isBuffer(object) || isTypedArray(object); 7055 iteratee2 = getIteratee(iteratee2, 4); 7056 if (accumulator == null) { 7057 var Ctor = object && object.constructor; 7058 if (isArrLike) { 7059 accumulator = isArr ? new Ctor() : []; 7060 } else if (isObject(object)) { 7061 accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {}; 7062 } else { 7063 accumulator = {}; 7064 } 7065 } 7066 (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object2) { 7067 return iteratee2(accumulator, value, index, object2); 7068 }); 7069 return accumulator; 7070 } 7071 function unset(object, path) { 7072 return object == null ? true : baseUnset(object, path); 7073 } 7074 function update(object, path, updater) { 7075 return object == null ? object : baseUpdate(object, path, castFunction(updater)); 7076 } 7077 function updateWith(object, path, updater, customizer) { 7078 customizer = typeof customizer == "function" ? customizer : undefined2; 7079 return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer); 7080 } 7081 function values(object) { 7082 return object == null ? [] : baseValues(object, keys(object)); 7083 } 7084 function valuesIn(object) { 7085 return object == null ? [] : baseValues(object, keysIn(object)); 7086 } 7087 function clamp(number, lower, upper) { 7088 if (upper === undefined2) { 7089 upper = lower; 7090 lower = undefined2; 7091 } 7092 if (upper !== undefined2) { 7093 upper = toNumber(upper); 7094 upper = upper === upper ? upper : 0; 7095 } 7096 if (lower !== undefined2) { 7097 lower = toNumber(lower); 7098 lower = lower === lower ? lower : 0; 7099 } 7100 return baseClamp(toNumber(number), lower, upper); 7101 } 7102 function inRange(number, start, end) { 7103 start = toFinite(start); 7104 if (end === undefined2) { 7105 end = start; 7106 start = 0; 7107 } else { 7108 end = toFinite(end); 7109 } 7110 number = toNumber(number); 7111 return baseInRange(number, start, end); 7112 } 7113 function random(lower, upper, floating) { 7114 if (floating && typeof floating != "boolean" && isIterateeCall(lower, upper, floating)) { 7115 upper = floating = undefined2; 7116 } 7117 if (floating === undefined2) { 7118 if (typeof upper == "boolean") { 7119 floating = upper; 7120 upper = undefined2; 7121 } else if (typeof lower == "boolean") { 7122 floating = lower; 7123 lower = undefined2; 7124 } 7125 } 7126 if (lower === undefined2 && upper === undefined2) { 7127 lower = 0; 7128 upper = 1; 7129 } else { 7130 lower = toFinite(lower); 7131 if (upper === undefined2) { 7132 upper = lower; 7133 lower = 0; 7134 } else { 7135 upper = toFinite(upper); 7136 } 7137 } 7138 if (lower > upper) { 7139 var temp = lower; 7140 lower = upper; 7141 upper = temp; 7142 } 7143 if (floating || lower % 1 || upper % 1) { 7144 var rand = nativeRandom(); 7145 return nativeMin(lower + rand * (upper - lower + freeParseFloat("1e-" + ((rand + "").length - 1))), upper); 7146 } 7147 return baseRandom(lower, upper); 7148 } 7149 var camelCase = createCompounder(function(result2, word, index) { 7150 word = word.toLowerCase(); 7151 return result2 + (index ? capitalize(word) : word); 7152 }); 7153 function capitalize(string) { 7154 return upperFirst(toString(string).toLowerCase()); 7155 } 7156 function deburr(string) { 7157 string = toString(string); 7158 return string && string.replace(reLatin, deburrLetter).replace(reComboMark, ""); 7159 } 7160 function endsWith(string, target, position) { 7161 string = toString(string); 7162 target = baseToString(target); 7163 var length = string.length; 7164 position = position === undefined2 ? length : baseClamp(toInteger(position), 0, length); 7165 var end = position; 7166 position -= target.length; 7167 return position >= 0 && string.slice(position, end) == target; 7168 } 7169 function escape(string) { 7170 string = toString(string); 7171 return string && reHasUnescapedHtml.test(string) ? string.replace(reUnescapedHtml, escapeHtmlChar) : string; 7172 } 7173 function escapeRegExp(string) { 7174 string = toString(string); 7175 return string && reHasRegExpChar.test(string) ? string.replace(reRegExpChar, "\\$&") : string; 7176 } 7177 var kebabCase = createCompounder(function(result2, word, index) { 7178 return result2 + (index ? "-" : "") + word.toLowerCase(); 7179 }); 7180 var lowerCase = createCompounder(function(result2, word, index) { 7181 return result2 + (index ? " " : "") + word.toLowerCase(); 7182 }); 7183 var lowerFirst = createCaseFirst("toLowerCase"); 7184 function pad(string, length, chars) { 7185 string = toString(string); 7186 length = toInteger(length); 7187 var strLength = length ? stringSize(string) : 0; 7188 if (!length || strLength >= length) { 7189 return string; 7190 } 7191 var mid = (length - strLength) / 2; 7192 return createPadding(nativeFloor(mid), chars) + string + createPadding(nativeCeil(mid), chars); 7193 } 7194 function padEnd(string, length, chars) { 7195 string = toString(string); 7196 length = toInteger(length); 7197 var strLength = length ? stringSize(string) : 0; 7198 return length && strLength < length ? string + createPadding(length - strLength, chars) : string; 7199 } 7200 function padStart(string, length, chars) { 7201 string = toString(string); 7202 length = toInteger(length); 7203 var strLength = length ? stringSize(string) : 0; 7204 return length && strLength < length ? createPadding(length - strLength, chars) + string : string; 7205 } 7206 function parseInt2(string, radix, guard) { 7207 if (guard || radix == null) { 7208 radix = 0; 7209 } else if (radix) { 7210 radix = +radix; 7211 } 7212 return nativeParseInt(toString(string).replace(reTrimStart, ""), radix || 0); 7213 } 7214 function repeat(string, n, guard) { 7215 if (guard ? isIterateeCall(string, n, guard) : n === undefined2) { 7216 n = 1; 7217 } else { 7218 n = toInteger(n); 7219 } 7220 return baseRepeat(toString(string), n); 7221 } 7222 function replace() { 7223 var args = arguments, string = toString(args[0]); 7224 return args.length < 3 ? string : string.replace(args[1], args[2]); 7225 } 7226 var snakeCase = createCompounder(function(result2, word, index) { 7227 return result2 + (index ? "_" : "") + word.toLowerCase(); 7228 }); 7229 function split(string, separator, limit) { 7230 if (limit && typeof limit != "number" && isIterateeCall(string, separator, limit)) { 7231 separator = limit = undefined2; 7232 } 7233 limit = limit === undefined2 ? MAX_ARRAY_LENGTH : limit >>> 0; 7234 if (!limit) { 7235 return []; 7236 } 7237 string = toString(string); 7238 if (string && (typeof separator == "string" || separator != null && !isRegExp(separator))) { 7239 separator = baseToString(separator); 7240 if (!separator && hasUnicode(string)) { 7241 return castSlice(stringToArray(string), 0, limit); 7242 } 7243 } 7244 return string.split(separator, limit); 7245 } 7246 var startCase = createCompounder(function(result2, word, index) { 7247 return result2 + (index ? " " : "") + upperFirst(word); 7248 }); 7249 function startsWith(string, target, position) { 7250 string = toString(string); 7251 position = position == null ? 0 : baseClamp(toInteger(position), 0, string.length); 7252 target = baseToString(target); 7253 return string.slice(position, position + target.length) == target; 7254 } 7255 function template(string, options, guard) { 7256 var settings = lodash.templateSettings; 7257 if (guard && isIterateeCall(string, options, guard)) { 7258 options = undefined2; 7259 } 7260 string = toString(string); 7261 options = assignInWith({}, options, settings, customDefaultsAssignIn); 7262 var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys(imports), importsValues = baseValues(imports, importsKeys); 7263 var isEscaping, isEvaluating, index = 0, interpolate = options.interpolate || reNoMatch, source = "__p += '"; 7264 var reDelimiters = RegExp2( 7265 (options.escape || reNoMatch).source + "|" + interpolate.source + "|" + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options.evaluate || reNoMatch).source + "|$", 7266 "g" 7267 ); 7268 var sourceURL = "//# sourceURL=" + (hasOwnProperty.call(options, "sourceURL") ? (options.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++templateCounter + "]") + "\n"; 7269 string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) { 7270 interpolateValue || (interpolateValue = esTemplateValue); 7271 source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar); 7272 if (escapeValue) { 7273 isEscaping = true; 7274 source += "' +\n__e(" + escapeValue + ") +\n'"; 7275 } 7276 if (evaluateValue) { 7277 isEvaluating = true; 7278 source += "';\n" + evaluateValue + ";\n__p += '"; 7279 } 7280 if (interpolateValue) { 7281 source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'"; 7282 } 7283 index = offset + match.length; 7284 return match; 7285 }); 7286 source += "';\n"; 7287 var variable = hasOwnProperty.call(options, "variable") && options.variable; 7288 if (!variable) { 7289 source = "with (obj) {\n" + source + "\n}\n"; 7290 } else if (reForbiddenIdentifierChars.test(variable)) { 7291 throw new Error2(INVALID_TEMPL_VAR_ERROR_TEXT); 7292 } 7293 source = (isEvaluating ? source.replace(reEmptyStringLeading, "") : source).replace(reEmptyStringMiddle, "$1").replace(reEmptyStringTrailing, "$1;"); 7294 source = "function(" + (variable || "obj") + ") {\n" + (variable ? "" : "obj || (obj = {});\n") + "var __t, __p = ''" + (isEscaping ? ", __e = _.escape" : "") + (isEvaluating ? ", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n" : ";\n") + source + "return __p\n}"; 7295 var result2 = attempt(function() { 7296 return Function2(importsKeys, sourceURL + "return " + source).apply(undefined2, importsValues); 7297 }); 7298 result2.source = source; 7299 if (isError(result2)) { 7300 throw result2; 7301 } 7302 return result2; 7303 } 7304 function toLower(value) { 7305 return toString(value).toLowerCase(); 7306 } 7307 function toUpper(value) { 7308 return toString(value).toUpperCase(); 7309 } 7310 function trim(string, chars, guard) { 7311 string = toString(string); 7312 if (string && (guard || chars === undefined2)) { 7313 return baseTrim(string); 7314 } 7315 if (!string || !(chars = baseToString(chars))) { 7316 return string; 7317 } 7318 var strSymbols = stringToArray(string), chrSymbols = stringToArray(chars), start = charsStartIndex(strSymbols, chrSymbols), end = charsEndIndex(strSymbols, chrSymbols) + 1; 7319 return castSlice(strSymbols, start, end).join(""); 7320 } 7321 function trimEnd(string, chars, guard) { 7322 string = toString(string); 7323 if (string && (guard || chars === undefined2)) { 7324 return string.slice(0, trimmedEndIndex(string) + 1); 7325 } 7326 if (!string || !(chars = baseToString(chars))) { 7327 return string; 7328 } 7329 var strSymbols = stringToArray(string), end = charsEndIndex(strSymbols, stringToArray(chars)) + 1; 7330 return castSlice(strSymbols, 0, end).join(""); 7331 } 7332 function trimStart(string, chars, guard) { 7333 string = toString(string); 7334 if (string && (guard || chars === undefined2)) { 7335 return string.replace(reTrimStart, ""); 7336 } 7337 if (!string || !(chars = baseToString(chars))) { 7338 return string; 7339 } 7340 var strSymbols = stringToArray(string), start = charsStartIndex(strSymbols, stringToArray(chars)); 7341 return castSlice(strSymbols, start).join(""); 7342 } 7343 function truncate(string, options) { 7344 var length = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION; 7345 if (isObject(options)) { 7346 var separator = "separator" in options ? options.separator : separator; 7347 length = "length" in options ? toInteger(options.length) : length; 7348 omission = "omission" in options ? baseToString(options.omission) : omission; 7349 } 7350 string = toString(string); 7351 var strLength = string.length; 7352 if (hasUnicode(string)) { 7353 var strSymbols = stringToArray(string); 7354 strLength = strSymbols.length; 7355 } 7356 if (length >= strLength) { 7357 return string; 7358 } 7359 var end = length - stringSize(omission); 7360 if (end < 1) { 7361 return omission; 7362 } 7363 var result2 = strSymbols ? castSlice(strSymbols, 0, end).join("") : string.slice(0, end); 7364 if (separator === undefined2) { 7365 return result2 + omission; 7366 } 7367 if (strSymbols) { 7368 end += result2.length - end; 7369 } 7370 if (isRegExp(separator)) { 7371 if (string.slice(end).search(separator)) { 7372 var match, substring = result2; 7373 if (!separator.global) { 7374 separator = RegExp2(separator.source, toString(reFlags.exec(separator)) + "g"); 7375 } 7376 separator.lastIndex = 0; 7377 while (match = separator.exec(substring)) { 7378 var newEnd = match.index; 7379 } 7380 result2 = result2.slice(0, newEnd === undefined2 ? end : newEnd); 7381 } 7382 } else if (string.indexOf(baseToString(separator), end) != end) { 7383 var index = result2.lastIndexOf(separator); 7384 if (index > -1) { 7385 result2 = result2.slice(0, index); 7386 } 7387 } 7388 return result2 + omission; 7389 } 7390 function unescape(string) { 7391 string = toString(string); 7392 return string && reHasEscapedHtml.test(string) ? string.replace(reEscapedHtml, unescapeHtmlChar) : string; 7393 } 7394 var upperCase = createCompounder(function(result2, word, index) { 7395 return result2 + (index ? " " : "") + word.toUpperCase(); 7396 }); 7397 var upperFirst = createCaseFirst("toUpperCase"); 7398 function words(string, pattern, guard) { 7399 string = toString(string); 7400 pattern = guard ? undefined2 : pattern; 7401 if (pattern === undefined2) { 7402 return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string); 7403 } 7404 return string.match(pattern) || []; 7405 } 7406 var attempt = baseRest(function(func, args) { 7407 try { 7408 return apply(func, undefined2, args); 7409 } catch (e) { 7410 return isError(e) ? e : new Error2(e); 7411 } 7412 }); 7413 var bindAll = flatRest(function(object, methodNames) { 7414 arrayEach(methodNames, function(key) { 7415 key = toKey(key); 7416 baseAssignValue(object, key, bind(object[key], object)); 7417 }); 7418 return object; 7419 }); 7420 function cond(pairs) { 7421 var length = pairs == null ? 0 : pairs.length, toIteratee = getIteratee(); 7422 pairs = !length ? [] : arrayMap(pairs, function(pair) { 7423 if (typeof pair[1] != "function") { 7424 throw new TypeError2(FUNC_ERROR_TEXT); 7425 } 7426 return [toIteratee(pair[0]), pair[1]]; 7427 }); 7428 return baseRest(function(args) { 7429 var index = -1; 7430 while (++index < length) { 7431 var pair = pairs[index]; 7432 if (apply(pair[0], this, args)) { 7433 return apply(pair[1], this, args); 7434 } 7435 } 7436 }); 7437 } 7438 function conforms(source) { 7439 return baseConforms(baseClone(source, CLONE_DEEP_FLAG)); 7440 } 7441 function constant(value) { 7442 return function() { 7443 return value; 7444 }; 7445 } 7446 function defaultTo(value, defaultValue) { 7447 return value == null || value !== value ? defaultValue : value; 7448 } 7449 var flow = createFlow(); 7450 var flowRight = createFlow(true); 7451 function identity(value) { 7452 return value; 7453 } 7454 function iteratee(func) { 7455 return baseIteratee(typeof func == "function" ? func : baseClone(func, CLONE_DEEP_FLAG)); 7456 } 7457 function matches(source) { 7458 return baseMatches(baseClone(source, CLONE_DEEP_FLAG)); 7459 } 7460 function matchesProperty(path, srcValue) { 7461 return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG)); 7462 } 7463 var method = baseRest(function(path, args) { 7464 return function(object) { 7465 return baseInvoke(object, path, args); 7466 }; 7467 }); 7468 var methodOf = baseRest(function(object, args) { 7469 return function(path) { 7470 return baseInvoke(object, path, args); 7471 }; 7472 }); 7473 function mixin(object, source, options) { 7474 var props = keys(source), methodNames = baseFunctions(source, props); 7475 if (options == null && !(isObject(source) && (methodNames.length || !props.length))) { 7476 options = source; 7477 source = object; 7478 object = this; 7479 methodNames = baseFunctions(source, keys(source)); 7480 } 7481 var chain2 = !(isObject(options) && "chain" in options) || !!options.chain, isFunc = isFunction(object); 7482 arrayEach(methodNames, function(methodName) { 7483 var func = source[methodName]; 7484 object[methodName] = func; 7485 if (isFunc) { 7486 object.prototype[methodName] = function() { 7487 var chainAll = this.__chain__; 7488 if (chain2 || chainAll) { 7489 var result2 = object(this.__wrapped__), actions = result2.__actions__ = copyArray(this.__actions__); 7490 actions.push({ "func": func, "args": arguments, "thisArg": object }); 7491 result2.__chain__ = chainAll; 7492 return result2; 7493 } 7494 return func.apply(object, arrayPush([this.value()], arguments)); 7495 }; 7496 } 7497 }); 7498 return object; 7499 } 7500 function noConflict() { 7501 if (root._ === this) { 7502 root._ = oldDash; 7503 } 7504 return this; 7505 } 7506 function noop() { 7507 } 7508 function nthArg(n) { 7509 n = toInteger(n); 7510 return baseRest(function(args) { 7511 return baseNth(args, n); 7512 }); 7513 } 7514 var over = createOver(arrayMap); 7515 var overEvery = createOver(arrayEvery); 7516 var overSome = createOver(arraySome); 7517 function property(path) { 7518 return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path); 7519 } 7520 function propertyOf(object) { 7521 return function(path) { 7522 return object == null ? undefined2 : baseGet(object, path); 7523 }; 7524 } 7525 var range = createRange(); 7526 var rangeRight = createRange(true); 7527 function stubArray() { 7528 return []; 7529 } 7530 function stubFalse() { 7531 return false; 7532 } 7533 function stubObject() { 7534 return {}; 7535 } 7536 function stubString() { 7537 return ""; 7538 } 7539 function stubTrue() { 7540 return true; 7541 } 7542 function times(n, iteratee2) { 7543 n = toInteger(n); 7544 if (n < 1 || n > MAX_SAFE_INTEGER) { 7545 return []; 7546 } 7547 var index = MAX_ARRAY_LENGTH, length = nativeMin(n, MAX_ARRAY_LENGTH); 7548 iteratee2 = getIteratee(iteratee2); 7549 n -= MAX_ARRAY_LENGTH; 7550 var result2 = baseTimes(length, iteratee2); 7551 while (++index < n) { 7552 iteratee2(index); 7553 } 7554 return result2; 7555 } 7556 function toPath(value) { 7557 if (isArray(value)) { 7558 return arrayMap(value, toKey); 7559 } 7560 return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value))); 7561 } 7562 function uniqueId(prefix) { 7563 var id = ++idCounter; 7564 return toString(prefix) + id; 7565 } 7566 var add = createMathOperation(function(augend, addend) { 7567 return augend + addend; 7568 }, 0); 7569 var ceil = createRound("ceil"); 7570 var divide = createMathOperation(function(dividend, divisor) { 7571 return dividend / divisor; 7572 }, 1); 7573 var floor = createRound("floor"); 7574 function max(array) { 7575 return array && array.length ? baseExtremum(array, identity, baseGt) : undefined2; 7576 } 7577 function maxBy(array, iteratee2) { 7578 return array && array.length ? baseExtremum(array, getIteratee(iteratee2, 2), baseGt) : undefined2; 7579 } 7580 function mean(array) { 7581 return baseMean(array, identity); 7582 } 7583 function meanBy(array, iteratee2) { 7584 return baseMean(array, getIteratee(iteratee2, 2)); 7585 } 7586 function min(array) { 7587 return array && array.length ? baseExtremum(array, identity, baseLt) : undefined2; 7588 } 7589 function minBy(array, iteratee2) { 7590 return array && array.length ? baseExtremum(array, getIteratee(iteratee2, 2), baseLt) : undefined2; 7591 } 7592 var multiply = createMathOperation(function(multiplier, multiplicand) { 7593 return multiplier * multiplicand; 7594 }, 1); 7595 var round = createRound("round"); 7596 var subtract = createMathOperation(function(minuend, subtrahend) { 7597 return minuend - subtrahend; 7598 }, 0); 7599 function sum(array) { 7600 return array && array.length ? baseSum(array, identity) : 0; 7601 } 7602 function sumBy(array, iteratee2) { 7603 return array && array.length ? baseSum(array, getIteratee(iteratee2, 2)) : 0; 7604 } 7605 lodash.after = after; 7606 lodash.ary = ary; 7607 lodash.assign = assign; 7608 lodash.assignIn = assignIn; 7609 lodash.assignInWith = assignInWith; 7610 lodash.assignWith = assignWith; 7611 lodash.at = at; 7612 lodash.before = before; 7613 lodash.bind = bind; 7614 lodash.bindAll = bindAll; 7615 lodash.bindKey = bindKey; 7616 lodash.castArray = castArray; 7617 lodash.chain = chain; 7618 lodash.chunk = chunk; 7619 lodash.compact = compact; 7620 lodash.concat = concat; 7621 lodash.cond = cond; 7622 lodash.conforms = conforms; 7623 lodash.constant = constant; 7624 lodash.countBy = countBy; 7625 lodash.create = create; 7626 lodash.curry = curry; 7627 lodash.curryRight = curryRight; 7628 lodash.debounce = debounce; 7629 lodash.defaults = defaults; 7630 lodash.defaultsDeep = defaultsDeep; 7631 lodash.defer = defer; 7632 lodash.delay = delay; 7633 lodash.difference = difference; 7634 lodash.differenceBy = differenceBy; 7635 lodash.differenceWith = differenceWith; 7636 lodash.drop = drop; 7637 lodash.dropRight = dropRight; 7638 lodash.dropRightWhile = dropRightWhile; 7639 lodash.dropWhile = dropWhile; 7640 lodash.fill = fill; 7641 lodash.filter = filter; 7642 lodash.flatMap = flatMap; 7643 lodash.flatMapDeep = flatMapDeep; 7644 lodash.flatMapDepth = flatMapDepth; 7645 lodash.flatten = flatten; 7646 lodash.flattenDeep = flattenDeep; 7647 lodash.flattenDepth = flattenDepth; 7648 lodash.flip = flip; 7649 lodash.flow = flow; 7650 lodash.flowRight = flowRight; 7651 lodash.fromPairs = fromPairs; 7652 lodash.functions = functions; 7653 lodash.functionsIn = functionsIn; 7654 lodash.groupBy = groupBy; 7655 lodash.initial = initial; 7656 lodash.intersection = intersection; 7657 lodash.intersectionBy = intersectionBy; 7658 lodash.intersectionWith = intersectionWith; 7659 lodash.invert = invert; 7660 lodash.invertBy = invertBy; 7661 lodash.invokeMap = invokeMap; 7662 lodash.iteratee = iteratee; 7663 lodash.keyBy = keyBy; 7664 lodash.keys = keys; 7665 lodash.keysIn = keysIn; 7666 lodash.map = map; 7667 lodash.mapKeys = mapKeys; 7668 lodash.mapValues = mapValues; 7669 lodash.matches = matches; 7670 lodash.matchesProperty = matchesProperty; 7671 lodash.memoize = memoize; 7672 lodash.merge = merge; 7673 lodash.mergeWith = mergeWith; 7674 lodash.method = method; 7675 lodash.methodOf = methodOf; 7676 lodash.mixin = mixin; 7677 lodash.negate = negate; 7678 lodash.nthArg = nthArg; 7679 lodash.omit = omit; 7680 lodash.omitBy = omitBy; 7681 lodash.once = once; 7682 lodash.orderBy = orderBy; 7683 lodash.over = over; 7684 lodash.overArgs = overArgs; 7685 lodash.overEvery = overEvery; 7686 lodash.overSome = overSome; 7687 lodash.partial = partial; 7688 lodash.partialRight = partialRight; 7689 lodash.partition = partition; 7690 lodash.pick = pick; 7691 lodash.pickBy = pickBy; 7692 lodash.property = property; 7693 lodash.propertyOf = propertyOf; 7694 lodash.pull = pull; 7695 lodash.pullAll = pullAll; 7696 lodash.pullAllBy = pullAllBy; 7697 lodash.pullAllWith = pullAllWith; 7698 lodash.pullAt = pullAt; 7699 lodash.range = range; 7700 lodash.rangeRight = rangeRight; 7701 lodash.rearg = rearg; 7702 lodash.reject = reject; 7703 lodash.remove = remove; 7704 lodash.rest = rest; 7705 lodash.reverse = reverse; 7706 lodash.sampleSize = sampleSize; 7707 lodash.set = set; 7708 lodash.setWith = setWith; 7709 lodash.shuffle = shuffle; 7710 lodash.slice = slice; 7711 lodash.sortBy = sortBy; 7712 lodash.sortedUniq = sortedUniq; 7713 lodash.sortedUniqBy = sortedUniqBy; 7714 lodash.split = split; 7715 lodash.spread = spread; 7716 lodash.tail = tail; 7717 lodash.take = take; 7718 lodash.takeRight = takeRight; 7719 lodash.takeRightWhile = takeRightWhile; 7720 lodash.takeWhile = takeWhile; 7721 lodash.tap = tap; 7722 lodash.throttle = throttle; 7723 lodash.thru = thru; 7724 lodash.toArray = toArray; 7725 lodash.toPairs = toPairs; 7726 lodash.toPairsIn = toPairsIn; 7727 lodash.toPath = toPath; 7728 lodash.toPlainObject = toPlainObject; 7729 lodash.transform = transform; 7730 lodash.unary = unary; 7731 lodash.union = union; 7732 lodash.unionBy = unionBy; 7733 lodash.unionWith = unionWith; 7734 lodash.uniq = uniq; 7735 lodash.uniqBy = uniqBy; 7736 lodash.uniqWith = uniqWith; 7737 lodash.unset = unset; 7738 lodash.unzip = unzip; 7739 lodash.unzipWith = unzipWith; 7740 lodash.update = update; 7741 lodash.updateWith = updateWith; 7742 lodash.values = values; 7743 lodash.valuesIn = valuesIn; 7744 lodash.without = without; 7745 lodash.words = words; 7746 lodash.wrap = wrap; 7747 lodash.xor = xor; 7748 lodash.xorBy = xorBy; 7749 lodash.xorWith = xorWith; 7750 lodash.zip = zip; 7751 lodash.zipObject = zipObject; 7752 lodash.zipObjectDeep = zipObjectDeep; 7753 lodash.zipWith = zipWith; 7754 lodash.entries = toPairs; 7755 lodash.entriesIn = toPairsIn; 7756 lodash.extend = assignIn; 7757 lodash.extendWith = assignInWith; 7758 mixin(lodash, lodash); 7759 lodash.add = add; 7760 lodash.attempt = attempt; 7761 lodash.camelCase = camelCase; 7762 lodash.capitalize = capitalize; 7763 lodash.ceil = ceil; 7764 lodash.clamp = clamp; 7765 lodash.clone = clone; 7766 lodash.cloneDeep = cloneDeep; 7767 lodash.cloneDeepWith = cloneDeepWith; 7768 lodash.cloneWith = cloneWith; 7769 lodash.conformsTo = conformsTo; 7770 lodash.deburr = deburr; 7771 lodash.defaultTo = defaultTo; 7772 lodash.divide = divide; 7773 lodash.endsWith = endsWith; 7774 lodash.eq = eq; 7775 lodash.escape = escape; 7776 lodash.escapeRegExp = escapeRegExp; 7777 lodash.every = every; 7778 lodash.find = find; 7779 lodash.findIndex = findIndex; 7780 lodash.findKey = findKey; 7781 lodash.findLast = findLast; 7782 lodash.findLastIndex = findLastIndex; 7783 lodash.findLastKey = findLastKey; 7784 lodash.floor = floor; 7785 lodash.forEach = forEach; 7786 lodash.forEachRight = forEachRight; 7787 lodash.forIn = forIn; 7788 lodash.forInRight = forInRight; 7789 lodash.forOwn = forOwn; 7790 lodash.forOwnRight = forOwnRight; 7791 lodash.get = get; 7792 lodash.gt = gt; 7793 lodash.gte = gte; 7794 lodash.has = has; 7795 lodash.hasIn = hasIn; 7796 lodash.head = head; 7797 lodash.identity = identity; 7798 lodash.includes = includes; 7799 lodash.indexOf = indexOf; 7800 lodash.inRange = inRange; 7801 lodash.invoke = invoke; 7802 lodash.isArguments = isArguments; 7803 lodash.isArray = isArray; 7804 lodash.isArrayBuffer = isArrayBuffer; 7805 lodash.isArrayLike = isArrayLike; 7806 lodash.isArrayLikeObject = isArrayLikeObject; 7807 lodash.isBoolean = isBoolean; 7808 lodash.isBuffer = isBuffer; 7809 lodash.isDate = isDate; 7810 lodash.isElement = isElement; 7811 lodash.isEmpty = isEmpty; 7812 lodash.isEqual = isEqual; 7813 lodash.isEqualWith = isEqualWith; 7814 lodash.isError = isError; 7815 lodash.isFinite = isFinite2; 7816 lodash.isFunction = isFunction; 7817 lodash.isInteger = isInteger; 7818 lodash.isLength = isLength; 7819 lodash.isMap = isMap; 7820 lodash.isMatch = isMatch; 7821 lodash.isMatchWith = isMatchWith; 7822 lodash.isNaN = isNaN2; 7823 lodash.isNative = isNative; 7824 lodash.isNil = isNil; 7825 lodash.isNull = isNull; 7826 lodash.isNumber = isNumber; 7827 lodash.isObject = isObject; 7828 lodash.isObjectLike = isObjectLike; 7829 lodash.isPlainObject = isPlainObject; 7830 lodash.isRegExp = isRegExp; 7831 lodash.isSafeInteger = isSafeInteger; 7832 lodash.isSet = isSet; 7833 lodash.isString = isString; 7834 lodash.isSymbol = isSymbol; 7835 lodash.isTypedArray = isTypedArray; 7836 lodash.isUndefined = isUndefined; 7837 lodash.isWeakMap = isWeakMap; 7838 lodash.isWeakSet = isWeakSet; 7839 lodash.join = join; 7840 lodash.kebabCase = kebabCase; 7841 lodash.last = last; 7842 lodash.lastIndexOf = lastIndexOf; 7843 lodash.lowerCase = lowerCase; 7844 lodash.lowerFirst = lowerFirst; 7845 lodash.lt = lt; 7846 lodash.lte = lte; 7847 lodash.max = max; 7848 lodash.maxBy = maxBy; 7849 lodash.mean = mean; 7850 lodash.meanBy = meanBy; 7851 lodash.min = min; 7852 lodash.minBy = minBy; 7853 lodash.stubArray = stubArray; 7854 lodash.stubFalse = stubFalse; 7855 lodash.stubObject = stubObject; 7856 lodash.stubString = stubString; 7857 lodash.stubTrue = stubTrue; 7858 lodash.multiply = multiply; 7859 lodash.nth = nth; 7860 lodash.noConflict = noConflict; 7861 lodash.noop = noop; 7862 lodash.now = now; 7863 lodash.pad = pad; 7864 lodash.padEnd = padEnd; 7865 lodash.padStart = padStart; 7866 lodash.parseInt = parseInt2; 7867 lodash.random = random; 7868 lodash.reduce = reduce; 7869 lodash.reduceRight = reduceRight; 7870 lodash.repeat = repeat; 7871 lodash.replace = replace; 7872 lodash.result = result; 7873 lodash.round = round; 7874 lodash.runInContext = runInContext2; 7875 lodash.sample = sample; 7876 lodash.size = size; 7877 lodash.snakeCase = snakeCase; 7878 lodash.some = some; 7879 lodash.sortedIndex = sortedIndex; 7880 lodash.sortedIndexBy = sortedIndexBy; 7881 lodash.sortedIndexOf = sortedIndexOf; 7882 lodash.sortedLastIndex = sortedLastIndex; 7883 lodash.sortedLastIndexBy = sortedLastIndexBy; 7884 lodash.sortedLastIndexOf = sortedLastIndexOf; 7885 lodash.startCase = startCase; 7886 lodash.startsWith = startsWith; 7887 lodash.subtract = subtract; 7888 lodash.sum = sum; 7889 lodash.sumBy = sumBy; 7890 lodash.template = template; 7891 lodash.times = times; 7892 lodash.toFinite = toFinite; 7893 lodash.toInteger = toInteger; 7894 lodash.toLength = toLength; 7895 lodash.toLower = toLower; 7896 lodash.toNumber = toNumber; 7897 lodash.toSafeInteger = toSafeInteger; 7898 lodash.toString = toString; 7899 lodash.toUpper = toUpper; 7900 lodash.trim = trim; 7901 lodash.trimEnd = trimEnd; 7902 lodash.trimStart = trimStart; 7903 lodash.truncate = truncate; 7904 lodash.unescape = unescape; 7905 lodash.uniqueId = uniqueId; 7906 lodash.upperCase = upperCase; 7907 lodash.upperFirst = upperFirst; 7908 lodash.each = forEach; 7909 lodash.eachRight = forEachRight; 7910 lodash.first = head; 7911 mixin(lodash, function() { 7912 var source = {}; 7913 baseForOwn(lodash, function(func, methodName) { 7914 if (!hasOwnProperty.call(lodash.prototype, methodName)) { 7915 source[methodName] = func; 7916 } 7917 }); 7918 return source; 7919 }(), { "chain": false }); 7920 lodash.VERSION = VERSION; 7921 arrayEach(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(methodName) { 7922 lodash[methodName].placeholder = lodash; 7923 }); 7924 arrayEach(["drop", "take"], function(methodName, index) { 7925 LazyWrapper.prototype[methodName] = function(n) { 7926 n = n === undefined2 ? 1 : nativeMax(toInteger(n), 0); 7927 var result2 = this.__filtered__ && !index ? new LazyWrapper(this) : this.clone(); 7928 if (result2.__filtered__) { 7929 result2.__takeCount__ = nativeMin(n, result2.__takeCount__); 7930 } else { 7931 result2.__views__.push({ 7932 "size": nativeMin(n, MAX_ARRAY_LENGTH), 7933 "type": methodName + (result2.__dir__ < 0 ? "Right" : "") 7934 }); 7935 } 7936 return result2; 7937 }; 7938 LazyWrapper.prototype[methodName + "Right"] = function(n) { 7939 return this.reverse()[methodName](n).reverse(); 7940 }; 7941 }); 7942 arrayEach(["filter", "map", "takeWhile"], function(methodName, index) { 7943 var type = index + 1, isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG; 7944 LazyWrapper.prototype[methodName] = function(iteratee2) { 7945 var result2 = this.clone(); 7946 result2.__iteratees__.push({ 7947 "iteratee": getIteratee(iteratee2, 3), 7948 "type": type 7949 }); 7950 result2.__filtered__ = result2.__filtered__ || isFilter; 7951 return result2; 7952 }; 7953 }); 7954 arrayEach(["head", "last"], function(methodName, index) { 7955 var takeName = "take" + (index ? "Right" : ""); 7956 LazyWrapper.prototype[methodName] = function() { 7957 return this[takeName](1).value()[0]; 7958 }; 7959 }); 7960 arrayEach(["initial", "tail"], function(methodName, index) { 7961 var dropName = "drop" + (index ? "" : "Right"); 7962 LazyWrapper.prototype[methodName] = function() { 7963 return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1); 7964 }; 7965 }); 7966 LazyWrapper.prototype.compact = function() { 7967 return this.filter(identity); 7968 }; 7969 LazyWrapper.prototype.find = function(predicate) { 7970 return this.filter(predicate).head(); 7971 }; 7972 LazyWrapper.prototype.findLast = function(predicate) { 7973 return this.reverse().find(predicate); 7974 }; 7975 LazyWrapper.prototype.invokeMap = baseRest(function(path, args) { 7976 if (typeof path == "function") { 7977 return new LazyWrapper(this); 7978 } 7979 return this.map(function(value) { 7980 return baseInvoke(value, path, args); 7981 }); 7982 }); 7983 LazyWrapper.prototype.reject = function(predicate) { 7984 return this.filter(negate(getIteratee(predicate))); 7985 }; 7986 LazyWrapper.prototype.slice = function(start, end) { 7987 start = toInteger(start); 7988 var result2 = this; 7989 if (result2.__filtered__ && (start > 0 || end < 0)) { 7990 return new LazyWrapper(result2); 7991 } 7992 if (start < 0) { 7993 result2 = result2.takeRight(-start); 7994 } else if (start) { 7995 result2 = result2.drop(start); 7996 } 7997 if (end !== undefined2) { 7998 end = toInteger(end); 7999 result2 = end < 0 ? result2.dropRight(-end) : result2.take(end - start); 8000 } 8001 return result2; 8002 }; 8003 LazyWrapper.prototype.takeRightWhile = function(predicate) { 8004 return this.reverse().takeWhile(predicate).reverse(); 8005 }; 8006 LazyWrapper.prototype.toArray = function() { 8007 return this.take(MAX_ARRAY_LENGTH); 8008 }; 8009 baseForOwn(LazyWrapper.prototype, function(func, methodName) { 8010 var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName), isTaker = /^(?:head|last)$/.test(methodName), lodashFunc = lodash[isTaker ? "take" + (methodName == "last" ? "Right" : "") : methodName], retUnwrapped = isTaker || /^find/.test(methodName); 8011 if (!lodashFunc) { 8012 return; 8013 } 8014 lodash.prototype[methodName] = function() { 8015 var value = this.__wrapped__, args = isTaker ? [1] : arguments, isLazy = value instanceof LazyWrapper, iteratee2 = args[0], useLazy = isLazy || isArray(value); 8016 var interceptor = function(value2) { 8017 var result3 = lodashFunc.apply(lodash, arrayPush([value2], args)); 8018 return isTaker && chainAll ? result3[0] : result3; 8019 }; 8020 if (useLazy && checkIteratee && typeof iteratee2 == "function" && iteratee2.length != 1) { 8021 isLazy = useLazy = false; 8022 } 8023 var chainAll = this.__chain__, isHybrid = !!this.__actions__.length, isUnwrapped = retUnwrapped && !chainAll, onlyLazy = isLazy && !isHybrid; 8024 if (!retUnwrapped && useLazy) { 8025 value = onlyLazy ? value : new LazyWrapper(this); 8026 var result2 = func.apply(value, args); 8027 result2.__actions__.push({ "func": thru, "args": [interceptor], "thisArg": undefined2 }); 8028 return new LodashWrapper(result2, chainAll); 8029 } 8030 if (isUnwrapped && onlyLazy) { 8031 return func.apply(this, args); 8032 } 8033 result2 = this.thru(interceptor); 8034 return isUnwrapped ? isTaker ? result2.value()[0] : result2.value() : result2; 8035 }; 8036 }); 8037 arrayEach(["pop", "push", "shift", "sort", "splice", "unshift"], function(methodName) { 8038 var func = arrayProto[methodName], chainName = /^(?:push|sort|unshift)$/.test(methodName) ? "tap" : "thru", retUnwrapped = /^(?:pop|shift)$/.test(methodName); 8039 lodash.prototype[methodName] = function() { 8040 var args = arguments; 8041 if (retUnwrapped && !this.__chain__) { 8042 var value = this.value(); 8043 return func.apply(isArray(value) ? value : [], args); 8044 } 8045 return this[chainName](function(value2) { 8046 return func.apply(isArray(value2) ? value2 : [], args); 8047 }); 8048 }; 8049 }); 8050 baseForOwn(LazyWrapper.prototype, function(func, methodName) { 8051 var lodashFunc = lodash[methodName]; 8052 if (lodashFunc) { 8053 var key = lodashFunc.name + ""; 8054 if (!hasOwnProperty.call(realNames, key)) { 8055 realNames[key] = []; 8056 } 8057 realNames[key].push({ "name": methodName, "func": lodashFunc }); 8058 } 8059 }); 8060 realNames[createHybrid(undefined2, WRAP_BIND_KEY_FLAG).name] = [{ 8061 "name": "wrapper", 8062 "func": undefined2 8063 }]; 8064 LazyWrapper.prototype.clone = lazyClone; 8065 LazyWrapper.prototype.reverse = lazyReverse; 8066 LazyWrapper.prototype.value = lazyValue; 8067 lodash.prototype.at = wrapperAt; 8068 lodash.prototype.chain = wrapperChain; 8069 lodash.prototype.commit = wrapperCommit; 8070 lodash.prototype.next = wrapperNext; 8071 lodash.prototype.plant = wrapperPlant; 8072 lodash.prototype.reverse = wrapperReverse; 8073 lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue; 8074 lodash.prototype.first = lodash.prototype.head; 8075 if (symIterator) { 8076 lodash.prototype[symIterator] = wrapperToIterator; 8077 } 8078 return lodash; 8079 }; 8080 var _ = runInContext(); 8081 if (typeof define == "function" && typeof define.amd == "object" && define.amd) { 8082 root._ = _; 8083 define(function() { 8084 return _; 8085 }); 8086 } else if (freeModule) { 8087 (freeModule.exports = _)._ = _; 8088 freeExports._ = _; 8089 } else { 8090 root._ = _; 8091 } 8092 }).call(exports); 8093 } 8094 }); 8095 8096 // node_modules/@tgrosinger/md-advanced-tables/lib/calc/results.js 8097 var require_results = __commonJS({ 8098 "node_modules/@tgrosinger/md-advanced-tables/lib/calc/results.js"(exports) { 8099 "use strict"; 8100 var __importDefault = exports && exports.__importDefault || function(mod) { 8101 return mod && mod.__esModule ? mod : { "default": mod }; 8102 }; 8103 Object.defineProperty(exports, "__esModule", { value: true }); 8104 exports.Value = exports.Arity = exports.FloatOrMilliseconds = void 0; 8105 var decimal_js_1 = __importDefault(require_decimal()); 8106 var lodash_1 = require_lodash(); 8107 var datetimeRe = new RegExp("[1-9][0-9]{3}-[01][0-9]-[0-3][0-9][T ][0-2][0-9]:[0-5][0-9]"); 8108 var durationRe = new RegExp("^-?[0-9]+:[0-5][0-9]"); 8109 var FloatOrMilliseconds = (value) => { 8110 const v = value.trim(); 8111 if (v === "") { 8112 return new decimal_js_1.default(0); 8113 } 8114 if (datetimeRe.test(v)) { 8115 return new decimal_js_1.default(new Date(v).valueOf()); 8116 } 8117 if (durationRe.test(v)) { 8118 const neg = v.charAt(0) == "-"; 8119 const w = v.slice(neg ? 1 : 0); 8120 const minutes = parseInt(w.slice(0, -3)) * 60 + parseInt(w.slice(-2)); 8121 return new decimal_js_1.default((neg ? -1 : 1) * minutes * 6e4); 8122 } 8123 const decimalValue = new decimal_js_1.default(v); 8124 return decimalValue.isNaN() ? new decimal_js_1.default(0) : decimalValue; 8125 }; 8126 exports.FloatOrMilliseconds = FloatOrMilliseconds; 8127 var Arity = class { 8128 constructor(rows, columns) { 8129 this.isRow = () => this.rows > 1 && this.cols === 1; 8130 this.isColumn = () => this.rows === 1 && this.cols > 1; 8131 this.isCell = () => this.rows === 1 && this.cols === 1; 8132 this.rows = rows; 8133 this.cols = columns; 8134 } 8135 }; 8136 exports.Arity = Arity; 8137 var Value = class { 8138 constructor(val) { 8139 this.get = (row, column) => this.val[row][column]; 8140 this.getAsNumber = (row, column) => { 8141 const value = this.get(row, column); 8142 return (0, exports.FloatOrMilliseconds)(value); 8143 }; 8144 this.getArity = () => { 8145 const maxCols = this.val.reduce((max, currentRow) => Math.max(max, currentRow.length), 0); 8146 return new Arity(this.val.length, maxCols); 8147 }; 8148 this.toString = () => { 8149 if (this.getArity().isCell()) { 8150 return this.get(0, 0); 8151 } 8152 return `[${(0, lodash_1.flatten)(this.val).map((val2) => val2.trim()).filter((val2) => val2 !== "").join(", ")}]`; 8153 }; 8154 this.val = val; 8155 } 8156 }; 8157 exports.Value = Value; 8158 } 8159 }); 8160 8161 // node_modules/@tgrosinger/md-advanced-tables/lib/calc/algebraic_operation.js 8162 var require_algebraic_operation = __commonJS({ 8163 "node_modules/@tgrosinger/md-advanced-tables/lib/calc/algebraic_operation.js"(exports) { 8164 "use strict"; 8165 Object.defineProperty(exports, "__esModule", { value: true }); 8166 exports.AlgebraicOperation = void 0; 8167 var neverthrow_1 = require_neverthrow(); 8168 var ast_utils_1 = require_ast_utils(); 8169 var calc_1 = require_calc(); 8170 var results_1 = require_results(); 8171 var lodash_1 = require_lodash(); 8172 var AlgebraicOperation = class { 8173 constructor(ast, table) { 8174 this.getValue = (table2, cell) => { 8175 switch (this.operator) { 8176 case "+": 8177 return this.add(table2, cell); 8178 case "-": 8179 return this.subtract(table2, cell); 8180 case "*": 8181 return this.multiply(table2, cell); 8182 case "/": 8183 return this.divide(table2, cell); 8184 default: 8185 return (0, neverthrow_1.err)(Error("Invalid algbraic operator: " + this.operator)); 8186 } 8187 }; 8188 this.withCellAndRange = (table2, cell, name, canHaveRightRange, fn) => { 8189 const leftValue = this.leftSource.getValue(table2, cell); 8190 if (leftValue.isErr()) { 8191 return (0, neverthrow_1.err)(leftValue.error); 8192 } 8193 const rightValue = this.rightSource.getValue(table2, cell); 8194 if (rightValue.isErr()) { 8195 return (0, neverthrow_1.err)(rightValue.error); 8196 } 8197 const leftArity = leftValue.value.getArity(); 8198 const rightArity = rightValue.value.getArity(); 8199 if (!rightArity.isCell() && !leftArity.isCell()) { 8200 return (0, neverthrow_1.err)(Error(`At least one operand in algebraic "${name}" must be a single cell.`)); 8201 } 8202 if (!rightArity.isCell() && !canHaveRightRange) { 8203 return (0, neverthrow_1.err)(Error(`Right operand in algebraic "${name}" must be a single cell.`)); 8204 } 8205 if (rightArity.isCell()) { 8206 const rightCellValue = rightValue.value.getAsNumber(0, 0); 8207 const result2 = (0, lodash_1.map)(leftValue.value.val, (currentRow) => (0, lodash_1.map)(currentRow, (currentCell) => { 8208 const leftCellValue2 = (0, results_1.FloatOrMilliseconds)(currentCell); 8209 return fn(leftCellValue2, rightCellValue).toString(); 8210 })); 8211 return (0, neverthrow_1.ok)(new results_1.Value(result2)); 8212 } 8213 const leftCellValue = leftValue.value.getAsNumber(0, 0); 8214 const result = (0, lodash_1.map)(rightValue.value.val, (currentRow) => (0, lodash_1.map)(currentRow, (currentCell) => { 8215 const rightCellValue = (0, results_1.FloatOrMilliseconds)(currentCell); 8216 return fn(leftCellValue, rightCellValue).toString(); 8217 })); 8218 return (0, neverthrow_1.ok)(new results_1.Value(result)); 8219 }; 8220 this.add = (table2, cell) => this.withCellAndRange(table2, cell, "add", true, (left, right) => left.plus(right)); 8221 this.subtract = (table2, cell) => this.withCellAndRange(table2, cell, "subtract", true, (left, right) => left.minus(right)); 8222 this.multiply = (table2, cell) => this.withCellAndRange(table2, cell, "multiply", true, (left, right) => left.times(right)); 8223 this.divide = (table2, cell) => this.withCellAndRange(table2, cell, "divide", false, (left, right) => left.dividedBy(right)); 8224 const typeErr = (0, ast_utils_1.checkType)(ast, "algebraic_operation"); 8225 if (typeErr) { 8226 throw typeErr; 8227 } 8228 const lengthError = (0, ast_utils_1.checkChildLength)(ast, 3); 8229 if (lengthError) { 8230 throw lengthError; 8231 } 8232 const childTypeErr = (0, ast_utils_1.checkType)(ast.children[1], "algebraic_operator"); 8233 if (childTypeErr) { 8234 throw childTypeErr; 8235 } 8236 this.operator = ast.children[1].text; 8237 try { 8238 this.leftSource = new calc_1.Source(ast.children[0], table); 8239 this.rightSource = new calc_1.Source(ast.children[2], table); 8240 } catch (error) { 8241 throw error; 8242 } 8243 } 8244 }; 8245 exports.AlgebraicOperation = AlgebraicOperation; 8246 } 8247 }); 8248 8249 // node_modules/@tgrosinger/md-advanced-tables/lib/calc/conditional_function.js 8250 var require_conditional_function = __commonJS({ 8251 "node_modules/@tgrosinger/md-advanced-tables/lib/calc/conditional_function.js"(exports) { 8252 "use strict"; 8253 Object.defineProperty(exports, "__esModule", { value: true }); 8254 exports.ConditionalFunctionCall = void 0; 8255 var neverthrow_1 = require_neverthrow(); 8256 var ast_utils_1 = require_ast_utils(); 8257 var calc_1 = require_calc(); 8258 var ConditionalFunctionCall = class { 8259 constructor(ast, table) { 8260 this.getValue = (table2, cell) => this.predicate.eval(table2, cell).andThen((predicateResult) => predicateResult ? this.leftSource.getValue(table2, cell) : this.rightSource.getValue(table2, cell)); 8261 const typeError = (0, ast_utils_1.checkType)(ast, "conditional_function_call"); 8262 if (typeError) { 8263 throw typeError; 8264 } 8265 const lengthError = (0, ast_utils_1.checkChildLength)(ast, 3); 8266 if (lengthError) { 8267 throw lengthError; 8268 } 8269 try { 8270 this.predicate = new Predicate(ast.children[0], table); 8271 this.leftSource = new calc_1.Source(ast.children[1], table); 8272 this.rightSource = new calc_1.Source(ast.children[2], table); 8273 } catch (error) { 8274 throw error; 8275 } 8276 } 8277 }; 8278 exports.ConditionalFunctionCall = ConditionalFunctionCall; 8279 var Predicate = class { 8280 constructor(ast, table) { 8281 this.eval = (table2, cell) => { 8282 const leftData = this.leftSource.getValue(table2, cell); 8283 if (leftData.isErr()) { 8284 return (0, neverthrow_1.err)(leftData.error); 8285 } 8286 const rightData = this.rightSource.getValue(table2, cell); 8287 if (rightData.isErr()) { 8288 return (0, neverthrow_1.err)(rightData.error); 8289 } 8290 const leftArity = leftData.value.getArity(); 8291 const rightArity = rightData.value.getArity(); 8292 if (!leftArity.isCell()) { 8293 return (0, neverthrow_1.err)(Error("Can only use comparison operator on a single cell. Left side is not a cell.")); 8294 } 8295 if (!rightArity.isCell()) { 8296 return (0, neverthrow_1.err)(Error("Can only use comparison operator on a single cell. Right side is not a cell.")); 8297 } 8298 const leftVal = leftData.value.getAsNumber(0, 0); 8299 const rightVal = rightData.value.getAsNumber(0, 0); 8300 switch (this.operator) { 8301 case ">": 8302 return (0, neverthrow_1.ok)(leftVal.greaterThan(rightVal)); 8303 case ">=": 8304 return (0, neverthrow_1.ok)(leftVal.greaterThanOrEqualTo(rightVal)); 8305 case "<": 8306 return (0, neverthrow_1.ok)(leftVal.lessThan(rightVal)); 8307 case "<=": 8308 return (0, neverthrow_1.ok)(leftVal.lessThanOrEqualTo(rightVal)); 8309 case "==": 8310 return (0, neverthrow_1.ok)(leftVal.equals(rightVal)); 8311 case "!=": 8312 return (0, neverthrow_1.ok)(!leftVal.equals(rightVal)); 8313 default: 8314 return (0, neverthrow_1.err)(Error("Invalid conditional operator: " + this.operator)); 8315 } 8316 }; 8317 const typeError = (0, ast_utils_1.checkType)(ast, "predicate"); 8318 if (typeError) { 8319 throw typeError; 8320 } 8321 const lengthError = (0, ast_utils_1.checkChildLength)(ast, 3); 8322 if (lengthError) { 8323 throw lengthError; 8324 } 8325 const childTypeError = (0, ast_utils_1.checkType)(ast.children[1], "conditional_operator"); 8326 if (childTypeError) { 8327 throw childTypeError; 8328 } 8329 this.operator = ast.children[1].text; 8330 try { 8331 this.leftSource = new calc_1.Source(ast.children[0], table); 8332 this.rightSource = new calc_1.Source(ast.children[2], table); 8333 } catch (error) { 8334 throw error; 8335 } 8336 } 8337 }; 8338 } 8339 }); 8340 8341 // node_modules/@tgrosinger/md-advanced-tables/lib/calc/constant.js 8342 var require_constant = __commonJS({ 8343 "node_modules/@tgrosinger/md-advanced-tables/lib/calc/constant.js"(exports) { 8344 "use strict"; 8345 Object.defineProperty(exports, "__esModule", { value: true }); 8346 exports.Constant = void 0; 8347 var neverthrow_1 = require_neverthrow(); 8348 var ast_utils_1 = require_ast_utils(); 8349 var results_1 = require_results(); 8350 var Constant = class { 8351 constructor(ast, table) { 8352 const typeErr = (0, ast_utils_1.checkType)(ast, "real", "float"); 8353 if (typeErr) { 8354 throw typeErr; 8355 } 8356 const multiplier = ast.text[0] === "-" ? -1 : 1; 8357 if (ast.type === "real") { 8358 this.value = multiplier * parseInt(ast.children[0].text); 8359 } else { 8360 this.value = multiplier * parseFloat(ast.children[0].text + "." + ast.children[1].text); 8361 } 8362 } 8363 getValue(table, currentCell) { 8364 return (0, neverthrow_1.ok)(new results_1.Value([[this.value.toString()]])); 8365 } 8366 }; 8367 exports.Constant = Constant; 8368 } 8369 }); 8370 8371 // node_modules/@tgrosinger/md-advanced-tables/lib/calc/column.js 8372 var require_column = __commonJS({ 8373 "node_modules/@tgrosinger/md-advanced-tables/lib/calc/column.js"(exports) { 8374 "use strict"; 8375 Object.defineProperty(exports, "__esModule", { value: true }); 8376 exports.AbsoluteColumn = exports.Column = exports.newColumn = void 0; 8377 var neverthrow_1 = require_neverthrow(); 8378 var ast_utils_1 = require_ast_utils(); 8379 var results_1 = require_results(); 8380 var newColumn = (ast, table) => { 8381 try { 8382 switch (ast.type) { 8383 case "relative_column": 8384 return (0, neverthrow_1.ok)(new RelativeColumn(ast, table)); 8385 case "absolute_column": 8386 return (0, neverthrow_1.ok)(new AbsoluteColumn(ast, table)); 8387 default: 8388 return (0, neverthrow_1.err)(new Error(`Formula element '${ast.text}' is a ${ast.type} but expected an relatve_column or absolute_column in this position.`)); 8389 } 8390 } catch (error) { 8391 return (0, neverthrow_1.err)(error); 8392 } 8393 }; 8394 exports.newColumn = newColumn; 8395 var Column = class { 8396 constructor() { 8397 this.getValue = (table, currentCell) => { 8398 var _a; 8399 const val = ((_a = table.getCellAt(currentCell.row, this.getIndex(currentCell))) === null || _a === void 0 ? void 0 : _a.toText()) || ""; 8400 return (0, neverthrow_1.ok)(new results_1.Value([[val]])); 8401 }; 8402 } 8403 }; 8404 exports.Column = Column; 8405 var RelativeColumn = class extends Column { 8406 constructor(ast, table) { 8407 super(); 8408 this.getIndex = (currentCell) => currentCell.column + this.offset; 8409 this.getAbsoluteIndex = () => (0, neverthrow_1.err)(ast_utils_1.errRelativeReferenceIndex); 8410 const typeError = (0, ast_utils_1.checkType)(ast, "relative_column"); 8411 if (typeError) { 8412 throw typeError; 8413 } 8414 const lengthError = (0, ast_utils_1.checkChildLength)(ast, 1); 8415 if (lengthError) { 8416 throw lengthError; 8417 } 8418 const multiplier = ast.text[1] === "-" ? -1 : 1; 8419 this.offset = multiplier * parseInt(ast.children[0].text); 8420 } 8421 }; 8422 var AbsoluteColumn = class extends Column { 8423 constructor(ast, table) { 8424 super(); 8425 this.getIndex = (currentCell) => this.index; 8426 this.getAbsoluteIndex = () => (0, neverthrow_1.ok)(this.index); 8427 let index = -1; 8428 let symbol = ""; 8429 switch (ast.children.length) { 8430 case 0: 8431 symbol = ast.text[1]; 8432 break; 8433 case 1: 8434 const typeError = (0, ast_utils_1.checkType)(ast.children[0], "int"); 8435 if (typeError) { 8436 throw (0, neverthrow_1.err)(typeError); 8437 } 8438 index = parseInt(ast.children[0].text); 8439 break; 8440 default: 8441 throw new Error(`Formula element '${ast.text}' is a ${ast.type} but expected a 'absolute_column' in this position.`); 8442 } 8443 switch (symbol) { 8444 case "": 8445 break; 8446 case "<": 8447 index = 1; 8448 break; 8449 case ">": 8450 index = table.getWidth(); 8451 break; 8452 default: 8453 throw new Error(`Invalid column symbol '${symbol}'`); 8454 } 8455 if (index === 0) { 8456 throw ast_utils_1.errIndex0; 8457 } 8458 this.index = index - 1; 8459 } 8460 }; 8461 exports.AbsoluteColumn = AbsoluteColumn; 8462 } 8463 }); 8464 8465 // node_modules/@tgrosinger/md-advanced-tables/lib/calc/row.js 8466 var require_row = __commonJS({ 8467 "node_modules/@tgrosinger/md-advanced-tables/lib/calc/row.js"(exports) { 8468 "use strict"; 8469 Object.defineProperty(exports, "__esModule", { value: true }); 8470 exports.AbsoluteRow = exports.Row = exports.newRow = void 0; 8471 var neverthrow_1 = require_neverthrow(); 8472 var ast_utils_1 = require_ast_utils(); 8473 var results_1 = require_results(); 8474 var newRow = (ast, table) => { 8475 try { 8476 switch (ast.type) { 8477 case "relative_row": 8478 return (0, neverthrow_1.ok)(new RelativeRow(ast, table)); 8479 case "absolute_row": 8480 return (0, neverthrow_1.ok)(new AbsoluteRow(ast, table)); 8481 default: 8482 return (0, neverthrow_1.err)(new Error(`Formula element '${ast.text}' is a ${ast.type} but expected an relatve_row or absolute_row in this position.`)); 8483 } 8484 } catch (error) { 8485 return (0, neverthrow_1.err)(error); 8486 } 8487 }; 8488 exports.newRow = newRow; 8489 var Row = class { 8490 constructor() { 8491 this.getValue = (table, currentCell) => { 8492 var _a; 8493 const val = ((_a = table.getCellAt(this.getIndex(currentCell), currentCell.column)) === null || _a === void 0 ? void 0 : _a.toText()) || ""; 8494 return (0, neverthrow_1.ok)(new results_1.Value([[val]])); 8495 }; 8496 } 8497 }; 8498 exports.Row = Row; 8499 var RelativeRow = class extends Row { 8500 constructor(ast, table) { 8501 super(); 8502 this.getIndex = (currentCell) => currentCell.row + this.offset; 8503 this.getAbsoluteIndex = () => (0, neverthrow_1.err)(ast_utils_1.errRelativeReferenceIndex); 8504 const typeError = (0, ast_utils_1.checkType)(ast, "relative_row"); 8505 if (typeError) { 8506 throw typeError; 8507 } 8508 const lengthError = (0, ast_utils_1.checkChildLength)(ast, 1); 8509 if (lengthError) { 8510 throw lengthError; 8511 } 8512 const multiplier = ast.text[1] === "-" ? -1 : 1; 8513 this.offset = multiplier * parseInt(ast.children[0].text); 8514 } 8515 }; 8516 var AbsoluteRow = class extends Row { 8517 constructor(ast, table) { 8518 super(); 8519 this.getIndex = (currentCell) => this.index; 8520 this.getAbsoluteIndex = () => (0, neverthrow_1.ok)(this.index); 8521 let index = -1; 8522 let symbol = ""; 8523 switch (ast.children.length) { 8524 case 0: 8525 symbol = ast.text[1]; 8526 break; 8527 case 1: 8528 const typeError = (0, ast_utils_1.checkType)(ast.children[0], "int"); 8529 if (typeError) { 8530 throw (0, neverthrow_1.err)(typeError); 8531 } 8532 index = parseInt(ast.children[0].text); 8533 break; 8534 default: 8535 throw new Error(`Formula element '${ast.text}' is a ${ast.type} but expected a 'absolute_row' in this position.`); 8536 } 8537 switch (symbol) { 8538 case "": 8539 break; 8540 case "<": 8541 index = 1; 8542 break; 8543 case ">": 8544 index = table.getHeight() - 1; 8545 break; 8546 case "I": 8547 index = 2; 8548 break; 8549 default: 8550 throw new Error(`Invalid row symbol '${symbol}'`); 8551 } 8552 if (index === 0) { 8553 throw ast_utils_1.errIndex0; 8554 } 8555 if (index === 1) { 8556 this.index = 0; 8557 } else { 8558 this.index = index; 8559 } 8560 } 8561 }; 8562 exports.AbsoluteRow = AbsoluteRow; 8563 } 8564 }); 8565 8566 // node_modules/@tgrosinger/md-advanced-tables/lib/calc/reference.js 8567 var require_reference = __commonJS({ 8568 "node_modules/@tgrosinger/md-advanced-tables/lib/calc/reference.js"(exports) { 8569 "use strict"; 8570 Object.defineProperty(exports, "__esModule", { value: true }); 8571 exports.Reference = void 0; 8572 var neverthrow_1 = require_neverthrow(); 8573 var ast_utils_1 = require_ast_utils(); 8574 var column_1 = require_column(); 8575 var results_1 = require_results(); 8576 var row_1 = require_row(); 8577 var Reference = class { 8578 constructor(ast, table) { 8579 this.getValue = (table2, currentCell) => { 8580 var _a; 8581 const cell = { 8582 row: this.row ? this.row.getIndex(currentCell) : currentCell.row, 8583 column: this.column ? this.column.getIndex(currentCell) : currentCell.column 8584 }; 8585 const val = ((_a = table2.getCellAt(cell.row, cell.column)) === null || _a === void 0 ? void 0 : _a.toText()) || ""; 8586 return (0, neverthrow_1.ok)(new results_1.Value([[val]])); 8587 }; 8588 const typeErr = (0, ast_utils_1.checkType)(ast, "source_reference", "absolute_reference", "relative_reference"); 8589 if (typeErr) { 8590 throw typeErr; 8591 } 8592 for (let i = 0; i < ast.children.length; i++) { 8593 const child = ast.children[i]; 8594 switch (child.type) { 8595 case "relative_row": 8596 case "absolute_row": 8597 if (this.row !== void 0) { 8598 throw Error("Reference may only have at most 1 row, more than 1 provided"); 8599 } 8600 const createdRow = (0, row_1.newRow)(child, table); 8601 if (createdRow.isErr()) { 8602 if (createdRow.error === ast_utils_1.errIndex0) { 8603 break; 8604 } 8605 throw createdRow.error; 8606 } 8607 this.row = createdRow.value; 8608 break; 8609 case "relative_column": 8610 case "absolute_column": 8611 if (this.column !== void 0) { 8612 throw Error("Reference may only have at most 1 column, more than 1 provided"); 8613 } 8614 const createdCol = (0, column_1.newColumn)(child, table); 8615 if (createdCol.isErr()) { 8616 if (createdCol.error === ast_utils_1.errIndex0) { 8617 break; 8618 } 8619 throw createdCol.error; 8620 } 8621 this.column = createdCol.value; 8622 break; 8623 } 8624 } 8625 } 8626 }; 8627 exports.Reference = Reference; 8628 } 8629 }); 8630 8631 // node_modules/@tgrosinger/md-advanced-tables/lib/calc/range.js 8632 var require_range2 = __commonJS({ 8633 "node_modules/@tgrosinger/md-advanced-tables/lib/calc/range.js"(exports) { 8634 "use strict"; 8635 Object.defineProperty(exports, "__esModule", { value: true }); 8636 exports.Range = void 0; 8637 var neverthrow_1 = require_neverthrow(); 8638 var ast_utils_1 = require_ast_utils(); 8639 var reference_1 = require_reference(); 8640 var results_1 = require_results(); 8641 var lodash_1 = require_lodash(); 8642 var Range2 = class { 8643 constructor(ast, table) { 8644 this.getValue = (table2, currentCell) => { 8645 const startColumn = this.startColumn ? this.startColumn.getIndex(currentCell) : currentCell.column; 8646 const endColumn = this.endColumn ? this.endColumn.getIndex(currentCell) : startColumn; 8647 const startRow = this.startRow ? this.startRow.getIndex(currentCell) : currentCell.row; 8648 const endRow = this.endRow ? this.endRow.getIndex(currentCell) : currentCell.row; 8649 return (0, neverthrow_1.ok)(new results_1.Value((0, lodash_1.map)((0, lodash_1.range)(startRow, endRow + 1), (row) => (0, lodash_1.map)((0, lodash_1.range)(startColumn, endColumn + 1), (col) => { 8650 var _a; 8651 return ((_a = table2.getCellAt(row, col)) === null || _a === void 0 ? void 0 : _a.toText()) || ""; 8652 })))); 8653 }; 8654 this.asCells = () => { 8655 if (!this.startColumn || !this.startRow || !this.endRow) { 8656 return (0, neverthrow_1.err)(new Error("A range used as a desintation must define rows and cells")); 8657 } 8658 let endColumn = this.endColumn; 8659 if (!endColumn) { 8660 endColumn = this.startColumn; 8661 } 8662 const startRowIndex = this.startRow.getAbsoluteIndex(); 8663 const endRowIndex = this.endRow.getAbsoluteIndex(); 8664 const startColumnIndex = this.startColumn.getAbsoluteIndex(); 8665 const endColumnIndex = endColumn.getAbsoluteIndex(); 8666 if (startRowIndex.isErr() || endRowIndex.isErr() || startColumnIndex.isErr() || endColumnIndex.isErr()) { 8667 return (0, neverthrow_1.err)(new Error("A relative range can not be used in a formula destination")); 8668 } 8669 const minRow = Math.min(startRowIndex.value, endRowIndex.value); 8670 const maxRow = Math.max(startRowIndex.value, endRowIndex.value); 8671 const minColumn = Math.min(startColumnIndex.value, endColumnIndex.value); 8672 const maxColumn = Math.max(startColumnIndex.value, endColumnIndex.value); 8673 return (0, neverthrow_1.ok)((0, lodash_1.flatMap)((0, lodash_1.range)(minRow, maxRow + 1), (rowNum) => (0, lodash_1.range)(minColumn, maxColumn + 1).map((colNum) => ({ row: rowNum, column: colNum })))); 8674 }; 8675 let typeErr = (0, ast_utils_1.checkType)(ast, "range"); 8676 if (typeErr) { 8677 throw typeErr; 8678 } 8679 let lengthError = (0, ast_utils_1.checkChildLength)(ast, 2); 8680 if (lengthError) { 8681 throw lengthError; 8682 } 8683 const startChild = ast.children[0]; 8684 const endChild = ast.children[1]; 8685 typeErr = (0, ast_utils_1.checkType)(startChild, "source_reference"); 8686 if (typeErr) { 8687 throw typeErr; 8688 } 8689 typeErr = (0, ast_utils_1.checkType)(endChild, "source_reference"); 8690 if (typeErr) { 8691 throw typeErr; 8692 } 8693 lengthError = (0, ast_utils_1.checkChildLength)(startChild, 1); 8694 if (lengthError) { 8695 throw lengthError; 8696 } 8697 lengthError = (0, ast_utils_1.checkChildLength)(endChild, 1); 8698 if (lengthError) { 8699 throw lengthError; 8700 } 8701 const start = new reference_1.Reference(startChild.children[0], table); 8702 const end = new reference_1.Reference(endChild.children[0], table); 8703 if (start.row && !end.row || end.row && !start.row) { 8704 throw new Error("Range must use references of the same kind"); 8705 } 8706 if (!start.row && !start.column) { 8707 console.log(start); 8708 throw new Error("Range must have a row or a column defined"); 8709 } 8710 if (start.row) { 8711 this.startRow = start.row; 8712 } 8713 if (start.column) { 8714 this.startColumn = start.column; 8715 } 8716 if (end.row) { 8717 this.endRow = end.row; 8718 } 8719 if (end.column) { 8720 this.endColumn = end.column; 8721 } else { 8722 this.endColumn = start.column; 8723 } 8724 } 8725 }; 8726 exports.Range = Range2; 8727 } 8728 }); 8729 8730 // node_modules/@tgrosinger/md-advanced-tables/lib/calc/destination.js 8731 var require_destination = __commonJS({ 8732 "node_modules/@tgrosinger/md-advanced-tables/lib/calc/destination.js"(exports) { 8733 "use strict"; 8734 Object.defineProperty(exports, "__esModule", { value: true }); 8735 exports.RangeDestination = exports.CellDestination = exports.ColumnDestination = exports.RowDestination = exports.newDestination = void 0; 8736 var neverthrow_1 = require_neverthrow(); 8737 var ast_utils_1 = require_ast_utils(); 8738 var column_1 = require_column(); 8739 var range_1 = require_range2(); 8740 var row_1 = require_row(); 8741 var lodash_1 = require_lodash(); 8742 var newDestination = (ast, table, formatter) => { 8743 const typeErr = (0, ast_utils_1.checkType)(ast, "destination"); 8744 if (typeErr) { 8745 return (0, neverthrow_1.err)(typeErr); 8746 } 8747 const lengthError = (0, ast_utils_1.checkChildLength)(ast, 1); 8748 if (lengthError) { 8749 return (0, neverthrow_1.err)(lengthError); 8750 } 8751 const child = ast.children[0]; 8752 if (child.type === "range") { 8753 return (0, neverthrow_1.ok)(new RangeDestination(child, table, formatter)); 8754 } 8755 try { 8756 switch (child.children.length) { 8757 case 2: 8758 return (0, neverthrow_1.ok)(new CellDestination(child, table, formatter)); 8759 case 1: 8760 const innerChild = child.children[0]; 8761 if (innerChild.type === "absolute_row") { 8762 return (0, neverthrow_1.ok)(new RowDestination(child, table, formatter)); 8763 } else if (innerChild.type === "absolute_column") { 8764 return (0, neverthrow_1.ok)(new ColumnDestination(child, table, formatter)); 8765 } 8766 default: 8767 return (0, neverthrow_1.err)(new Error("Unexpected destination type " + child.type)); 8768 } 8769 } catch (error) { 8770 if (error === ast_utils_1.errIndex0) { 8771 return (0, neverthrow_1.err)(new Error("Index 0 may not be used in a destination")); 8772 } 8773 return (0, neverthrow_1.err)(error); 8774 } 8775 }; 8776 exports.newDestination = newDestination; 8777 var RowDestination = class { 8778 constructor(ast, table, formatter) { 8779 this.merge = (source, table2) => { 8780 const cells = (0, lodash_1.range)(0, table2.getWidth()).map((columnNum) => ({ row: this.row.index, column: columnNum })); 8781 return mergeForCells(source, table2, cells, this.formatter); 8782 }; 8783 this.formatter = formatter; 8784 const typeErr = (0, ast_utils_1.checkType)(ast, "absolute_reference"); 8785 if (typeErr) { 8786 throw typeErr; 8787 } 8788 const lengthError = (0, ast_utils_1.checkChildLength)(ast, 1); 8789 if (lengthError) { 8790 throw lengthError; 8791 } 8792 const child = ast.children[0]; 8793 try { 8794 this.row = new row_1.AbsoluteRow(child, table); 8795 } catch (error) { 8796 throw error; 8797 } 8798 } 8799 }; 8800 exports.RowDestination = RowDestination; 8801 var ColumnDestination = class { 8802 constructor(ast, table, formatter) { 8803 this.merge = (source, table2) => { 8804 const cells = (0, lodash_1.range)(2, table2.getHeight()).map((rowNum) => ({ row: rowNum, column: this.column.index })); 8805 return mergeForCells(source, table2, cells, this.formatter); 8806 }; 8807 this.formatter = formatter; 8808 const typeErr = (0, ast_utils_1.checkType)(ast, "absolute_reference"); 8809 if (typeErr) { 8810 throw typeErr; 8811 } 8812 const lengthError = (0, ast_utils_1.checkChildLength)(ast, 1); 8813 if (lengthError) { 8814 throw lengthError; 8815 } 8816 const child = ast.children[0]; 8817 try { 8818 this.column = new column_1.AbsoluteColumn(child, table); 8819 } catch (error) { 8820 throw error; 8821 } 8822 } 8823 }; 8824 exports.ColumnDestination = ColumnDestination; 8825 var CellDestination = class { 8826 constructor(ast, table, formatter) { 8827 this.merge = (source, table2) => { 8828 const cell = { row: this.row.index, column: this.column.index }; 8829 return mergeForCells(source, table2, [cell], this.formatter); 8830 }; 8831 this.formatter = formatter; 8832 const typeErr = (0, ast_utils_1.checkType)(ast, "absolute_reference"); 8833 if (typeErr) { 8834 throw typeErr; 8835 } 8836 const lengthError = (0, ast_utils_1.checkChildLength)(ast, 2); 8837 if (lengthError) { 8838 throw lengthError; 8839 } 8840 const rowChild = ast.children[0]; 8841 const colChild = ast.children[1]; 8842 try { 8843 this.row = new row_1.AbsoluteRow(rowChild, table); 8844 this.column = new column_1.AbsoluteColumn(colChild, table); 8845 } catch (error) { 8846 throw error; 8847 } 8848 } 8849 }; 8850 exports.CellDestination = CellDestination; 8851 var RangeDestination = class { 8852 constructor(ast, table, formatter) { 8853 this.merge = (source, table2) => this.range.asCells().andThen((cells) => mergeForCells(source, table2, cells, this.formatter)); 8854 this.formatter = formatter; 8855 const typeErr = (0, ast_utils_1.checkType)(ast, "range"); 8856 if (typeErr) { 8857 throw typeErr; 8858 } 8859 const lengthError = (0, ast_utils_1.checkChildLength)(ast, 2); 8860 if (lengthError) { 8861 throw lengthError; 8862 } 8863 ast.children.forEach((child) => { 8864 let childTypeErr = (0, ast_utils_1.checkType)(child, "source_reference"); 8865 if (childTypeErr) { 8866 throw childTypeErr; 8867 } 8868 const childLengthError = (0, ast_utils_1.checkChildLength)(child, 1); 8869 if (childLengthError) { 8870 throw childLengthError; 8871 } 8872 childTypeErr = (0, ast_utils_1.checkType)(child.children[0], "absolute_reference"); 8873 if (childTypeErr) { 8874 throw childTypeErr; 8875 } 8876 }); 8877 this.range = new range_1.Range(ast, table); 8878 } 8879 }; 8880 exports.RangeDestination = RangeDestination; 8881 var mergeForCells = (source, table, cells, formatter) => cells.reduce((currentTable, currentCell) => currentTable.andThen((t) => source.getValue(t, currentCell).andThen((val) => (0, neverthrow_1.ok)(val.toString())).andThen((val) => (0, neverthrow_1.ok)(val.trim() === "" ? "0" : val)).andThen((val) => (0, neverthrow_1.ok)(t.setCellAt(currentCell.row, currentCell.column, formatter.format(val))))), (0, neverthrow_1.ok)(table)); 8882 } 8883 }); 8884 8885 // node_modules/@tgrosinger/md-advanced-tables/lib/calc/display_directive.js 8886 var require_display_directive = __commonJS({ 8887 "node_modules/@tgrosinger/md-advanced-tables/lib/calc/display_directive.js"(exports) { 8888 "use strict"; 8889 Object.defineProperty(exports, "__esModule", { value: true }); 8890 exports.DisplayDirective = exports.DefaultFormatter = void 0; 8891 var ast_utils_1 = require_ast_utils(); 8892 var DefaultFormatter = class { 8893 constructor() { 8894 this.format = (num) => { 8895 if (typeof num === "string") { 8896 return num; 8897 } 8898 return num.toString(); 8899 }; 8900 } 8901 }; 8902 exports.DefaultFormatter = DefaultFormatter; 8903 var DisplayDirective = class { 8904 constructor(ast) { 8905 this.format = (num) => { 8906 const parsed = typeof num === "string" ? parseFloat(num) : num; 8907 if (this.displayAsDatetime) { 8908 const date = new Date(parsed); 8909 const pad = (v) => `0${v}`.slice(-2); 8910 const y = date.getFullYear(); 8911 const mo = pad(date.getMonth() + 1); 8912 const d = pad(date.getDate()); 8913 const h = pad(date.getHours()); 8914 const min = pad(date.getMinutes()); 8915 return `${y}-${mo}-${d} ${h}:${min}`; 8916 } 8917 if (this.displayAsHourMinute) { 8918 let sign = parsed < 0 ? "-" : ""; 8919 const minutes = Math.floor(Math.abs(parsed) / 6e4); 8920 const pad = (v) => `0${v}`.slice(-2); 8921 const h = pad(Math.floor(minutes / 60)); 8922 const m = pad(minutes % 60); 8923 return `${sign}${h}:${m}`; 8924 } 8925 return parsed.toFixed(this.decimalLength); 8926 }; 8927 let typeError = (0, ast_utils_1.checkType)(ast, "display_directive"); 8928 if (typeError) { 8929 throw typeError; 8930 } 8931 let lengthError = (0, ast_utils_1.checkChildLength)(ast, 1); 8932 if (lengthError) { 8933 throw lengthError; 8934 } 8935 const displayDirectiveOption = ast.children[0]; 8936 typeError = (0, ast_utils_1.checkType)(displayDirectiveOption, "display_directive_option"); 8937 if (typeError) { 8938 throw typeError; 8939 } 8940 lengthError = (0, ast_utils_1.checkChildLength)(displayDirectiveOption, 1); 8941 if (lengthError) { 8942 throw lengthError; 8943 } 8944 const formattingDirective = displayDirectiveOption.children[0]; 8945 typeError = (0, ast_utils_1.checkType)(formattingDirective, "formatting_directive", "datetime_directive", "hourminute_directive"); 8946 if (typeError) { 8947 throw typeError; 8948 } 8949 this.displayAsDatetime = formattingDirective.type === "datetime_directive"; 8950 this.displayAsHourMinute = formattingDirective.type === "hourminute_directive"; 8951 if (this.displayAsDatetime || this.displayAsHourMinute) { 8952 this.decimalLength = -1; 8953 return; 8954 } 8955 lengthError = (0, ast_utils_1.checkChildLength)(formattingDirective, 1); 8956 if (lengthError) { 8957 throw lengthError; 8958 } 8959 const formattingDirectiveLength = formattingDirective.children[0]; 8960 typeError = (0, ast_utils_1.checkType)(formattingDirectiveLength, "int"); 8961 if (typeError) { 8962 throw typeError; 8963 } 8964 this.decimalLength = parseInt(formattingDirectiveLength.text); 8965 } 8966 }; 8967 exports.DisplayDirective = DisplayDirective; 8968 } 8969 }); 8970 8971 // node_modules/@tgrosinger/md-advanced-tables/lib/calc/single_param_function.js 8972 var require_single_param_function = __commonJS({ 8973 "node_modules/@tgrosinger/md-advanced-tables/lib/calc/single_param_function.js"(exports) { 8974 "use strict"; 8975 var __importDefault = exports && exports.__importDefault || function(mod) { 8976 return mod && mod.__esModule ? mod : { "default": mod }; 8977 }; 8978 Object.defineProperty(exports, "__esModule", { value: true }); 8979 exports.SingleParamFunctionCall = void 0; 8980 var neverthrow_1 = require_neverthrow(); 8981 var ast_utils_1 = require_ast_utils(); 8982 var calc_1 = require_calc(); 8983 var results_1 = require_results(); 8984 var decimal_js_1 = __importDefault(require_decimal()); 8985 var SingleParamFunctionCall = class { 8986 constructor(ast, table) { 8987 this.getValue = (table2, cell) => this.param.getValue(table2, cell).andThen((sourceData) => ( 8988 // The operation functions do not throw errors because data arity has 8989 // already been validated. 8990 (0, neverthrow_1.ok)(this.op(sourceData)) 8991 )); 8992 const typeError = (0, ast_utils_1.checkType)(ast, "single_param_function_call"); 8993 if (typeError) { 8994 throw typeError; 8995 } 8996 const lengthError = (0, ast_utils_1.checkChildLength)(ast, 2); 8997 if (lengthError) { 8998 throw lengthError; 8999 } 9000 const childTypeError = (0, ast_utils_1.checkType)(ast.children[0], "single_param_function"); 9001 if (childTypeError) { 9002 throw childTypeError; 9003 } 9004 const functionName = ast.children[0].text; 9005 switch (functionName) { 9006 case "sum": 9007 this.op = sum; 9008 break; 9009 case "mean": 9010 this.op = mean; 9011 break; 9012 default: 9013 throw Error("Unknown single param function call: " + functionName); 9014 } 9015 this.param = new calc_1.Source(ast.children[1], table); 9016 } 9017 }; 9018 exports.SingleParamFunctionCall = SingleParamFunctionCall; 9019 var sum = (value) => { 9020 const total = value.val.reduce((runningTotal, currentRow) => currentRow.reduce((rowTotal, currentCell) => { 9021 const currentCellValue = (0, results_1.FloatOrMilliseconds)(currentCell); 9022 return currentCellValue.add(rowTotal); 9023 }, runningTotal), new decimal_js_1.default(0)); 9024 return new results_1.Value([[total.toString()]]); 9025 }; 9026 var mean = (value) => { 9027 const { total, count } = value.val.reduce(({ total: runningTotal1, count: currentCount1 }, currentRow) => currentRow.reduce(({ total: runningTotal2, count: currentCount2 }, currentCell) => ({ 9028 total: runningTotal2 + +currentCell, 9029 count: currentCount2 + 1 9030 }), { total: runningTotal1, count: currentCount1 }), { total: 0, count: 0 }); 9031 return new results_1.Value([[(total / count).toString()]]); 9032 }; 9033 } 9034 }); 9035 9036 // node_modules/ebnf/dist/TokenError.js 9037 var require_TokenError = __commonJS({ 9038 "node_modules/ebnf/dist/TokenError.js"(exports) { 9039 "use strict"; 9040 Object.defineProperty(exports, "__esModule", { value: true }); 9041 exports.TokenError = void 0; 9042 var TokenError = class extends Error { 9043 constructor(message, token) { 9044 super(message); 9045 this.message = message; 9046 this.token = token; 9047 if (token && token.errors) 9048 token.errors.push(this); 9049 else 9050 throw this; 9051 } 9052 inspect() { 9053 return "SyntaxError: " + this.message; 9054 } 9055 }; 9056 exports.TokenError = TokenError; 9057 } 9058 }); 9059 9060 // node_modules/ebnf/dist/Parser.js 9061 var require_Parser = __commonJS({ 9062 "node_modules/ebnf/dist/Parser.js"(exports) { 9063 "use strict"; 9064 Object.defineProperty(exports, "__esModule", { value: true }); 9065 exports.Parser = exports.findRuleByName = exports.parseRuleName = exports.escapeRegExp = exports.readToken = void 0; 9066 var UPPER_SNAKE_RE = /^[A-Z0-9_]+$/; 9067 var decorationRE = /(\?|\+|\*)$/; 9068 var preDecorationRE = /^(@|&|!)/; 9069 var WS_RULE = "WS"; 9070 var TokenError_1 = require_TokenError(); 9071 function readToken(txt, expr) { 9072 let result = expr.exec(txt); 9073 if (result && result.index == 0) { 9074 if (result[0].length == 0 && expr.source.length > 0) 9075 return null; 9076 return { 9077 type: null, 9078 text: result[0], 9079 rest: txt.substr(result[0].length), 9080 start: 0, 9081 end: result[0].length - 1, 9082 fullText: result[0], 9083 errors: [], 9084 children: [], 9085 parent: null 9086 }; 9087 } 9088 return null; 9089 } 9090 exports.readToken = readToken; 9091 function escapeRegExp(str) { 9092 return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); 9093 } 9094 exports.escapeRegExp = escapeRegExp; 9095 function fixRest(token) { 9096 token.rest = ""; 9097 token.children && token.children.forEach((c) => fixRest(c)); 9098 } 9099 function fixPositions(token, start) { 9100 token.start += start; 9101 token.end += start; 9102 token.children && token.children.forEach((c) => fixPositions(c, token.start)); 9103 } 9104 function agregateErrors(errors, token) { 9105 if (token.errors && token.errors.length) 9106 token.errors.forEach((err) => errors.push(err)); 9107 token.children && token.children.forEach((tok) => agregateErrors(errors, tok)); 9108 } 9109 function parseRuleName(name) { 9110 let postDecoration = decorationRE.exec(name); 9111 let preDecoration = preDecorationRE.exec(name); 9112 let postDecorationText = postDecoration && postDecoration[0] || ""; 9113 let preDecorationText = preDecoration && preDecoration[0] || ""; 9114 let out = { 9115 raw: name, 9116 name: name.replace(decorationRE, "").replace(preDecorationRE, ""), 9117 isOptional: postDecorationText == "?" || postDecorationText == "*", 9118 allowRepetition: postDecorationText == "+" || postDecorationText == "*", 9119 atLeastOne: postDecorationText == "+", 9120 lookupPositive: preDecorationText == "&", 9121 lookupNegative: preDecorationText == "!", 9122 pinned: preDecorationText == "@", 9123 lookup: false, 9124 isLiteral: false 9125 }; 9126 out.isLiteral = out.name[0] == "'" || out.name[0] == '"'; 9127 out.lookup = out.lookupNegative || out.lookupPositive; 9128 return out; 9129 } 9130 exports.parseRuleName = parseRuleName; 9131 function findRuleByName(name, parser) { 9132 let parsed = parseRuleName(name); 9133 return parser.cachedRules[parsed.name] || null; 9134 } 9135 exports.findRuleByName = findRuleByName; 9136 function stripRules(token, re) { 9137 if (token.children) { 9138 let localRules = token.children.filter((x) => x.type && re.test(x.type)); 9139 for (let i = 0; i < localRules.length; i++) { 9140 let indexOnChildren = token.children.indexOf(localRules[i]); 9141 if (indexOnChildren != -1) { 9142 token.children.splice(indexOnChildren, 1); 9143 } 9144 } 9145 token.children.forEach((c) => stripRules(c, re)); 9146 } 9147 } 9148 var ignoreMissingRules = ["EOF"]; 9149 var Parser = class { 9150 constructor(grammarRules, options) { 9151 this.grammarRules = grammarRules; 9152 this.options = options; 9153 this.cachedRules = {}; 9154 this.debug = options ? options.debug === true : false; 9155 let errors = []; 9156 let neededRules = []; 9157 grammarRules.forEach((rule) => { 9158 let parsedName = parseRuleName(rule.name); 9159 if (parsedName.name in this.cachedRules) { 9160 errors.push("Duplicated rule " + parsedName.name); 9161 return; 9162 } else { 9163 this.cachedRules[parsedName.name] = rule; 9164 } 9165 if (!rule.bnf || !rule.bnf.length) { 9166 let error = "Missing rule content, rule: " + rule.name; 9167 if (errors.indexOf(error) == -1) 9168 errors.push(error); 9169 } else { 9170 rule.bnf.forEach((options2) => { 9171 if (typeof options2[0] === "string") { 9172 let parsed = parseRuleName(options2[0]); 9173 if (parsed.name == rule.name) { 9174 let error = "Left recursion is not allowed, rule: " + rule.name; 9175 if (errors.indexOf(error) == -1) 9176 errors.push(error); 9177 } 9178 } 9179 options2.forEach((option) => { 9180 if (typeof option == "string") { 9181 let name = parseRuleName(option); 9182 if (!name.isLiteral && neededRules.indexOf(name.name) == -1 && ignoreMissingRules.indexOf(name.name) == -1) 9183 neededRules.push(name.name); 9184 } 9185 }); 9186 }); 9187 } 9188 if (WS_RULE == rule.name) 9189 rule.implicitWs = false; 9190 if (rule.implicitWs) { 9191 if (neededRules.indexOf(WS_RULE) == -1) 9192 neededRules.push(WS_RULE); 9193 } 9194 if (rule.recover) { 9195 if (neededRules.indexOf(rule.recover) == -1) 9196 neededRules.push(rule.recover); 9197 } 9198 }); 9199 neededRules.forEach((ruleName) => { 9200 if (!(ruleName in this.cachedRules)) { 9201 errors.push("Missing rule " + ruleName); 9202 } 9203 }); 9204 if (errors.length) 9205 throw new Error(errors.join("\n")); 9206 } 9207 getAST(txt, target) { 9208 if (!target) { 9209 target = this.grammarRules.filter((x) => !x.fragment && x.name.indexOf("%") != 0)[0].name; 9210 } 9211 let result = this.parse(txt, target); 9212 if (result) { 9213 agregateErrors(result.errors, result); 9214 fixPositions(result, 0); 9215 stripRules(result, /^%/); 9216 if (!this.options || !this.options.keepUpperRules) 9217 stripRules(result, UPPER_SNAKE_RE); 9218 let rest = result.rest; 9219 if (rest) { 9220 new TokenError_1.TokenError("Unexpected end of input: \n" + rest, result); 9221 } 9222 fixRest(result); 9223 result.rest = rest; 9224 } 9225 return result; 9226 } 9227 emitSource() { 9228 return "CANNOT EMIT SOURCE FROM BASE Parser"; 9229 } 9230 parse(txt, target, recursion = 0) { 9231 let out = null; 9232 let type = parseRuleName(target); 9233 let expr; 9234 let printable = this.debug && /*!isLiteral &*/ 9235 !UPPER_SNAKE_RE.test(type.name); 9236 printable && console.log(new Array(recursion).join("\u2502 ") + "Trying to get " + target + " from " + JSON.stringify(txt.split("\n")[0])); 9237 let realType = type.name; 9238 let targetLex = findRuleByName(type.name, this); 9239 if (type.name == "EOF") { 9240 if (txt.length) { 9241 return null; 9242 } else if (txt.length == 0) { 9243 return { 9244 type: "EOF", 9245 text: "", 9246 rest: "", 9247 start: 0, 9248 end: 0, 9249 fullText: "", 9250 errors: [], 9251 children: [], 9252 parent: null 9253 }; 9254 } 9255 } 9256 try { 9257 if (!targetLex && type.isLiteral) { 9258 let src = type.name.trim(); 9259 if (src.startsWith('"')) { 9260 src = JSON.parse(src); 9261 } else if (src.startsWith("'")) { 9262 src = src.replace(/^'(.+)'$/, "$1").replace(/\\'/g, "'"); 9263 } 9264 if (src === "") { 9265 return { 9266 type: "%%EMPTY%%", 9267 text: "", 9268 rest: txt, 9269 start: 0, 9270 end: 0, 9271 fullText: "", 9272 errors: [], 9273 children: [], 9274 parent: null 9275 }; 9276 } 9277 expr = new RegExp(escapeRegExp(src)); 9278 realType = null; 9279 } 9280 } catch (e) { 9281 if (e instanceof ReferenceError) { 9282 console.error(e); 9283 } 9284 return null; 9285 } 9286 if (expr) { 9287 let result = readToken(txt, expr); 9288 if (result) { 9289 result.type = realType; 9290 return result; 9291 } 9292 } else { 9293 let options = targetLex.bnf; 9294 if (options instanceof Array) { 9295 options.forEach((phases) => { 9296 if (out) 9297 return; 9298 let pinned = null; 9299 let tmp = { 9300 type: type.name, 9301 text: "", 9302 children: [], 9303 end: 0, 9304 errors: [], 9305 fullText: "", 9306 parent: null, 9307 start: 0, 9308 rest: txt 9309 }; 9310 if (targetLex.fragment) 9311 tmp.fragment = true; 9312 let tmpTxt = txt; 9313 let position = 0; 9314 let allOptional = phases.length > 0; 9315 let foundSomething = false; 9316 for (let i = 0; i < phases.length; i++) { 9317 if (typeof phases[i] == "string") { 9318 let localTarget = parseRuleName(phases[i]); 9319 allOptional = allOptional && localTarget.isOptional; 9320 let got; 9321 let foundAtLeastOne = false; 9322 do { 9323 got = null; 9324 if (targetLex.implicitWs) { 9325 got = this.parse(tmpTxt, localTarget.name, recursion + 1); 9326 if (!got) { 9327 let WS; 9328 do { 9329 WS = this.parse(tmpTxt, WS_RULE, recursion + 1); 9330 if (WS) { 9331 tmp.text = tmp.text + WS.text; 9332 tmp.end = tmp.text.length; 9333 WS.parent = tmp; 9334 tmp.children.push(WS); 9335 tmpTxt = tmpTxt.substr(WS.text.length); 9336 position += WS.text.length; 9337 } else { 9338 break; 9339 } 9340 } while (WS && WS.text.length); 9341 } 9342 } 9343 got = got || this.parse(tmpTxt, localTarget.name, recursion + 1); 9344 if (localTarget.lookupNegative) { 9345 if (got) 9346 return; 9347 break; 9348 } 9349 if (localTarget.lookupPositive) { 9350 if (!got) 9351 return; 9352 } 9353 if (!got) { 9354 if (localTarget.isOptional) 9355 break; 9356 if (localTarget.atLeastOne && foundAtLeastOne) 9357 break; 9358 } 9359 if (got && targetLex.pinned == i + 1) { 9360 pinned = got; 9361 printable && console.log(new Array(recursion + 1).join("\u2502 ") + "\u2514\u2500 " + got.type + " PINNED"); 9362 } 9363 if (!got) 9364 got = this.parseRecovery(targetLex, tmpTxt, recursion + 1); 9365 if (!got) { 9366 if (pinned) { 9367 out = tmp; 9368 got = { 9369 type: "SyntaxError", 9370 text: tmpTxt, 9371 children: [], 9372 end: tmpTxt.length, 9373 errors: [], 9374 fullText: "", 9375 parent: null, 9376 start: 0, 9377 rest: "" 9378 }; 9379 if (tmpTxt.length) { 9380 new TokenError_1.TokenError(`Unexpected end of input. Expecting ${localTarget.name} Got: ${tmpTxt}`, got); 9381 } else { 9382 new TokenError_1.TokenError(`Unexpected end of input. Missing ${localTarget.name}`, got); 9383 } 9384 printable && console.log(new Array(recursion + 1).join("\u2502 ") + "\u2514\u2500 " + got.type + " " + JSON.stringify(got.text)); 9385 } else { 9386 return; 9387 } 9388 } 9389 foundAtLeastOne = true; 9390 foundSomething = true; 9391 if (got.type == "%%EMPTY%%") { 9392 break; 9393 } 9394 got.start += position; 9395 got.end += position; 9396 if (!localTarget.lookupPositive && got.type) { 9397 if (got.fragment) { 9398 got.children && got.children.forEach((x) => { 9399 x.start += position; 9400 x.end += position; 9401 x.parent = tmp; 9402 tmp.children.push(x); 9403 }); 9404 } else { 9405 got.parent = tmp; 9406 tmp.children.push(got); 9407 } 9408 } 9409 if (localTarget.lookup) 9410 got.lookup = true; 9411 printable && console.log(new Array(recursion + 1).join("\u2502 ") + "\u2514\u2500 " + got.type + " " + JSON.stringify(got.text)); 9412 if (!localTarget.lookup && !got.lookup) { 9413 tmp.text = tmp.text + got.text; 9414 tmp.end = tmp.text.length; 9415 tmpTxt = tmpTxt.substr(got.text.length); 9416 position += got.text.length; 9417 } 9418 tmp.rest = tmpTxt; 9419 } while (got && localTarget.allowRepetition && tmpTxt.length && !got.lookup); 9420 } else { 9421 let got = readToken(tmpTxt, phases[i]); 9422 if (!got) { 9423 return; 9424 } 9425 printable && console.log(new Array(recursion + 1).join("\u2502 ") + "\u2514> " + JSON.stringify(got.text) + phases[i].source); 9426 foundSomething = true; 9427 got.start += position; 9428 got.end += position; 9429 tmp.text = tmp.text + got.text; 9430 tmp.end = tmp.text.length; 9431 tmpTxt = tmpTxt.substr(got.text.length); 9432 position += got.text.length; 9433 tmp.rest = tmpTxt; 9434 } 9435 } 9436 if (foundSomething) { 9437 out = tmp; 9438 printable && console.log(new Array(recursion).join("\u2502 ") + "\u251C<\u2500\u2534< PUSHING " + out.type + " " + JSON.stringify(out.text)); 9439 } 9440 }); 9441 } 9442 if (out && targetLex.simplifyWhenOneChildren && out.children.length == 1) { 9443 out = out.children[0]; 9444 } 9445 } 9446 if (!out) { 9447 printable && console.log(target + " NOT RESOLVED FROM " + txt); 9448 } 9449 return out; 9450 } 9451 parseRecovery(recoverableToken, tmpTxt, recursion) { 9452 if (recoverableToken.recover && tmpTxt.length) { 9453 let printable = this.debug; 9454 printable && console.log(new Array(recursion + 1).join("\u2502 ") + "Trying to recover until token " + recoverableToken.recover + " from " + JSON.stringify(tmpTxt.split("\n")[0] + tmpTxt.split("\n")[1])); 9455 let tmp = { 9456 type: "SyntaxError", 9457 text: "", 9458 children: [], 9459 end: 0, 9460 errors: [], 9461 fullText: "", 9462 parent: null, 9463 start: 0, 9464 rest: "" 9465 }; 9466 let got; 9467 do { 9468 got = this.parse(tmpTxt, recoverableToken.recover, recursion + 1); 9469 if (got) { 9470 new TokenError_1.TokenError('Unexpected input: "' + tmp.text + `" Expecting: ${recoverableToken.name}`, tmp); 9471 break; 9472 } else { 9473 tmp.text = tmp.text + tmpTxt[0]; 9474 tmp.end = tmp.text.length; 9475 tmpTxt = tmpTxt.substr(1); 9476 } 9477 } while (!got && tmpTxt.length > 0); 9478 if (tmp.text.length > 0 && got) { 9479 printable && console.log(new Array(recursion + 1).join("\u2502 ") + "Recovered text: " + JSON.stringify(tmp.text)); 9480 return tmp; 9481 } 9482 } 9483 return null; 9484 } 9485 }; 9486 exports.Parser = Parser; 9487 exports.default = Parser; 9488 } 9489 }); 9490 9491 // node_modules/ebnf/dist/SemanticHelpers.js 9492 var require_SemanticHelpers = __commonJS({ 9493 "node_modules/ebnf/dist/SemanticHelpers.js"(exports) { 9494 "use strict"; 9495 Object.defineProperty(exports, "__esModule", { value: true }); 9496 exports.findChildrenByType = void 0; 9497 function findChildrenByType(token, type) { 9498 return token.children ? token.children.filter((x) => x.type == type) : []; 9499 } 9500 exports.findChildrenByType = findChildrenByType; 9501 } 9502 }); 9503 9504 // node_modules/ebnf/dist/Grammars/BNF.js 9505 var require_BNF = __commonJS({ 9506 "node_modules/ebnf/dist/Grammars/BNF.js"(exports) { 9507 "use strict"; 9508 Object.defineProperty(exports, "__esModule", { value: true }); 9509 var SemanticHelpers_1 = require_SemanticHelpers(); 9510 var Parser_1 = require_Parser(); 9511 var BNF; 9512 (function(BNF2) { 9513 BNF2.RULES = [ 9514 { 9515 name: "syntax", 9516 bnf: [["RULE_EOL*", "rule+"]] 9517 }, 9518 { 9519 name: "rule", 9520 bnf: [ 9521 [ 9522 '" "*', 9523 '"<"', 9524 "rule-name", 9525 '">"', 9526 '" "*', 9527 '"::="', 9528 "firstExpression", 9529 "otherExpression*", 9530 '" "*', 9531 "RULE_EOL+", 9532 '" "*' 9533 ] 9534 ] 9535 }, 9536 { 9537 name: "firstExpression", 9538 bnf: [['" "*', "list"]] 9539 }, 9540 { 9541 name: "otherExpression", 9542 bnf: [['" "*', '"|"', '" "*', "list"]] 9543 }, 9544 { 9545 name: "RULE_EOL", 9546 bnf: [['"\\r"'], ['"\\n"']] 9547 }, 9548 { 9549 name: "list", 9550 bnf: [["term", '" "*', "list"], ["term"]] 9551 }, 9552 { 9553 name: "term", 9554 bnf: [["literal"], ['"<"', "rule-name", '">"']] 9555 }, 9556 { 9557 name: "literal", 9558 bnf: [[`'"'`, "RULE_CHARACTER1*", `'"'`], [`"'"`, "RULE_CHARACTER2*", `"'"`]] 9559 }, 9560 { 9561 name: "RULE_CHARACTER", 9562 bnf: [['" "'], ["RULE_LETTER"], ["RULE_DIGIT"], ["RULE_SYMBOL"]] 9563 }, 9564 { 9565 name: "RULE_LETTER", 9566 bnf: [ 9567 ['"A"'], 9568 ['"B"'], 9569 ['"C"'], 9570 ['"D"'], 9571 ['"E"'], 9572 ['"F"'], 9573 ['"G"'], 9574 ['"H"'], 9575 ['"I"'], 9576 ['"J"'], 9577 ['"K"'], 9578 ['"L"'], 9579 ['"M"'], 9580 ['"N"'], 9581 ['"O"'], 9582 ['"P"'], 9583 ['"Q"'], 9584 ['"R"'], 9585 ['"S"'], 9586 ['"T"'], 9587 ['"U"'], 9588 ['"V"'], 9589 ['"W"'], 9590 ['"X"'], 9591 ['"Y"'], 9592 ['"Z"'], 9593 ['"a"'], 9594 ['"b"'], 9595 ['"c"'], 9596 ['"d"'], 9597 ['"e"'], 9598 ['"f"'], 9599 ['"g"'], 9600 ['"h"'], 9601 ['"i"'], 9602 ['"j"'], 9603 ['"k"'], 9604 ['"l"'], 9605 ['"m"'], 9606 ['"n"'], 9607 ['"o"'], 9608 ['"p"'], 9609 ['"q"'], 9610 ['"r"'], 9611 ['"s"'], 9612 ['"t"'], 9613 ['"u"'], 9614 ['"v"'], 9615 ['"w"'], 9616 ['"x"'], 9617 ['"y"'], 9618 ['"z"'] 9619 ] 9620 }, 9621 { 9622 name: "RULE_DIGIT", 9623 bnf: [['"0"'], ['"1"'], ['"2"'], ['"3"'], ['"4"'], ['"5"'], ['"6"'], ['"7"'], ['"8"'], ['"9"']] 9624 }, 9625 { 9626 name: "RULE_SYMBOL", 9627 bnf: [ 9628 ['"-"'], 9629 ['"_"'], 9630 ['"!"'], 9631 ['"#"'], 9632 ['"$"'], 9633 ['"%"'], 9634 ['"&"'], 9635 ['"("'], 9636 ['")"'], 9637 ['"*"'], 9638 ['"+"'], 9639 ['","'], 9640 ['"-"'], 9641 ['"."'], 9642 ['"/"'], 9643 ['":"'], 9644 ['";"'], 9645 ['"<"'], 9646 ['"="'], 9647 ['">"'], 9648 ['"?"'], 9649 ['"@"'], 9650 ['"["'], 9651 ['"\\"'], 9652 ['"]"'], 9653 ['"^"'], 9654 ['"_"'], 9655 ['"`"'], 9656 ['"{"'], 9657 ['"|"'], 9658 ['"}"'], 9659 ['"~"'] 9660 ] 9661 }, 9662 { 9663 name: "RULE_CHARACTER1", 9664 bnf: [["RULE_CHARACTER"], [`"'"`]] 9665 }, 9666 { 9667 name: "RULE_CHARACTER2", 9668 bnf: [["RULE_CHARACTER"], [`'"'`]] 9669 }, 9670 { 9671 name: "rule-name", 9672 bnf: [["RULE_LETTER", "RULE_CHAR*"]] 9673 }, 9674 { 9675 name: "RULE_CHAR", 9676 bnf: [["RULE_LETTER"], ["RULE_DIGIT"], ['"_"'], ['"-"']] 9677 } 9678 ]; 9679 BNF2.defaultParser = new Parser_1.Parser(BNF2.RULES, { debug: false }); 9680 function getAllTerms(expr) { 9681 let terms = SemanticHelpers_1.findChildrenByType(expr, "term").map((term) => { 9682 return SemanticHelpers_1.findChildrenByType(term, "literal").concat(SemanticHelpers_1.findChildrenByType(term, "rule-name"))[0].text; 9683 }); 9684 SemanticHelpers_1.findChildrenByType(expr, "list").forEach((expr2) => { 9685 terms = terms.concat(getAllTerms(expr2)); 9686 }); 9687 return terms; 9688 } 9689 function getRules(source, parser = BNF2.defaultParser) { 9690 let ast = parser.getAST(source); 9691 if (!ast) 9692 throw new Error("Could not parse " + source); 9693 if (ast.errors && ast.errors.length) { 9694 throw ast.errors[0]; 9695 } 9696 let rules = SemanticHelpers_1.findChildrenByType(ast, "rule"); 9697 let ret = rules.map((rule) => { 9698 let name = SemanticHelpers_1.findChildrenByType(rule, "rule-name")[0].text; 9699 let expressions = SemanticHelpers_1.findChildrenByType(rule, "firstExpression").concat(SemanticHelpers_1.findChildrenByType(rule, "otherExpression")); 9700 let bnf = []; 9701 expressions.forEach((expr) => { 9702 bnf.push(getAllTerms(expr)); 9703 }); 9704 return { 9705 name, 9706 bnf 9707 }; 9708 }); 9709 if (!ret.some((x) => x.name == "EOL")) { 9710 ret.push({ 9711 name: "EOL", 9712 bnf: [['"\\r\\n"', '"\\r"', '"\\n"']] 9713 }); 9714 } 9715 return ret; 9716 } 9717 BNF2.getRules = getRules; 9718 function Transform(source, subParser = BNF2.defaultParser) { 9719 return getRules(source.join(""), subParser); 9720 } 9721 BNF2.Transform = Transform; 9722 class Parser extends Parser_1.Parser { 9723 constructor(source, options) { 9724 const subParser = options && options.debugRulesParser === true ? new Parser_1.Parser(BNF2.RULES, { debug: true }) : BNF2.defaultParser; 9725 super(getRules(source, subParser), options); 9726 this.source = source; 9727 } 9728 emitSource() { 9729 return this.source; 9730 } 9731 } 9732 BNF2.Parser = Parser; 9733 })(BNF || (BNF = {})); 9734 exports.default = BNF; 9735 } 9736 }); 9737 9738 // node_modules/ebnf/dist/Grammars/W3CEBNF.js 9739 var require_W3CEBNF = __commonJS({ 9740 "node_modules/ebnf/dist/Grammars/W3CEBNF.js"(exports) { 9741 "use strict"; 9742 Object.defineProperty(exports, "__esModule", { value: true }); 9743 var Parser_1 = require_Parser(); 9744 var BNF; 9745 (function(BNF2) { 9746 BNF2.RULES = [ 9747 { 9748 name: "Grammar", 9749 bnf: [["RULE_S*", "%Atomic*", "EOF"]] 9750 }, 9751 { 9752 name: "%Atomic", 9753 bnf: [["Production", "RULE_S*"]], 9754 fragment: true 9755 }, 9756 { 9757 name: "Production", 9758 bnf: [["NCName", "RULE_S*", '"::="', "RULE_WHITESPACE*", "Choice", "RULE_WHITESPACE*", "RULE_EOL+", "RULE_S*"]] 9759 }, 9760 { 9761 name: "NCName", 9762 bnf: [[/[a-zA-Z][a-zA-Z_0-9]*/]] 9763 }, 9764 { 9765 name: "Choice", 9766 bnf: [["SequenceOrDifference", "%_Choice_1*"]], 9767 fragment: true 9768 }, 9769 { 9770 name: "%_Choice_1", 9771 bnf: [["RULE_WHITESPACE*", '"|"', "RULE_WHITESPACE*", "SequenceOrDifference"]], 9772 fragment: true 9773 }, 9774 { 9775 name: "SequenceOrDifference", 9776 bnf: [["Item", "RULE_WHITESPACE*", "%_Item_1?"]] 9777 }, 9778 { 9779 name: "%_Item_1", 9780 bnf: [["Minus", "Item"], ["Item*"]], 9781 fragment: true 9782 }, 9783 { 9784 name: "Minus", 9785 bnf: [['"-"']] 9786 }, 9787 { 9788 name: "Item", 9789 bnf: [["RULE_WHITESPACE*", "%Primary", "PrimaryDecoration?"]], 9790 fragment: true 9791 }, 9792 { 9793 name: "PrimaryDecoration", 9794 bnf: [['"?"'], ['"*"'], ['"+"']] 9795 }, 9796 { 9797 name: "DecorationName", 9798 bnf: [['"ebnf://"', /[^\x5D#]+/]] 9799 }, 9800 { 9801 name: "%Primary", 9802 bnf: [["NCName"], ["StringLiteral"], ["CharCode"], ["CharClass"], ["SubItem"]], 9803 fragment: true 9804 }, 9805 { 9806 name: "SubItem", 9807 bnf: [['"("', "RULE_WHITESPACE*", "Choice", "RULE_WHITESPACE*", '")"']] 9808 }, 9809 { 9810 name: "StringLiteral", 9811 bnf: [[`'"'`, /[^"]*/, `'"'`], [`"'"`, /[^']*/, `"'"`]], 9812 pinned: 1 9813 }, 9814 { 9815 name: "CharCode", 9816 bnf: [['"#x"', /[0-9a-zA-Z]+/]] 9817 }, 9818 { 9819 name: "CharClass", 9820 bnf: [["'['", "'^'?", "%RULE_CharClass_1+", '"]"']] 9821 }, 9822 { 9823 name: "%RULE_CharClass_1", 9824 bnf: [["CharCodeRange"], ["CharRange"], ["CharCode"], ["RULE_Char"]], 9825 fragment: true 9826 }, 9827 { 9828 name: "RULE_Char", 9829 bnf: [[/\x09/], [/\x0A/], [/\x0D/], [/[\x20-\x5c]/], [/[\x5e-\uD7FF]/], [/[\uE000-\uFFFD]/]] 9830 }, 9831 { 9832 name: "CharRange", 9833 bnf: [["RULE_Char", '"-"', "RULE_Char"]] 9834 }, 9835 { 9836 name: "CharCodeRange", 9837 bnf: [["CharCode", '"-"', "CharCode"]] 9838 }, 9839 { 9840 name: "RULE_WHITESPACE", 9841 bnf: [["%RULE_WHITESPACE_CHAR*"], ["Comment", "RULE_WHITESPACE*"]] 9842 }, 9843 { 9844 name: "RULE_S", 9845 bnf: [["RULE_WHITESPACE", "RULE_S*"], ["RULE_EOL", "RULE_S*"]] 9846 }, 9847 { 9848 name: "%RULE_WHITESPACE_CHAR", 9849 bnf: [[/\x09/], [/\x20/]], 9850 fragment: true 9851 }, 9852 { 9853 name: "Comment", 9854 bnf: [['"/*"', "%RULE_Comment_Body*", '"*/"']] 9855 }, 9856 { 9857 name: "%RULE_Comment_Body", 9858 bnf: [['!"*/"', /[^*]/]], 9859 fragment: true 9860 }, 9861 { 9862 name: "RULE_EOL", 9863 bnf: [[/\x0D/, /\x0A/], [/\x0A/], [/\x0D/]] 9864 }, 9865 { 9866 name: "Link", 9867 bnf: [["'['", "Url", "']'"]] 9868 }, 9869 { 9870 name: "Url", 9871 bnf: [[/[^\x5D:/?#]/, '"://"', /[^\x5D#]+/, "%Url1?"]] 9872 }, 9873 { 9874 name: "%Url1", 9875 bnf: [['"#"', "NCName"]], 9876 fragment: true 9877 } 9878 ]; 9879 BNF2.defaultParser = new Parser_1.Parser(BNF2.RULES, { debug: false }); 9880 const preDecorationRE = /^(!|&)/; 9881 const decorationRE = /(\?|\+|\*)$/; 9882 const subExpressionRE = /^%/; 9883 function getBNFRule(name, parser) { 9884 if (typeof name == "string") { 9885 if (preDecorationRE.test(name)) 9886 return ""; 9887 let subexpression = subExpressionRE.test(name); 9888 if (subexpression) { 9889 let decoration = decorationRE.exec(name); 9890 let decorationText = decoration ? decoration[0] + " " : ""; 9891 let lonely = isLonelyRule(name, parser); 9892 if (lonely) 9893 return getBNFBody(name, parser) + decorationText; 9894 return "(" + getBNFBody(name, parser) + ")" + decorationText; 9895 } 9896 return name; 9897 } else { 9898 return name.source.replace(/\\(?:x|u)([a-zA-Z0-9]+)/g, "#x$1").replace(/\[\\(?:x|u)([a-zA-Z0-9]+)-\\(?:x|u)([a-zA-Z0-9]+)\]/g, "[#x$1-#x$2]"); 9899 } 9900 } 9901 function isLonelyRule(name, parser) { 9902 let rule = Parser_1.findRuleByName(name, parser); 9903 return rule && rule.bnf.length == 1 && rule.bnf[0].length == 1 && (rule.bnf[0][0] instanceof RegExp || rule.bnf[0][0][0] == '"' || rule.bnf[0][0][0] == "'"); 9904 } 9905 function getBNFChoice(rules, parser) { 9906 return rules.map((x) => getBNFRule(x, parser)).join(" "); 9907 } 9908 function getBNFBody(name, parser) { 9909 let rule = Parser_1.findRuleByName(name, parser); 9910 if (rule) 9911 return rule.bnf.map((x) => getBNFChoice(x, parser)).join(" | "); 9912 return "RULE_NOT_FOUND {" + name + "}"; 9913 } 9914 function emit(parser) { 9915 let acumulator = []; 9916 parser.grammarRules.forEach((l) => { 9917 if (!/^%/.test(l.name)) { 9918 let recover = l.recover ? " /* { recoverUntil=" + l.recover + " } */" : ""; 9919 acumulator.push(l.name + " ::= " + getBNFBody(l.name, parser) + recover); 9920 } 9921 }); 9922 return acumulator.join("\n"); 9923 } 9924 BNF2.emit = emit; 9925 let subitems = 0; 9926 function restar(total, resta) { 9927 console.log("reberia restar " + resta + " a " + total); 9928 throw new Error("Difference not supported yet"); 9929 } 9930 function convertRegex(txt) { 9931 return new RegExp(txt.replace(/#x([a-zA-Z0-9]{4})/g, "\\u$1").replace(/#x([a-zA-Z0-9]{3})/g, "\\u0$1").replace(/#x([a-zA-Z0-9]{2})/g, "\\x$1").replace(/#x([a-zA-Z0-9]{1})/g, "\\x0$1")); 9932 } 9933 function getSubItems(tmpRules, seq, parentName) { 9934 let anterior = null; 9935 let bnfSeq = []; 9936 seq.children.forEach((x, i) => { 9937 if (x.type == "Minus") { 9938 restar(anterior, x); 9939 } else { 9940 } 9941 let decoration = seq.children[i + 1]; 9942 decoration = decoration && decoration.type == "PrimaryDecoration" && decoration.text || ""; 9943 let preDecoration = ""; 9944 switch (x.type) { 9945 case "SubItem": 9946 let name = "%" + (parentName + subitems++); 9947 createRule(tmpRules, x, name); 9948 bnfSeq.push(preDecoration + name + decoration); 9949 break; 9950 case "NCName": 9951 case "StringLiteral": 9952 bnfSeq.push(preDecoration + x.text + decoration); 9953 break; 9954 case "CharCode": 9955 case "CharClass": 9956 if (decoration || preDecoration) { 9957 let newRule = { 9958 name: "%" + (parentName + subitems++), 9959 bnf: [[convertRegex(x.text)]] 9960 }; 9961 tmpRules.push(newRule); 9962 bnfSeq.push(preDecoration + newRule.name + decoration); 9963 } else { 9964 bnfSeq.push(convertRegex(x.text)); 9965 } 9966 break; 9967 case "PrimaryDecoration": 9968 break; 9969 default: 9970 throw new Error(" HOW SHOULD I PARSE THIS? " + x.type + " -> " + JSON.stringify(x.text)); 9971 } 9972 anterior = x; 9973 }); 9974 return bnfSeq; 9975 } 9976 function createRule(tmpRules, token, name) { 9977 let bnf = token.children.filter((x) => x.type == "SequenceOrDifference").map((s) => getSubItems(tmpRules, s, name)); 9978 let rule = { 9979 name, 9980 bnf 9981 }; 9982 let recover = null; 9983 bnf.forEach((x) => { 9984 recover = recover || x["recover"]; 9985 delete x["recover"]; 9986 }); 9987 if (name.indexOf("%") == 0) 9988 rule.fragment = true; 9989 if (recover) 9990 rule.recover = recover; 9991 tmpRules.push(rule); 9992 } 9993 function getRules(source, parser = BNF2.defaultParser) { 9994 let ast = parser.getAST(source); 9995 if (!ast) 9996 throw new Error("Could not parse " + source); 9997 if (ast.errors && ast.errors.length) { 9998 throw ast.errors[0]; 9999 } 10000 let tmpRules = []; 10001 ast.children.filter((x) => x.type == "Production").map((x) => { 10002 let name = x.children.filter((x2) => x2.type == "NCName")[0].text; 10003 createRule(tmpRules, x, name); 10004 }); 10005 return tmpRules; 10006 } 10007 BNF2.getRules = getRules; 10008 function Transform(source, subParser = BNF2.defaultParser) { 10009 return getRules(source.join(""), subParser); 10010 } 10011 BNF2.Transform = Transform; 10012 class Parser extends Parser_1.Parser { 10013 constructor(source, options) { 10014 const subParser = options && options.debugRulesParser === true ? new Parser_1.Parser(BNF2.RULES, { debug: true }) : BNF2.defaultParser; 10015 super(getRules(source, subParser), options); 10016 } 10017 emitSource() { 10018 return emit(this); 10019 } 10020 } 10021 BNF2.Parser = Parser; 10022 })(BNF || (BNF = {})); 10023 exports.default = BNF; 10024 } 10025 }); 10026 10027 // node_modules/ebnf/dist/Grammars/Custom.js 10028 var require_Custom = __commonJS({ 10029 "node_modules/ebnf/dist/Grammars/Custom.js"(exports) { 10030 "use strict"; 10031 Object.defineProperty(exports, "__esModule", { value: true }); 10032 var TokenError_1 = require_TokenError(); 10033 var Parser_1 = require_Parser(); 10034 var BNF; 10035 (function(BNF2) { 10036 BNF2.RULES = [ 10037 { 10038 name: "Grammar", 10039 bnf: [["RULE_S*", "Attributes?", "RULE_S*", "%Atomic*", "EOF"]] 10040 }, 10041 { 10042 name: "%Atomic", 10043 bnf: [["Production", "RULE_S*"]], 10044 fragment: true 10045 }, 10046 { 10047 name: "Production", 10048 bnf: [ 10049 [ 10050 "NCName", 10051 "RULE_S*", 10052 '"::="', 10053 "RULE_WHITESPACE*", 10054 "%Choice", 10055 "RULE_WHITESPACE*", 10056 "Attributes?", 10057 "RULE_EOL+", 10058 "RULE_S*" 10059 ] 10060 ] 10061 }, 10062 { 10063 name: "NCName", 10064 bnf: [[/[a-zA-Z][a-zA-Z_0-9]*/]] 10065 }, 10066 { 10067 name: "Attributes", 10068 bnf: [['"{"', "Attribute", "%Attributes*", "RULE_S*", '"}"']] 10069 }, 10070 { 10071 name: "%Attributes", 10072 bnf: [["RULE_S*", '","', "Attribute"]], 10073 fragment: true 10074 }, 10075 { 10076 name: "Attribute", 10077 bnf: [["RULE_S*", "NCName", "RULE_WHITESPACE*", '"="', "RULE_WHITESPACE*", "AttributeValue"]] 10078 }, 10079 { 10080 name: "AttributeValue", 10081 bnf: [["NCName"], [/[1-9][0-9]*/]] 10082 }, 10083 { 10084 name: "%Choice", 10085 bnf: [["SequenceOrDifference", "%_Choice_1*"]], 10086 fragment: true 10087 }, 10088 { 10089 name: "%_Choice_1", 10090 bnf: [["RULE_S*", '"|"', "RULE_S*", "SequenceOrDifference"]], 10091 fragment: true 10092 }, 10093 { 10094 name: "SequenceOrDifference", 10095 bnf: [["%Item", "RULE_WHITESPACE*", "%_Item_1?"]] 10096 }, 10097 { 10098 name: "%_Item_1", 10099 bnf: [["Minus", "%Item"], ["%Item*"]], 10100 fragment: true 10101 }, 10102 { 10103 name: "Minus", 10104 bnf: [['"-"']] 10105 }, 10106 { 10107 name: "%Item", 10108 bnf: [["RULE_WHITESPACE*", "PrimaryPreDecoration?", "%Primary", "PrimaryDecoration?"]], 10109 fragment: true 10110 }, 10111 { 10112 name: "PrimaryDecoration", 10113 bnf: [['"?"'], ['"*"'], ['"+"']] 10114 }, 10115 { 10116 name: "PrimaryPreDecoration", 10117 bnf: [['"&"'], ['"!"'], ['"~"']] 10118 }, 10119 { 10120 name: "%Primary", 10121 bnf: [["NCName"], ["StringLiteral"], ["CharCode"], ["CharClass"], ["SubItem"]], 10122 fragment: true 10123 }, 10124 { 10125 name: "SubItem", 10126 bnf: [['"("', "RULE_S*", "%Choice", "RULE_S*", '")"']] 10127 }, 10128 { 10129 name: "StringLiteral", 10130 bnf: [[`'"'`, /[^"]*/, `'"'`], [`"'"`, /[^']*/, `"'"`]] 10131 }, 10132 { 10133 name: "CharCode", 10134 bnf: [['"#x"', /[0-9a-zA-Z]+/]] 10135 }, 10136 { 10137 name: "CharClass", 10138 bnf: [["'['", "'^'?", "%RULE_CharClass_1+", '"]"']] 10139 }, 10140 { 10141 name: "%RULE_CharClass_1", 10142 bnf: [["CharCodeRange"], ["CharRange"], ["CharCode"], ["RULE_Char"]], 10143 fragment: true 10144 }, 10145 { 10146 name: "RULE_Char", 10147 bnf: [[/\x09/], [/\x0A/], [/\x0D/], [/[\x20-\x5c]/], [/[\x5e-\uD7FF]/], [/[\uE000-\uFFFD]/]] 10148 }, 10149 { 10150 name: "CharRange", 10151 bnf: [["RULE_Char", '"-"', "RULE_Char"]] 10152 }, 10153 { 10154 name: "CharCodeRange", 10155 bnf: [["CharCode", '"-"', "CharCode"]] 10156 }, 10157 { 10158 name: "RULE_WHITESPACE", 10159 bnf: [["%RULE_WHITESPACE_CHAR*"], ["Comment", "RULE_WHITESPACE*"]] 10160 }, 10161 { 10162 name: "RULE_S", 10163 bnf: [["RULE_WHITESPACE", "RULE_S*"], ["RULE_EOL", "RULE_S*"]] 10164 }, 10165 { 10166 name: "%RULE_WHITESPACE_CHAR", 10167 bnf: [[/\x09/], [/\x20/]], 10168 fragment: true 10169 }, 10170 { 10171 name: "Comment", 10172 bnf: [['"/*"', "%RULE_Comment_Body*", '"*/"']] 10173 }, 10174 { 10175 name: "%RULE_Comment_Body", 10176 bnf: [[/[^*]/], ['"*"+', /[^/]*/]], 10177 fragment: true 10178 }, 10179 { 10180 name: "RULE_EOL", 10181 bnf: [[/\x0D/, /\x0A/], [/\x0A/], [/\x0D/]] 10182 }, 10183 { 10184 name: "Link", 10185 bnf: [["'['", "Url", "']'"]] 10186 }, 10187 { 10188 name: "Url", 10189 bnf: [[/[^\x5D:/?#]/, '"://"', /[^\x5D#]+/, "%Url1?"]] 10190 }, 10191 { 10192 name: "%Url1", 10193 bnf: [['"#"', "NCName"]], 10194 fragment: true 10195 } 10196 ]; 10197 BNF2.defaultParser = new Parser_1.Parser(BNF2.RULES, { debug: false }); 10198 const preDecorationRE = /^(!|&)/; 10199 const decorationRE = /(\?|\+|\*)$/; 10200 const subExpressionRE = /^%/; 10201 function getBNFRule(name, parser) { 10202 if (typeof name == "string") { 10203 let decoration = decorationRE.exec(name); 10204 let preDecoration = preDecorationRE.exec(name); 10205 let preDecorationText = preDecoration ? preDecoration[0] : ""; 10206 let decorationText = decoration ? decoration[0] + " " : ""; 10207 let subexpression = subExpressionRE.test(name); 10208 if (subexpression) { 10209 let lonely = isLonelyRule(name, parser); 10210 if (lonely) 10211 return preDecorationText + getBNFBody(name, parser) + decorationText; 10212 return preDecorationText + "(" + getBNFBody(name, parser) + ")" + decorationText; 10213 } 10214 return name.replace(preDecorationRE, preDecorationText); 10215 } else { 10216 return name.source.replace(/\\(?:x|u)([a-zA-Z0-9]+)/g, "#x$1").replace(/\[\\(?:x|u)([a-zA-Z0-9]+)-\\(?:x|u)([a-zA-Z0-9]+)\]/g, "[#x$1-#x$2]"); 10217 } 10218 } 10219 function isLonelyRule(name, parser) { 10220 let rule = Parser_1.findRuleByName(name, parser); 10221 return rule && rule.bnf.length == 1 && rule.bnf[0].length == 1 && (rule.bnf[0][0] instanceof RegExp || rule.bnf[0][0][0] == '"' || rule.bnf[0][0][0] == "'"); 10222 } 10223 function getBNFChoice(rules, parser) { 10224 return rules.map((x) => getBNFRule(x, parser)).join(" "); 10225 } 10226 function getBNFBody(name, parser) { 10227 let rule = Parser_1.findRuleByName(name, parser); 10228 if (rule) 10229 return rule.bnf.map((x) => getBNFChoice(x, parser)).join(" | "); 10230 return "RULE_NOT_FOUND {" + name + "}"; 10231 } 10232 function emit(parser) { 10233 let acumulator = []; 10234 parser.grammarRules.forEach((l) => { 10235 if (!/^%/.test(l.name)) { 10236 let recover = l.recover ? " { recoverUntil=" + l.recover + " }" : ""; 10237 acumulator.push(l.name + " ::= " + getBNFBody(l.name, parser) + recover); 10238 } 10239 }); 10240 return acumulator.join("\n"); 10241 } 10242 BNF2.emit = emit; 10243 let subitems = 0; 10244 function restar(total, resta) { 10245 console.log("reberia restar " + resta + " a " + total); 10246 throw new Error("Difference not supported yet"); 10247 } 10248 function convertRegex(txt) { 10249 return new RegExp(txt.replace(/#x([a-zA-Z0-9]{4})/g, "\\u$1").replace(/#x([a-zA-Z0-9]{3})/g, "\\u0$1").replace(/#x([a-zA-Z0-9]{2})/g, "\\x$1").replace(/#x([a-zA-Z0-9]{1})/g, "\\x0$1")); 10250 } 10251 function getSubItems(tmpRules, seq, parentName, parentAttributes) { 10252 let anterior = null; 10253 let bnfSeq = []; 10254 seq.children.forEach((x, i) => { 10255 if (x.type == "Minus") { 10256 restar(anterior, x); 10257 } else { 10258 } 10259 let decoration = seq.children[i + 1]; 10260 decoration = decoration && decoration.type == "PrimaryDecoration" && decoration.text || ""; 10261 let preDecoration = ""; 10262 if (anterior && anterior.type == "PrimaryPreDecoration") { 10263 preDecoration = anterior.text; 10264 } 10265 let pinned = preDecoration == "~" ? 1 : void 0; 10266 if (pinned) { 10267 preDecoration = ""; 10268 } 10269 switch (x.type) { 10270 case "SubItem": 10271 let name = "%" + (parentName + subitems++); 10272 createRule(tmpRules, x, name, parentAttributes); 10273 bnfSeq.push(preDecoration + name + decoration); 10274 break; 10275 case "NCName": 10276 bnfSeq.push(preDecoration + x.text + decoration); 10277 break; 10278 case "StringLiteral": 10279 if (decoration || preDecoration || !/^['"/()a-zA-Z0-9&_.:=,+*\-\^\\]+$/.test(x.text)) { 10280 bnfSeq.push(preDecoration + x.text + decoration); 10281 } else { 10282 for (const c of x.text.slice(1, -1)) { 10283 if (parentAttributes && parentAttributes["ignoreCase"] == "true" && /[a-zA-Z]/.test(c)) { 10284 bnfSeq.push(new RegExp("[" + c.toUpperCase() + c.toLowerCase() + "]")); 10285 } else { 10286 bnfSeq.push(new RegExp(Parser_1.escapeRegExp(c))); 10287 } 10288 } 10289 } 10290 break; 10291 case "CharCode": 10292 case "CharClass": 10293 if (decoration || preDecoration) { 10294 let newRule = { 10295 name: "%" + (parentName + subitems++), 10296 bnf: [[convertRegex(x.text)]], 10297 pinned 10298 }; 10299 tmpRules.push(newRule); 10300 bnfSeq.push(preDecoration + newRule.name + decoration); 10301 } else { 10302 bnfSeq.push(convertRegex(x.text)); 10303 } 10304 break; 10305 case "PrimaryPreDecoration": 10306 case "PrimaryDecoration": 10307 break; 10308 default: 10309 throw new Error(" HOW SHOULD I PARSE THIS? " + x.type + " -> " + JSON.stringify(x.text)); 10310 } 10311 anterior = x; 10312 }); 10313 return bnfSeq; 10314 } 10315 function createRule(tmpRules, token, name, parentAttributes = void 0) { 10316 let attrNode = token.children.filter((x) => x.type == "Attributes")[0]; 10317 let attributes = {}; 10318 if (attrNode) { 10319 attrNode.children.forEach((x) => { 10320 let name2 = x.children.filter((x2) => x2.type == "NCName")[0].text; 10321 if (name2 in attributes) { 10322 throw new TokenError_1.TokenError("Duplicated attribute " + name2, x); 10323 } else { 10324 attributes[name2] = x.children.filter((x2) => x2.type == "AttributeValue")[0].text; 10325 } 10326 }); 10327 } 10328 let bnf = token.children.filter((x) => x.type == "SequenceOrDifference").map((s) => getSubItems(tmpRules, s, name, parentAttributes ? parentAttributes : attributes)); 10329 let rule = { 10330 name, 10331 bnf 10332 }; 10333 if (name.indexOf("%") == 0) 10334 rule.fragment = true; 10335 if (attributes["recoverUntil"]) { 10336 rule.recover = attributes["recoverUntil"]; 10337 if (rule.bnf.length > 1) 10338 throw new TokenError_1.TokenError("only one-option productions are suitable for error recovering", token); 10339 } 10340 if ("pin" in attributes) { 10341 let num = parseInt(attributes["pin"]); 10342 if (!isNaN(num)) { 10343 rule.pinned = num; 10344 } 10345 if (rule.bnf.length > 1) 10346 throw new TokenError_1.TokenError("only one-option productions are suitable for pinning", token); 10347 } 10348 if ("ws" in attributes) { 10349 rule.implicitWs = attributes["ws"] != "explicit"; 10350 } else { 10351 rule.implicitWs = null; 10352 } 10353 rule.fragment = rule.fragment || attributes["fragment"] == "true"; 10354 rule.simplifyWhenOneChildren = attributes["simplifyWhenOneChildren"] == "true"; 10355 tmpRules.push(rule); 10356 } 10357 function getRules(source, parser = BNF2.defaultParser) { 10358 let ast = parser.getAST(source); 10359 if (!ast) 10360 throw new Error("Could not parse " + source); 10361 if (ast.errors && ast.errors.length) { 10362 throw ast.errors[0]; 10363 } 10364 let implicitWs = null; 10365 let attrNode = ast.children.filter((x) => x.type == "Attributes")[0]; 10366 let attributes = {}; 10367 if (attrNode) { 10368 attrNode.children.forEach((x) => { 10369 let name = x.children.filter((x2) => x2.type == "NCName")[0].text; 10370 if (name in attributes) { 10371 throw new TokenError_1.TokenError("Duplicated attribute " + name, x); 10372 } else { 10373 attributes[name] = x.children.filter((x2) => x2.type == "AttributeValue")[0].text; 10374 } 10375 }); 10376 } 10377 implicitWs = attributes["ws"] == "implicit"; 10378 let tmpRules = []; 10379 ast.children.filter((x) => x.type == "Production").map((x) => { 10380 let name = x.children.filter((x2) => x2.type == "NCName")[0].text; 10381 createRule(tmpRules, x, name); 10382 }); 10383 tmpRules.forEach((rule) => { 10384 if (rule.implicitWs === null) 10385 rule.implicitWs = implicitWs; 10386 }); 10387 return tmpRules; 10388 } 10389 BNF2.getRules = getRules; 10390 function Transform(source, subParser = BNF2.defaultParser) { 10391 return getRules(source.join(""), subParser); 10392 } 10393 BNF2.Transform = Transform; 10394 class Parser extends Parser_1.Parser { 10395 constructor(source, options) { 10396 const subParser = options && options.debugRulesParser === true ? new Parser_1.Parser(BNF2.RULES, { debug: true }) : BNF2.defaultParser; 10397 super(getRules(source, subParser), options); 10398 } 10399 emitSource() { 10400 return emit(this); 10401 } 10402 } 10403 BNF2.Parser = Parser; 10404 })(BNF || (BNF = {})); 10405 exports.default = BNF; 10406 } 10407 }); 10408 10409 // node_modules/ebnf/dist/Grammars/index.js 10410 var require_Grammars = __commonJS({ 10411 "node_modules/ebnf/dist/Grammars/index.js"(exports) { 10412 "use strict"; 10413 Object.defineProperty(exports, "__esModule", { value: true }); 10414 var BNF_1 = require_BNF(); 10415 Object.defineProperty(exports, "BNF", { enumerable: true, get: function() { 10416 return BNF_1.default; 10417 } }); 10418 var W3CEBNF_1 = require_W3CEBNF(); 10419 Object.defineProperty(exports, "W3C", { enumerable: true, get: function() { 10420 return W3CEBNF_1.default; 10421 } }); 10422 var Custom_1 = require_Custom(); 10423 Object.defineProperty(exports, "Custom", { enumerable: true, get: function() { 10424 return Custom_1.default; 10425 } }); 10426 } 10427 }); 10428 10429 // node_modules/ebnf/dist/index.js 10430 var require_dist = __commonJS({ 10431 "node_modules/ebnf/dist/index.js"(exports) { 10432 "use strict"; 10433 Object.defineProperty(exports, "__esModule", { value: true }); 10434 var Parser_1 = require_Parser(); 10435 Object.defineProperty(exports, "Parser", { enumerable: true, get: function() { 10436 return Parser_1.Parser; 10437 } }); 10438 var TokenError_1 = require_TokenError(); 10439 Object.defineProperty(exports, "TokenError", { enumerable: true, get: function() { 10440 return TokenError_1.TokenError; 10441 } }); 10442 exports.Grammars = require_Grammars(); 10443 } 10444 }); 10445 10446 // node_modules/@tgrosinger/md-advanced-tables/lib/calc/calc.js 10447 var require_calc = __commonJS({ 10448 "node_modules/@tgrosinger/md-advanced-tables/lib/calc/calc.js"(exports) { 10449 "use strict"; 10450 Object.defineProperty(exports, "__esModule", { value: true }); 10451 exports.parseFormula = exports.parseAndApply = exports.Source = exports.Formula = void 0; 10452 var neverthrow_1 = require_neverthrow(); 10453 var algebraic_operation_1 = require_algebraic_operation(); 10454 var ast_utils_1 = require_ast_utils(); 10455 var conditional_function_1 = require_conditional_function(); 10456 var constant_1 = require_constant(); 10457 var destination_1 = require_destination(); 10458 var display_directive_1 = require_display_directive(); 10459 var range_1 = require_range2(); 10460 var reference_1 = require_reference(); 10461 var single_param_function_1 = require_single_param_function(); 10462 var ebnf_1 = require_dist(); 10463 var lodash_1 = require_lodash(); 10464 var parserGrammar = ` 10465 tblfm_line ::= "<!-- TBLFM: " formula_list " -->" 10466 formula_list ::= formula ( "::" formula_list )? 10467 formula ::= destination "=" source display_directive? 10468 10469 source ::= range | source_reference | single_param_function_call | conditional_function_call | algebraic_operation | float | real 10470 range ::= source_reference ".." source_reference 10471 source_reference ::= absolute_reference | relative_reference 10472 destination ::= range | absolute_reference 10473 10474 relative_reference ::= (relative_row | absolute_row) (relative_column | absolute_column) | relative_row | relative_column 10475 relative_row ::= "@" ( "-" | "+" ) int 10476 relative_column ::= "$" ( "-" | "+" ) int 10477 10478 absolute_reference ::= absolute_row absolute_column | absolute_row | absolute_column 10479 absolute_row ::= "@" ( "I" | "<" | ">" | int ) 10480 absolute_column ::= "$" ( "<" | ">" | int ) 10481 10482 single_param_function_call ::= single_param_function "(" source ")" 10483 single_param_function ::= "mean" | "sum" 10484 10485 conditional_function_call ::= "if(" predicate "," " "? source "," " "? source ")" 10486 predicate ::= source_without_range conditional_operator source_without_range 10487 source_without_range ::= source_reference | single_param_function_call | conditional_function_call | algebraic_operation | float | real 10488 conditional_operator ::= ">" | "<" | ">=" | "<=" | "==" | "!=" 10489 10490 algebraic_operation ::= "(" source " "? algebraic_operator " "? source ")" 10491 algebraic_operator ::= "+" | "-" | "*" | "/" 10492 10493 display_directive ::= ";" display_directive_option 10494 display_directive_option ::= formatting_directive | datetime_directive | hourminute_directive 10495 formatting_directive ::= "%." int "f" 10496 datetime_directive ::= "dt" 10497 hourminute_directive ::= "hm" 10498 10499 float ::= "-"? int "." int 10500 real ::= "-"? int 10501 int ::= [0-9]+ 10502 `; 10503 var Formula = class { 10504 constructor(ast, table) { 10505 this.merge = (table2) => this.destination.merge(this.source, table2); 10506 let formatter = new display_directive_1.DefaultFormatter(); 10507 if (ast.children.length === 3) { 10508 formatter = new display_directive_1.DisplayDirective(ast.children[2]); 10509 } 10510 const destination = (0, destination_1.newDestination)(ast.children[0], table, formatter); 10511 if (destination.isErr()) { 10512 throw destination.error; 10513 } 10514 this.destination = destination.value; 10515 this.source = new Source(ast.children[1], table); 10516 } 10517 }; 10518 exports.Formula = Formula; 10519 var Source = class { 10520 constructor(ast, table) { 10521 this.getValue = (table2, currentCell) => this.locationDescriptor.getValue(table2, currentCell); 10522 if (ast.type !== "source" && ast.type !== "source_without_range") { 10523 throw Error("Invalid AST token type of " + ast.type); 10524 } 10525 if (ast.children.length !== 1) { 10526 throw Error("Unexpected children length in Source"); 10527 } 10528 const paramChild = ast.children[0]; 10529 const vp = newValueProvider(paramChild, table); 10530 if (vp.isErr()) { 10531 throw vp.error; 10532 } 10533 this.locationDescriptor = vp.value; 10534 } 10535 }; 10536 exports.Source = Source; 10537 var newValueProvider = (ast, table) => { 10538 try { 10539 switch (ast.type) { 10540 case "range": 10541 return (0, neverthrow_1.ok)(new range_1.Range(ast, table)); 10542 case "source_reference": 10543 const lengthError = (0, ast_utils_1.checkChildLength)(ast, 1); 10544 if (lengthError) { 10545 return (0, neverthrow_1.err)(lengthError); 10546 } 10547 return (0, neverthrow_1.ok)(new reference_1.Reference(ast.children[0], table)); 10548 case "single_param_function_call": 10549 return (0, neverthrow_1.ok)(new single_param_function_1.SingleParamFunctionCall(ast, table)); 10550 case "conditional_function_call": 10551 return (0, neverthrow_1.ok)(new conditional_function_1.ConditionalFunctionCall(ast, table)); 10552 case "algebraic_operation": 10553 return (0, neverthrow_1.ok)(new algebraic_operation_1.AlgebraicOperation(ast, table)); 10554 case "real": 10555 return (0, neverthrow_1.ok)(new constant_1.Constant(ast, table)); 10556 case "float": 10557 return (0, neverthrow_1.ok)(new constant_1.Constant(ast, table)); 10558 default: 10559 throw Error("Unrecognized valueProvider type " + ast.type); 10560 } 10561 } catch (error) { 10562 return (0, neverthrow_1.err)(error); 10563 } 10564 }; 10565 var parseAndApply = (formulaLines, table) => { 10566 const formulas = formulaLines.reduce((prev, formulaLine) => prev.andThen((currentFormulas) => { 10567 const newFormulas = (0, exports.parseFormula)(formulaLine, table); 10568 if (newFormulas.isErr()) { 10569 return newFormulas; 10570 } 10571 return (0, neverthrow_1.ok)((0, lodash_1.concat)(newFormulas.value, currentFormulas)); 10572 }), (0, neverthrow_1.ok)([])); 10573 return formulas.andThen((innerFormulas) => ( 10574 // for each formula 10575 innerFormulas.reduceRight( 10576 (prevValue, formula) => ( 10577 // If the previous formula didn't give an error 10578 prevValue.andThen((prevTable) => ( 10579 // attempt to apply this formula to the table and return the result 10580 formula.merge(prevTable) 10581 )) 10582 ), 10583 // Start with the current table state 10584 (0, neverthrow_1.ok)(table) 10585 ) 10586 )); 10587 }; 10588 exports.parseAndApply = parseAndApply; 10589 var parseFormula = (line, table) => { 10590 const parser = new ebnf_1.Grammars.W3C.Parser(parserGrammar); 10591 const ast = parser.getAST(line); 10592 if (!ast) { 10593 return (0, neverthrow_1.err)(new Error(`Formula '${line}' could not be parsed`)); 10594 } 10595 const typeError = (0, ast_utils_1.checkType)(ast, "tblfm_line"); 10596 if (typeError) { 10597 return (0, neverthrow_1.err)(typeError); 10598 } 10599 const lengthError = (0, ast_utils_1.checkChildLength)(ast, 1); 10600 if (lengthError) { 10601 return (0, neverthrow_1.err)(lengthError); 10602 } 10603 let unparsedFormulas = ast.children[0].children; 10604 const formulas = []; 10605 try { 10606 do { 10607 formulas.push(new Formula(unparsedFormulas[0], table)); 10608 if (unparsedFormulas.length > 1 && unparsedFormulas[1].type === "formula_list") { 10609 unparsedFormulas = unparsedFormulas[1].children; 10610 } else { 10611 unparsedFormulas = []; 10612 } 10613 } while (unparsedFormulas.length > 0); 10614 return (0, neverthrow_1.ok)(formulas); 10615 } catch (error) { 10616 return (0, neverthrow_1.err)(error); 10617 } 10618 }; 10619 exports.parseFormula = parseFormula; 10620 } 10621 }); 10622 10623 // node_modules/@tgrosinger/md-advanced-tables/lib/table.js 10624 var require_table = __commonJS({ 10625 "node_modules/@tgrosinger/md-advanced-tables/lib/table.js"(exports) { 10626 "use strict"; 10627 Object.defineProperty(exports, "__esModule", { value: true }); 10628 exports.Table = void 0; 10629 var calc_1 = require_calc(); 10630 var focus_1 = require_focus(); 10631 var point_1 = require_point(); 10632 var range_1 = require_range(); 10633 var Table = class _Table { 10634 /** 10635 * Creates a new `Table` object. 10636 * 10637 * @param rows - An array of rows that the table contains. 10638 * @param formulas - An array of formulas attached to the table. 10639 */ 10640 constructor(rows) { 10641 this._rows = rows.slice(); 10642 } 10643 /** 10644 * Gets the number of rows in the table. 10645 * 10646 * @returns The number of rows. 10647 */ 10648 getHeight() { 10649 return this._rows.length; 10650 } 10651 /** 10652 * Gets the maximum width of the rows in the table. 10653 * 10654 * @returns The maximum width of the rows. 10655 */ 10656 getWidth() { 10657 return this._rows.map((row) => row.getWidth()).reduce((x, y) => Math.max(x, y), 0); 10658 } 10659 /** 10660 * Gets the width of the header row. 10661 * Assumes that it is called on a valid table with a header row. 10662 * 10663 * @returns The width of the header row 10664 */ 10665 getHeaderWidth() { 10666 return this._rows[0].getWidth(); 10667 } 10668 /** 10669 * Gets the rows that the table contains. 10670 * 10671 * @returns An array of the rows. 10672 */ 10673 getRows() { 10674 return this._rows.slice(); 10675 } 10676 /** 10677 * Gets the delimiter row of the table. 10678 * 10679 * @returns The delimiter row; `undefined` if there is not delimiter row. 10680 */ 10681 getDelimiterRow() { 10682 const row = this._rows[1]; 10683 if (row === void 0) { 10684 return void 0; 10685 } 10686 if (row.isDelimiter()) { 10687 return row; 10688 } 10689 return void 0; 10690 } 10691 /** 10692 * Gets a cell at the specified index. 10693 * 10694 * @param rowIndex - Row index of the cell. 10695 * @param columnIndex - Column index of the cell. 10696 * @returns The cell at the specified index; `undefined` if not found. 10697 */ 10698 getCellAt(rowIndex, columnIndex) { 10699 const row = this._rows[rowIndex]; 10700 if (row === void 0) { 10701 return void 0; 10702 } 10703 return row.getCellAt(columnIndex); 10704 } 10705 /** 10706 * Gets the cell at the focus. 10707 * 10708 * @param focus - Focus object. 10709 * @returns The cell at the focus; `undefined` if not found. 10710 */ 10711 getFocusedCell(focus) { 10712 return this.getCellAt(focus.row, focus.column); 10713 } 10714 /** 10715 * Converts the table to an array of text representations of the rows. 10716 * 10717 * @returns An array of text representations of the rows. 10718 */ 10719 toLines() { 10720 return this._rows.map((row) => row.toText()); 10721 } 10722 /** 10723 * Sets a cell in the table to a new value, returning a copy of the table 10724 * with the modified value. 10725 * 10726 * If an invalid index is provided, the table will be unchanged. 10727 */ 10728 setCellAt(rowIndex, columnIndex, value) { 10729 const rows = this.getRows(); 10730 rows[rowIndex] = rows[rowIndex].setCellAt(columnIndex, value); 10731 return new _Table(rows); 10732 } 10733 /** 10734 * Computes a focus from a point in the text editor. 10735 * 10736 * @param pos - A point in the text editor. 10737 * @param rowOffset - The row index where the table starts in the text editor. 10738 * @returns A focus object that corresponds to the specified point; 10739 * `undefined` if the row index is out of bounds. 10740 */ 10741 focusOfPosition(pos, rowOffset) { 10742 const rowIndex = pos.row - rowOffset; 10743 const row = this._rows[rowIndex]; 10744 if (row === void 0) { 10745 return void 0; 10746 } 10747 if (pos.column < row.marginLeft.length + 1) { 10748 return new focus_1.Focus(rowIndex, -1, pos.column); 10749 } 10750 const cellWidths = row.getCells().map((cell) => cell.rawContent.length); 10751 let columnPos = row.marginLeft.length + 1; 10752 let columnIndex = 0; 10753 for (; columnIndex < cellWidths.length; columnIndex++) { 10754 if (columnPos + cellWidths[columnIndex] + 1 > pos.column) { 10755 break; 10756 } 10757 columnPos += cellWidths[columnIndex] + 1; 10758 } 10759 const offset = pos.column - columnPos; 10760 return new focus_1.Focus(rowIndex, columnIndex, offset); 10761 } 10762 /** 10763 * Computes a position in the text editor from a focus. 10764 * 10765 * @param focus - A focus object. 10766 * @param rowOffset - The row index where the table starts in the text editor. 10767 * @returns A position in the text editor that corresponds to the focus; 10768 * `undefined` if the focused row is out of the table. 10769 */ 10770 positionOfFocus(focus, rowOffset) { 10771 const row = this._rows[focus.row]; 10772 if (row === void 0) { 10773 return void 0; 10774 } 10775 const rowPos = focus.row + rowOffset; 10776 if (focus.column < 0) { 10777 return new point_1.Point(rowPos, focus.offset); 10778 } 10779 const cellWidths = row.getCells().map((cell) => cell.rawContent.length); 10780 const maxIndex = Math.min(focus.column, cellWidths.length); 10781 let columnPos = row.marginLeft.length + 1; 10782 for (let columnIndex = 0; columnIndex < maxIndex; columnIndex++) { 10783 columnPos += cellWidths[columnIndex] + 1; 10784 } 10785 return new point_1.Point(rowPos, columnPos + focus.offset); 10786 } 10787 /** 10788 * Computes a selection range from a focus. 10789 * 10790 * @param focus - A focus object. 10791 * @param rowOffset - The row index where the table starts in the text editor. 10792 * @returns A range to be selected that corresponds to the focus; 10793 * `undefined` if the focus does not specify any cell or the specified cell is empty. 10794 */ 10795 selectionRangeOfFocus(focus, rowOffset) { 10796 const row = this._rows[focus.row]; 10797 if (row === void 0) { 10798 return void 0; 10799 } 10800 const cell = row.getCellAt(focus.column); 10801 if (cell === void 0) { 10802 return void 0; 10803 } 10804 if (cell.content === "") { 10805 return void 0; 10806 } 10807 const rowPos = focus.row + rowOffset; 10808 const cellWidths = row.getCells().map((cell2) => cell2.rawContent.length); 10809 let columnPos = row.marginLeft.length + 1; 10810 for (let columnIndex = 0; columnIndex < focus.column; columnIndex++) { 10811 columnPos += cellWidths[columnIndex] + 1; 10812 } 10813 columnPos += cell.paddingLeft; 10814 return new range_1.Range(new point_1.Point(rowPos, columnPos), new point_1.Point(rowPos, columnPos + cell.content.length)); 10815 } 10816 /** 10817 * Evaluate the formula, applying the results to this table and returning the 10818 * changes as a new table. 10819 */ 10820 applyFormulas(formulaLines) { 10821 return (0, calc_1.parseAndApply)(formulaLines, this); 10822 } 10823 }; 10824 exports.Table = Table; 10825 } 10826 }); 10827 10828 // node_modules/@tgrosinger/md-advanced-tables/lib/parser.js 10829 var require_parser = __commonJS({ 10830 "node_modules/@tgrosinger/md-advanced-tables/lib/parser.js"(exports) { 10831 "use strict"; 10832 Object.defineProperty(exports, "__esModule", { value: true }); 10833 exports.readTable = exports._marginRegex = exports.marginRegexSrc = exports._readRow = exports._splitCells = void 0; 10834 var table_1 = require_table(); 10835 var table_cell_1 = require_table_cell(); 10836 var table_row_1 = require_table_row(); 10837 var _splitCells = (text) => { 10838 const cells = []; 10839 let buf = ""; 10840 let rest = text; 10841 while (rest !== "") { 10842 switch (rest[0]) { 10843 case "`": 10844 { 10845 const startMatch = rest.match(/^`*/); 10846 if (startMatch === null) { 10847 break; 10848 } 10849 const start = startMatch[0]; 10850 let buf1 = start; 10851 let rest1 = rest.substr(start.length); 10852 let closed = false; 10853 while (rest1 !== "") { 10854 if (rest1[0] === "`") { 10855 const endMatch = rest1.match(/^`*/); 10856 if (endMatch === null) { 10857 break; 10858 } 10859 const end = endMatch[0]; 10860 buf1 += end; 10861 rest1 = rest1.substr(end.length); 10862 if (end.length === start.length) { 10863 closed = true; 10864 break; 10865 } 10866 } else { 10867 buf1 += rest1[0]; 10868 rest1 = rest1.substr(1); 10869 } 10870 } 10871 if (closed) { 10872 buf += buf1; 10873 rest = rest1; 10874 } else { 10875 buf += "`"; 10876 rest = rest.substr(1); 10877 } 10878 } 10879 break; 10880 case "\\": 10881 if (rest.length >= 2) { 10882 buf += rest.substr(0, 2); 10883 rest = rest.substr(2); 10884 } else { 10885 buf += "\\"; 10886 rest = rest.substr(1); 10887 } 10888 break; 10889 case "[": 10890 buf += "["; 10891 rest = rest.substr(1); 10892 if (/\[[^\\|\]]+\|[^|\]]+]]/.test(rest)) { 10893 const idx = rest.indexOf("|"); 10894 buf += rest.slice(0, idx); 10895 buf += "\\|"; 10896 rest = rest.substr(idx + 1); 10897 } 10898 break; 10899 case "|": 10900 cells.push(buf); 10901 buf = ""; 10902 rest = rest.substr(1); 10903 break; 10904 default: 10905 buf += rest[0]; 10906 rest = rest.substr(1); 10907 } 10908 } 10909 cells.push(buf); 10910 return cells; 10911 }; 10912 exports._splitCells = _splitCells; 10913 var _readRow = (text, leftMarginRegex = /^\s*$/) => { 10914 let cells = (0, exports._splitCells)(text); 10915 let marginLeft; 10916 if (cells.length > 0 && leftMarginRegex.test(cells[0])) { 10917 marginLeft = cells[0]; 10918 cells = cells.slice(1); 10919 } else { 10920 marginLeft = ""; 10921 } 10922 let marginRight; 10923 if (cells.length > 1 && /^\s*$/.test(cells[cells.length - 1])) { 10924 marginRight = cells[cells.length - 1]; 10925 cells = cells.slice(0, cells.length - 1); 10926 } else { 10927 marginRight = ""; 10928 } 10929 return new table_row_1.TableRow(cells.map((cell) => new table_cell_1.TableCell(cell)), marginLeft, marginRight); 10930 }; 10931 exports._readRow = _readRow; 10932 var marginRegexSrc = (chars) => { 10933 let cs = ""; 10934 chars.forEach((c) => { 10935 if (c !== "|" && c !== "\\" && c !== "`") { 10936 cs += `\\u{${c.codePointAt(0).toString(16)}}`; 10937 } 10938 }); 10939 return `[\\s${cs}]*`; 10940 }; 10941 exports.marginRegexSrc = marginRegexSrc; 10942 var _marginRegex = (chars) => new RegExp(`^${(0, exports.marginRegexSrc)(chars)}$`, "u"); 10943 exports._marginRegex = _marginRegex; 10944 var readTable = (lines, options) => { 10945 const leftMarginRegex = (0, exports._marginRegex)(options.leftMarginChars); 10946 return new table_1.Table(lines.map((line) => (0, exports._readRow)(line, leftMarginRegex))); 10947 }; 10948 exports.readTable = readTable; 10949 } 10950 }); 10951 10952 // node_modules/meaw/lib/index.js 10953 var require_lib = __commonJS({ 10954 "node_modules/meaw/lib/index.js"(exports) { 10955 "use strict"; 10956 Object.defineProperty(exports, "__esModule", { value: true }); 10957 var defs = [ 10958 [0, 31, "N"], 10959 [32, 126, "Na"], 10960 [127, 160, "N"], 10961 [161, 161, "A"], 10962 [162, 163, "Na"], 10963 [164, 164, "A"], 10964 [165, 166, "Na"], 10965 [167, 168, "A"], 10966 [169, 169, "N"], 10967 [170, 170, "A"], 10968 [171, 171, "N"], 10969 [172, 172, "Na"], 10970 [173, 174, "A"], 10971 [175, 175, "Na"], 10972 [176, 180, "A"], 10973 [181, 181, "N"], 10974 [182, 186, "A"], 10975 [187, 187, "N"], 10976 [188, 191, "A"], 10977 [192, 197, "N"], 10978 [198, 198, "A"], 10979 [199, 207, "N"], 10980 [208, 208, "A"], 10981 [209, 214, "N"], 10982 [215, 216, "A"], 10983 [217, 221, "N"], 10984 [222, 225, "A"], 10985 [226, 229, "N"], 10986 [230, 230, "A"], 10987 [231, 231, "N"], 10988 [232, 234, "A"], 10989 [235, 235, "N"], 10990 [236, 237, "A"], 10991 [238, 239, "N"], 10992 [240, 240, "A"], 10993 [241, 241, "N"], 10994 [242, 243, "A"], 10995 [244, 246, "N"], 10996 [247, 250, "A"], 10997 [251, 251, "N"], 10998 [252, 252, "A"], 10999 [253, 253, "N"], 11000 [254, 254, "A"], 11001 [255, 256, "N"], 11002 [257, 257, "A"], 11003 [258, 272, "N"], 11004 [273, 273, "A"], 11005 [274, 274, "N"], 11006 [275, 275, "A"], 11007 [276, 282, "N"], 11008 [283, 283, "A"], 11009 [284, 293, "N"], 11010 [294, 295, "A"], 11011 [296, 298, "N"], 11012 [299, 299, "A"], 11013 [300, 304, "N"], 11014 [305, 307, "A"], 11015 [308, 311, "N"], 11016 [312, 312, "A"], 11017 [313, 318, "N"], 11018 [319, 322, "A"], 11019 [323, 323, "N"], 11020 [324, 324, "A"], 11021 [325, 327, "N"], 11022 [328, 331, "A"], 11023 [332, 332, "N"], 11024 [333, 333, "A"], 11025 [334, 337, "N"], 11026 [338, 339, "A"], 11027 [340, 357, "N"], 11028 [358, 359, "A"], 11029 [360, 362, "N"], 11030 [363, 363, "A"], 11031 [364, 461, "N"], 11032 [462, 462, "A"], 11033 [463, 463, "N"], 11034 [464, 464, "A"], 11035 [465, 465, "N"], 11036 [466, 466, "A"], 11037 [467, 467, "N"], 11038 [468, 468, "A"], 11039 [469, 469, "N"], 11040 [470, 470, "A"], 11041 [471, 471, "N"], 11042 [472, 472, "A"], 11043 [473, 473, "N"], 11044 [474, 474, "A"], 11045 [475, 475, "N"], 11046 [476, 476, "A"], 11047 [477, 592, "N"], 11048 [593, 593, "A"], 11049 [594, 608, "N"], 11050 [609, 609, "A"], 11051 [610, 707, "N"], 11052 [708, 708, "A"], 11053 [709, 710, "N"], 11054 [711, 711, "A"], 11055 [712, 712, "N"], 11056 [713, 715, "A"], 11057 [716, 716, "N"], 11058 [717, 717, "A"], 11059 [718, 719, "N"], 11060 [720, 720, "A"], 11061 [721, 727, "N"], 11062 [728, 731, "A"], 11063 [732, 732, "N"], 11064 [733, 733, "A"], 11065 [734, 734, "N"], 11066 [735, 735, "A"], 11067 [736, 767, "N"], 11068 [768, 879, "A"], 11069 [880, 912, "N"], 11070 [913, 929, "A"], 11071 [930, 930, "N"], 11072 [931, 937, "A"], 11073 [938, 944, "N"], 11074 [945, 961, "A"], 11075 [962, 962, "N"], 11076 [963, 969, "A"], 11077 [970, 1024, "N"], 11078 [1025, 1025, "A"], 11079 [1026, 1039, "N"], 11080 [1040, 1103, "A"], 11081 [1104, 1104, "N"], 11082 [1105, 1105, "A"], 11083 [1106, 4351, "N"], 11084 [4352, 4447, "W"], 11085 [4448, 8207, "N"], 11086 [8208, 8208, "A"], 11087 [8209, 8210, "N"], 11088 [8211, 8214, "A"], 11089 [8215, 8215, "N"], 11090 [8216, 8217, "A"], 11091 [8218, 8219, "N"], 11092 [8220, 8221, "A"], 11093 [8222, 8223, "N"], 11094 [8224, 8226, "A"], 11095 [8227, 8227, "N"], 11096 [8228, 8231, "A"], 11097 [8232, 8239, "N"], 11098 [8240, 8240, "A"], 11099 [8241, 8241, "N"], 11100 [8242, 8243, "A"], 11101 [8244, 8244, "N"], 11102 [8245, 8245, "A"], 11103 [8246, 8250, "N"], 11104 [8251, 8251, "A"], 11105 [8252, 8253, "N"], 11106 [8254, 8254, "A"], 11107 [8255, 8307, "N"], 11108 [8308, 8308, "A"], 11109 [8309, 8318, "N"], 11110 [8319, 8319, "A"], 11111 [8320, 8320, "N"], 11112 [8321, 8324, "A"], 11113 [8325, 8360, "N"], 11114 [8361, 8361, "H"], 11115 [8362, 8363, "N"], 11116 [8364, 8364, "A"], 11117 [8365, 8450, "N"], 11118 [8451, 8451, "A"], 11119 [8452, 8452, "N"], 11120 [8453, 8453, "A"], 11121 [8454, 8456, "N"], 11122 [8457, 8457, "A"], 11123 [8458, 8466, "N"], 11124 [8467, 8467, "A"], 11125 [8468, 8469, "N"], 11126 [8470, 8470, "A"], 11127 [8471, 8480, "N"], 11128 [8481, 8482, "A"], 11129 [8483, 8485, "N"], 11130 [8486, 8486, "A"], 11131 [8487, 8490, "N"], 11132 [8491, 8491, "A"], 11133 [8492, 8530, "N"], 11134 [8531, 8532, "A"], 11135 [8533, 8538, "N"], 11136 [8539, 8542, "A"], 11137 [8543, 8543, "N"], 11138 [8544, 8555, "A"], 11139 [8556, 8559, "N"], 11140 [8560, 8569, "A"], 11141 [8570, 8584, "N"], 11142 [8585, 8585, "A"], 11143 [8586, 8591, "N"], 11144 [8592, 8601, "A"], 11145 [8602, 8631, "N"], 11146 [8632, 8633, "A"], 11147 [8634, 8657, "N"], 11148 [8658, 8658, "A"], 11149 [8659, 8659, "N"], 11150 [8660, 8660, "A"], 11151 [8661, 8678, "N"], 11152 [8679, 8679, "A"], 11153 [8680, 8703, "N"], 11154 [8704, 8704, "A"], 11155 [8705, 8705, "N"], 11156 [8706, 8707, "A"], 11157 [8708, 8710, "N"], 11158 [8711, 8712, "A"], 11159 [8713, 8714, "N"], 11160 [8715, 8715, "A"], 11161 [8716, 8718, "N"], 11162 [8719, 8719, "A"], 11163 [8720, 8720, "N"], 11164 [8721, 8721, "A"], 11165 [8722, 8724, "N"], 11166 [8725, 8725, "A"], 11167 [8726, 8729, "N"], 11168 [8730, 8730, "A"], 11169 [8731, 8732, "N"], 11170 [8733, 8736, "A"], 11171 [8737, 8738, "N"], 11172 [8739, 8739, "A"], 11173 [8740, 8740, "N"], 11174 [8741, 8741, "A"], 11175 [8742, 8742, "N"], 11176 [8743, 8748, "A"], 11177 [8749, 8749, "N"], 11178 [8750, 8750, "A"], 11179 [8751, 8755, "N"], 11180 [8756, 8759, "A"], 11181 [8760, 8763, "N"], 11182 [8764, 8765, "A"], 11183 [8766, 8775, "N"], 11184 [8776, 8776, "A"], 11185 [8777, 8779, "N"], 11186 [8780, 8780, "A"], 11187 [8781, 8785, "N"], 11188 [8786, 8786, "A"], 11189 [8787, 8799, "N"], 11190 [8800, 8801, "A"], 11191 [8802, 8803, "N"], 11192 [8804, 8807, "A"], 11193 [8808, 8809, "N"], 11194 [8810, 8811, "A"], 11195 [8812, 8813, "N"], 11196 [8814, 8815, "A"], 11197 [8816, 8833, "N"], 11198 [8834, 8835, "A"], 11199 [8836, 8837, "N"], 11200 [8838, 8839, "A"], 11201 [8840, 8852, "N"], 11202 [8853, 8853, "A"], 11203 [8854, 8856, "N"], 11204 [8857, 8857, "A"], 11205 [8858, 8868, "N"], 11206 [8869, 8869, "A"], 11207 [8870, 8894, "N"], 11208 [8895, 8895, "A"], 11209 [8896, 8977, "N"], 11210 [8978, 8978, "A"], 11211 [8979, 8985, "N"], 11212 [8986, 8987, "W"], 11213 [8988, 9e3, "N"], 11214 [9001, 9002, "W"], 11215 [9003, 9192, "N"], 11216 [9193, 9196, "W"], 11217 [9197, 9199, "N"], 11218 [9200, 9200, "W"], 11219 [9201, 9202, "N"], 11220 [9203, 9203, "W"], 11221 [9204, 9311, "N"], 11222 [9312, 9449, "A"], 11223 [9450, 9450, "N"], 11224 [9451, 9547, "A"], 11225 [9548, 9551, "N"], 11226 [9552, 9587, "A"], 11227 [9588, 9599, "N"], 11228 [9600, 9615, "A"], 11229 [9616, 9617, "N"], 11230 [9618, 9621, "A"], 11231 [9622, 9631, "N"], 11232 [9632, 9633, "A"], 11233 [9634, 9634, "N"], 11234 [9635, 9641, "A"], 11235 [9642, 9649, "N"], 11236 [9650, 9651, "A"], 11237 [9652, 9653, "N"], 11238 [9654, 9655, "A"], 11239 [9656, 9659, "N"], 11240 [9660, 9661, "A"], 11241 [9662, 9663, "N"], 11242 [9664, 9665, "A"], 11243 [9666, 9669, "N"], 11244 [9670, 9672, "A"], 11245 [9673, 9674, "N"], 11246 [9675, 9675, "A"], 11247 [9676, 9677, "N"], 11248 [9678, 9681, "A"], 11249 [9682, 9697, "N"], 11250 [9698, 9701, "A"], 11251 [9702, 9710, "N"], 11252 [9711, 9711, "A"], 11253 [9712, 9724, "N"], 11254 [9725, 9726, "W"], 11255 [9727, 9732, "N"], 11256 [9733, 9734, "A"], 11257 [9735, 9736, "N"], 11258 [9737, 9737, "A"], 11259 [9738, 9741, "N"], 11260 [9742, 9743, "A"], 11261 [9744, 9747, "N"], 11262 [9748, 9749, "W"], 11263 [9750, 9755, "N"], 11264 [9756, 9756, "A"], 11265 [9757, 9757, "N"], 11266 [9758, 9758, "A"], 11267 [9759, 9791, "N"], 11268 [9792, 9792, "A"], 11269 [9793, 9793, "N"], 11270 [9794, 9794, "A"], 11271 [9795, 9799, "N"], 11272 [9800, 9811, "W"], 11273 [9812, 9823, "N"], 11274 [9824, 9825, "A"], 11275 [9826, 9826, "N"], 11276 [9827, 9829, "A"], 11277 [9830, 9830, "N"], 11278 [9831, 9834, "A"], 11279 [9835, 9835, "N"], 11280 [9836, 9837, "A"], 11281 [9838, 9838, "N"], 11282 [9839, 9839, "A"], 11283 [9840, 9854, "N"], 11284 [9855, 9855, "W"], 11285 [9856, 9874, "N"], 11286 [9875, 9875, "W"], 11287 [9876, 9885, "N"], 11288 [9886, 9887, "A"], 11289 [9888, 9888, "N"], 11290 [9889, 9889, "W"], 11291 [9890, 9897, "N"], 11292 [9898, 9899, "W"], 11293 [9900, 9916, "N"], 11294 [9917, 9918, "W"], 11295 [9919, 9919, "A"], 11296 [9920, 9923, "N"], 11297 [9924, 9925, "W"], 11298 [9926, 9933, "A"], 11299 [9934, 9934, "W"], 11300 [9935, 9939, "A"], 11301 [9940, 9940, "W"], 11302 [9941, 9953, "A"], 11303 [9954, 9954, "N"], 11304 [9955, 9955, "A"], 11305 [9956, 9959, "N"], 11306 [9960, 9961, "A"], 11307 [9962, 9962, "W"], 11308 [9963, 9969, "A"], 11309 [9970, 9971, "W"], 11310 [9972, 9972, "A"], 11311 [9973, 9973, "W"], 11312 [9974, 9977, "A"], 11313 [9978, 9978, "W"], 11314 [9979, 9980, "A"], 11315 [9981, 9981, "W"], 11316 [9982, 9983, "A"], 11317 [9984, 9988, "N"], 11318 [9989, 9989, "W"], 11319 [9990, 9993, "N"], 11320 [9994, 9995, "W"], 11321 [9996, 10023, "N"], 11322 [10024, 10024, "W"], 11323 [10025, 10044, "N"], 11324 [10045, 10045, "A"], 11325 [10046, 10059, "N"], 11326 [10060, 10060, "W"], 11327 [10061, 10061, "N"], 11328 [10062, 10062, "W"], 11329 [10063, 10066, "N"], 11330 [10067, 10069, "W"], 11331 [10070, 10070, "N"], 11332 [10071, 10071, "W"], 11333 [10072, 10101, "N"], 11334 [10102, 10111, "A"], 11335 [10112, 10132, "N"], 11336 [10133, 10135, "W"], 11337 [10136, 10159, "N"], 11338 [10160, 10160, "W"], 11339 [10161, 10174, "N"], 11340 [10175, 10175, "W"], 11341 [10176, 10213, "N"], 11342 [10214, 10221, "Na"], 11343 [10222, 10628, "N"], 11344 [10629, 10630, "Na"], 11345 [10631, 11034, "N"], 11346 [11035, 11036, "W"], 11347 [11037, 11087, "N"], 11348 [11088, 11088, "W"], 11349 [11089, 11092, "N"], 11350 [11093, 11093, "W"], 11351 [11094, 11097, "A"], 11352 [11098, 11903, "N"], 11353 [11904, 11929, "W"], 11354 [11930, 11930, "N"], 11355 [11931, 12019, "W"], 11356 [12020, 12031, "N"], 11357 [12032, 12245, "W"], 11358 [12246, 12271, "N"], 11359 [12272, 12283, "W"], 11360 [12284, 12287, "N"], 11361 [12288, 12288, "F"], 11362 [12289, 12350, "W"], 11363 [12351, 12352, "N"], 11364 [12353, 12438, "W"], 11365 [12439, 12440, "N"], 11366 [12441, 12543, "W"], 11367 [12544, 12548, "N"], 11368 [12549, 12591, "W"], 11369 [12592, 12592, "N"], 11370 [12593, 12686, "W"], 11371 [12687, 12687, "N"], 11372 [12688, 12771, "W"], 11373 [12772, 12783, "N"], 11374 [12784, 12830, "W"], 11375 [12831, 12831, "N"], 11376 [12832, 12871, "W"], 11377 [12872, 12879, "A"], 11378 [12880, 19903, "W"], 11379 [19904, 19967, "N"], 11380 [19968, 42124, "W"], 11381 [42125, 42127, "N"], 11382 [42128, 42182, "W"], 11383 [42183, 43359, "N"], 11384 [43360, 43388, "W"], 11385 [43389, 44031, "N"], 11386 [44032, 55203, "W"], 11387 [55204, 57343, "N"], 11388 [57344, 63743, "A"], 11389 [63744, 64255, "W"], 11390 [64256, 65023, "N"], 11391 [65024, 65039, "A"], 11392 [65040, 65049, "W"], 11393 [65050, 65071, "N"], 11394 [65072, 65106, "W"], 11395 [65107, 65107, "N"], 11396 [65108, 65126, "W"], 11397 [65127, 65127, "N"], 11398 [65128, 65131, "W"], 11399 [65132, 65280, "N"], 11400 [65281, 65376, "F"], 11401 [65377, 65470, "H"], 11402 [65471, 65473, "N"], 11403 [65474, 65479, "H"], 11404 [65480, 65481, "N"], 11405 [65482, 65487, "H"], 11406 [65488, 65489, "N"], 11407 [65490, 65495, "H"], 11408 [65496, 65497, "N"], 11409 [65498, 65500, "H"], 11410 [65501, 65503, "N"], 11411 [65504, 65510, "F"], 11412 [65511, 65511, "N"], 11413 [65512, 65518, "H"], 11414 [65519, 65532, "N"], 11415 [65533, 65533, "A"], 11416 [65534, 94175, "N"], 11417 [94176, 94180, "W"], 11418 [94181, 94191, "N"], 11419 [94192, 94193, "W"], 11420 [94194, 94207, "N"], 11421 [94208, 100343, "W"], 11422 [100344, 100351, "N"], 11423 [100352, 101589, "W"], 11424 [101590, 101631, "N"], 11425 [101632, 101640, "W"], 11426 [101641, 110591, "N"], 11427 [110592, 110878, "W"], 11428 [110879, 110927, "N"], 11429 [110928, 110930, "W"], 11430 [110931, 110947, "N"], 11431 [110948, 110951, "W"], 11432 [110952, 110959, "N"], 11433 [110960, 111355, "W"], 11434 [111356, 126979, "N"], 11435 [126980, 126980, "W"], 11436 [126981, 127182, "N"], 11437 [127183, 127183, "W"], 11438 [127184, 127231, "N"], 11439 [127232, 127242, "A"], 11440 [127243, 127247, "N"], 11441 [127248, 127277, "A"], 11442 [127278, 127279, "N"], 11443 [127280, 127337, "A"], 11444 [127338, 127343, "N"], 11445 [127344, 127373, "A"], 11446 [127374, 127374, "W"], 11447 [127375, 127376, "A"], 11448 [127377, 127386, "W"], 11449 [127387, 127404, "A"], 11450 [127405, 127487, "N"], 11451 [127488, 127490, "W"], 11452 [127491, 127503, "N"], 11453 [127504, 127547, "W"], 11454 [127548, 127551, "N"], 11455 [127552, 127560, "W"], 11456 [127561, 127567, "N"], 11457 [127568, 127569, "W"], 11458 [127570, 127583, "N"], 11459 [127584, 127589, "W"], 11460 [127590, 127743, "N"], 11461 [127744, 127776, "W"], 11462 [127777, 127788, "N"], 11463 [127789, 127797, "W"], 11464 [127798, 127798, "N"], 11465 [127799, 127868, "W"], 11466 [127869, 127869, "N"], 11467 [127870, 127891, "W"], 11468 [127892, 127903, "N"], 11469 [127904, 127946, "W"], 11470 [127947, 127950, "N"], 11471 [127951, 127955, "W"], 11472 [127956, 127967, "N"], 11473 [127968, 127984, "W"], 11474 [127985, 127987, "N"], 11475 [127988, 127988, "W"], 11476 [127989, 127991, "N"], 11477 [127992, 128062, "W"], 11478 [128063, 128063, "N"], 11479 [128064, 128064, "W"], 11480 [128065, 128065, "N"], 11481 [128066, 128252, "W"], 11482 [128253, 128254, "N"], 11483 [128255, 128317, "W"], 11484 [128318, 128330, "N"], 11485 [128331, 128334, "W"], 11486 [128335, 128335, "N"], 11487 [128336, 128359, "W"], 11488 [128360, 128377, "N"], 11489 [128378, 128378, "W"], 11490 [128379, 128404, "N"], 11491 [128405, 128406, "W"], 11492 [128407, 128419, "N"], 11493 [128420, 128420, "W"], 11494 [128421, 128506, "N"], 11495 [128507, 128591, "W"], 11496 [128592, 128639, "N"], 11497 [128640, 128709, "W"], 11498 [128710, 128715, "N"], 11499 [128716, 128716, "W"], 11500 [128717, 128719, "N"], 11501 [128720, 128722, "W"], 11502 [128723, 128724, "N"], 11503 [128725, 128727, "W"], 11504 [128728, 128746, "N"], 11505 [128747, 128748, "W"], 11506 [128749, 128755, "N"], 11507 [128756, 128764, "W"], 11508 [128765, 128991, "N"], 11509 [128992, 129003, "W"], 11510 [129004, 129291, "N"], 11511 [129292, 129338, "W"], 11512 [129339, 129339, "N"], 11513 [129340, 129349, "W"], 11514 [129350, 129350, "N"], 11515 [129351, 129400, "W"], 11516 [129401, 129401, "N"], 11517 [129402, 129483, "W"], 11518 [129484, 129484, "N"], 11519 [129485, 129535, "W"], 11520 [129536, 129647, "N"], 11521 [129648, 129652, "W"], 11522 [129653, 129655, "N"], 11523 [129656, 129658, "W"], 11524 [129659, 129663, "N"], 11525 [129664, 129670, "W"], 11526 [129671, 129679, "N"], 11527 [129680, 129704, "W"], 11528 [129705, 129711, "N"], 11529 [129712, 129718, "W"], 11530 [129719, 129727, "N"], 11531 [129728, 129730, "W"], 11532 [129731, 129743, "N"], 11533 [129744, 129750, "W"], 11534 [129751, 131071, "N"], 11535 [131072, 196605, "W"], 11536 [196606, 196607, "N"], 11537 [196608, 262141, "W"], 11538 [262142, 917759, "N"], 11539 [917760, 917999, "A"], 11540 [918e3, 983039, "N"], 11541 [983040, 1048573, "A"], 11542 [1048574, 1048575, "N"], 11543 [1048576, 1114109, "A"], 11544 [1114110, 1114111, "N"] 11545 ]; 11546 var version = "13.0.0"; 11547 function getEAWOfCodePoint(codePoint) { 11548 var min = 0; 11549 var max = defs.length - 1; 11550 while (min !== max) { 11551 var i = min + (max - min >> 1); 11552 var _a = defs[i], start = _a[0], end = _a[1], prop = _a[2]; 11553 if (codePoint < start) { 11554 max = i - 1; 11555 } else if (codePoint > end) { 11556 min = i + 1; 11557 } else { 11558 return prop; 11559 } 11560 } 11561 return defs[min][2]; 11562 } 11563 function getEAW(str, pos) { 11564 if (pos === void 0) { 11565 pos = 0; 11566 } 11567 var codePoint = str.codePointAt(pos); 11568 if (codePoint === void 0) { 11569 return void 0; 11570 } 11571 return getEAWOfCodePoint(codePoint); 11572 } 11573 var defaultWidths = { 11574 N: 1, 11575 Na: 1, 11576 W: 2, 11577 F: 2, 11578 H: 1, 11579 A: 1 11580 }; 11581 function computeWidth(str, widths) { 11582 var width = 0; 11583 for (var _i = 0, str_1 = str; _i < str_1.length; _i++) { 11584 var char = str_1[_i]; 11585 var eaw = getEAW(char); 11586 width += widths && widths[eaw] || defaultWidths[eaw]; 11587 } 11588 return width; 11589 } 11590 exports.computeWidth = computeWidth; 11591 exports.eawVersion = version; 11592 exports.getEAW = getEAW; 11593 } 11594 }); 11595 11596 // node_modules/@tgrosinger/md-advanced-tables/lib/formatter.js 11597 var require_formatter = __commonJS({ 11598 "node_modules/@tgrosinger/md-advanced-tables/lib/formatter.js"(exports) { 11599 "use strict"; 11600 Object.defineProperty(exports, "__esModule", { value: true }); 11601 exports.moveColumn = exports.deleteColumn = exports.insertColumn = exports.moveRow = exports.deleteRow = exports.insertRow = exports.alterAlignment = exports.formatTable = exports.FormatType = exports._weakFormatTable = exports._formatTable = exports._padText = exports._alignText = exports._computeTextWidth = exports.completeTable = exports._extendArray = exports._delimiterText = void 0; 11602 var alignment_1 = require_alignment(); 11603 var table_1 = require_table(); 11604 var table_cell_1 = require_table_cell(); 11605 var table_row_1 = require_table_row(); 11606 var meaw_1 = require_lib(); 11607 var _delimiterText = (alignment, width) => { 11608 const bar = "-".repeat(width); 11609 switch (alignment) { 11610 case alignment_1.Alignment.NONE: 11611 return ` ${bar} `; 11612 case alignment_1.Alignment.LEFT: 11613 return `:${bar} `; 11614 case alignment_1.Alignment.RIGHT: 11615 return ` ${bar}:`; 11616 case alignment_1.Alignment.CENTER: 11617 return `:${bar}:`; 11618 default: 11619 throw new Error("Unknown alignment: " + alignment); 11620 } 11621 }; 11622 exports._delimiterText = _delimiterText; 11623 var _extendArray = (arr, size, callback) => { 11624 const extended = arr.slice(); 11625 for (let i = arr.length; i < size; i++) { 11626 extended.push(callback(i, arr)); 11627 } 11628 return extended; 11629 }; 11630 exports._extendArray = _extendArray; 11631 var completeTable = (table, options) => { 11632 const tableHeight = table.getHeight(); 11633 const tableWidth = table.getWidth(); 11634 if (tableHeight === 0) { 11635 throw new Error("Empty table"); 11636 } 11637 const rows = table.getRows(); 11638 const newRows = []; 11639 const headerRow = rows[0]; 11640 const headerCells = headerRow.getCells(); 11641 newRows.push(new table_row_1.TableRow((0, exports._extendArray)(headerCells, tableWidth, (j) => new table_cell_1.TableCell(j === headerCells.length ? headerRow.marginRight : "")), headerRow.marginLeft, headerCells.length < tableWidth ? "" : headerRow.marginRight)); 11642 const delimiterRow = table.getDelimiterRow(); 11643 if (delimiterRow !== void 0) { 11644 const delimiterCells = delimiterRow.getCells(); 11645 newRows.push(new table_row_1.TableRow((0, exports._extendArray)(delimiterCells, tableWidth, (j) => new table_cell_1.TableCell((0, exports._delimiterText)(alignment_1.Alignment.NONE, j === delimiterCells.length ? Math.max(options.minDelimiterWidth, delimiterRow.marginRight.length - 2) : options.minDelimiterWidth))), delimiterRow.marginLeft, delimiterCells.length < tableWidth ? "" : delimiterRow.marginRight)); 11646 } else { 11647 newRows.push(new table_row_1.TableRow((0, exports._extendArray)([], tableWidth, () => new table_cell_1.TableCell((0, exports._delimiterText)(alignment_1.Alignment.NONE, options.minDelimiterWidth))), "", "")); 11648 } 11649 for (let i = delimiterRow !== void 0 ? 2 : 1; i < tableHeight; i++) { 11650 const row = rows[i]; 11651 const cells = row.getCells(); 11652 newRows.push(new table_row_1.TableRow((0, exports._extendArray)(cells, tableWidth, (j) => new table_cell_1.TableCell(j === cells.length ? row.marginRight : "")), row.marginLeft, cells.length < tableWidth ? "" : row.marginRight)); 11653 } 11654 return { 11655 table: new table_1.Table(newRows), 11656 delimiterInserted: delimiterRow === void 0 11657 }; 11658 }; 11659 exports.completeTable = completeTable; 11660 var _computeTextWidth = (text, options) => { 11661 const normalized = options.normalize ? text.normalize("NFC") : text; 11662 let w = 0; 11663 for (const char of normalized) { 11664 if (options.wideChars.has(char)) { 11665 w += 2; 11666 continue; 11667 } 11668 if (options.narrowChars.has(char)) { 11669 w += 1; 11670 continue; 11671 } 11672 switch ((0, meaw_1.getEAW)(char)) { 11673 case "F": 11674 case "W": 11675 w += 2; 11676 break; 11677 case "A": 11678 w += options.ambiguousAsWide ? 2 : 1; 11679 break; 11680 default: 11681 w += 1; 11682 } 11683 } 11684 return w; 11685 }; 11686 exports._computeTextWidth = _computeTextWidth; 11687 var _alignText = (text, width, alignment, options) => { 11688 const space = width - (0, exports._computeTextWidth)(text, options); 11689 if (space < 0) { 11690 return text; 11691 } 11692 switch (alignment) { 11693 case alignment_1.Alignment.NONE: 11694 throw new Error("Unexpected default alignment"); 11695 case alignment_1.Alignment.LEFT: 11696 return text + " ".repeat(space); 11697 case alignment_1.Alignment.RIGHT: 11698 return " ".repeat(space) + text; 11699 case alignment_1.Alignment.CENTER: 11700 return " ".repeat(Math.floor(space / 2)) + text + " ".repeat(Math.ceil(space / 2)); 11701 default: 11702 throw new Error("Unknown alignment: " + alignment); 11703 } 11704 }; 11705 exports._alignText = _alignText; 11706 var _padText = (text) => ` ${text} `; 11707 exports._padText = _padText; 11708 var _formatTable = (table, options) => { 11709 const tableHeight = table.getHeight(); 11710 const tableWidth = table.getWidth(); 11711 if (tableHeight === 0) { 11712 return { 11713 table, 11714 marginLeft: "" 11715 }; 11716 } 11717 const marginLeft = table.getRows()[0].marginLeft; 11718 if (tableWidth === 0) { 11719 const rows2 = new Array(tableHeight).fill(new table_row_1.TableRow([], marginLeft, "")); 11720 return { 11721 table: new table_1.Table(rows2), 11722 marginLeft 11723 }; 11724 } 11725 const delimiterRow = table.getDelimiterRow(); 11726 const columnWidths = new Array(tableWidth).fill(0); 11727 if (delimiterRow !== void 0) { 11728 const delimiterRowWidth = delimiterRow.getWidth(); 11729 for (let j = 0; j < delimiterRowWidth; j++) { 11730 columnWidths[j] = options.minDelimiterWidth; 11731 } 11732 } 11733 for (let i = 0; i < tableHeight; i++) { 11734 if (delimiterRow !== void 0 && i === 1) { 11735 continue; 11736 } 11737 const row = table.getRows()[i]; 11738 const rowWidth = row.getWidth(); 11739 for (let j = 0; j < rowWidth; j++) { 11740 columnWidths[j] = Math.max(columnWidths[j], (0, exports._computeTextWidth)(row.getCellAt(j).content, options.textWidthOptions)); 11741 } 11742 } 11743 const alignments = delimiterRow !== void 0 ? (0, exports._extendArray)( 11744 delimiterRow.getCells().map((cell) => cell.getAlignment()), 11745 tableWidth, 11746 // Safe conversion because DefaultAlignment is a subset of Alignment 11747 () => options.defaultAlignment 11748 ) : new Array(tableWidth).fill(options.defaultAlignment); 11749 const rows = []; 11750 const headerRow = table.getRows()[0]; 11751 rows.push(new table_row_1.TableRow(headerRow.getCells().map((cell, j) => new table_cell_1.TableCell((0, exports._padText)((0, exports._alignText)(cell.content, columnWidths[j], options.headerAlignment === alignment_1.HeaderAlignment.FOLLOW ? alignments[j] === alignment_1.Alignment.NONE ? options.defaultAlignment : alignments[j] : options.headerAlignment, options.textWidthOptions)))), marginLeft, "")); 11752 if (delimiterRow !== void 0) { 11753 rows.push(new table_row_1.TableRow(delimiterRow.getCells().map((cell, j) => new table_cell_1.TableCell((0, exports._delimiterText)(alignments[j], columnWidths[j]))), marginLeft, "")); 11754 } 11755 for (let i = delimiterRow !== void 0 ? 2 : 1; i < tableHeight; i++) { 11756 const row = table.getRows()[i]; 11757 rows.push(new table_row_1.TableRow(row.getCells().map((cell, j) => new table_cell_1.TableCell((0, exports._padText)((0, exports._alignText)(cell.content, columnWidths[j], alignments[j] === alignment_1.Alignment.NONE ? options.defaultAlignment : alignments[j], options.textWidthOptions)))), marginLeft, "")); 11758 } 11759 return { 11760 table: new table_1.Table(rows), 11761 marginLeft 11762 }; 11763 }; 11764 exports._formatTable = _formatTable; 11765 var _weakFormatTable = (table, options) => { 11766 const tableHeight = table.getHeight(); 11767 const tableWidth = table.getWidth(); 11768 if (tableHeight === 0) { 11769 return { 11770 table, 11771 marginLeft: "" 11772 }; 11773 } 11774 const marginLeft = table.getRows()[0].marginLeft; 11775 if (tableWidth === 0) { 11776 const rows2 = new Array(tableHeight).fill(new table_row_1.TableRow([], marginLeft, "")); 11777 return { 11778 table: new table_1.Table(rows2), 11779 marginLeft 11780 }; 11781 } 11782 const delimiterRow = table.getDelimiterRow(); 11783 const rows = []; 11784 const headerRow = table.getRows()[0]; 11785 rows.push(new table_row_1.TableRow(headerRow.getCells().map((cell) => new table_cell_1.TableCell((0, exports._padText)(cell.content))), marginLeft, "")); 11786 if (delimiterRow !== void 0) { 11787 rows.push(new table_row_1.TableRow(delimiterRow.getCells().map((cell) => new table_cell_1.TableCell((0, exports._delimiterText)(cell.getAlignment(), options.minDelimiterWidth))), marginLeft, "")); 11788 } 11789 for (let i = delimiterRow !== void 0 ? 2 : 1; i < tableHeight; i++) { 11790 const row = table.getRows()[i]; 11791 rows.push(new table_row_1.TableRow(row.getCells().map((cell) => new table_cell_1.TableCell((0, exports._padText)(cell.content))), marginLeft, "")); 11792 } 11793 return { 11794 table: new table_1.Table(rows), 11795 marginLeft 11796 }; 11797 }; 11798 exports._weakFormatTable = _weakFormatTable; 11799 var FormatType3; 11800 (function(FormatType4) { 11801 FormatType4["NORMAL"] = "normal"; 11802 FormatType4["WEAK"] = "weak"; 11803 })(FormatType3 || (exports.FormatType = FormatType3 = {})); 11804 var formatTable = (table, options) => { 11805 switch (options.formatType) { 11806 case FormatType3.NORMAL: 11807 return (0, exports._formatTable)(table, options); 11808 case FormatType3.WEAK: 11809 return (0, exports._weakFormatTable)(table, options); 11810 default: 11811 throw new Error("Unknown format type: " + options.formatType); 11812 } 11813 }; 11814 exports.formatTable = formatTable; 11815 var alterAlignment = (table, columnIndex, alignment, options) => { 11816 if (table.getHeight() < 1) { 11817 return table; 11818 } 11819 const delimiterRow = table.getRows()[1]; 11820 if (columnIndex < 0 || delimiterRow.getWidth() - 1 < columnIndex) { 11821 return table; 11822 } 11823 const delimiterCells = delimiterRow.getCells(); 11824 delimiterCells[columnIndex] = new table_cell_1.TableCell((0, exports._delimiterText)(alignment, options.minDelimiterWidth)); 11825 const rows = table.getRows(); 11826 rows[1] = new table_row_1.TableRow(delimiterCells, delimiterRow.marginLeft, delimiterRow.marginRight); 11827 return new table_1.Table(rows); 11828 }; 11829 exports.alterAlignment = alterAlignment; 11830 var insertRow = (table, rowIndex, row) => { 11831 const rows = table.getRows(); 11832 rows.splice(Math.max(rowIndex, 2), 0, row); 11833 return new table_1.Table(rows); 11834 }; 11835 exports.insertRow = insertRow; 11836 var deleteRow = (table, rowIndex) => { 11837 if (rowIndex === 1) { 11838 return table; 11839 } 11840 const rows = table.getRows(); 11841 if (rowIndex === 0) { 11842 const headerRow = rows[0]; 11843 rows[0] = new table_row_1.TableRow(new Array(headerRow.getWidth()).fill(new table_cell_1.TableCell("")), headerRow.marginLeft, headerRow.marginRight); 11844 } else { 11845 rows.splice(rowIndex, 1); 11846 } 11847 return new table_1.Table(rows); 11848 }; 11849 exports.deleteRow = deleteRow; 11850 var moveRow = (table, rowIndex, destIndex) => { 11851 if (rowIndex <= 1 || destIndex <= 1 || rowIndex === destIndex) { 11852 return table; 11853 } 11854 const rows = table.getRows(); 11855 const row = rows[rowIndex]; 11856 rows.splice(rowIndex, 1); 11857 rows.splice(destIndex, 0, row); 11858 return new table_1.Table(rows); 11859 }; 11860 exports.moveRow = moveRow; 11861 var insertColumn = (table, columnIndex, column, options) => { 11862 const rows = table.getRows(); 11863 for (let i = 0; i < rows.length; i++) { 11864 const row = rows[i]; 11865 const cells = rows[i].getCells(); 11866 const cell = i === 1 ? new table_cell_1.TableCell((0, exports._delimiterText)(alignment_1.Alignment.NONE, options.minDelimiterWidth)) : column[i > 1 ? i - 1 : i]; 11867 cells.splice(columnIndex, 0, cell); 11868 rows[i] = new table_row_1.TableRow(cells, row.marginLeft, row.marginRight); 11869 } 11870 return new table_1.Table(rows); 11871 }; 11872 exports.insertColumn = insertColumn; 11873 var deleteColumn = (table, columnIndex, options) => { 11874 const rows = table.getRows(); 11875 for (let i = 0; i < rows.length; i++) { 11876 const row = rows[i]; 11877 let cells = row.getCells(); 11878 if (cells.length <= 1) { 11879 cells = [ 11880 new table_cell_1.TableCell(i === 1 ? (0, exports._delimiterText)(alignment_1.Alignment.NONE, options.minDelimiterWidth) : "") 11881 ]; 11882 } else { 11883 cells.splice(columnIndex, 1); 11884 } 11885 rows[i] = new table_row_1.TableRow(cells, row.marginLeft, row.marginRight); 11886 } 11887 return new table_1.Table(rows); 11888 }; 11889 exports.deleteColumn = deleteColumn; 11890 var moveColumn = (table, columnIndex, destIndex) => { 11891 if (columnIndex === destIndex) { 11892 return table; 11893 } 11894 const rows = table.getRows(); 11895 for (let i = 0; i < rows.length; i++) { 11896 const row = rows[i]; 11897 const cells = row.getCells(); 11898 const cell = cells[columnIndex]; 11899 cells.splice(columnIndex, 1); 11900 cells.splice(destIndex, 0, cell); 11901 rows[i] = new table_row_1.TableRow(cells, row.marginLeft, row.marginRight); 11902 } 11903 return new table_1.Table(rows); 11904 }; 11905 exports.moveColumn = moveColumn; 11906 } 11907 }); 11908 11909 // node_modules/@tgrosinger/md-advanced-tables/lib/edit-script.js 11910 var require_edit_script = __commonJS({ 11911 "node_modules/@tgrosinger/md-advanced-tables/lib/edit-script.js"(exports) { 11912 "use strict"; 11913 Object.defineProperty(exports, "__esModule", { value: true }); 11914 exports.shortestEditScript = exports.applyEditScript = exports._applyCommand = exports.Delete = exports.Insert = void 0; 11915 var Insert = class { 11916 /** 11917 * Creats a new `Insert` object. 11918 * 11919 * @param row - Row index, starts from `0`. 11920 * @param line - A string to be inserted at the row. 11921 */ 11922 constructor(row, line) { 11923 this.row = row; 11924 this.line = line; 11925 } 11926 }; 11927 exports.Insert = Insert; 11928 var Delete = class { 11929 /** 11930 * Creates a new `Delete` object. 11931 * 11932 * @param row - Row index, starts from `0`. 11933 */ 11934 constructor(row) { 11935 this.row = row; 11936 } 11937 }; 11938 exports.Delete = Delete; 11939 var _applyCommand = (textEditor, command, rowOffset) => { 11940 if (command instanceof Insert) { 11941 textEditor.insertLine(rowOffset + command.row, command.line); 11942 } else if (command instanceof Delete) { 11943 textEditor.deleteLine(rowOffset + command.row); 11944 } else { 11945 throw new Error("Unknown command"); 11946 } 11947 }; 11948 exports._applyCommand = _applyCommand; 11949 var applyEditScript = (textEditor, script, rowOffset) => { 11950 for (const command of script) { 11951 (0, exports._applyCommand)(textEditor, command, rowOffset); 11952 } 11953 }; 11954 exports.applyEditScript = applyEditScript; 11955 var IList = class { 11956 get car() { 11957 throw new Error("Not implemented"); 11958 } 11959 get cdr() { 11960 throw new Error("Not implemented"); 11961 } 11962 isEmpty() { 11963 throw new Error("Not implemented"); 11964 } 11965 unshift(value) { 11966 return new Cons(value, this); 11967 } 11968 toArray() { 11969 const arr = []; 11970 let rest = this; 11971 while (!rest.isEmpty()) { 11972 arr.push(rest.car); 11973 rest = rest.cdr; 11974 } 11975 return arr; 11976 } 11977 }; 11978 var Nil = class extends IList { 11979 constructor() { 11980 super(); 11981 } 11982 get car() { 11983 throw new Error("Empty list"); 11984 } 11985 get cdr() { 11986 throw new Error("Empty list"); 11987 } 11988 isEmpty() { 11989 return true; 11990 } 11991 }; 11992 var Cons = class extends IList { 11993 constructor(car, cdr) { 11994 super(); 11995 this._car = car; 11996 this._cdr = cdr; 11997 } 11998 get car() { 11999 return this._car; 12000 } 12001 get cdr() { 12002 return this._cdr; 12003 } 12004 isEmpty() { 12005 return false; 12006 } 12007 }; 12008 var shortestEditScript = (from, to, limit = -1) => { 12009 const fromLen = from.length; 12010 const toLen = to.length; 12011 const maxd = limit >= 0 ? Math.min(limit, fromLen + toLen) : fromLen + toLen; 12012 const mem = new Array(Math.min(maxd, fromLen) + Math.min(maxd, toLen) + 1); 12013 const offset = Math.min(maxd, fromLen); 12014 for (let d = 0; d <= maxd; d++) { 12015 const mink = d <= fromLen ? -d : d - 2 * fromLen; 12016 const maxk = d <= toLen ? d : -d + 2 * toLen; 12017 for (let k = mink; k <= maxk; k += 2) { 12018 let i; 12019 let script; 12020 if (d === 0) { 12021 i = 0; 12022 script = new Nil(); 12023 } else if (k === -d) { 12024 i = mem[offset + k + 1].i + 1; 12025 script = mem[offset + k + 1].script.unshift(new Delete(i + k)); 12026 } else if (k === d) { 12027 i = mem[offset + k - 1].i; 12028 script = mem[offset + k - 1].script.unshift(new Insert(i + k - 1, to[i + k - 1])); 12029 } else { 12030 const vi = mem[offset + k + 1].i + 1; 12031 const hi = mem[offset + k - 1].i; 12032 if (vi > hi) { 12033 i = vi; 12034 script = mem[offset + k + 1].script.unshift(new Delete(i + k)); 12035 } else { 12036 i = hi; 12037 script = mem[offset + k - 1].script.unshift(new Insert(i + k - 1, to[i + k - 1])); 12038 } 12039 } 12040 while (i < fromLen && i + k < toLen && from[i] === to[i + k]) { 12041 i += 1; 12042 } 12043 if (k === toLen - fromLen && i === fromLen) { 12044 return script.toArray().reverse(); 12045 } 12046 mem[offset + k] = { i, script }; 12047 } 12048 } 12049 return void 0; 12050 }; 12051 exports.shortestEditScript = shortestEditScript; 12052 } 12053 }); 12054 12055 // node_modules/@tgrosinger/md-advanced-tables/lib/text-editor.js 12056 var require_text_editor = __commonJS({ 12057 "node_modules/@tgrosinger/md-advanced-tables/lib/text-editor.js"(exports) { 12058 "use strict"; 12059 Object.defineProperty(exports, "__esModule", { value: true }); 12060 exports.ITextEditor = void 0; 12061 var ITextEditor = class { 12062 /** 12063 * Gets the current cursor position. 12064 * 12065 * @returns A point object that represents the cursor position. 12066 */ 12067 getCursorPosition() { 12068 throw new Error("Not implemented: getCursorPosition"); 12069 } 12070 /** 12071 * Sets the cursor position to a specified one. 12072 */ 12073 setCursorPosition(pos) { 12074 throw new Error("Not implemented: setCursorPosition"); 12075 } 12076 /** 12077 * Sets the selection range. 12078 * This method also expects the cursor position to be moved as the end of the selection range. 12079 */ 12080 setSelectionRange(range) { 12081 throw new Error("Not implemented: setSelectionRange"); 12082 } 12083 /** 12084 * Gets the last row index of the text editor. 12085 */ 12086 getLastRow() { 12087 throw new Error("Not implemented: getLastRow"); 12088 } 12089 /** 12090 * Checks if the editor accepts a table at a row to be editted. 12091 * It should return `false` if, for example, the row is in a code block (not Markdown). 12092 * 12093 * @param row - A row index in the text editor. 12094 * @returns `true` if the table at the row can be editted. 12095 */ 12096 acceptsTableEdit(row) { 12097 throw new Error("Not implemented: acceptsTableEdit"); 12098 } 12099 /** 12100 * Gets a line string at a row. 12101 * 12102 * @param row - Row index, starts from `0`. 12103 * @returns The line at the specified row. 12104 * The line must not contain an EOL like `"\n"` or `"\r"`. 12105 */ 12106 getLine(row) { 12107 throw new Error("Not implemented: getLine"); 12108 } 12109 /** 12110 * Inserts a line at a specified row. 12111 * 12112 * @param row - Row index, starts from `0`. 12113 * @param line - A string to be inserted. 12114 * This must not contain an EOL like `"\n"` or `"\r"`. 12115 */ 12116 insertLine(row, line) { 12117 throw new Error("Not implemented: insertLine"); 12118 } 12119 /** 12120 * Deletes a line at a specified row. 12121 * 12122 * @param row - Row index, starts from `0`. 12123 */ 12124 deleteLine(row) { 12125 throw new Error("Not implemented: deleteLine"); 12126 } 12127 /** 12128 * Replace lines in a specified range. 12129 * 12130 * @param startRow - Start row index, starts from `0`. 12131 * @param endRow - End row index. 12132 * Lines from `startRow` to `endRow - 1` is replaced. 12133 * @param lines - An array of string. 12134 * Each strings must not contain an EOL like `"\n"` or `"\r"`. 12135 */ 12136 replaceLines(startRow, endRow, lines) { 12137 throw new Error("Not implemented: replaceLines"); 12138 } 12139 /** 12140 * Batches multiple operations as a single undo/redo step. 12141 * 12142 * @param func - A callback function that executes some operations on the text editor. 12143 */ 12144 transact(func) { 12145 throw new Error("Not implemented: transact"); 12146 } 12147 }; 12148 exports.ITextEditor = ITextEditor; 12149 } 12150 }); 12151 12152 // node_modules/@tgrosinger/md-advanced-tables/lib/options.js 12153 var require_options = __commonJS({ 12154 "node_modules/@tgrosinger/md-advanced-tables/lib/options.js"(exports) { 12155 "use strict"; 12156 Object.defineProperty(exports, "__esModule", { value: true }); 12157 exports.defaultOptions = exports.optionsWithDefaults = void 0; 12158 var alignment_1 = require_alignment(); 12159 var formatter_1 = require_formatter(); 12160 var DEFAULT_TEXT_WIDTH_OPTIONS = { 12161 normalize: true, 12162 wideChars: /* @__PURE__ */ new Set(), 12163 narrowChars: /* @__PURE__ */ new Set(), 12164 ambiguousAsWide: false 12165 }; 12166 var DEFAULT_OPTIONS = { 12167 leftMarginChars: /* @__PURE__ */ new Set(), 12168 formatType: formatter_1.FormatType.NORMAL, 12169 minDelimiterWidth: 3, 12170 defaultAlignment: alignment_1.DefaultAlignment.LEFT, 12171 headerAlignment: alignment_1.HeaderAlignment.FOLLOW, 12172 smartCursor: false 12173 }; 12174 var optionsWithDefaults2 = (options) => Object.assign(Object.assign(Object.assign({}, DEFAULT_OPTIONS), options), { textWidthOptions: options.textWidthOptions ? Object.assign(Object.assign({}, DEFAULT_TEXT_WIDTH_OPTIONS), options.textWidthOptions) : DEFAULT_TEXT_WIDTH_OPTIONS }); 12175 exports.optionsWithDefaults = optionsWithDefaults2; 12176 exports.defaultOptions = (0, exports.optionsWithDefaults)({}); 12177 } 12178 }); 12179 12180 // node_modules/@tgrosinger/md-advanced-tables/lib/table-editor.js 12181 var require_table_editor = __commonJS({ 12182 "node_modules/@tgrosinger/md-advanced-tables/lib/table-editor.js"(exports) { 12183 "use strict"; 12184 Object.defineProperty(exports, "__esModule", { value: true }); 12185 exports.TableEditor = exports._computeNewOffset = exports._createIsTableFormulaRegex = exports._createIsTableRowRegex = exports.SortOrder = void 0; 12186 var edit_script_1 = require_edit_script(); 12187 var focus_1 = require_focus(); 12188 var formatter_1 = require_formatter(); 12189 var parser_1 = require_parser(); 12190 var point_1 = require_point(); 12191 var range_1 = require_range(); 12192 var table_1 = require_table(); 12193 var table_cell_1 = require_table_cell(); 12194 var table_row_1 = require_table_row(); 12195 var SortOrder2; 12196 (function(SortOrder3) { 12197 SortOrder3["Ascending"] = "ascending"; 12198 SortOrder3["Descending"] = "descending"; 12199 })(SortOrder2 || (exports.SortOrder = SortOrder2 = {})); 12200 var _createIsTableRowRegex = (leftMarginChars) => new RegExp(`^${(0, parser_1.marginRegexSrc)(leftMarginChars)}\\|`, "u"); 12201 exports._createIsTableRowRegex = _createIsTableRowRegex; 12202 var _createIsTableFormulaRegex = (leftMarginChars) => new RegExp(`^${(0, parser_1.marginRegexSrc)(leftMarginChars)}<!-- ?.+-->$`, "u"); 12203 exports._createIsTableFormulaRegex = _createIsTableFormulaRegex; 12204 var _computeNewOffset = (focus, table, formatted, moved) => { 12205 if (moved) { 12206 const formattedFocusedCell2 = formatted.table.getFocusedCell(focus); 12207 if (formattedFocusedCell2 !== void 0) { 12208 return formattedFocusedCell2.computeRawOffset(0); 12209 } 12210 return focus.column < 0 ? formatted.marginLeft.length : 0; 12211 } 12212 const focusedCell = table.getFocusedCell(focus); 12213 const formattedFocusedCell = formatted.table.getFocusedCell(focus); 12214 if (focusedCell !== void 0 && formattedFocusedCell !== void 0) { 12215 const contentOffset = Math.min(focusedCell.computeContentOffset(focus.offset), formattedFocusedCell.content.length); 12216 return formattedFocusedCell.computeRawOffset(contentOffset); 12217 } 12218 return focus.column < 0 ? formatted.marginLeft.length : 0; 12219 }; 12220 exports._computeNewOffset = _computeNewOffset; 12221 var TableEditor2 = class { 12222 /** 12223 * Creates a new table editor instance. 12224 * 12225 * @param textEditor - A text editor interface. 12226 */ 12227 constructor(textEditor) { 12228 this._textEditor = textEditor; 12229 this._scActive = false; 12230 } 12231 /** 12232 * Resets the smart cursor. 12233 * Call this method when the table editor is inactivated. 12234 */ 12235 resetSmartCursor() { 12236 this._scActive = false; 12237 } 12238 /** 12239 * Checks if the cursor is in a table row. Returns false if the cursor is in a 12240 * table formula row (see cursorIsInTableFormula). 12241 * This is useful to check whether the table editor should be activated or not. 12242 * 12243 * @returns `true` if the cursor is in a table row. 12244 */ 12245 cursorIsInTable(options) { 12246 const re = (0, exports._createIsTableRowRegex)(options.leftMarginChars); 12247 const pos = this._textEditor.getCursorPosition(); 12248 return this._textEditor.acceptsTableEdit(pos.row) && re.test(this._textEditor.getLine(pos.row)); 12249 } 12250 /** 12251 * Checks if the cursor is in a formula row below a table. 12252 * This is useful to check whether the table editor should be activated or not. 12253 * 12254 * @returns `true` if the cursor is in a formula row. 12255 */ 12256 cursorIsInTableFormula(options) { 12257 const formulaRe = (0, exports._createIsTableFormulaRegex)(options.leftMarginChars); 12258 const pos = this._textEditor.getCursorPosition(); 12259 return this._textEditor.acceptsTableEdit(pos.row) && formulaRe.test(this._textEditor.getLine(pos.row)); 12260 } 12261 /** 12262 * Finds a table under the current cursor position. 12263 * 12264 * @returns undefined if there is no table or the determined focus is invalid. 12265 */ 12266 _findTable(options) { 12267 const re = (0, exports._createIsTableRowRegex)(options.leftMarginChars); 12268 const formulaRe = (0, exports._createIsTableFormulaRegex)(options.leftMarginChars); 12269 let pos = this._textEditor.getCursorPosition(); 12270 const lastRow = this._textEditor.getLastRow(); 12271 const lines = []; 12272 const formulaLines = []; 12273 let startRow = pos.row; 12274 let endRow = pos.row; 12275 { 12276 let line = this._textEditor.getLine(pos.row); 12277 while (formulaRe.test(line) && pos.row >= 0) { 12278 pos = new point_1.Point(pos.row - 1, pos.column); 12279 endRow--; 12280 line = this._textEditor.getLine(pos.row); 12281 } 12282 } 12283 { 12284 const line = this._textEditor.getLine(pos.row); 12285 if (!this._textEditor.acceptsTableEdit(pos.row) || !re.test(line)) { 12286 return void 0; 12287 } 12288 lines.push(line); 12289 } 12290 for (let row = pos.row - 1; row >= 0; row--) { 12291 const line = this._textEditor.getLine(row); 12292 if (!this._textEditor.acceptsTableEdit(row) || !re.test(line)) { 12293 break; 12294 } 12295 lines.unshift(line); 12296 startRow = row; 12297 } 12298 for (let row = pos.row + 1; row <= lastRow; row++) { 12299 const line = this._textEditor.getLine(row); 12300 if (!this._textEditor.acceptsTableEdit(row) || !re.test(line)) { 12301 break; 12302 } 12303 lines.push(line); 12304 endRow = row; 12305 } 12306 for (let row = endRow + 1; row <= lastRow; row++) { 12307 const line = this._textEditor.getLine(row); 12308 if (!this._textEditor.acceptsTableEdit(row) || !formulaRe.test(line)) { 12309 break; 12310 } 12311 formulaLines.push(line); 12312 } 12313 const range = new range_1.Range(new point_1.Point(startRow, 0), new point_1.Point(endRow, lines[lines.length - 1].length)); 12314 const table = (0, parser_1.readTable)(lines, options); 12315 const focus = table.focusOfPosition(pos, startRow); 12316 if (focus === void 0) { 12317 return void 0; 12318 } 12319 return { range, lines, formulaLines, table, focus }; 12320 } 12321 /** 12322 * Finds a table and does an operation with it. 12323 * 12324 * @private 12325 * @param func - A function that does some operation on table information obtained by 12326 * {@link TableEditor#_findTable}. 12327 */ 12328 _withTable(options, func) { 12329 const info = this._findTable(options); 12330 if (info === void 0) { 12331 return; 12332 } 12333 return func(info); 12334 } 12335 /** 12336 * Updates lines in a given range in the text editor. 12337 * 12338 * @private 12339 * @param startRow - Start row index, starts from `0`. 12340 * @param endRow - End row index. 12341 * Lines from `startRow` to `endRow - 1` are replaced. 12342 * @param newLines - New lines. 12343 * @param [oldLines=undefined] - Old lines to be replaced. 12344 */ 12345 _updateLines(startRow, endRow, newLines, oldLines = void 0) { 12346 if (oldLines !== void 0) { 12347 const ses = (0, edit_script_1.shortestEditScript)(oldLines, newLines, 3); 12348 if (ses !== void 0) { 12349 (0, edit_script_1.applyEditScript)(this._textEditor, ses, startRow); 12350 return; 12351 } 12352 } 12353 this._textEditor.replaceLines(startRow, endRow, newLines); 12354 } 12355 /** 12356 * Moves the cursor position to the focused cell, 12357 * 12358 * @private 12359 * @param startRow - Row index where the table starts in the text editor. 12360 * @param table - A table. 12361 * @param focus - A focus to which the cursor will be moved. 12362 */ 12363 _moveToFocus(startRow, table, focus) { 12364 const pos = table.positionOfFocus(focus, startRow); 12365 if (pos !== void 0) { 12366 this._textEditor.setCursorPosition(pos); 12367 } 12368 } 12369 /** 12370 * Selects the focused cell. 12371 * If the cell has no content to be selected, then just moves the cursor position. 12372 * 12373 * @private 12374 * @param startRow - Row index where the table starts in the text editor. 12375 * @param table - A table. 12376 * @param focus - A focus to be selected. 12377 */ 12378 _selectFocus(startRow, table, focus) { 12379 const range = table.selectionRangeOfFocus(focus, startRow); 12380 if (range !== void 0) { 12381 this._textEditor.setSelectionRange(range); 12382 } else { 12383 this._moveToFocus(startRow, table, focus); 12384 } 12385 } 12386 /** 12387 * Formats the table under the cursor. 12388 */ 12389 format(options) { 12390 this.withCompletedTable(options, ({ range, lines, table, focus }) => { 12391 const newFocus = focus; 12392 this._textEditor.transact(() => { 12393 this._updateLines(range.start.row, range.end.row + 1, table.toLines(), lines); 12394 this._moveToFocus(range.start.row, table, newFocus); 12395 }); 12396 }); 12397 } 12398 /** 12399 * Formats and escapes from the table. 12400 */ 12401 escape(options) { 12402 this._withTable(options, ({ range, lines, table, focus }) => { 12403 const completed = (0, formatter_1.completeTable)(table, options); 12404 const formatted = (0, formatter_1.formatTable)(completed.table, options); 12405 const newRow = range.end.row + (completed.delimiterInserted ? 2 : 1); 12406 this._textEditor.transact(() => { 12407 this._updateLines(range.start.row, range.end.row + 1, formatted.table.toLines(), lines); 12408 let newPos; 12409 if (newRow > this._textEditor.getLastRow()) { 12410 this._textEditor.insertLine(newRow, ""); 12411 newPos = new point_1.Point(newRow, 0); 12412 } else { 12413 const re = new RegExp(`^${(0, parser_1.marginRegexSrc)(options.leftMarginChars)}`, "u"); 12414 const nextLine = this._textEditor.getLine(newRow); 12415 const margin = re.exec(nextLine)[0]; 12416 newPos = new point_1.Point(newRow, margin.length); 12417 } 12418 this._textEditor.setCursorPosition(newPos); 12419 }); 12420 this.resetSmartCursor(); 12421 }); 12422 } 12423 /** 12424 * Alters the alignment of the focused column. 12425 */ 12426 alignColumn(alignment, options) { 12427 this.withCompletedTable(options, ({ range, lines, table, focus }) => { 12428 let newFocus = focus; 12429 let altered = table; 12430 if (0 <= newFocus.column && newFocus.column <= altered.getHeaderWidth() - 1) { 12431 altered = (0, formatter_1.alterAlignment)(table, newFocus.column, alignment, options); 12432 } 12433 const formatted = (0, formatter_1.formatTable)(altered, options); 12434 newFocus = newFocus.setOffset((0, exports._computeNewOffset)(newFocus, table, formatted, false)); 12435 this._textEditor.transact(() => { 12436 this._updateLines(range.start.row, range.end.row + 1, formatted.table.toLines(), lines); 12437 this._moveToFocus(range.start.row, formatted.table, newFocus); 12438 }); 12439 }); 12440 } 12441 /** 12442 * Selects the focused cell content. 12443 */ 12444 selectCell(options) { 12445 this.withCompletedTable(options, ({ range, lines, table, focus }) => { 12446 const newFocus = focus; 12447 this._textEditor.transact(() => { 12448 this._updateLines(range.start.row, range.end.row + 1, table.toLines(), lines); 12449 this._selectFocus(range.start.row, table, newFocus); 12450 }); 12451 }); 12452 } 12453 /** 12454 * Moves the focus to another cell. 12455 * 12456 * @param rowOffset - Offset in row. 12457 * @param columnOffset - Offset in column. 12458 */ 12459 moveFocus(rowOffset, columnOffset, options) { 12460 this.withCompletedTable(options, ({ range, lines, table, focus }) => { 12461 let newFocus = focus; 12462 const startFocus = newFocus; 12463 if (rowOffset !== 0) { 12464 const height = table.getHeight(); 12465 const skip = newFocus.row < 1 && newFocus.row + rowOffset >= 1 ? 1 : newFocus.row > 1 && newFocus.row + rowOffset <= 1 ? -1 : 0; 12466 newFocus = newFocus.setRow(Math.min(Math.max(newFocus.row + rowOffset + skip, 0), height <= 2 ? 0 : height - 1)); 12467 } 12468 if (columnOffset !== 0) { 12469 const width = table.getHeaderWidth(); 12470 if (!(newFocus.column < 0 && columnOffset < 0) && !(newFocus.column > width - 1 && columnOffset > 0)) { 12471 newFocus = newFocus.setColumn(Math.min(Math.max(newFocus.column + columnOffset, 0), width - 1)); 12472 } 12473 } 12474 const moved = !newFocus.posEquals(startFocus); 12475 const formatted = (0, formatter_1.formatTable)(table, options); 12476 newFocus = newFocus.setOffset((0, exports._computeNewOffset)(newFocus, table, formatted, moved)); 12477 this._textEditor.transact(() => { 12478 this._updateLines(range.start.row, range.end.row + 1, formatted.table.toLines(), lines); 12479 if (moved) { 12480 this._selectFocus(range.start.row, formatted.table, newFocus); 12481 } else { 12482 this._moveToFocus(range.start.row, formatted.table, newFocus); 12483 } 12484 }); 12485 if (moved) { 12486 this.resetSmartCursor(); 12487 } 12488 }); 12489 } 12490 /** 12491 * Moves the focus to the next cell. 12492 */ 12493 nextCell(options) { 12494 this._withTable(options, ({ range, lines, table, focus }) => { 12495 const focusMoved = this._scTablePos !== void 0 && !range.start.equals(this._scTablePos) || this._scLastFocus !== void 0 && !focus.posEquals(this._scLastFocus); 12496 if (this._scActive && focusMoved) { 12497 this.resetSmartCursor(); 12498 } 12499 let newFocus = focus; 12500 const completed = (0, formatter_1.completeTable)(table, options); 12501 if (completed.delimiterInserted && newFocus.row > 0) { 12502 newFocus = newFocus.setRow(newFocus.row + 1); 12503 } 12504 const startFocus = newFocus; 12505 let altered = completed.table; 12506 if (newFocus.row === 1) { 12507 newFocus = newFocus.setRow(2); 12508 if (options.smartCursor) { 12509 if (newFocus.column < 0 || altered.getHeaderWidth() - 1 < newFocus.column) { 12510 newFocus = newFocus.setColumn(0); 12511 } 12512 } else { 12513 newFocus = newFocus.setColumn(0); 12514 } 12515 if (newFocus.row > altered.getHeight() - 1) { 12516 const row = new Array(altered.getHeaderWidth()).fill(new table_cell_1.TableCell("")); 12517 altered = (0, formatter_1.insertRow)(altered, altered.getHeight(), new table_row_1.TableRow(row, "", "")); 12518 } 12519 } else { 12520 if (newFocus.column > altered.getHeaderWidth() - 1) { 12521 const column = new Array(altered.getHeight() - 1).fill(new table_cell_1.TableCell("")); 12522 altered = (0, formatter_1.insertColumn)(altered, altered.getHeaderWidth(), column, options); 12523 } 12524 newFocus = newFocus.setColumn(newFocus.column + 1); 12525 } 12526 const formatted = (0, formatter_1.formatTable)(altered, options); 12527 newFocus = newFocus.setOffset((0, exports._computeNewOffset)(newFocus, altered, formatted, true)); 12528 const newLines = formatted.table.toLines(); 12529 if (newFocus.column > formatted.table.getHeaderWidth() - 1) { 12530 newLines[newFocus.row] += " "; 12531 newFocus = newFocus.setOffset(1); 12532 } 12533 this._textEditor.transact(() => { 12534 this._updateLines(range.start.row, range.end.row + 1, newLines, lines); 12535 this._selectFocus(range.start.row, formatted.table, newFocus); 12536 }); 12537 if (options.smartCursor) { 12538 if (!this._scActive) { 12539 this._scActive = true; 12540 this._scTablePos = range.start; 12541 if (startFocus.column < 0 || formatted.table.getHeaderWidth() - 1 < startFocus.column) { 12542 this._scStartFocus = new focus_1.Focus(startFocus.row, 0, 0); 12543 } else { 12544 this._scStartFocus = startFocus; 12545 } 12546 } 12547 this._scLastFocus = newFocus; 12548 } 12549 }); 12550 } 12551 /** 12552 * Moves the focus to the previous cell. 12553 */ 12554 previousCell(options) { 12555 this.withCompletedTable(options, ({ range, lines, table, focus }) => { 12556 let newFocus = focus; 12557 const startFocus = newFocus; 12558 if (newFocus.row === 0) { 12559 if (newFocus.column > 0) { 12560 newFocus = newFocus.setColumn(newFocus.column - 1); 12561 } 12562 } else if (newFocus.row === 1) { 12563 newFocus = new focus_1.Focus(0, table.getHeaderWidth() - 1, newFocus.offset); 12564 } else { 12565 if (newFocus.column > 0) { 12566 newFocus = newFocus.setColumn(newFocus.column - 1); 12567 } else { 12568 newFocus = new focus_1.Focus(newFocus.row === 2 ? 0 : newFocus.row - 1, table.getHeaderWidth() - 1, newFocus.offset); 12569 } 12570 } 12571 const moved = !newFocus.posEquals(startFocus); 12572 const formatted = (0, formatter_1.formatTable)(table, options); 12573 newFocus = newFocus.setOffset((0, exports._computeNewOffset)(newFocus, table, formatted, moved)); 12574 this._textEditor.transact(() => { 12575 this._updateLines(range.start.row, range.end.row + 1, formatted.table.toLines(), lines); 12576 if (moved) { 12577 this._selectFocus(range.start.row, formatted.table, newFocus); 12578 } else { 12579 this._moveToFocus(range.start.row, formatted.table, newFocus); 12580 } 12581 }); 12582 if (moved) { 12583 this.resetSmartCursor(); 12584 } 12585 }); 12586 } 12587 /** 12588 * Moves the focus to the next row. 12589 */ 12590 nextRow(options) { 12591 this._withTable(options, ({ range, lines, table, focus }) => { 12592 const focusMoved = this._scTablePos !== void 0 && !range.start.equals(this._scTablePos) || this._scLastFocus !== void 0 && !focus.posEquals(this._scLastFocus); 12593 if (this._scActive && focusMoved) { 12594 this.resetSmartCursor(); 12595 } 12596 let newFocus = focus; 12597 const completed = (0, formatter_1.completeTable)(table, options); 12598 if (completed.delimiterInserted && newFocus.row > 0) { 12599 newFocus = newFocus.setRow(newFocus.row + 1); 12600 } 12601 const startFocus = newFocus; 12602 let altered = completed.table; 12603 if (newFocus.row === 0) { 12604 newFocus = newFocus.setRow(2); 12605 } else { 12606 newFocus = newFocus.setRow(newFocus.row + 1); 12607 } 12608 if (options.smartCursor) { 12609 if (this._scActive && this._scStartFocus !== void 0) { 12610 newFocus = newFocus.setColumn(this._scStartFocus.column); 12611 } else if (newFocus.column < 0 || altered.getHeaderWidth() - 1 < newFocus.column) { 12612 newFocus = newFocus.setColumn(0); 12613 } 12614 } else { 12615 newFocus = newFocus.setColumn(0); 12616 } 12617 if (newFocus.row > altered.getHeight() - 1) { 12618 const row = new Array(altered.getHeaderWidth()).fill(new table_cell_1.TableCell("")); 12619 altered = (0, formatter_1.insertRow)(altered, altered.getHeight(), new table_row_1.TableRow(row, "", "")); 12620 } 12621 const formatted = (0, formatter_1.formatTable)(altered, options); 12622 newFocus = newFocus.setOffset((0, exports._computeNewOffset)(newFocus, altered, formatted, true)); 12623 this._textEditor.transact(() => { 12624 this._updateLines(range.start.row, range.end.row + 1, formatted.table.toLines(), lines); 12625 this._selectFocus(range.start.row, formatted.table, newFocus); 12626 }); 12627 if (options.smartCursor) { 12628 if (!this._scActive) { 12629 this._scActive = true; 12630 this._scTablePos = range.start; 12631 if (startFocus.column < 0 || formatted.table.getHeaderWidth() - 1 < startFocus.column) { 12632 this._scStartFocus = new focus_1.Focus(startFocus.row, 0, 0); 12633 } else { 12634 this._scStartFocus = startFocus; 12635 } 12636 } 12637 this._scLastFocus = newFocus; 12638 } 12639 }); 12640 } 12641 /** 12642 * Inserts an empty row at the current focus. 12643 */ 12644 insertRow(options) { 12645 this.withCompletedTable(options, ({ range, lines, formulaLines, table, focus }) => { 12646 let newFocus = focus; 12647 if (newFocus.row <= 1) { 12648 newFocus = newFocus.setRow(2); 12649 } 12650 newFocus = newFocus.setColumn(0); 12651 const row = new Array(table.getHeaderWidth()).fill(new table_cell_1.TableCell("")); 12652 const altered = (0, formatter_1.insertRow)(table, newFocus.row, new table_row_1.TableRow(row, "", "")); 12653 this.formatAndApply(options, range, lines, formulaLines, altered, newFocus); 12654 }); 12655 } 12656 /** 12657 * Deletes a row at the current focus. 12658 */ 12659 deleteRow(options) { 12660 this.withCompletedTable(options, ({ range, lines, formulaLines, table, focus }) => { 12661 let newFocus = focus; 12662 let altered = table; 12663 let moved = false; 12664 if (newFocus.row !== 1) { 12665 altered = (0, formatter_1.deleteRow)(altered, newFocus.row); 12666 moved = true; 12667 if (newFocus.row > altered.getHeight() - 1) { 12668 newFocus = newFocus.setRow(newFocus.row === 2 ? 0 : newFocus.row - 1); 12669 } 12670 } 12671 this.formatAndApply(options, range, lines, formulaLines, altered, newFocus, moved); 12672 }); 12673 } 12674 /** 12675 * Moves the focused row by the specified offset. 12676 * 12677 * @param offset - An offset the row is moved by. 12678 */ 12679 moveRow(offset, options) { 12680 this.withCompletedTable(options, ({ range, lines, formulaLines, table, focus }) => { 12681 let newFocus = focus; 12682 let altered = table; 12683 if (newFocus.row > 1) { 12684 const dest = Math.min(Math.max(newFocus.row + offset, 2), altered.getHeight() - 1); 12685 altered = (0, formatter_1.moveRow)(altered, newFocus.row, dest); 12686 newFocus = newFocus.setRow(dest); 12687 } 12688 this.formatAndApply(options, range, lines, formulaLines, altered, newFocus); 12689 }); 12690 } 12691 evaluateFormulas(options) { 12692 return this.withCompletedTable(options, ({ range, lines, formulaLines, table, focus }) => { 12693 const result = table.applyFormulas(formulaLines); 12694 if (result.isErr()) { 12695 return result.error; 12696 } 12697 const { table: formattedTable, focus: newFocus } = this.formatAndApply(options, range, lines, formulaLines, result.value, focus, false); 12698 }); 12699 } 12700 /** 12701 * Transpose rows and columns of a table by inverting the X and Y axis values. 12702 * @param options 12703 */ 12704 transpose(options) { 12705 this.withCompletedTable(options, ({ range, lines, formulaLines, table, focus }) => { 12706 var _a, _b, _c, _d, _e, _f, _g, _h; 12707 const width = table.getWidth(); 12708 const height = table.getHeight(); 12709 const newRows = new Array(width + 1); 12710 for (let x = 0; x < width + 1; ++x) { 12711 if (x === 0) { 12712 const newRow = new Array(height - 1); 12713 for (let y = 0; y < height; ++y) { 12714 if (y === 0) { 12715 const s = (_b = (_a = table.getCellAt(y, x)) === null || _a === void 0 ? void 0 : _a.content) !== null && _b !== void 0 ? _b : ""; 12716 newRow[y] = new table_cell_1.TableCell(s); 12717 } else if (y === 1) { 12718 continue; 12719 } else if (y > 1) { 12720 const s = (_d = (_c = table.getCellAt(y, x)) === null || _c === void 0 ? void 0 : _c.content) !== null && _d !== void 0 ? _d : ""; 12721 newRow[y - 1] = new table_cell_1.TableCell(s); 12722 } 12723 } 12724 newRows[x] = new table_row_1.TableRow(newRow, "", ""); 12725 } else if (x === 1) { 12726 const newRow = new Array(height - 1); 12727 for (let i = 0; i < height - 1; ++i) { 12728 newRow[i] = new table_cell_1.TableCell(" --- "); 12729 } 12730 newRows[x] = new table_row_1.TableRow(newRow, "", ""); 12731 continue; 12732 } else if (x > 1) { 12733 const newRow = new Array(height - 1); 12734 for (let y = 0; y < height; ++y) { 12735 if (y === 0) { 12736 const s = (_f = (_e = table.getCellAt(y, x - 1)) === null || _e === void 0 ? void 0 : _e.content) !== null && _f !== void 0 ? _f : ""; 12737 newRow[y] = new table_cell_1.TableCell(s); 12738 } else if (y === 1) { 12739 continue; 12740 } else if (y > 1) { 12741 const s = (_h = (_g = table.getCellAt(y, x - 1)) === null || _g === void 0 ? void 0 : _g.content) !== null && _h !== void 0 ? _h : ""; 12742 newRow[y - 1] = new table_cell_1.TableCell(s); 12743 } 12744 } 12745 newRows[x] = new table_row_1.TableRow(newRow, "", ""); 12746 } 12747 } 12748 const newTable = new table_1.Table(newRows); 12749 const { table: formattedTable, focus: newFocus } = this.formatAndApply(options, range, lines, formulaLines, newTable, focus, true); 12750 this._moveToFocus(range.start.row, formattedTable, newFocus); 12751 }); 12752 } 12753 /** 12754 * Sorts rows alphanumerically using the column at the current focus. 12755 * If all cells in the sorting column are numbers, the column is sorted 12756 * numerically. 12757 */ 12758 sortRows(sortOrder, options) { 12759 this.withCompletedTable(options, ({ range, lines, formulaLines, table, focus }) => { 12760 const bodyRows = table.getRows().slice(2); 12761 const isNumber = (s) => /^\s*[-+]?((\d+(\.\d+)?)|(\d+\.)|(\.\d+))([eE][-+]?\d+)?\s*$/.test(s); 12762 const notAllNums = bodyRows.map((row) => { 12763 var _a; 12764 return (_a = row.getCellAt(focus.column)) === null || _a === void 0 ? void 0 : _a.content; 12765 }).some((cell) => cell !== void 0 && cell !== "" && !isNumber(cell)); 12766 bodyRows.sort((rowA, rowB) => { 12767 const cellA = rowA.getCellAt(focus.column); 12768 const cellB = rowB.getCellAt(focus.column); 12769 if (cellA === void 0 || cellA.content === "") { 12770 if (cellB === void 0 || cellB.content === "") { 12771 return 0; 12772 } 12773 return -1; 12774 } else if (cellB === void 0 || cellB.content === "") { 12775 return 1; 12776 } 12777 const contentA = notAllNums ? cellA.content.replace(/[*~_$]/g, "") : parseFloat(cellA.content); 12778 const contentB = notAllNums ? cellB.content.replace(/[*~_$]/g, "") : parseFloat(cellB.content); 12779 if (contentA === contentB) { 12780 return 0; 12781 } else if (contentA === void 0) { 12782 return -1; 12783 } else if (contentB === void 0) { 12784 return 1; 12785 } 12786 return contentA < contentB ? -1 : 1; 12787 }); 12788 if (sortOrder === SortOrder2.Descending) { 12789 bodyRows.reverse(); 12790 } 12791 const allRows = table.getRows().slice(0, 2).concat(bodyRows); 12792 const newTable = new table_1.Table(allRows); 12793 const { table: formattedTable, focus: newFocus } = this.formatAndApply(options, range, lines, formulaLines, newTable, focus, true); 12794 this._moveToFocus(range.start.row, formattedTable, newFocus); 12795 }); 12796 } 12797 /** 12798 * Inserts an empty column at the current focus. 12799 */ 12800 insertColumn(options) { 12801 this.withCompletedTable(options, ({ range, lines, formulaLines, table, focus }) => { 12802 let newFocus = focus; 12803 if (newFocus.row === 1) { 12804 newFocus = newFocus.setRow(0); 12805 } 12806 if (newFocus.column < 0) { 12807 newFocus = newFocus.setColumn(0); 12808 } 12809 const column = new Array(table.getHeight() - 1).fill(new table_cell_1.TableCell("")); 12810 const altered = (0, formatter_1.insertColumn)(table, newFocus.column, column, options); 12811 this.formatAndApply(options, range, lines, formulaLines, altered, newFocus); 12812 }); 12813 } 12814 /** 12815 * Deletes a column at the current focus. 12816 */ 12817 deleteColumn(options) { 12818 this.withCompletedTable(options, ({ range, lines, formulaLines, table, focus }) => { 12819 let newFocus = focus; 12820 if (newFocus.row === 1) { 12821 newFocus = newFocus.setRow(0); 12822 } 12823 let altered = table; 12824 let moved = false; 12825 if (0 <= newFocus.column && newFocus.column <= altered.getHeaderWidth() - 1) { 12826 altered = (0, formatter_1.deleteColumn)(table, newFocus.column, options); 12827 moved = true; 12828 if (newFocus.column > altered.getHeaderWidth() - 1) { 12829 newFocus = newFocus.setColumn(altered.getHeaderWidth() - 1); 12830 } 12831 } 12832 this.formatAndApply(options, range, lines, formulaLines, altered, newFocus, moved); 12833 }); 12834 } 12835 /** 12836 * Moves the focused column by the specified offset. 12837 * 12838 * @param offset - An offset the column is moved by. 12839 */ 12840 moveColumn(offset, options) { 12841 this.withCompletedTable(options, ({ range, lines, formulaLines, table, focus }) => { 12842 let newFocus = focus; 12843 let altered = table; 12844 if (0 <= newFocus.column && newFocus.column <= altered.getHeaderWidth() - 1) { 12845 const dest = Math.min(Math.max(newFocus.column + offset, 0), altered.getHeaderWidth() - 1); 12846 altered = (0, formatter_1.moveColumn)(altered, newFocus.column, dest); 12847 newFocus = newFocus.setColumn(dest); 12848 } 12849 this.formatAndApply(options, range, lines, formulaLines, altered, newFocus); 12850 }); 12851 } 12852 /** 12853 * Formats all the tables in the text editor. 12854 */ 12855 formatAll(options) { 12856 this._textEditor.transact(() => { 12857 const re = (0, exports._createIsTableRowRegex)(options.leftMarginChars); 12858 let pos = this._textEditor.getCursorPosition(); 12859 let lines = []; 12860 let startRow = void 0; 12861 let lastRow = this._textEditor.getLastRow(); 12862 for (let row = 0; row <= lastRow; row++) { 12863 const line = this._textEditor.getLine(row); 12864 if (this._textEditor.acceptsTableEdit(row) && re.test(line)) { 12865 lines.push(line); 12866 if (startRow === void 0) { 12867 startRow = row; 12868 } 12869 } else if (startRow !== void 0) { 12870 const endRow = row - 1; 12871 const range = new range_1.Range(new point_1.Point(startRow, 0), new point_1.Point(endRow, lines[lines.length - 1].length)); 12872 const table = (0, parser_1.readTable)(lines, options); 12873 const focus = table.focusOfPosition(pos, startRow); 12874 let diff; 12875 if (focus !== void 0) { 12876 let newFocus = focus; 12877 const completed = (0, formatter_1.completeTable)(table, options); 12878 if (completed.delimiterInserted && newFocus.row > 0) { 12879 newFocus = newFocus.setRow(newFocus.row + 1); 12880 } 12881 const formatted = (0, formatter_1.formatTable)(completed.table, options); 12882 newFocus = newFocus.setOffset((0, exports._computeNewOffset)(newFocus, completed.table, formatted, false)); 12883 const newLines = formatted.table.toLines(); 12884 this._updateLines(range.start.row, range.end.row + 1, newLines, lines); 12885 diff = newLines.length - lines.length; 12886 pos = formatted.table.positionOfFocus(newFocus, startRow); 12887 } else { 12888 const completed = (0, formatter_1.completeTable)(table, options); 12889 const formatted = (0, formatter_1.formatTable)(completed.table, options); 12890 const newLines = formatted.table.toLines(); 12891 this._updateLines(range.start.row, range.end.row + 1, newLines, lines); 12892 diff = newLines.length - lines.length; 12893 if (pos.row > endRow) { 12894 pos = new point_1.Point(pos.row + diff, pos.column); 12895 } 12896 } 12897 lines = []; 12898 startRow = void 0; 12899 lastRow += diff; 12900 row += diff; 12901 } 12902 } 12903 if (startRow !== void 0) { 12904 const endRow = lastRow; 12905 const range = new range_1.Range(new point_1.Point(startRow, 0), new point_1.Point(endRow, lines[lines.length - 1].length)); 12906 const table = (0, parser_1.readTable)(lines, options); 12907 const focus = table.focusOfPosition(pos, startRow); 12908 let newFocus = focus; 12909 const completed = (0, formatter_1.completeTable)(table, options); 12910 if (completed.delimiterInserted && newFocus.row > 0) { 12911 newFocus = newFocus.setRow(newFocus.row + 1); 12912 } 12913 const formatted = (0, formatter_1.formatTable)(completed.table, options); 12914 newFocus = newFocus.setOffset( 12915 // @ts-expect-error TODO 12916 (0, exports._computeNewOffset)(newFocus, completed.table, formatted, false) 12917 ); 12918 const newLines = formatted.table.toLines(); 12919 this._updateLines(range.start.row, range.end.row + 1, newLines, lines); 12920 pos = formatted.table.positionOfFocus(newFocus, startRow); 12921 } 12922 this._textEditor.setCursorPosition(pos); 12923 }); 12924 } 12925 /** 12926 * Exports the table as a two dimensional string array 12927 */ 12928 exportTable(withtHeaders, options) { 12929 return this.withCompletedTable(options, ({ range, lines, formulaLines, table, focus }) => { 12930 const bodyRows = table.getRows(); 12931 if (bodyRows.length > 0 && !withtHeaders) { 12932 bodyRows.splice(0, 2); 12933 } 12934 return bodyRows.map((row) => row.getCells().map((cell) => cell.content)); 12935 }); 12936 } 12937 /** 12938 * Exports the table as a two dimensional string array 12939 */ 12940 exportCSV(withtHeaders, options) { 12941 const r = this.exportTable(withtHeaders, options); 12942 return !r ? void 0 : r.map((row) => row.join(" ")).join("\n"); 12943 } 12944 /** 12945 * Finds a table, completes it, then does an operation with it. 12946 * 12947 * @param func - A function that does some operation on table information obtained by 12948 * {@link TableEditor#_findTable}. 12949 */ 12950 withCompletedTable(options, func) { 12951 return this._withTable(options, (tableInfo) => { 12952 let newFocus = tableInfo.focus; 12953 const completed = (0, formatter_1.completeTable)(tableInfo.table, options); 12954 if (completed.delimiterInserted && newFocus.row > 0) { 12955 newFocus = newFocus.setRow(newFocus.row + 1); 12956 } 12957 const formatted = (0, formatter_1.formatTable)(completed.table, options); 12958 newFocus = newFocus.setOffset((0, exports._computeNewOffset)(newFocus, completed.table, formatted, false)); 12959 tableInfo.table = formatted.table; 12960 tableInfo.focus = newFocus; 12961 return func(tableInfo); 12962 }); 12963 } 12964 /** 12965 * Formats the table and applies any changes based on the difference between 12966 * originalLines and the newTable. Should generally be the last function call 12967 * in a TableEditor function. 12968 */ 12969 formatAndApply(options, range, originalLines, formulaLines, newTable, newFocus, moved = false) { 12970 const formatted = (0, formatter_1.formatTable)(newTable, options); 12971 newFocus = newFocus.setOffset((0, exports._computeNewOffset)(newFocus, newTable, formatted, moved)); 12972 this._textEditor.transact(() => { 12973 this._updateLines(range.start.row, range.end.row + 1, formatted.table.toLines(), originalLines); 12974 if (moved) { 12975 this._selectFocus(range.start.row, formatted.table, newFocus); 12976 } else { 12977 this._moveToFocus(range.start.row, formatted.table, newFocus); 12978 } 12979 }); 12980 this.resetSmartCursor(); 12981 return { 12982 range, 12983 lines: originalLines, 12984 formulaLines, 12985 table: formatted.table, 12986 focus: newFocus 12987 }; 12988 } 12989 }; 12990 exports.TableEditor = TableEditor2; 12991 } 12992 }); 12993 12994 // node_modules/@tgrosinger/md-advanced-tables/lib/index.js 12995 var require_lib2 = __commonJS({ 12996 "node_modules/@tgrosinger/md-advanced-tables/lib/index.js"(exports) { 12997 "use strict"; 12998 Object.defineProperty(exports, "__esModule", { value: true }); 12999 exports.SortOrder = exports.TableEditor = exports.optionsWithDefaults = exports.defaultOptions = exports.ITextEditor = exports.shortestEditScript = exports.applyEditScript = exports.Delete = exports.Insert = exports.moveColumn = exports.deleteColumn = exports.insertColumn = exports.moveRow = exports.deleteRow = exports.insertRow = exports.alterAlignment = exports.formatTable = exports.completeTable = exports.FormatType = exports.readTable = exports.Table = exports.TableRow = exports.TableCell = exports.HeaderAlignment = exports.DefaultAlignment = exports.Alignment = exports.Focus = exports.Range = exports.Point = void 0; 13000 var point_1 = require_point(); 13001 Object.defineProperty(exports, "Point", { enumerable: true, get: function() { 13002 return point_1.Point; 13003 } }); 13004 var range_1 = require_range(); 13005 Object.defineProperty(exports, "Range", { enumerable: true, get: function() { 13006 return range_1.Range; 13007 } }); 13008 var focus_1 = require_focus(); 13009 Object.defineProperty(exports, "Focus", { enumerable: true, get: function() { 13010 return focus_1.Focus; 13011 } }); 13012 var alignment_1 = require_alignment(); 13013 Object.defineProperty(exports, "Alignment", { enumerable: true, get: function() { 13014 return alignment_1.Alignment; 13015 } }); 13016 Object.defineProperty(exports, "DefaultAlignment", { enumerable: true, get: function() { 13017 return alignment_1.DefaultAlignment; 13018 } }); 13019 Object.defineProperty(exports, "HeaderAlignment", { enumerable: true, get: function() { 13020 return alignment_1.HeaderAlignment; 13021 } }); 13022 var table_cell_1 = require_table_cell(); 13023 Object.defineProperty(exports, "TableCell", { enumerable: true, get: function() { 13024 return table_cell_1.TableCell; 13025 } }); 13026 var table_row_1 = require_table_row(); 13027 Object.defineProperty(exports, "TableRow", { enumerable: true, get: function() { 13028 return table_row_1.TableRow; 13029 } }); 13030 var table_1 = require_table(); 13031 Object.defineProperty(exports, "Table", { enumerable: true, get: function() { 13032 return table_1.Table; 13033 } }); 13034 var parser_1 = require_parser(); 13035 Object.defineProperty(exports, "readTable", { enumerable: true, get: function() { 13036 return parser_1.readTable; 13037 } }); 13038 var formatter_js_1 = require_formatter(); 13039 Object.defineProperty(exports, "FormatType", { enumerable: true, get: function() { 13040 return formatter_js_1.FormatType; 13041 } }); 13042 Object.defineProperty(exports, "completeTable", { enumerable: true, get: function() { 13043 return formatter_js_1.completeTable; 13044 } }); 13045 Object.defineProperty(exports, "formatTable", { enumerable: true, get: function() { 13046 return formatter_js_1.formatTable; 13047 } }); 13048 Object.defineProperty(exports, "alterAlignment", { enumerable: true, get: function() { 13049 return formatter_js_1.alterAlignment; 13050 } }); 13051 Object.defineProperty(exports, "insertRow", { enumerable: true, get: function() { 13052 return formatter_js_1.insertRow; 13053 } }); 13054 Object.defineProperty(exports, "deleteRow", { enumerable: true, get: function() { 13055 return formatter_js_1.deleteRow; 13056 } }); 13057 Object.defineProperty(exports, "moveRow", { enumerable: true, get: function() { 13058 return formatter_js_1.moveRow; 13059 } }); 13060 Object.defineProperty(exports, "insertColumn", { enumerable: true, get: function() { 13061 return formatter_js_1.insertColumn; 13062 } }); 13063 Object.defineProperty(exports, "deleteColumn", { enumerable: true, get: function() { 13064 return formatter_js_1.deleteColumn; 13065 } }); 13066 Object.defineProperty(exports, "moveColumn", { enumerable: true, get: function() { 13067 return formatter_js_1.moveColumn; 13068 } }); 13069 var edit_script_1 = require_edit_script(); 13070 Object.defineProperty(exports, "Insert", { enumerable: true, get: function() { 13071 return edit_script_1.Insert; 13072 } }); 13073 Object.defineProperty(exports, "Delete", { enumerable: true, get: function() { 13074 return edit_script_1.Delete; 13075 } }); 13076 Object.defineProperty(exports, "applyEditScript", { enumerable: true, get: function() { 13077 return edit_script_1.applyEditScript; 13078 } }); 13079 Object.defineProperty(exports, "shortestEditScript", { enumerable: true, get: function() { 13080 return edit_script_1.shortestEditScript; 13081 } }); 13082 var text_editor_1 = require_text_editor(); 13083 Object.defineProperty(exports, "ITextEditor", { enumerable: true, get: function() { 13084 return text_editor_1.ITextEditor; 13085 } }); 13086 var options_1 = require_options(); 13087 Object.defineProperty(exports, "defaultOptions", { enumerable: true, get: function() { 13088 return options_1.defaultOptions; 13089 } }); 13090 Object.defineProperty(exports, "optionsWithDefaults", { enumerable: true, get: function() { 13091 return options_1.optionsWithDefaults; 13092 } }); 13093 var table_editor_1 = require_table_editor(); 13094 Object.defineProperty(exports, "TableEditor", { enumerable: true, get: function() { 13095 return table_editor_1.TableEditor; 13096 } }); 13097 Object.defineProperty(exports, "SortOrder", { enumerable: true, get: function() { 13098 return table_editor_1.SortOrder; 13099 } }); 13100 } 13101 }); 13102 13103 // src/main.ts 13104 var main_exports = {}; 13105 __export(main_exports, { 13106 default: () => TableEditorPlugin 13107 }); 13108 module.exports = __toCommonJS(main_exports); 13109 13110 // src/icons.ts 13111 var import_obsidian = require("obsidian"); 13112 var icons = { 13113 spreadsheet: ` 13114 <svg version="1.1" viewBox="0 0 482.81 482.81" xmlns="http://www.w3.org/2000/svg"> 13115 <path fill="currentColor" d="m457.58 25.464-432.83 0.42151c-13.658 0.013314-24.758 11.115-24.757 24.757l0.031024 347.45c7.4833e-4 8.3808 4.211 15.772 10.608 20.259 3.4533 2.4499 5.0716 3.2901 8.879 3.9022 1.7033 0.37333 3.4561 0.59471 5.2692 0.59294l432.84-0.42151c1.809-1e-3 3.5618-0.21823 5.2568-0.59294h1.2174v-0.37196c10.505-2.8727 18.279-12.397 18.278-23.788l-0.031-347.43c1e-3 -13.649-11.107-24.763-24.768-24.763zm3.5453 24.763v71.344h-163.31v-74.886h159.76c1.9641 0.0014 3.5467 1.5922 3.5467 3.5425zm-1.6737 350.37h-161.6v-67.207h163.31v64.268c1e-3 1.2572-0.70549 2.321-1.7033 2.9386zm-438.21-2.5171v-64.268h76.646v67.207h-74.942c-0.99784-0.61765-1.7033-1.6814-1.7033-2.9386zm255.28-155.18v69.688h-157.42v-69.688zm0 90.913v67.207h-157.42v-67.207zm-0.031-211.83h-157.42v-74.886h157.42zm0 21.226v77.826h-157.42v-77.826zm-178.64 77.826h-76.646v-77.826h76.646zm0.03102 21.862v69.688h-76.646v-69.688zm199.95 69.268v-69.697h163.31v69.697zm-0.031-91.552v-77.826h163.31v77.826z" stroke-width="1.3725"/> 13116 </svg>`, 13117 alignLeft: ` 13118 <svg class="widget-icon" enable-background="new 0 0 512 512" version="1.1" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"> 13119 <g transform="matrix(-1 0 0 1 512 0)"> 13120 <path d="m501.33 170.67h-320c-5.896 0-10.667 4.771-10.667 10.667v21.333c0 5.896 4.771 10.667 10.667 10.667h320c5.896 0 10.667-4.771 10.667-10.667v-21.333c0-5.896-4.771-10.667-10.667-10.667z"/> 13121 <path d="m501.33 298.67h-490.67c-5.896 0-10.667 4.771-10.667 10.666v21.333c0 5.896 4.771 10.667 10.667 10.667h490.67c5.896 0 10.667-4.771 10.667-10.667v-21.333c-1e-3 -5.895-4.772-10.666-10.668-10.666z"/> 13122 <path d="m501.33 426.67h-320c-5.896 0-10.667 4.771-10.667 10.667v21.333c0 5.896 4.771 10.667 10.667 10.667h320c5.896 0 10.667-4.771 10.667-10.667v-21.333c0-5.896-4.771-10.667-10.667-10.667z"/> 13123 <path d="m501.33 42.667h-490.67c-5.896 0-10.667 4.771-10.667 10.666v21.333c0 5.896 4.771 10.667 10.667 10.667h490.67c5.896 0 10.667-4.771 10.667-10.667v-21.333c-1e-3 -5.895-4.772-10.666-10.668-10.666z"/> 13124 </g> 13125 </svg>`, 13126 alignCenter: ` 13127 <svg class="widget-icon" enable-background="new 0 0 512 512" version="1.1" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"> 13128 <g transform="matrix(-1 0 0 1 512 0)"> 13129 <path d="m416 170.67h-320c-5.896 0-10.667 4.771-10.667 10.667v21.333c0 5.896 4.771 10.667 10.667 10.667h320c5.896 0 10.667-4.771 10.667-10.667v-21.333c0-5.896-4.771-10.667-10.667-10.667z"/> 13130 <path d="m501.33 298.67h-490.67c-5.896 0-10.667 4.771-10.667 10.666v21.333c0 5.896 4.771 10.667 10.667 10.667h490.67c5.896 0 10.667-4.771 10.667-10.667v-21.333c-1e-3 -5.895-4.772-10.666-10.668-10.666z"/> 13131 <path d="m416 426.67h-320c-5.896 0-10.667 4.771-10.667 10.667v21.333c0 5.896 4.771 10.667 10.667 10.667h320c5.896 0 10.667-4.771 10.667-10.667v-21.333c0-5.896-4.771-10.667-10.667-10.667z"/> 13132 <path d="m501.33 42.667h-490.67c-5.896 0-10.667 4.771-10.667 10.666v21.333c0 5.896 4.771 10.667 10.667 10.667h490.67c5.896 0 10.667-4.771 10.667-10.667v-21.333c-1e-3 -5.895-4.772-10.666-10.668-10.666z"/> 13133 </g> 13134 </svg>`, 13135 alignRight: ` 13136 <svg class="widget-icon" enable-background="new 0 0 512 512" version="1.1" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"> 13137 <path d="m501.33 170.67h-320c-5.896 0-10.667 4.771-10.667 10.667v21.333c0 5.896 4.771 10.667 10.667 10.667h320c5.896 0 10.667-4.771 10.667-10.667v-21.333c0-5.896-4.771-10.667-10.667-10.667z"/> 13138 <path d="m501.33 298.67h-490.67c-5.896 0-10.667 4.771-10.667 10.666v21.333c0 5.896 4.771 10.667 10.667 10.667h490.67c5.896 0 10.667-4.771 10.667-10.667v-21.333c-1e-3 -5.895-4.772-10.666-10.668-10.666z"/> 13139 <path d="m501.33 426.67h-320c-5.896 0-10.667 4.771-10.667 10.667v21.333c0 5.896 4.771 10.667 10.667 10.667h320c5.896 0 10.667-4.771 10.667-10.667v-21.333c0-5.896-4.771-10.667-10.667-10.667z"/> 13140 <path d="m501.33 42.667h-490.67c-5.896 0-10.667 4.771-10.667 10.666v21.333c0 5.896 4.771 10.667 10.667 10.667h490.67c5.896 0 10.667-4.771 10.667-10.667v-21.333c-1e-3 -5.895-4.772-10.666-10.668-10.666z"/> 13141 </svg>`, 13142 deleteColumn: ` 13143 <svg class="widget-icon" enable-background="new 0 0 26 26" version="1.1" viewBox="0 0 26 26" xmlns="http://www.w3.org/2000/svg"> 13144 <path d="m13.594 20.85v3.15h-10v-22h10v3.15c0.633-0.323 1.304-0.565 2-0.727v-3.423c0-0.551-0.448-1-1-1h-12c-0.55 0-1 0.449-1 1v24c0 0.551 0.449 1 1 1h12c0.552 0 1-0.449 1-1v-3.424c-0.696-0.161-1.367-0.403-2-0.726z"/> 13145 <path d="m17.594 6.188c-3.762 0-6.813 3.051-6.812 6.813-1e-3 3.761 3.05 6.812 6.812 6.812s6.813-3.051 6.813-6.813-3.052-6.812-6.813-6.812zm3.632 7.802-7.267 1e-3v-1.982h7.268l-1e-3 1.981z"/> 13146 </svg>`, 13147 deleteRow: ` 13148 <svg class="widget-icon" enable-background="new 0 0 15.381 15.381" version="1.1" viewBox="0 0 15.381 15.381" xmlns="http://www.w3.org/2000/svg"> 13149 <path d="M0,1.732v7.732h6.053c0-0.035-0.004-0.07-0.004-0.104c0-0.434,0.061-0.854,0.165-1.255H1.36V3.092 h12.662v2.192c0.546,0.396,1.01,0.897,1.359,1.477V1.732H0z"/> 13150 <path d="m11.196 5.28c-2.307 0-4.183 1.877-4.183 4.184 0 2.308 1.876 4.185 4.183 4.185 2.309 0 4.185-1.877 4.185-4.185 0-2.307-1.876-4.184-4.185-4.184zm0 7.233c-1.679 0-3.047-1.367-3.047-3.049 0-1.68 1.368-3.049 3.047-3.049 1.684 0 3.05 1.369 3.05 3.049 0 1.682-1.366 3.049-3.05 3.049z"/> 13151 <rect x="9.312" y="8.759" width="3.844" height="1.104"/> 13152 </svg>`, 13153 insertColumn: ` 13154 <svg class="widget-icon" version="1.1" viewBox="-21 0 512 512" xmlns="http://www.w3.org/2000/svg"> 13155 <path d="m288 106.67c-3.9258 0-7.8516-1.4297-10.922-4.3125l-80-74.664c-4.8008-4.4805-6.3789-11.457-3.9688-17.559 2.4102-6.1016 8.3203-10.133 14.891-10.133h160c6.5703 0 12.48 4.0117 14.891 10.133 2.4102 6.125 0.83203 13.078-3.9688 17.559l-80 74.664c-3.0703 2.8828-6.9961 4.3125-10.922 4.3125zm-39.402-74.668 39.402 36.777 39.402-36.777z"/> 13156 <path d="m432 512h-53.332c-20.59 0-37.336-16.746-37.336-37.332v-330.67c0-20.586 16.746-37.332 37.336-37.332h53.332c20.586 0 37.332 16.746 37.332 37.332v330.67c0 20.586-16.746 37.332-37.332 37.332zm-53.332-373.33c-2.9453 0-5.3359 2.3867-5.3359 5.332v330.67c0 2.9414 2.3906 5.332 5.3359 5.332h53.332c2.9453 0 5.332-2.3906 5.332-5.332v-330.67c0-2.9453-2.3867-5.332-5.332-5.332z"/> 13157 <path d="m197.33 512h-160c-20.586 0-37.332-16.746-37.332-37.332v-330.67c0-20.586 16.746-37.332 37.332-37.332h160c20.59 0 37.336 16.746 37.336 37.332v330.67c0 20.586-16.746 37.332-37.336 37.332zm-160-373.33c-2.9414 0-5.332 2.3867-5.332 5.332v330.67c0 2.9414 2.3906 5.332 5.332 5.332h160c2.9453 0 5.3359-2.3906 5.3359-5.332v-330.67c0-2.9453-2.3906-5.332-5.3359-5.332z"/> 13158 <path d="m453.33 325.33h-96c-8.832 0-16-7.168-16-16s7.168-16 16-16h96c8.832 0 16 7.168 16 16s-7.168 16-16 16z"/> 13159 <path d="m218.67 325.33h-202.67c-8.832 0-16-7.168-16-16s7.168-16 16-16h202.67c8.832 0 16 7.168 16 16s-7.168 16-16 16z"/> 13160 <path d="m117.33 512c-8.832 0-16-7.168-16-16v-373.33c0-8.832 7.168-16 16-16s16 7.168 16 16v373.33c0 8.832-7.168 16-16 16z"/> 13161 </svg>`, 13162 insertRow: ` 13163 <svg class="widget-icon" version="1.1" viewBox="0 -21 512 512" xmlns="http://www.w3.org/2000/svg"> 13164 <path d="m16 277.33c-1.9844 0-3.9688-0.36328-5.8672-1.1094-6.1211-2.4102-10.133-8.3203-10.133-14.891v-160c0-6.5703 4.0117-12.48 10.133-14.891 6.1445-2.4102 13.078-0.85156 17.559 3.9688l74.664 80c5.7617 6.1445 5.7617 15.68 0 21.824l-74.664 80c-3.0938 3.3281-7.3398 5.0977-11.691 5.0977zm16-135.4v78.805l36.777-39.402z"/> 13165 <path d="m474.67 128h-330.67c-20.586 0-37.332-16.746-37.332-37.332v-53.336c0-20.586 16.746-37.332 37.332-37.332h330.67c20.586 0 37.332 16.746 37.332 37.332v53.336c0 20.586-16.746 37.332-37.332 37.332zm-330.67-96c-2.9453 0-5.332 2.3906-5.332 5.332v53.336c0 2.9414 2.3867 5.332 5.332 5.332h330.67c2.9414 0 5.332-2.3906 5.332-5.332v-53.336c0-2.9414-2.3906-5.332-5.332-5.332z"/> 13166 <path d="m474.67 469.33h-330.67c-20.586 0-37.332-16.746-37.332-37.332v-160c0-20.586 16.746-37.332 37.332-37.332h330.67c20.586 0 37.332 16.746 37.332 37.332v160c0 20.586-16.746 37.332-37.332 37.332zm-330.67-202.66c-2.9453 0-5.332 2.3867-5.332 5.332v160c0 2.9453 2.3867 5.332 5.332 5.332h330.67c2.9414 0 5.332-2.3867 5.332-5.332v-160c0-2.9453-2.3906-5.332-5.332-5.332z"/> 13167 <path d="m309.33 128c-8.832 0-16-7.168-16-16v-96c0-8.832 7.168-16 16-16s16 7.168 16 16v96c0 8.832-7.168 16-16 16z"/> 13168 <path d="m309.33 469.33c-8.832 0-16-7.168-16-16v-202.66c0-8.832 7.168-16 16-16s16 7.168 16 16v202.66c0 8.832-7.168 16-16 16z"/> 13169 <path d="m496 368h-373.33c-8.832 0-16-7.168-16-16s7.168-16 16-16h373.33c8.832 0 16 7.168 16 16s-7.168 16-16 16z"/> 13170 </svg>`, 13171 moveColumnLeft: ` 13172 <svg class="widget-icon" version="1.1" viewBox="0 0 512.02 512" xmlns="http://www.w3.org/2000/svg"> 13173 <path d="m357.35 512.01h96c32.363 0 58.668-26.305 58.668-58.668v-394.66c0-32.363-26.305-58.668-58.668-58.668h-96c-32.363 0-58.664 26.305-58.664 58.668v394.66c0 32.363 26.301 58.668 58.664 58.668zm96-480c14.699 0 26.668 11.969 26.668 26.668v394.66c0 14.699-11.969 26.668-26.668 26.668h-96c-14.699 0-26.664-11.969-26.664-26.668v-394.66c0-14.699 11.965-26.668 26.664-26.668z"/> 13174 <path d="m16.016 272.01h224c8.832 0 16-7.168 16-16s-7.168-16-16-16h-224c-8.832 0-16 7.168-16 16s7.168 16 16 16z"/> 13175 <path d="m101.35 357.34c4.0976 0 8.1914-1.5547 11.309-4.6914 6.25-6.25 6.25-16.383 0-22.637l-74.027-74.023 74.027-74.027c6.25-6.25 6.25-16.387 0-22.637s-16.383-6.25-22.637 0l-85.332 85.336c-6.25 6.25-6.25 16.383 0 22.633l85.332 85.332c3.1367 3.1602 7.2344 4.7148 11.328 4.7148z"/> 13176 </svg>`, 13177 moveColumnRight: ` 13178 <svg class="widget-icon" version="1.1" viewBox="0 0 512.02 512" xmlns="http://www.w3.org/2000/svg"> 13179 <path d="m154.67 512.01h-96c-32.363 0-58.668-26.305-58.668-58.668v-394.66c0-32.363 26.305-58.668 58.668-58.668h96c32.363 0 58.664 26.305 58.664 58.668v394.66c0 32.363-26.301 58.668-58.664 58.668zm-96-480c-14.699 0-26.668 11.969-26.668 26.668v394.66c0 14.699 11.969 26.668 26.668 26.668h96c14.699 0 26.664-11.969 26.664-26.668v-394.66c0-14.699-11.965-26.668-26.664-26.668z"/> 13180 <path d="m496 272.01h-224c-8.832 0-16-7.168-16-16 0-8.832 7.168-16 16-16h224c8.832 0 16 7.168 16 16 0 8.832-7.168 16-16 16z"/> 13181 <path d="m410.67 357.34c-4.0977 0-8.1914-1.5547-11.309-4.6914-6.25-6.25-6.25-16.383 0-22.637l74.027-74.023-74.027-74.027c-6.25-6.25-6.25-16.387 0-22.637s16.383-6.25 22.637 0l85.332 85.336c6.25 6.25 6.25 16.383 0 22.633l-85.332 85.332c-3.1367 3.1602-7.2344 4.7148-11.328 4.7148z"/> 13182 </svg>`, 13183 moveRowDown: ` 13184 <svg class="widget-icon" version="1.1" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"> 13185 <path d="m453.33 213.33h-394.66c-32.363 0-58.668-26.301-58.668-58.664v-96c0-32.363 26.305-58.668 58.668-58.668h394.66c32.363 0 58.668 26.305 58.668 58.668v96c0 32.363-26.305 58.664-58.668 58.664zm-394.66-181.33c-14.699 0-26.668 11.969-26.668 26.668v96c0 14.699 11.969 26.664 26.668 26.664h394.66c14.699 0 26.668-11.965 26.668-26.664v-96c0-14.699-11.969-26.668-26.668-26.668z"/> 13186 <path d="m256 512c-8.832 0-16-7.168-16-16v-224c0-8.832 7.168-16 16-16s16 7.168 16 16v224c0 8.832-7.168 16-16 16z"/> 13187 <path d="m256 512c-4.0977 0-8.1914-1.5586-11.309-4.6914l-85.332-85.336c-6.25-6.25-6.25-16.383 0-22.633s16.383-6.25 22.637 0l74.023 74.027 74.027-74.027c6.25-6.25 16.387-6.25 22.637 0s6.25 16.383 0 22.633l-85.336 85.336c-3.1562 3.1328-7.25 4.6914-11.348 4.6914z"/> 13188 </svg>`, 13189 moveRowUp: ` 13190 <svg class="widget-icon" version="1.1" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"> 13191 <path d="m453.33 298.67h-394.66c-32.363 0-58.668 26.301-58.668 58.664v96c0 32.363 26.305 58.668 58.668 58.668h394.66c32.363 0 58.668-26.305 58.668-58.668v-96c0-32.363-26.305-58.664-58.668-58.664zm-394.66 181.33c-14.699 0-26.668-11.969-26.668-26.668v-96c0-14.699 11.969-26.664 26.668-26.664h394.66c14.699 0 26.668 11.965 26.668 26.664v96c0 14.699-11.969 26.668-26.668 26.668z"/> 13192 <path d="m256 0c-8.832 0-16 7.168-16 16v224c0 8.832 7.168 16 16 16s16-7.168 16-16v-224c0-8.832-7.168-16-16-16z"/> 13193 <path d="m256 0c-4.0977 0-8.1914 1.5586-11.309 4.6914l-85.332 85.336c-6.25 6.25-6.25 16.383 0 22.633s16.383 6.25 22.637 0l74.023-74.027 74.027 74.027c6.25 6.25 16.387 6.25 22.637 0s6.25-16.383 0-22.633l-85.336-85.336c-3.1562-3.1328-7.25-4.6914-11.348-4.6914z"/> 13194 </svg>`, 13195 transpose: ` 13196 <svg class="widget-icon" version="1.1" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"> 13197 <path d="m19 26h-5v-2h5a5.0055 5.0055 0 0 0 5-5v-5h2v5a7.0078 7.0078 0 0 1-7 7z"/> 13198 <path d="M8,30H4a2.0023,2.0023,0,0,1-2-2V14a2.0023,2.0023,0,0,1,2-2H8a2.0023,2.0023,0,0,1,2,2V28A2.0023,2.0023,0,0,1,8,30ZM4,14V28H8V14Z"/> 13199 <path d="M28,10H14a2.0023,2.0023,0,0,1-2-2V4a2.0023,2.0023,0,0,1,2-2H28a2.0023,2.0023,0,0,1,2,2V8A2.0023,2.0023,0,0,1,28,10ZM14,4V8H28V4Z"/> 13200 </svg>`, 13201 sortAsc: ` 13202 <svg class="widget-icon" version="1.1" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"> 13203 <g transform="matrix(1 0 0 -1 0 501.15)" stroke-width="1.3333"> 13204 <path d="m353.6 74.486c-11.776 0-21.333 9.5573-21.333 21.333v298.67c0 11.776 9.5573 21.333 21.333 21.333s21.333-9.5573 21.333-21.333v-298.67c0-11.776-9.5573-21.333-21.333-21.333z"/> 13205 <path d="m353.6 74.486c-5.4636 0-10.922 2.0781-15.079 6.2552l-113.78 113.78c-8.3333 8.3333-8.3333 21.844 0 30.177 8.3333 8.3333 21.844 8.3333 30.183 0l98.697-98.703 98.703 98.703c8.3333 8.3333 21.849 8.3333 30.183 0 8.3333-8.3333 8.3333-21.844 0-30.177l-113.78-113.78c-4.2083-4.1771-9.6667-6.2552-15.131-6.2552z"/> 13206 </g> 13207 <path d="m166.04 210.11q-5.0971-13.492-9.5945-26.385-4.4974-13.192-9.2947-26.685h-94.146l-18.889 53.07h-30.283q11.993-32.981 22.487-60.865 10.494-28.184 20.388-53.369 10.194-25.186 20.089-47.973 9.8943-23.087 20.688-45.574h26.685q10.794 22.487 20.688 45.574 9.8943 22.787 19.789 47.973 10.194 25.186 20.688 53.369 10.494 27.884 22.487 60.865zm-27.284-77.056q-9.5945-26.085-19.189-50.371-9.2947-24.586-19.489-47.073-10.494 22.487-20.089 47.073-9.2947 24.286-18.589 50.371z"/> 13208 <path d="m173.24 325.25q-6.896 7.7955-16.191 18.889-8.9948 10.794-19.189 24.286-10.194 13.192-20.988 28.184-10.794 14.692-21.288 29.983-10.194 14.991-19.489 29.983-9.2947 14.991-16.79 28.484h116.93v24.886h-150.81v-19.489q6.2964-11.993 14.692-26.385 8.695-14.392 18.29-29.383 9.8943-14.991 20.388-30.283t20.688-29.383q10.494-14.092 20.088-26.385 9.8943-12.293 17.99-21.588h-106.74v-24.886h142.42z"/> 13209 </svg>`, 13210 sortDesc: ` 13211 <svg class="widget-icon" version="1.1" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"> 13212 <g transform="matrix(1 0 0 -1 0 501.15)" stroke-width="1.3333"> 13213 <path d="m353.6 74.486c-11.776 0-21.333 9.5573-21.333 21.333v298.67c0 11.776 9.5573 21.333 21.333 21.333s21.333-9.5573 21.333-21.333v-298.67c0-11.776-9.5573-21.333-21.333-21.333z"/> 13214 <path d="m353.6 74.486c-5.4636 0-10.922 2.0781-15.079 6.2552l-113.78 113.78c-8.3333 8.3333-8.3333 21.844 0 30.177 8.3333 8.3333 21.844 8.3333 30.183 0l98.697-98.703 98.703 98.703c8.3333 8.3333 21.849 8.3333 30.183 0 8.3333-8.3333 8.3333-21.844 0-30.177l-113.78-113.78c-4.2083-4.1771-9.6667-6.2552-15.131-6.2552z"/> 13215 </g> 13216 <path d="m169.11 507.72q-5.0971-13.492-9.5945-26.385-4.4974-13.192-9.2947-26.685h-94.146l-18.889 53.07h-30.283q11.993-32.981 22.487-60.865 10.494-28.184 20.388-53.369 10.194-25.186 20.088-47.973 9.8943-23.087 20.688-45.574h26.685q10.794 22.487 20.688 45.574 9.8943 22.787 19.789 47.973 10.194 25.186 20.688 53.369 10.494 27.884 22.487 60.865zm-27.284-77.056q-9.5945-26.085-19.189-50.371-9.2947-24.586-19.489-47.073-10.494 22.487-20.089 47.073-9.2947 24.286-18.589 50.371z"/> 13217 <path d="m176.31 27.639q-6.896 7.7955-16.191 18.889-8.9948 10.794-19.189 24.286-10.194 13.192-20.988 28.184-10.794 14.692-21.288 29.983-10.194 14.991-19.489 29.983-9.2947 14.991-16.79 28.484h116.93v24.886h-150.81v-19.489q6.2964-11.993 14.692-26.385 8.695-14.392 18.29-29.383 9.8943-14.991 20.388-30.283 10.494-15.291 20.688-29.383 10.494-14.092 20.088-26.385 9.8943-12.293 17.99-21.588h-106.74v-24.886h142.42z"/> 13218 </svg>`, 13219 formula: ` 13220 <svg class="widget-icon" version="1.1" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"> 13221 <path d="m263.51 62.967c1.672-11.134 9.326-22.967 20.222-22.967 11.028 0 20 8.972 20 20h40c0-33.084-26.916-60-60-60-33.629 0-55.527 28.691-59.784 57.073l-12.862 86.927h-61.354v40h55.436l-39.22 265.07-0.116 0.937c-1.063 10.62-9.393 21.99-20.1 21.99-11.028 0-20-8.972-20-20h-40c0 33.084 26.916 60 60 60 33.661 0 56.771-29.141 59.848-57.496l40.023-270.5h60.129v-40h-54.211l11.989-81.033z"/> 13222 <polygon points="426.27 248 378.24 248 352.25 287.08 334.92 248 291.17 248 326 326.57 270.52 410 318.56 410 345.21 369.92 362.98 410 406.73 410 371.46 330.43"/> 13223 </svg>`, 13224 help: ` 13225 <svg class="widget-icon" version="1.1" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"> 13226 <path d="m248.16 343.22c-14.639 0-26.491 12.2-26.491 26.84 0 14.291 11.503 26.84 26.491 26.84s26.84-12.548 26.84-26.84c0-14.64-12.199-26.84-26.84-26.84z"/> 13227 <path d="m252.69 140c-47.057 0-68.668 27.885-68.668 46.708 0 13.595 11.502 19.869 20.914 19.869 18.822 0 11.154-26.84 46.708-26.84 17.429 0 31.372 7.669 31.372 23.703 0 18.824-19.52 29.629-31.023 39.389-10.108 8.714-23.354 23.006-23.354 52.983 0 18.125 4.879 23.354 19.171 23.354 17.08 0 20.565-7.668 20.565-14.291 0-18.126 0.35-28.583 19.521-43.571 9.411-7.32 39.04-31.023 39.04-63.789s-29.629-57.515-74.246-57.515z"/> 13228 <path d="m256 0c-141.48 0-256 114.5-256 256v236c0 11.046 8.954 20 20 20h236c141.48 0 256-114.5 256-256 0-141.48-114.5-256-256-256zm0 472h-216v-216c0-119.38 96.607-216 216-216 119.38 0 216 96.607 216 216 0 119.38-96.607 216-216 216z"/> 13229 </svg>`, 13230 csv: ` 13231 <svg class="widget-icon" version="1.1" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"> 13232 <path d="m4.9979 9v-8h14.502l3.5 3.5 2e-7 18.5h-19m14-22v5h5m-16 7h-2c-1 0-2 0.5-2 1.5v1.5s1e-8 0.5 0 1.5 1 1.5 2 1.5h2m6.25-6h-2.5c-1.5 0-2 0.5-2 1.5s0.5 1.5 2 1.5 2 0.5 2 1.5-0.5 1.5-2 1.5h-2.5m12.25-7v0.5c0 0.5-2.5 6.5-2.5 6.5h-0.5s-2.5-6-2.5-6.5v-0.5" fill="none" stroke="var(--text-muted)" stroke-width="1.5"/> 13233 </svg>`, 13234 arrowenter: ` 13235 <svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"> 13236 <path fill="currentColor" d="m4.64119 12.5 2.87283 2.7038c.30163.2839.31602.7586.03213 1.0602-.28389.3017-.75854.316-1.06017.0321l-4.25-4c-.15059-.1417-.23598-.3393-.23598-.5461s.08539-.4044.23598-.5462l4.25-3.99995c.30163-.28389.77628-.2695 1.06017.03213s.2695.77628-.03213 1.06017l-2.87284 2.70385h10.10882c.9665 0 1.75-.7835 1.75-1.75v-4.5c0-.41421.3358-.75.75-.75s.75.33579.75.75v4.5c0 1.7949-1.4551 3.25-3.25 3.25z"/> 13237 </svg>`, 13238 arrowtab: ` 13239 <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"> 13240 <path fill="currentColor" d="m18.2071068 11.2928932-6.5-6.49999998c-.3905243-.39052429-1.0236893-.39052429-1.4142136 0-.36048394.36048396-.38821348.92771502-.0831886 1.32000622l.0831886.09420734 4.7931068 4.79289322h-11.086c-.51283584 0-.93550716.3860402-.99327227.8833789l-.00672773.1166211c0 .5128358.38604019.9355072.88337887.9932723l.11662113.0067277h11.086l-4.7931068 4.7928932c-.36048394.360484-.38821348.927715-.0831886 1.3200062l.0831886.0942074c.360484.3604839.927715.3882135 1.3200062.0831886l.0942074-.0831886 6.5-6.5c.3604839-.360484.3882135-.927715.0831886-1.3200062l-.0831886-.0942074-6.5-6.49999998zm2.7928932 7.2071068v-13c0-.55228475-.4477153-1-1-1s-1 .44771525-1 1v13c0 .5522847.4477153 1 1 1s1-.4477153 1-1z" fill="#212121"/> 13241 </svg>` 13242 }; 13243 var addIcons = () => { 13244 Object.keys(icons).forEach((key) => { 13245 if (key !== "help") { 13246 (0, import_obsidian.addIcon)(key, icons[key]); 13247 } 13248 }); 13249 }; 13250 13251 // src/settings.ts 13252 var import_md_advanced_tables = __toESM(require_lib2()); 13253 var defaultSettings = { 13254 formatType: import_md_advanced_tables.FormatType.NORMAL, 13255 showRibbonIcon: true, 13256 bindEnter: true, 13257 bindTab: true 13258 }; 13259 var TableEditorPluginSettings = class { 13260 constructor(loadedData) { 13261 const allFields = { ...defaultSettings, ...loadedData }; 13262 this.formatType = allFields.formatType; 13263 this.showRibbonIcon = allFields.showRibbonIcon; 13264 this.bindEnter = allFields.bindEnter; 13265 this.bindTab = allFields.bindTab; 13266 } 13267 asOptions() { 13268 return (0, import_md_advanced_tables.optionsWithDefaults)({ formatType: this.formatType }); 13269 } 13270 }; 13271 13272 // src/obsidian-text-editor.ts 13273 var import_md_advanced_tables2 = __toESM(require_lib2()); 13274 var ObsidianTextEditor = class { 13275 constructor(app, file, editor) { 13276 this.getCursorPosition = () => { 13277 const position = this.editor.getCursor(); 13278 return new import_md_advanced_tables2.Point(position.line, position.ch); 13279 }; 13280 this.setCursorPosition = (pos) => { 13281 this.editor.setCursor({ line: pos.row, ch: pos.column }); 13282 }; 13283 this.setSelectionRange = (range) => { 13284 this.editor.setSelection( 13285 { line: range.start.row, ch: range.start.column }, 13286 { line: range.end.row, ch: range.end.column } 13287 ); 13288 }; 13289 this.getLastRow = () => this.editor.lastLine(); 13290 this.acceptsTableEdit = (row) => { 13291 const cache = this.app.metadataCache.getFileCache(this.file); 13292 if (!cache.sections) { 13293 return true; 13294 } 13295 const table = cache.sections.find( 13296 (section) => section.position.start.line <= row && section.position.end.line >= row && section.type !== "code" && section.type !== "math" 13297 ); 13298 if (table === void 0) { 13299 return false; 13300 } 13301 const preceedingLineIndex = table.position.start.line; 13302 if (preceedingLineIndex >= 0) { 13303 const preceedingLine = this.getLine(preceedingLineIndex); 13304 if (preceedingLine === "-tx-") { 13305 return false; 13306 } 13307 } 13308 return true; 13309 }; 13310 this.getLine = (row) => this.editor.getLine(row); 13311 this.insertLine = (row, line) => { 13312 if (row > this.getLastRow()) { 13313 this.editor.replaceRange("\n" + line, { line: row, ch: 0 }); 13314 } else { 13315 this.editor.replaceRange(line + "\n", { line: row, ch: 0 }); 13316 } 13317 }; 13318 this.deleteLine = (row) => { 13319 if (row === this.getLastRow()) { 13320 const rowContents = this.getLine(row); 13321 this.editor.replaceRange( 13322 "", 13323 { line: row, ch: 0 }, 13324 { line: row, ch: rowContents.length } 13325 ); 13326 } else { 13327 this.editor.replaceRange( 13328 "", 13329 { line: row, ch: 0 }, 13330 { line: row + 1, ch: 0 } 13331 ); 13332 } 13333 }; 13334 this.replaceLines = (startRow, endRow, lines) => { 13335 const realEndRow = endRow - 1; 13336 const endRowContents = this.editor.getLine(realEndRow); 13337 const endRowFinalIndex = endRowContents.length; 13338 this.editor.replaceRange( 13339 lines.join("\n"), 13340 { line: startRow, ch: 0 }, 13341 { line: realEndRow, ch: endRowFinalIndex } 13342 ); 13343 }; 13344 this.transact = (func) => { 13345 func(); 13346 }; 13347 this.app = app; 13348 this.file = file; 13349 this.editor = editor; 13350 } 13351 }; 13352 13353 // src/table-editor.ts 13354 var import_md_advanced_tables3 = __toESM(require_lib2()); 13355 var import_obsidian2 = require("obsidian"); 13356 var TableEditor = class { 13357 constructor(app, file, editor, settings) { 13358 this.cursorIsInTableFormula = () => this.mte.cursorIsInTableFormula(this.settings.asOptions()); 13359 this.cursorIsInTable = () => this.mte.cursorIsInTable(this.settings.asOptions()); 13360 this.nextCell = () => { 13361 this.mte.nextCell(this.settings.asOptions()); 13362 }; 13363 this.previousCell = () => { 13364 this.mte.previousCell(this.settings.asOptions()); 13365 }; 13366 this.nextRow = () => { 13367 this.mte.nextRow(this.settings.asOptions()); 13368 }; 13369 this.formatTable = () => { 13370 this.mte.format(this.settings.asOptions()); 13371 }; 13372 this.formatAllTables = () => { 13373 this.mte.formatAll(this.settings.asOptions()); 13374 }; 13375 this.insertColumn = () => { 13376 this.mte.insertColumn(this.settings.asOptions()); 13377 }; 13378 this.insertRow = () => { 13379 this.mte.insertRow(this.settings.asOptions()); 13380 }; 13381 this.leftAlignColumn = () => { 13382 this.mte.alignColumn(import_md_advanced_tables3.Alignment.LEFT, this.settings.asOptions()); 13383 }; 13384 this.centerAlignColumn = () => { 13385 this.mte.alignColumn(import_md_advanced_tables3.Alignment.CENTER, this.settings.asOptions()); 13386 }; 13387 this.rightAlignColumn = () => { 13388 this.mte.alignColumn(import_md_advanced_tables3.Alignment.RIGHT, this.settings.asOptions()); 13389 }; 13390 this.moveColumnLeft = () => { 13391 this.mte.moveColumn(-1, this.settings.asOptions()); 13392 }; 13393 this.moveColumnRight = () => { 13394 this.mte.moveColumn(1, this.settings.asOptions()); 13395 }; 13396 this.moveRowUp = () => { 13397 this.mte.moveRow(-1, this.settings.asOptions()); 13398 }; 13399 this.moveRowDown = () => { 13400 this.mte.moveRow(1, this.settings.asOptions()); 13401 }; 13402 this.deleteColumn = () => { 13403 this.mte.deleteColumn(this.settings.asOptions()); 13404 }; 13405 this.deleteRow = () => { 13406 this.mte.deleteRow(this.settings.asOptions()); 13407 }; 13408 this.sortRowsAsc = () => { 13409 this.mte.sortRows(import_md_advanced_tables3.SortOrder.Ascending, this.settings.asOptions()); 13410 }; 13411 this.sortRowsDesc = () => { 13412 this.mte.sortRows(import_md_advanced_tables3.SortOrder.Descending, this.settings.asOptions()); 13413 }; 13414 this.transpose = () => { 13415 this.mte.transpose(this.settings.asOptions()); 13416 }; 13417 this.escape = () => { 13418 this.mte.escape(this.settings.asOptions()); 13419 }; 13420 this.evaluateFormulas = () => { 13421 const err = this.mte.evaluateFormulas(this.settings.asOptions()); 13422 if (err) { 13423 new import_obsidian2.Notice(err.message); 13424 } 13425 }; 13426 this.exportCSVModal = () => { 13427 new CSVModal(this.app, this.mte, this.settings).open(); 13428 }; 13429 this.app = app; 13430 this.settings = settings; 13431 const ote = new ObsidianTextEditor(app, file, editor); 13432 this.mte = new import_md_advanced_tables3.TableEditor(ote); 13433 } 13434 }; 13435 var CSVModal = class extends import_obsidian2.Modal { 13436 constructor(app, mte, settings) { 13437 super(app); 13438 this.mte = mte; 13439 this.settings = settings; 13440 } 13441 onOpen() { 13442 const { contentEl } = this; 13443 const div = contentEl.createDiv({ 13444 cls: "advanced-tables-csv-export" 13445 }); 13446 const ta = div.createEl("textarea", { 13447 attr: { 13448 readonly: true 13449 } 13450 }); 13451 ta.value = this.mte.exportCSV(true, this.settings.asOptions()); 13452 ta.onClickEvent(() => ta.select()); 13453 const lb = div.createEl("label"); 13454 const cb = lb.createEl("input", { 13455 type: "checkbox", 13456 attr: { 13457 checked: true 13458 } 13459 }); 13460 lb.createSpan().setText("Include table headers"); 13461 cb.onClickEvent(() => { 13462 ta.value = this.mte.exportCSV(cb.checked, this.settings.asOptions()); 13463 }); 13464 } 13465 onClose() { 13466 const { contentEl } = this; 13467 contentEl.empty(); 13468 } 13469 }; 13470 13471 // src/table-controls-view.ts 13472 var import_obsidian3 = require("obsidian"); 13473 var TableControlsViewType = "advanced-tables-toolbar"; 13474 var TableControlsView = class extends import_obsidian3.ItemView { 13475 constructor(leaf, settings) { 13476 super(leaf); 13477 this.draw = () => { 13478 const container = this.containerEl.children[1]; 13479 const rootEl = document.createElement("div"); 13480 rootEl.addClass("advanced-tables-buttons"); 13481 rootEl.createDiv().createSpan({ cls: "title" }).setText("Advanced Tables"); 13482 const navHeader = rootEl.createDiv({ cls: "nav-header" }); 13483 const rowOneBtns = navHeader.createDiv({ cls: "nav-buttons-container" }); 13484 rowOneBtns.createSpan({ cls: "advanced-tables-row-label" }).setText("Align:"); 13485 this.drawBtn( 13486 rowOneBtns, 13487 "alignLeft", 13488 "left align column", 13489 (te) => te.leftAlignColumn() 13490 ); 13491 this.drawBtn( 13492 rowOneBtns, 13493 "alignCenter", 13494 "center align column", 13495 (te) => te.centerAlignColumn() 13496 ); 13497 this.drawBtn( 13498 rowOneBtns, 13499 "alignRight", 13500 "right align column", 13501 (te) => te.rightAlignColumn() 13502 ); 13503 const rowTwoBtns = navHeader.createDiv({ cls: "nav-buttons-container" }); 13504 rowTwoBtns.createSpan({ cls: "advanced-tables-row-label" }).setText("Move:"); 13505 this.drawBtn( 13506 rowTwoBtns, 13507 "moveRowDown", 13508 "move row down", 13509 (te) => te.moveRowDown() 13510 ); 13511 this.drawBtn( 13512 rowTwoBtns, 13513 "moveRowUp", 13514 "move row up", 13515 (te) => te.moveRowUp() 13516 ); 13517 this.drawBtn( 13518 rowTwoBtns, 13519 "moveColumnRight", 13520 "move column right", 13521 (te) => te.moveColumnRight() 13522 ); 13523 this.drawBtn( 13524 rowTwoBtns, 13525 "moveColumnLeft", 13526 "move column left", 13527 (te) => te.moveColumnLeft() 13528 ); 13529 this.drawBtn( 13530 rowTwoBtns, 13531 "transpose", 13532 "transpose", 13533 (te) => te.transpose() 13534 ); 13535 const rowThreeBtns = navHeader.createDiv({ cls: "nav-buttons-container" }); 13536 rowThreeBtns.createSpan({ cls: "advanced-tables-row-label" }).setText("Edit:"); 13537 this.drawBtn( 13538 rowThreeBtns, 13539 "insertRow", 13540 "insert row above", 13541 (te) => te.insertRow() 13542 ); 13543 this.drawBtn( 13544 rowThreeBtns, 13545 "insertColumn", 13546 "insert column left", 13547 (te) => te.insertColumn() 13548 ); 13549 this.drawBtn( 13550 rowThreeBtns, 13551 "deleteRow", 13552 "delete row", 13553 (te) => te.deleteRow() 13554 ); 13555 this.drawBtn( 13556 rowThreeBtns, 13557 "deleteColumn", 13558 "delete column", 13559 (te) => te.deleteColumn() 13560 ); 13561 const rowFourBtns = navHeader.createDiv({ cls: "nav-buttons-container" }); 13562 rowFourBtns.createSpan({ cls: "advanced-tables-row-label" }).setText("Sort/F:"); 13563 this.drawBtn( 13564 rowFourBtns, 13565 "sortAsc", 13566 "sort by column ascending", 13567 (te) => te.sortRowsAsc() 13568 ); 13569 this.drawBtn( 13570 rowFourBtns, 13571 "sortDesc", 13572 "sort by column descending", 13573 (te) => te.sortRowsDesc() 13574 ); 13575 this.drawBtn( 13576 rowFourBtns, 13577 "formula", 13578 "evaluate formulas", 13579 (te) => te.evaluateFormulas() 13580 ); 13581 const rowFiveBtns = navHeader.createDiv({ cls: "nav-buttons-container" }); 13582 rowFiveBtns.createSpan({ cls: "advanced-tables-row-label" }).setText("Misc:"); 13583 this.drawBtn( 13584 rowFiveBtns, 13585 "csv", 13586 "export as csv", 13587 (te) => te.exportCSVModal() 13588 ); 13589 this.drawBtn( 13590 rowFiveBtns, 13591 "help", 13592 "help", 13593 () => window.open( 13594 "https://github.com/tgrosinger/advanced-tables-obsidian/blob/main/docs/help.md" 13595 ) 13596 ); 13597 container.empty(); 13598 container.appendChild(rootEl); 13599 }; 13600 this.drawBtn = (parent, iconName, title, fn) => { 13601 const cursorCheck = (te) => { 13602 if (title === "evaluate formulas") { 13603 return te.cursorIsInTable() || te.cursorIsInTableFormula(); 13604 } 13605 return te.cursorIsInTable(); 13606 }; 13607 const button = parent.createDiv({ cls: "advanced-tables-button nav-action-button", title }); 13608 button.onClickEvent(() => this.withTE(fn, cursorCheck)); 13609 button.appendChild(Element(icons[iconName])); 13610 }; 13611 this.withTE = (fn, cursorCheck, alertOnNoTable = true) => { 13612 let editor; 13613 const leaf = this.app.workspace.getMostRecentLeaf(); 13614 if (leaf.view instanceof import_obsidian3.MarkdownView) { 13615 editor = leaf.view.editor; 13616 } else { 13617 console.warn("Advanced Tables: Unable to determine current editor."); 13618 return; 13619 } 13620 const te = new TableEditor(this.app, leaf.view.file, editor, this.settings); 13621 if (!cursorCheck(te)) { 13622 if (alertOnNoTable) { 13623 new import_obsidian3.Notice("Advanced Tables: Cursor must be in a table."); 13624 } 13625 return; 13626 } 13627 fn(te); 13628 }; 13629 this.settings = settings; 13630 } 13631 getViewType() { 13632 return TableControlsViewType; 13633 } 13634 getDisplayText() { 13635 return "Advanced Tables"; 13636 } 13637 getIcon() { 13638 return "spreadsheet"; 13639 } 13640 load() { 13641 super.load(); 13642 this.draw(); 13643 } 13644 }; 13645 var Element = (svgText) => { 13646 const parser = new DOMParser(); 13647 return parser.parseFromString(svgText, "text/xml").documentElement; 13648 }; 13649 13650 // src/main.ts 13651 var import_state = require("@codemirror/state"); 13652 var import_view = require("@codemirror/view"); 13653 var import_md_advanced_tables4 = __toESM(require_lib2()); 13654 var import_obsidian4 = require("obsidian"); 13655 var TableEditorPlugin = class extends import_obsidian4.Plugin { 13656 constructor() { 13657 super(...arguments); 13658 // makeEditorExtension is used to bind Tab and Enter in the new CM6 Live Preview editor. 13659 this.makeEditorExtension = () => { 13660 const keymaps = []; 13661 if (this.settings.bindEnter) { 13662 keymaps.push({ 13663 key: "Enter", 13664 run: () => this.newPerformTableActionCM6((te) => te.nextRow())(), 13665 preventDefault: true 13666 }); 13667 } 13668 if (this.settings.bindTab) { 13669 keymaps.push({ 13670 key: "Tab", 13671 run: () => this.newPerformTableActionCM6((te) => te.nextCell())(), 13672 shift: () => this.newPerformTableActionCM6( 13673 (te) => te.previousCell() 13674 )(), 13675 preventDefault: true 13676 }); 13677 } 13678 return import_state.Prec.highest(import_view.keymap.of(keymaps)); 13679 }; 13680 this.newPerformTableActionCM6 = (fn) => () => { 13681 const view = this.app.workspace.getActiveViewOfType(import_obsidian4.MarkdownView); 13682 if (view) { 13683 const currentMode = view.currentMode; 13684 if ("sourceMode" in currentMode && !currentMode.sourceMode) { 13685 return false; 13686 } 13687 const te = new TableEditor( 13688 this.app, 13689 view.file, 13690 view.editor, 13691 this.settings 13692 ); 13693 if (te.cursorIsInTable()) { 13694 fn(te); 13695 return true; 13696 } 13697 } 13698 return false; 13699 }; 13700 this.newPerformTableAction = (fn, alertOnNoTable = true) => (checking, editor, view) => { 13701 const te = new TableEditor(this.app, view.file, editor, this.settings); 13702 if (checking) { 13703 return te.cursorIsInTable(); 13704 } 13705 fn(te); 13706 }; 13707 // handleKeyDown is used to bind the tab and enter keys in the legacy CM5 editor. 13708 this.handleKeyDown = (cm, event) => { 13709 if (["Tab", "Enter"].contains(event.key)) { 13710 const view = this.app.workspace.getActiveViewOfType(import_obsidian4.MarkdownView); 13711 const editor = view ? view.editor : null; 13712 const action = this.newPerformTableAction((te) => { 13713 switch (event.key) { 13714 case "Tab": 13715 if (!this.settings.bindTab) { 13716 return; 13717 } 13718 if (event.shiftKey) { 13719 te.previousCell(); 13720 } else { 13721 te.nextCell(); 13722 } 13723 break; 13724 case "Enter": 13725 if (!this.settings.bindEnter) { 13726 return; 13727 } 13728 if (event.shiftKey) { 13729 te.escape(); 13730 } else if (event.ctrlKey || event.metaKey || event.altKey) { 13731 return; 13732 } else { 13733 te.nextRow(); 13734 } 13735 break; 13736 } 13737 event.preventDefault(); 13738 }, false); 13739 if (action(true, editor, view)) { 13740 action(false, editor, view); 13741 } 13742 } 13743 }; 13744 this.toggleTableControlsView = async () => { 13745 const existing = this.app.workspace.getLeavesOfType(TableControlsViewType); 13746 if (existing.length) { 13747 this.app.workspace.revealLeaf(existing[0]); 13748 return; 13749 } 13750 await this.app.workspace.getRightLeaf(false).setViewState({ 13751 type: TableControlsViewType, 13752 active: true 13753 }); 13754 this.app.workspace.revealLeaf( 13755 this.app.workspace.getLeavesOfType(TableControlsViewType)[0] 13756 ); 13757 }; 13758 this.isMobile = () => this.app.isMobile; 13759 } 13760 async onload() { 13761 console.log("loading markdown-table-editor plugin"); 13762 await this.loadSettings(); 13763 this.registerView( 13764 TableControlsViewType, 13765 (leaf) => new TableControlsView(leaf, this.settings) 13766 ); 13767 addIcons(); 13768 if (this.settings.showRibbonIcon) { 13769 this.addRibbonIcon("spreadsheet", "Advanced Tables Toolbar", () => { 13770 this.toggleTableControlsView(); 13771 }); 13772 } 13773 this.registerEditorExtension(this.makeEditorExtension()); 13774 this.addCommand({ 13775 id: "next-row", 13776 name: "Go to next row", 13777 icon: "arrowenter", 13778 editorCheckCallback: this.newPerformTableAction((te) => { 13779 if (this.settings.bindEnter && !this.isMobile) { 13780 new import_obsidian4.Notice( 13781 "Advanced Tables: Next row also bound to enter. Possibly producing double actions. See Advanced Tables settings." 13782 ); 13783 } 13784 te.nextRow(); 13785 }) 13786 }); 13787 this.addCommand({ 13788 id: "next-cell", 13789 name: "Go to next cell", 13790 icon: "arrowtab", 13791 editorCheckCallback: this.newPerformTableAction((te) => { 13792 if (this.settings.bindTab && !this.isMobile) { 13793 new import_obsidian4.Notice( 13794 "Advanced Tables: Next cell also bound to tab. Possibly producing double actions. See Advanced Tables settings." 13795 ); 13796 } 13797 te.nextCell(); 13798 }) 13799 }); 13800 this.addCommand({ 13801 id: "previous-cell", 13802 name: "Go to previous cell", 13803 editorCheckCallback: this.newPerformTableAction((te) => { 13804 if (this.settings.bindTab && !this.isMobile) { 13805 new import_obsidian4.Notice( 13806 "Advanced Tables: Previous cell also bound to shift+tab. Possibly producing double actions. See Advanced Tables settings." 13807 ); 13808 } 13809 te.previousCell(); 13810 }) 13811 }); 13812 this.addCommand({ 13813 id: "format-table", 13814 name: "Format table at the cursor", 13815 editorCheckCallback: this.newPerformTableAction((te) => { 13816 te.formatTable(); 13817 }) 13818 }); 13819 this.addCommand({ 13820 id: "format-all-tables", 13821 name: "Format all tables in this file", 13822 editorCallback: (editor, view) => { 13823 const te = new TableEditor(this.app, view.file, editor, this.settings); 13824 te.formatAllTables(); 13825 } 13826 }); 13827 this.addCommand({ 13828 id: "insert-column", 13829 name: "Insert column before current", 13830 icon: "insertColumn", 13831 editorCheckCallback: this.newPerformTableAction((te) => { 13832 te.insertColumn(); 13833 }) 13834 }); 13835 this.addCommand({ 13836 id: "insert-row", 13837 name: "Insert row before current", 13838 icon: "insertRow", 13839 editorCheckCallback: this.newPerformTableAction((te) => { 13840 te.insertRow(); 13841 }) 13842 }); 13843 this.addCommand({ 13844 id: "escape-table", 13845 name: "Move cursor out of table", 13846 editorCheckCallback: this.newPerformTableAction((te) => { 13847 te.escape(); 13848 }) 13849 }); 13850 this.addCommand({ 13851 id: "left-align-column", 13852 name: "Left align column", 13853 icon: "alignLeft", 13854 editorCheckCallback: this.newPerformTableAction((te) => { 13855 te.leftAlignColumn(); 13856 }) 13857 }); 13858 this.addCommand({ 13859 id: "center-align-column", 13860 name: "Center align column", 13861 icon: "alignCenter", 13862 editorCheckCallback: this.newPerformTableAction((te) => { 13863 te.centerAlignColumn(); 13864 }) 13865 }); 13866 this.addCommand({ 13867 id: "right-align-column", 13868 name: "Right align column", 13869 icon: "alignRight", 13870 editorCheckCallback: this.newPerformTableAction((te) => { 13871 te.rightAlignColumn(); 13872 }) 13873 }); 13874 this.addCommand({ 13875 id: "move-column-left", 13876 name: "Move column left", 13877 icon: "moveColumnLeft", 13878 editorCheckCallback: this.newPerformTableAction((te) => { 13879 te.moveColumnLeft(); 13880 }) 13881 }); 13882 this.addCommand({ 13883 id: "move-column-right", 13884 name: "Move column right", 13885 icon: "moveColumnRight", 13886 editorCheckCallback: this.newPerformTableAction((te) => { 13887 te.moveColumnRight(); 13888 }) 13889 }); 13890 this.addCommand({ 13891 id: "move-row-up", 13892 name: "Move row up", 13893 icon: "moveRowUp", 13894 editorCheckCallback: this.newPerformTableAction((te) => { 13895 te.moveRowUp(); 13896 }) 13897 }); 13898 this.addCommand({ 13899 id: "move-row-down", 13900 name: "Move row down", 13901 icon: "moveRowDown", 13902 editorCheckCallback: this.newPerformTableAction((te) => { 13903 te.moveRowDown(); 13904 }) 13905 }); 13906 this.addCommand({ 13907 id: "delete-column", 13908 name: "Delete column", 13909 icon: "deleteColumn", 13910 editorCheckCallback: this.newPerformTableAction((te) => { 13911 te.deleteColumn(); 13912 }) 13913 }); 13914 this.addCommand({ 13915 id: "delete-row", 13916 name: "Delete row", 13917 icon: "deleteRow", 13918 editorCheckCallback: this.newPerformTableAction((te) => { 13919 te.deleteRow(); 13920 }) 13921 }); 13922 this.addCommand({ 13923 id: "sort-rows-ascending", 13924 name: "Sort rows ascending", 13925 icon: "sortAsc", 13926 editorCheckCallback: this.newPerformTableAction((te) => { 13927 te.sortRowsAsc(); 13928 }) 13929 }); 13930 this.addCommand({ 13931 id: "sort-rows-descending", 13932 name: "Sort rows descending", 13933 icon: "sortDesc", 13934 editorCheckCallback: this.newPerformTableAction((te) => { 13935 te.sortRowsDesc(); 13936 }) 13937 }); 13938 this.addCommand({ 13939 id: "transpose", 13940 name: "Transpose", 13941 icon: "transpose", 13942 editorCheckCallback: this.newPerformTableAction((te) => { 13943 te.transpose(); 13944 }) 13945 }); 13946 this.addCommand({ 13947 id: "evaluate-formulas", 13948 name: "Evaluate table formulas", 13949 icon: "formula", 13950 editorCheckCallback: (checking, editor, view) => { 13951 const te = new TableEditor(this.app, view.file, editor, this.settings); 13952 if (checking) { 13953 return te.cursorIsInTable() || te.cursorIsInTableFormula(); 13954 } 13955 te.evaluateFormulas(); 13956 } 13957 }); 13958 this.addCommand({ 13959 id: "table-control-bar", 13960 name: "Open table controls toolbar", 13961 hotkeys: [ 13962 { 13963 modifiers: ["Mod", "Shift"], 13964 key: "d" 13965 } 13966 ], 13967 callback: () => { 13968 this.toggleTableControlsView(); 13969 } 13970 }); 13971 this.addSettingTab(new TableEditorSettingsTab(this.app, this)); 13972 } 13973 async loadSettings() { 13974 const settingsOptions = Object.assign( 13975 defaultSettings, 13976 await this.loadData() 13977 ); 13978 this.settings = new TableEditorPluginSettings(settingsOptions); 13979 this.saveData(this.settings); 13980 } 13981 }; 13982 var TableEditorSettingsTab = class extends import_obsidian4.PluginSettingTab { 13983 constructor(app, plugin) { 13984 super(app, plugin); 13985 this.plugin = plugin; 13986 } 13987 display() { 13988 const { containerEl } = this; 13989 containerEl.empty(); 13990 containerEl.createEl("h2", { text: "Advanced Tables Plugin - Settings" }); 13991 new import_obsidian4.Setting(containerEl).setName("Bind enter to table navigation").setDesc( 13992 'Requires restart of Obsidian. If enabled, when the cursor is in a table, enter advances to the next row. Disabling this can help avoid conflicting with tag or CJK autocompletion. If disabling, bind "Go to ..." in the Obsidian Hotkeys settings.' 13993 ).addToggle( 13994 (toggle) => toggle.setValue(this.plugin.settings.bindEnter).onChange((value) => { 13995 this.plugin.settings.bindEnter = value; 13996 this.plugin.saveData(this.plugin.settings); 13997 this.display(); 13998 }) 13999 ); 14000 new import_obsidian4.Setting(containerEl).setName("Bind tab to table navigation").setDesc( 14001 'Requires restart of Obsidian. If enabled, when the cursor is in a table, tab/shift+tab navigate between cells. Disabling this can help avoid conflicting with tag or CJK autocompletion. If disabling, bind "Go to ..." in the Obsidian Hotkeys settings.' 14002 ).addToggle( 14003 (toggle) => toggle.setValue(this.plugin.settings.bindTab).onChange((value) => { 14004 this.plugin.settings.bindTab = value; 14005 this.plugin.saveData(this.plugin.settings); 14006 this.display(); 14007 }) 14008 ); 14009 new import_obsidian4.Setting(containerEl).setName("Pad cell width using spaces").setDesc( 14010 "If enabled, table cells will have spaces added to match the width of the longest cell in the column." 14011 ).addToggle( 14012 (toggle) => toggle.setValue(this.plugin.settings.formatType === import_md_advanced_tables4.FormatType.NORMAL).onChange((value) => { 14013 this.plugin.settings.formatType = value ? import_md_advanced_tables4.FormatType.NORMAL : import_md_advanced_tables4.FormatType.WEAK; 14014 this.plugin.saveData(this.plugin.settings); 14015 this.display(); 14016 }) 14017 ); 14018 new import_obsidian4.Setting(containerEl).setName("Show icon in sidebar").setDesc( 14019 "If enabled, a button which opens the table controls toolbar will be added to the Obsidian sidebar. The toolbar can also be opened with a Hotkey. Changes only take effect on reload." 14020 ).addToggle( 14021 (toggle) => toggle.setValue(this.plugin.settings.showRibbonIcon).onChange((value) => { 14022 this.plugin.settings.showRibbonIcon = value; 14023 this.plugin.saveData(this.plugin.settings); 14024 this.display(); 14025 }) 14026 ); 14027 const div = containerEl.createEl("div", { 14028 cls: "advanced-tables-donation" 14029 }); 14030 const donateText = document.createElement("p"); 14031 donateText.appendText( 14032 "If this plugin adds value for you and you would like to help support continued development, please use the buttons below:" 14033 ); 14034 div.appendChild(donateText); 14035 const parser = new DOMParser(); 14036 div.appendChild( 14037 createDonateButton( 14038 "https://paypal.me/tgrosinger", 14039 parser.parseFromString(paypal, "text/xml").documentElement 14040 ) 14041 ); 14042 div.appendChild( 14043 createDonateButton( 14044 "https://www.buymeacoffee.com/tgrosinger", 14045 parser.parseFromString(buyMeACoffee, "text/xml").documentElement 14046 ) 14047 ); 14048 } 14049 }; 14050 var createDonateButton = (link, img) => { 14051 const a = document.createElement("a"); 14052 a.setAttribute("href", link); 14053 a.addClass("advanced-tables-donate-button"); 14054 a.appendChild(img); 14055 return a; 14056 }; 14057 var buyMeACoffee = ` 14058 <svg width="150" height="42" viewBox="0 0 260 73" fill="none" xmlns="http://www.w3.org/2000/svg"> 14059 <path d="M0 11.68C0 5.22932 5.22931 0 11.68 0H248.2C254.651 0 259.88 5.22931 259.88 11.68V61.32C259.88 67.7707 254.651 73 248.2 73H11.68C5.22931 73 0 67.7707 0 61.32V11.68Z" fill="#FFDD00"/> 14060 <path d="M52.2566 24.0078L52.2246 23.9889L52.1504 23.9663C52.1802 23.9915 52.2176 24.0061 52.2566 24.0078Z" fill="#0D0C22"/> 14061 <path d="M52.7248 27.3457L52.6895 27.3556L52.7248 27.3457Z" fill="#0D0C22"/> 14062 <path d="M52.2701 24.0024C52.266 24.0019 52.2619 24.0009 52.258 23.9995C52.2578 24.0022 52.2578 24.0049 52.258 24.0076C52.2624 24.007 52.2666 24.0052 52.2701 24.0024Z" fill="#0D0C22"/> 14063 <path d="M52.2578 24.0094H52.2643V24.0054L52.2578 24.0094Z" fill="#0D0C22"/> 14064 <path d="M52.6973 27.3394L52.7513 27.3086L52.7714 27.2973L52.7897 27.2778C52.7554 27.2926 52.7241 27.3135 52.6973 27.3394Z" fill="#0D0C22"/> 14065 <path d="M52.3484 24.0812L52.2956 24.031L52.2598 24.0115C52.279 24.0454 52.3108 24.0705 52.3484 24.0812Z" fill="#0D0C22"/> 14066 <path d="M39.0684 56.469C39.0262 56.4872 38.9893 56.5158 38.9609 56.552L38.9943 56.5306C39.0169 56.5098 39.0489 56.4853 39.0684 56.469Z" fill="#0D0C22"/> 14067 <path d="M46.7802 54.9518C46.7802 54.9041 46.7569 54.9129 46.7626 55.0826C46.7626 55.0687 46.7683 55.0549 46.7708 55.0417C46.7739 55.0115 46.7764 54.982 46.7802 54.9518Z" fill="#0D0C22"/> 14068 <path d="M45.9844 56.469C45.9422 56.4872 45.9053 56.5158 45.877 56.552L45.9103 56.5306C45.9329 56.5098 45.9649 56.4853 45.9844 56.469Z" fill="#0D0C22"/> 14069 <path d="M33.6307 56.8301C33.5987 56.8023 33.5595 56.784 33.5176 56.7773C33.5515 56.7937 33.5855 56.81 33.6081 56.8226L33.6307 56.8301Z" fill="#0D0C22"/> 14070 <path d="M32.4118 55.6598C32.4068 55.6103 32.3916 55.5624 32.3672 55.519C32.3845 55.5642 32.399 55.6104 32.4106 55.6573L32.4118 55.6598Z" fill="#0D0C22"/> 14071 <path d="M40.623 34.7221C38.9449 35.4405 37.0404 36.2551 34.5722 36.2551C33.5397 36.2531 32.5122 36.1114 31.5176 35.834L33.2247 53.3605C33.2851 54.093 33.6188 54.7761 34.1595 55.2739C34.7003 55.7718 35.4085 56.0482 36.1435 56.048C36.1435 56.048 38.564 56.1737 39.3716 56.1737C40.2409 56.1737 42.8474 56.048 42.8474 56.048C43.5823 56.048 44.2904 55.7716 44.831 55.2737C45.3716 54.7759 45.7052 54.0929 45.7656 53.3605L47.594 33.993C46.7769 33.714 45.9523 33.5286 45.0227 33.5286C43.415 33.5279 42.1196 34.0817 40.623 34.7221Z" fill="white"/> 14072 <path d="M26.2344 27.2449L26.2633 27.2719L26.2821 27.2832C26.2676 27.2688 26.2516 27.2559 26.2344 27.2449Z" fill="#0D0C22"/> 14073 <path d="M55.4906 25.6274L55.2336 24.3307C55.0029 23.1673 54.4793 22.068 53.2851 21.6475C52.9024 21.513 52.468 21.4552 52.1745 21.1768C51.881 20.8983 51.7943 20.4659 51.7264 20.0649C51.6007 19.3289 51.4825 18.5923 51.3537 17.8575C51.2424 17.2259 51.1544 16.5163 50.8647 15.9368C50.4876 15.1586 49.705 14.7036 48.9269 14.4025C48.5282 14.2537 48.1213 14.1278 47.7082 14.0254C45.7642 13.5125 43.7202 13.324 41.7202 13.2165C39.3197 13.084 36.9128 13.1239 34.518 13.3359C32.7355 13.4981 30.8581 13.6942 29.1642 14.3108C28.5451 14.5364 27.9071 14.8073 27.4364 15.2856C26.8587 15.8733 26.6702 16.7821 27.0919 17.515C27.3917 18.0354 27.8996 18.4031 28.4382 18.6463C29.1398 18.9597 29.8726 19.1982 30.6242 19.3578C32.7172 19.8204 34.885 20.0021 37.0233 20.0794C39.3932 20.175 41.767 20.0975 44.1256 19.8474C44.7089 19.7833 45.2911 19.7064 45.8723 19.6168C46.5568 19.5118 46.9961 18.6168 46.7943 17.9933C46.553 17.2479 45.9044 16.9587 45.1709 17.0712C45.0628 17.0882 44.9553 17.1039 44.8472 17.1196L44.7692 17.131C44.5208 17.1624 44.2723 17.1917 44.0238 17.219C43.5105 17.2743 42.9959 17.3195 42.4801 17.3547C41.3249 17.4352 40.1665 17.4722 39.0088 17.4741C37.8712 17.4741 36.7329 17.4421 35.5978 17.3673C35.0799 17.3333 34.5632 17.2902 34.0478 17.2378C33.8134 17.2133 33.5796 17.1875 33.3458 17.1586L33.1233 17.1303L33.0749 17.1234L32.8442 17.0901C32.3728 17.0191 31.9014 16.9374 31.435 16.8387C31.388 16.8283 31.3459 16.8021 31.3157 16.7645C31.2856 16.7269 31.2691 16.6801 31.2691 16.6319C31.2691 16.5837 31.2856 16.5369 31.3157 16.4993C31.3459 16.4617 31.388 16.4356 31.435 16.4251H31.4438C31.848 16.339 32.2553 16.2655 32.6638 16.2014C32.8 16.18 32.9366 16.159 33.0736 16.1385H33.0774C33.3332 16.1215 33.5903 16.0757 33.8448 16.0455C36.0595 15.8151 38.2874 15.7366 40.5128 15.8104C41.5933 15.8419 42.6731 15.9053 43.7485 16.0147C43.9798 16.0386 44.2098 16.0637 44.4399 16.092C44.5279 16.1027 44.6165 16.1153 44.7051 16.1259L44.8836 16.1517C45.404 16.2292 45.9217 16.3233 46.4367 16.4339C47.1997 16.5999 48.1796 16.6539 48.519 17.4898C48.6271 17.7551 48.6761 18.0499 48.7359 18.3283L48.8119 18.6834C48.8139 18.6898 48.8154 18.6963 48.8163 18.7029C48.9961 19.5409 49.176 20.379 49.3562 21.217C49.3694 21.2789 49.3697 21.3429 49.3571 21.4049C49.3445 21.4669 49.3193 21.5257 49.2829 21.5776C49.2466 21.6294 49.2 21.6732 49.146 21.7062C49.092 21.7392 49.0317 21.7608 48.969 21.7695H48.964L48.854 21.7846L48.7453 21.799C48.4009 21.8439 48.056 21.8858 47.7107 21.9247C47.0307 22.0022 46.3496 22.0693 45.6674 22.1259C44.3119 22.2386 42.9536 22.3125 41.5927 22.3477C40.8992 22.3662 40.2059 22.3748 39.5129 22.3735C36.7543 22.3713 33.9981 22.211 31.2578 21.8933C30.9611 21.8581 30.6645 21.8204 30.3678 21.7821C30.5978 21.8116 30.2006 21.7594 30.1202 21.7481C29.9316 21.7217 29.7431 21.6943 29.5545 21.6658C28.9216 21.5709 28.2924 21.454 27.6607 21.3515C26.8971 21.2258 26.1667 21.2887 25.476 21.6658C24.909 21.976 24.4501 22.4518 24.1605 23.0297C23.8626 23.6456 23.7739 24.3163 23.6407 24.9781C23.5074 25.6399 23.3 26.3521 23.3786 27.0315C23.5477 28.4979 24.5728 29.6895 26.0473 29.956C27.4345 30.2074 28.8292 30.4111 30.2276 30.5846C35.7212 31.2574 41.2711 31.3379 46.7818 30.8247C47.2305 30.7828 47.6787 30.7371 48.1262 30.6876C48.266 30.6723 48.4074 30.6884 48.5401 30.7348C48.6729 30.7812 48.7936 30.8566 48.8934 30.9557C48.9932 31.0548 49.0695 31.1749 49.1169 31.3073C49.1642 31.4397 49.1814 31.5811 49.167 31.7209L49.0275 33.0773C48.7463 35.8181 48.4652 38.5587 48.184 41.299C47.8907 44.1769 47.5955 47.0545 47.2984 49.9319C47.2146 50.7422 47.1308 51.5524 47.047 52.3624C46.9666 53.16 46.9552 53.9827 46.8038 54.7709C46.5649 56.0103 45.7258 56.7715 44.5015 57.0499C43.3798 57.3052 42.2339 57.4392 41.0836 57.4497C39.8083 57.4566 38.5336 57.4 37.2583 57.4069C35.897 57.4145 34.2295 57.2887 33.1786 56.2756C32.2553 55.3856 32.1277 53.9921 32.002 52.7872C31.8344 51.192 31.6682 49.5971 31.5036 48.0023L30.5796 39.1344L29.9819 33.3966C29.9718 33.3017 29.9618 33.208 29.9524 33.1125C29.8807 32.428 29.3961 31.758 28.6324 31.7926C27.9788 31.8215 27.2359 32.3771 27.3125 33.1125L27.7557 37.3664L28.672 46.1657C28.9331 48.6652 29.1935 51.165 29.4533 53.6653C29.5036 54.1442 29.5507 54.6244 29.6035 55.1034C29.8908 57.7205 31.8895 59.131 34.3646 59.5282C35.8102 59.7607 37.291 59.8085 38.758 59.8324C40.6386 59.8626 42.538 59.9348 44.3877 59.5942C47.1287 59.0914 49.1853 57.2611 49.4788 54.422C49.5626 53.6024 49.6464 52.7826 49.7302 51.9626C50.0088 49.2507 50.2871 46.5386 50.5649 43.8263L51.4737 34.9641L51.8904 30.9026C51.9112 30.7012 51.9962 30.5118 52.133 30.3625C52.2697 30.2132 52.4509 30.1119 52.6497 30.0736C53.4335 29.9208 54.1827 29.66 54.7402 29.0635C55.6277 28.1138 55.8043 26.8756 55.4906 25.6274ZM26.0071 26.5035C26.019 26.4979 25.997 26.6003 25.9876 26.6481C25.9857 26.5758 25.9895 26.5117 26.0071 26.5035ZM26.0831 27.0918C26.0894 27.0874 26.1083 27.1126 26.1278 27.1428C26.0982 27.1151 26.0794 27.0944 26.0825 27.0918H26.0831ZM26.1579 27.1905C26.185 27.2364 26.1994 27.2653 26.1579 27.1905V27.1905ZM26.3082 27.3125H26.3119C26.3119 27.3169 26.3188 27.3213 26.3214 27.3257C26.3172 27.3208 26.3126 27.3164 26.3075 27.3125H26.3082ZM52.6132 27.1302C52.3317 27.3979 51.9074 27.5224 51.4882 27.5846C46.7868 28.2823 42.0169 28.6355 37.264 28.4796C33.8624 28.3633 30.4967 27.9856 27.129 27.5098C26.799 27.4633 26.4414 27.403 26.2145 27.1597C25.7871 26.7009 25.997 25.777 26.1083 25.2226C26.2101 24.7148 26.405 24.0378 27.009 23.9656C27.9518 23.8549 29.0466 24.2528 29.9794 24.3942C31.1023 24.5656 32.2295 24.7028 33.3609 24.8059C38.1892 25.2459 43.0986 25.1774 47.9056 24.5337C48.7817 24.416 49.6548 24.2792 50.5246 24.1233C51.2996 23.9844 52.1588 23.7236 52.6271 24.5262C52.9482 25.073 52.991 25.8046 52.9413 26.4225C52.926 26.6917 52.8084 26.9448 52.6126 27.1302H52.6132Z" fill="#0D0C22"/> 14074 <path fill-rule="evenodd" clip-rule="evenodd" d="M81.1302 40.1929C80.8556 40.7169 80.4781 41.1732 79.9978 41.5604C79.5175 41.9479 78.9571 42.2633 78.3166 42.5062C77.6761 42.7497 77.0315 42.9131 76.3835 42.9964C75.7352 43.0799 75.106 43.0727 74.4963 42.9735C73.8863 42.8749 73.3674 42.6737 72.9408 42.3695L73.4214 37.3779C73.8633 37.2261 74.4197 37.0703 75.0909 36.9107C75.7619 36.7513 76.452 36.6371 77.1613 36.5689C77.8705 36.5003 78.5412 36.5084 79.1744 36.5917C79.8068 36.6753 80.3065 36.8765 80.6725 37.1958C80.8707 37.378 81.0387 37.5754 81.176 37.7883C81.313 38.0011 81.3969 38.2214 81.4276 38.4493C81.5037 39.0875 81.4047 39.6687 81.1302 40.1929ZM74.153 29.5602C74.4734 29.3627 74.8585 29.1877 75.3083 29.0356C75.7581 28.8841 76.2195 28.7774 76.6923 28.7167C77.1648 28.6562 77.6262 28.6481 78.0763 28.6938C78.5258 28.7395 78.9228 28.8647 79.2659 29.0697C79.6089 29.2751 79.8643 29.5714 80.032 29.9586C80.1997 30.3464 80.2456 30.8365 80.1693 31.429C80.1083 31.9001 79.9211 32.2991 79.6089 32.6256C79.2963 32.9526 78.9147 33.2259 78.4652 33.4462C78.0154 33.6668 77.5388 33.8415 77.0356 33.9702C76.5321 34.0997 76.0477 34.1949 75.5828 34.2553C75.1176 34.3163 74.7137 34.3545 74.3706 34.3692C74.0273 34.3845 73.8021 34.3921 73.6956 34.3921L74.153 29.5602ZM83.6007 36.9676C83.3566 36.4361 83.0287 35.9689 82.6172 35.5658C82.2054 35.1633 81.717 34.8709 81.1531 34.6885C81.3969 34.491 81.6371 34.1795 81.8737 33.7539C82.1099 33.3288 82.3119 32.865 82.4796 32.3636C82.6474 31.8619 82.762 31.357 82.8229 30.8478C82.8836 30.3389 82.8607 29.902 82.7544 29.537C82.4947 28.6256 82.087 27.9114 81.5303 27.3946C80.9734 26.8782 80.3257 26.5211 79.586 26.3233C78.8462 26.1264 78.0304 26.0842 77.1383 26.1981C76.2462 26.312 75.3347 26.5361 74.4049 26.8704C74.4049 26.7946 74.4124 26.7148 74.4278 26.6312C74.4426 26.548 74.4504 26.4604 74.4504 26.369C74.4504 26.1411 74.3361 25.9439 74.1074 25.7765C73.8787 25.6093 73.6155 25.5107 73.3183 25.4801C73.0209 25.45 72.731 25.5142 72.4489 25.6738C72.1665 25.8334 71.9721 26.1264 71.8656 26.5511C71.7434 27.9189 71.6215 29.3398 71.4996 30.8134C71.3774 32.2875 71.248 33.7767 71.1107 35.2812C70.9735 36.7855 70.8362 38.2784 70.6989 39.7598C70.5616 41.2414 70.4244 42.6659 70.2871 44.0333C70.333 44.4436 70.4473 44.7629 70.6304 44.9907C70.8133 45.2189 71.0268 45.3556 71.2709 45.401C71.5147 45.4467 71.7704 45.4045 72.0371 45.2755C72.3038 45.1469 72.5365 44.9222 72.735 44.6032C73.3447 44.9375 74.0311 45.1541 74.7938 45.253C75.5561 45.3516 76.3298 45.3516 77.1157 45.253C77.9007 45.1541 78.6747 44.9682 79.4374 44.6943C80.1997 44.4211 80.8936 44.079 81.519 43.669C82.1441 43.2586 82.6703 42.7911 83.0975 42.2671C83.5244 41.7426 83.8065 41.1767 83.9437 40.5691C84.081 39.946 84.119 39.3231 84.0581 38.7C83.9971 38.0771 83.8445 37.5 83.6007 36.9676Z" fill="#0D0C23"/> 14075 <path fill-rule="evenodd" clip-rule="evenodd" d="M105.915 49.0017C105.832 49.5031 105.713 50.0311 105.561 50.586C105.408 51.1403 105.229 51.6458 105.023 52.1018C104.818 52.5575 104.589 52.9256 104.337 53.207C104.085 53.488 103.815 53.606 103.525 53.5606C103.296 53.5297 103.151 53.3854 103.091 53.1274C103.029 52.8686 103.029 52.5497 103.091 52.17C103.151 51.7901 103.269 51.3607 103.445 50.8821C103.62 50.4035 103.834 49.9284 104.085 49.4577C104.337 48.9864 104.623 48.5347 104.943 48.1015C105.264 47.6686 105.599 47.3075 105.95 47.0189C106.026 47.11 106.06 47.3378 106.053 47.7028C106.045 48.0674 105.999 48.5006 105.915 49.0017ZM113.67 39.1097C113.464 38.8819 113.213 38.7529 112.915 38.7223C112.618 38.6919 112.317 38.859 112.012 39.2237C111.813 39.5883 111.562 39.9379 111.257 40.2722C110.952 40.6067 110.635 40.9103 110.307 41.1839C109.98 41.4572 109.667 41.6931 109.37 41.8903C109.072 42.0881 108.84 42.2324 108.672 42.3235C108.611 41.8374 108.576 41.3132 108.569 40.7507C108.561 40.1886 108.573 39.619 108.603 39.0415C108.649 38.2209 108.744 37.393 108.889 36.557C109.034 35.7213 109.244 34.9007 109.518 34.0951C109.518 33.67 109.419 33.3242 109.221 33.0582C109.022 32.7924 108.782 32.625 108.5 32.5567C108.218 32.4885 107.929 32.5264 107.631 32.6707C107.334 32.8153 107.078 33.0775 106.865 33.4569C106.682 33.9586 106.472 34.5207 106.236 35.1436C105.999 35.7667 105.732 36.4012 105.435 37.0469C105.138 37.6931 104.806 38.3197 104.44 38.9273C104.074 39.5354 103.674 40.075 103.239 40.5457C102.804 41.0168 102.331 41.3854 101.821 41.6512C101.31 41.9172 100.757 42.0349 100.162 42.0045C99.8876 41.9285 99.6893 41.7235 99.5675 41.3889C99.4453 41.0549 99.373 40.6368 99.3504 40.1354C99.3275 39.634 99.3504 39.0831 99.4189 38.4828C99.4877 37.8828 99.5791 37.2863 99.6934 36.6938C99.8078 36.101 99.9337 35.5389 100.071 35.0071C100.208 34.4753 100.337 34.0268 100.46 33.6622C100.643 33.2218 100.643 32.8529 100.46 32.5567C100.277 32.2604 100.025 32.0631 99.705 31.964C99.3846 31.8654 99.0489 31.8694 98.6983 31.9755C98.3474 32.0819 98.0958 32.3173 97.9435 32.682C97.684 33.3054 97.4475 34.004 97.2342 34.779C97.0206 35.5539 96.8491 36.3558 96.7197 37.1836C96.5896 38.0121 96.5171 38.8327 96.502 39.6456C96.5011 39.6985 96.5037 39.7488 96.5034 39.8014C96.1709 40.6848 95.854 41.3525 95.553 41.7992C95.1641 42.377 94.7253 42.6277 94.2375 42.5513C94.0236 42.4603 93.8832 42.2477 93.8147 41.9132C93.7453 41.5792 93.7227 41.1689 93.7453 40.6822C93.7688 40.1964 93.826 39.6456 93.9171 39.0299C94.0091 38.4146 94.1229 37.7764 94.2601 37.1154C94.3977 36.4541 94.5425 35.7899 94.6949 35.121C94.8472 34.4525 94.9845 33.8218 95.107 33.2291C95.0916 32.6973 94.9352 32.291 94.6377 32.0097C94.3405 31.7289 93.9247 31.6187 93.3913 31.6791C93.0253 31.8312 92.7542 32.029 92.579 32.2719C92.4034 32.5148 92.2623 32.8265 92.1558 33.2062C92.0946 33.404 92.0032 33.799 91.8813 34.3918C91.7591 34.984 91.603 35.6644 91.4123 36.4315C91.2217 37.1992 90.9967 38.0005 90.7376 38.8362C90.4781 39.6719 90.1885 40.4283 89.8684 41.1041C89.548 41.7801 89.1972 42.3235 88.8161 42.7338C88.4348 43.1438 88.023 43.3113 87.5807 43.2352C87.3366 43.1895 87.1805 42.9388 87.112 42.4831C87.0432 42.0271 87.0319 41.4653 87.0775 40.7964C87.1233 40.1279 87.2148 39.3946 87.352 38.5971C87.4893 37.7993 87.63 37.0434 87.7752 36.3289C87.92 35.6149 88.0535 34.984 88.1756 34.4372C88.2975 33.8901 88.3814 33.5254 88.4272 33.3433C88.4272 32.9026 88.3277 32.5495 88.1298 32.2832C87.9313 32.0178 87.6913 31.8503 87.4092 31.7818C87.1268 31.7136 86.8372 31.7514 86.54 31.8957C86.2426 32.0403 85.9872 32.3026 85.7736 32.682C85.6973 33.0923 85.598 33.5674 85.4761 34.1067C85.3539 34.6459 85.2361 35.2006 85.1218 35.7705C85.0074 36.3404 84.9003 36.8988 84.8014 37.4459C84.7021 37.993 84.6299 38.4716 84.584 38.8819C84.5536 39.2008 84.519 39.5923 84.4813 40.0556C84.443 40.5194 84.4238 41.0092 84.4238 41.5257C84.4238 42.0427 84.4618 42.5554 84.5385 43.0643C84.6145 43.5735 84.7518 44.0408 84.95 44.4659C85.1482 44.8915 85.4265 45.2408 85.7852 45.5144C86.1433 45.7879 86.5972 45.9397 87.1463 45.9704C87.7101 46.0005 88.202 45.9591 88.6217 45.8449C89.041 45.731 89.4221 45.5523 89.7654 45.3091C90.1084 45.0665 90.421 44.7776 90.7033 44.443C90.9851 44.1091 91.2637 43.7444 91.5383 43.3491C91.7974 43.9269 92.1329 44.3748 92.5447 44.694C92.9565 45.013 93.3913 45.2032 93.8486 45.2637C94.306 45.3241 94.7715 45.2602 95.2442 45.0699C95.7167 44.8803 96.1436 44.5573 96.5252 44.1012C96.7762 43.8216 97.0131 43.5038 97.2354 43.1525C97.3297 43.317 97.4301 43.4758 97.543 43.6224C97.9168 44.1091 98.424 44.443 99.0645 44.6255C99.7506 44.808 100.421 44.8386 101.077 44.7169C101.733 44.5954 102.358 44.3748 102.953 44.0559C103.548 43.7366 104.101 43.3532 104.612 42.9047C105.122 42.4565 105.568 41.9895 105.95 41.5028C105.934 41.8524 105.927 42.1832 105.927 42.4944C105.927 42.8061 105.919 43.1438 105.904 43.5088C105.141 44.0408 104.421 44.679 103.742 45.4233C103.064 46.1676 102.469 46.9616 101.958 47.8051C101.447 48.6483 101.047 49.5031 100.757 50.3691C100.467 51.2357 100.326 52.0445 100.334 52.7969C100.341 53.549 100.521 54.206 100.871 54.7681C101.222 55.3306 101.794 55.7331 102.587 55.9763C103.411 56.2348 104.135 56.242 104.76 55.9991C105.386 55.7559 105.931 55.3531 106.396 54.791C106.861 54.2289 107.242 53.549 107.54 52.7512C107.837 51.9534 108.073 51.1215 108.249 50.2555C108.424 49.3894 108.535 48.5379 108.58 47.7028C108.626 46.8668 108.626 46.1219 108.58 45.4687C109.892 44.9219 110.967 44.2305 111.806 43.3945C112.645 42.5594 113.338 41.6778 113.887 40.7507C114.055 40.5229 114.112 40.2493 114.059 39.9304C114.006 39.6111 113.876 39.3376 113.67 39.1097Z" fill="#0D0C23"/> 14076 <path fill-rule="evenodd" clip-rule="evenodd" d="M142.53 37.6515C142.575 37.3022 142.644 36.9335 142.735 36.546C142.827 36.1585 142.941 35.7823 143.079 35.4177C143.216 35.0531 143.376 34.7379 143.559 34.4718C143.742 34.2061 143.937 34.0161 144.142 33.9019C144.348 33.7883 144.558 33.7995 144.771 33.936C145 34.0731 145.141 34.3617 145.195 34.8021C145.248 35.2433 145.195 35.7141 145.034 36.2155C144.874 36.7172 144.588 37.1879 144.177 37.6286C143.765 38.0696 143.208 38.3579 142.507 38.4947C142.476 38.2824 142.484 38.0011 142.53 37.6515ZM150.456 38.5857C150.204 38.5103 149.964 38.5025 149.735 38.5632C149.506 38.6239 149.361 38.7835 149.301 39.042C149.178 39.5281 148.984 40.0258 148.717 40.5347C148.45 41.0439 148.122 41.5262 147.734 41.9822C147.345 42.438 146.906 42.8408 146.418 43.1901C145.93 43.5397 145.419 43.7904 144.886 43.9422C144.351 44.1096 143.91 44.1284 143.559 43.9991C143.208 43.8705 142.93 43.6498 142.724 43.3384C142.518 43.027 142.369 42.6508 142.278 42.2101C142.186 41.7694 142.133 41.3137 142.118 40.8424C142.987 40.9034 143.761 40.7478 144.44 40.3751C145.118 40.0032 145.694 39.509 146.167 38.8937C146.639 38.2784 146.998 37.587 147.242 36.8195C147.485 36.0524 147.623 35.2887 147.653 34.5288C147.669 33.8146 147.562 33.2108 147.333 32.7169C147.105 32.2233 146.796 31.839 146.407 31.5658C146.018 31.2922 145.572 31.1326 145.069 31.0872C144.566 31.0415 144.054 31.11 143.536 31.2922C142.91 31.505 142.381 31.8506 141.946 32.3294C141.512 32.808 141.149 33.3629 140.86 33.9933C140.57 34.6239 140.341 35.3038 140.173 36.033C140.005 36.7626 139.883 37.4806 139.807 38.1873C139.739 38.8214 139.702 39.4278 139.689 40.013C139.657 40.0874 139.625 40.1588 139.59 40.2383C139.354 40.7782 139.079 41.3062 138.766 41.8226C138.454 42.3394 138.107 42.7725 137.726 43.1218C137.344 43.4714 136.948 43.5929 136.536 43.4865C136.292 43.426 136.159 43.1444 136.136 42.6433C136.113 42.1416 136.139 41.5187 136.216 40.7741C136.292 40.0298 136.38 39.2239 136.479 38.3579C136.578 37.4918 136.628 36.664 136.628 35.8737C136.628 35.1898 136.498 34.5329 136.239 33.9019C135.979 33.2718 135.625 32.7473 135.175 32.3294C134.725 31.9113 134.203 31.634 133.608 31.4975C133.013 31.3605 132.373 31.4518 131.687 31.7708C131 32.09 130.455 32.5382 130.051 33.1157C129.647 33.6934 129.277 34.3009 128.942 34.9391C128.819 34.4528 128.641 34.0011 128.404 33.583C128.167 33.1651 127.878 32.8005 127.535 32.4888C127.191 32.1776 126.806 31.9344 126.38 31.7595C125.953 31.5851 125.502 31.4975 125.03 31.4975C124.572 31.4975 124.149 31.5851 123.76 31.7595C123.371 31.9344 123.017 32.1583 122.696 32.4318C122.376 32.7056 122.087 33.013 121.827 33.3551C121.568 33.6969 121.339 34.0352 121.141 34.3692C121.11 33.9742 121.076 33.6286 121.038 33.332C121 33.0359 120.931 32.7852 120.832 32.5801C120.733 32.3748 120.592 32.2193 120.409 32.1129C120.226 32.0067 119.967 31.9532 119.632 31.9532C119.464 31.9532 119.296 31.9874 119.128 32.0556C118.96 32.1241 118.811 32.2193 118.682 32.3407C118.552 32.4627 118.453 32.6105 118.385 32.7852C118.316 32.9598 118.297 33.1614 118.327 33.3892C118.342 33.5566 118.385 33.7576 118.453 33.9933C118.522 34.2289 118.587 34.5369 118.648 34.9163C118.708 35.2962 118.758 35.756 118.796 36.2953C118.834 36.8349 118.846 37.4959 118.831 38.2784C118.815 39.0611 118.758 39.9763 118.659 41.0248C118.56 42.0733 118.403 43.289 118.19 44.6714C118.16 44.9907 118.282 45.2492 118.556 45.4467C118.831 45.6439 119.143 45.7578 119.494 45.7885C119.845 45.8188 120.177 45.7578 120.489 45.6063C120.802 45.4539 120.981 45.1882 121.027 44.8085C121.072 44.0943 121.16 43.3347 121.29 42.529C121.419 41.724 121.579 40.9262 121.77 40.1359C121.961 39.346 122.178 38.5938 122.422 37.8793C122.666 37.1651 122.937 36.5347 123.234 35.9876C123.532 35.4405 123.84 35.0039 124.161 34.6771C124.481 34.3504 124.816 34.187 125.167 34.187C125.594 34.187 125.926 34.3805 126.162 34.7679C126.398 35.1557 126.566 35.6536 126.666 36.2609C126.765 36.869 126.81 37.5341 126.803 38.2555C126.795 38.9773 126.765 39.6724 126.711 40.341C126.658 41.0098 126.597 41.606 126.528 42.1303C126.46 42.6545 126.41 43.0157 126.38 43.2129C126.38 43.5625 126.513 43.8395 126.78 44.0448C127.046 44.2498 127.344 44.3716 127.672 44.4095C128 44.4476 128.309 44.3866 128.598 44.227C128.888 44.0674 129.056 43.7982 129.102 43.4179C129.254 42.324 129.464 41.2264 129.731 40.1247C129.997 39.023 130.303 38.0355 130.646 37.1616C130.989 36.2878 131.37 35.5735 131.79 35.0189C132.209 34.4646 132.655 34.187 133.128 34.187C133.371 34.187 133.559 34.3544 133.688 34.6884C133.818 35.0227 133.883 35.4784 133.883 36.0559C133.883 36.4815 133.848 36.9184 133.78 37.3666C133.711 37.8148 133.631 38.2784 133.54 38.7569C133.448 39.2358 133.368 39.7256 133.299 40.227C133.231 40.7287 133.196 41.2527 133.196 41.7998C133.196 42.1797 133.235 42.6204 133.311 43.1218C133.387 43.6229 133.532 44.0983 133.745 44.5462C133.959 44.9947 134.252 45.3744 134.626 45.6858C135 45.9973 135.476 46.1531 136.056 46.1531C136.925 46.1531 137.695 45.9669 138.366 45.5947C139.037 45.2226 139.613 44.7365 140.093 44.1362C140.118 44.1047 140.141 44.0711 140.165 44.0399C140.202 44.1287 140.235 44.2227 140.276 44.3071C140.604 44.9756 141.05 45.4921 141.615 45.857C142.178 46.2216 142.842 46.4229 143.605 46.4611C144.367 46.4987 145.198 46.3581 146.098 46.0392C146.769 45.796 147.352 45.4921 147.848 45.1275C148.343 44.7628 148.789 44.3184 149.186 43.7941C149.583 43.2699 149.945 42.6658 150.273 41.9822C150.601 41.2981 150.932 40.5159 151.268 39.6342C151.329 39.3916 151.272 39.1751 151.097 38.9848C150.921 38.7951 150.708 38.6621 150.456 38.5857Z" fill="#0D0C23"/> 14077 <path fill-rule="evenodd" clip-rule="evenodd" d="M162.887 36.0434C162.81 36.4918 162.707 36.986 162.578 37.525C162.448 38.0646 162.284 38.623 162.086 39.2004C161.888 39.7779 161.644 40.2984 161.354 40.7616C161.064 41.2254 160.733 41.5935 160.359 41.8671C159.985 42.1406 159.555 42.2546 159.066 42.2089C158.822 42.1788 158.635 42.0117 158.506 41.7075C158.376 41.4038 158.308 41.0161 158.3 40.545C158.292 40.0743 158.334 39.5575 158.426 38.9951C158.517 38.4333 158.658 37.8821 158.849 37.3426C159.04 36.8036 159.272 36.3056 159.547 35.8496C159.821 35.3939 160.138 35.0405 160.496 34.7898C160.854 34.5391 161.247 34.4217 161.674 34.4365C162.101 34.4518 162.559 34.6643 163.047 35.0747C163.016 35.2725 162.963 35.5954 162.887 36.0434ZM171.019 37.787C170.782 37.6656 170.538 37.6392 170.287 37.7075C170.035 37.7757 169.856 38.0076 169.749 38.4026C169.688 38.8283 169.551 39.3294 169.338 39.9069C169.124 40.4843 168.861 41.0317 168.548 41.5478C168.236 42.0646 167.877 42.494 167.473 42.8358C167.069 43.1778 166.638 43.3337 166.181 43.3028C165.799 43.2727 165.532 43.079 165.38 42.7218C165.227 42.3647 165.147 41.9168 165.14 41.3769C165.132 40.838 165.186 40.2301 165.3 39.5538C165.414 38.8777 165.552 38.2054 165.712 37.5363C165.872 36.868 166.036 36.2258 166.204 35.6105C166.371 34.9951 166.508 34.4747 166.616 34.0493C166.738 33.6693 166.699 33.3466 166.501 33.0803C166.303 32.8149 166.055 32.6246 165.758 32.5107C165.46 32.3967 165.159 32.3664 164.854 32.4196C164.549 32.4728 164.351 32.6362 164.259 32.9094C163.359 32.1345 162.494 31.7166 161.663 31.6559C160.831 31.5952 160.065 31.7776 159.364 32.203C158.662 32.6284 158.041 33.2437 157.5 34.0493C156.958 34.8549 156.52 35.7322 156.184 36.6818C155.849 37.6314 155.639 38.6004 155.555 39.5879C155.471 40.5757 155.536 41.4761 155.75 42.289C155.963 43.1018 156.34 43.7669 156.882 44.283C157.423 44.7998 158.159 45.0583 159.089 45.0583C159.501 45.0583 159.898 44.9747 160.279 44.8076C160.66 44.6401 161.011 44.4426 161.331 44.2148C161.651 43.9869 161.933 43.7475 162.178 43.4968C162.421 43.2461 162.612 43.0373 162.749 42.8699C162.856 43.417 163.032 43.8808 163.276 44.2605C163.519 44.6401 163.798 44.9521 164.111 45.1948C164.423 45.4376 164.751 45.6164 165.094 45.7306C165.437 45.8445 165.769 45.9015 166.089 45.9015C166.806 45.9015 167.477 45.6583 168.102 45.1719C168.727 44.6861 169.288 44.0893 169.784 43.3829C170.279 42.6762 170.687 41.9319 171.007 41.1491C171.328 40.3666 171.541 39.6715 171.648 39.0634C171.755 38.8355 171.735 38.5964 171.591 38.3457C171.446 38.095 171.255 37.909 171.019 37.787Z" fill="#0D0C23"/> 14078 <path fill-rule="evenodd" clip-rule="evenodd" d="M212.194 50.3701C212.064 50.8866 211.862 51.3238 211.587 51.6806C211.313 52.0377 210.97 52.2239 210.558 52.2393C210.299 52.2543 210.101 52.1175 209.963 51.8289C209.826 51.5401 209.731 51.1679 209.678 50.7122C209.624 50.2562 209.601 49.747 209.609 49.1849C209.616 48.6227 209.639 48.0681 209.678 47.521C209.715 46.9742 209.761 46.4647 209.815 45.9939C209.868 45.5226 209.91 45.1586 209.94 44.9C210.459 44.9608 210.89 45.1846 211.233 45.5723C211.576 45.9598 211.839 46.4193 212.022 46.9514C212.205 47.4831 212.312 48.0568 212.343 48.6722C212.373 49.2875 212.323 49.8534 212.194 50.3701ZM203.913 50.3701C203.783 50.8866 203.581 51.3238 203.307 51.6806C203.032 52.0377 202.689 52.2239 202.277 52.2393C202.018 52.2543 201.82 52.1175 201.683 51.8289C201.545 51.5401 201.45 51.1679 201.397 50.7122C201.343 50.2562 201.32 49.747 201.328 49.1849C201.336 48.6227 201.358 48.0681 201.397 47.521C201.434 46.9742 201.48 46.4647 201.534 45.9939C201.587 45.5226 201.629 45.1586 201.66 44.9C202.178 44.9608 202.609 45.1846 202.952 45.5723C203.295 45.9598 203.558 46.4193 203.741 46.9514C203.924 47.4831 204.031 48.0568 204.062 48.6722C204.092 49.2875 204.042 49.8534 203.913 50.3701ZM195.415 37.4241C195.399 37.7884 195.365 38.1114 195.312 38.3925C195.258 38.6741 195.186 38.8522 195.095 38.9283C194.927 38.8369 194.721 38.6018 194.477 38.2216C194.233 37.8419 194.042 37.4122 193.905 36.9336C193.768 36.4551 193.725 35.9843 193.779 35.5205C193.832 35.0573 194.073 34.6967 194.5 34.4379C194.667 34.3468 194.812 34.3809 194.934 34.5405C195.056 34.7001 195.155 34.9318 195.232 35.2357C195.308 35.5399 195.361 35.8892 195.392 36.2842C195.422 36.6795 195.43 37.0591 195.415 37.4241ZM193.39 41.9711C193.154 42.2215 192.89 42.4381 192.601 42.6206C192.311 42.803 192.014 42.9398 191.709 43.0309C191.404 43.1223 191.129 43.1448 190.885 43.0991C190.199 42.9627 189.673 42.666 189.307 42.2103C188.941 41.7545 188.708 41.219 188.609 40.6037C188.51 39.9881 188.521 39.3308 188.644 38.6319C188.765 37.933 188.971 37.2835 189.261 36.6832C189.551 36.0829 189.902 35.5662 190.313 35.1333C190.725 34.7001 191.175 34.4306 191.663 34.3239C191.48 35.0989 191.419 35.9007 191.48 36.7286C191.541 37.5568 191.739 38.3355 192.075 39.0648C192.288 39.506 192.544 39.9082 192.841 40.2729C193.139 40.6378 193.501 40.9492 193.928 41.2075C193.806 41.466 193.626 41.7204 193.39 41.9711ZM218.702 37.6519C218.747 37.3026 218.816 36.9336 218.908 36.5462C218.999 36.159 219.114 35.7828 219.251 35.4181C219.388 35.0532 219.548 34.738 219.731 34.4723C219.914 34.2065 220.108 34.0163 220.314 33.9024C220.52 33.7884 220.73 33.7997 220.943 33.9365C221.172 34.0735 221.313 34.3621 221.367 34.8025C221.42 35.2435 221.367 35.7142 221.207 36.2159C221.046 36.7173 220.761 37.1884 220.349 37.6288C219.937 38.07 219.38 38.3583 218.679 38.4951C218.648 38.2826 218.656 38.0015 218.702 37.6519ZM227.921 37.6519C227.966 37.3026 228.035 36.9336 228.126 36.5462C228.218 36.159 228.332 35.7828 228.47 35.4181C228.607 35.0532 228.767 34.738 228.95 34.4723C229.133 34.2065 229.328 34.0163 229.533 33.9024C229.739 33.7884 229.949 33.7997 230.162 33.9365C230.391 34.0735 230.532 34.3621 230.586 34.8025C230.639 35.2435 230.586 35.7142 230.425 36.2159C230.265 36.7173 229.979 37.1884 229.568 37.6288C229.156 38.07 228.599 38.3583 227.898 38.4951C227.867 38.2826 227.875 38.0015 227.921 37.6519ZM236.488 38.9852C236.312 38.7955 236.099 38.6625 235.847 38.5862C235.595 38.5104 235.355 38.5029 235.126 38.5636C234.897 38.6244 234.752 38.784 234.692 39.0422C234.57 39.5286 234.375 40.0262 234.108 40.5349C233.841 41.0444 233.514 41.5267 233.125 41.9824C232.736 42.4381 232.297 42.8412 231.81 43.1905C231.321 43.5401 230.81 43.7908 230.277 43.9423C229.743 44.1101 229.301 44.1289 228.95 43.9996C228.599 43.8706 228.321 43.6503 228.115 43.3389C227.909 43.0271 227.761 42.6512 227.669 42.2103C227.578 41.7699 227.524 41.3142 227.509 40.8428C228.378 40.9038 229.152 40.7483 229.831 40.3755C230.509 40.0034 231.085 39.5092 231.558 38.8939C232.031 38.2788 232.389 37.5874 232.633 36.82C232.877 36.0526 233.014 35.2892 233.045 34.5293C233.06 33.815 232.953 33.211 232.724 32.7171C232.496 32.2235 232.187 31.8395 231.798 31.5662C231.409 31.2924 230.963 31.133 230.46 31.0874C229.957 31.0417 229.445 31.1105 228.927 31.2924C228.302 31.5055 227.772 31.851 227.338 32.3296C226.903 32.8085 226.54 33.3634 226.251 33.9934C225.961 34.6244 225.732 35.3039 225.564 36.0335C225.396 36.7627 225.274 37.481 225.199 38.1874C225.124 38.873 225.084 39.5292 225.075 40.1572C225.017 40.2824 224.956 40.4082 224.889 40.5349C224.622 41.0444 224.295 41.5267 223.906 41.9824C223.517 42.4381 223.078 42.8412 222.591 43.1905C222.102 43.5401 221.592 43.7908 221.058 43.9423C220.524 44.1101 220.082 44.1289 219.731 43.9996C219.38 43.8706 219.102 43.6503 218.896 43.3389C218.691 43.0271 218.542 42.6512 218.45 42.2103C218.359 41.7699 218.305 41.3142 218.29 40.8428C219.159 40.9038 219.933 40.7483 220.612 40.3755C221.29 40.0034 221.866 39.5092 222.339 38.8939C222.811 38.2788 223.17 37.5874 223.414 36.82C223.658 36.0526 223.795 35.2892 223.826 34.5293C223.841 33.815 223.734 33.211 223.506 32.7171C223.277 32.2235 222.968 31.8395 222.579 31.5662C222.19 31.2924 221.744 31.133 221.241 31.0874C220.738 31.0417 220.227 31.1105 219.708 31.2924C219.083 31.5055 218.553 31.851 218.119 32.3296C217.684 32.8085 217.321 33.3634 217.032 33.9934C216.742 34.6244 216.513 35.3039 216.346 36.0335C216.178 36.7627 216.056 37.481 215.98 38.1874C215.936 38.5859 215.907 38.9722 215.886 39.3516C215.739 39.4765 215.595 39.6023 215.442 39.7258C214.916 40.1514 214.363 40.5349 213.784 40.8769C213.204 41.219 212.601 41.5001 211.977 41.7204C211.351 41.9408 210.71 42.0738 210.055 42.1192L211.473 26.9847C211.565 26.6655 211.519 26.3847 211.336 26.1415C211.153 25.8983 210.916 25.7312 210.627 25.6401C210.337 25.5488 210.028 25.5566 209.7 25.6627C209.372 25.7694 209.102 26.0126 208.888 26.3919C208.781 26.9697 208.671 27.7597 208.557 28.7625C208.442 29.7653 208.328 30.8595 208.213 32.0448C208.099 33.23 207.985 34.4532 207.87 35.7142C207.756 36.9759 207.657 38.1533 207.573 39.2472C207.569 39.2958 207.566 39.3398 207.562 39.3878C207.429 39.5005 207.299 39.6142 207.161 39.7258C206.635 40.1514 206.082 40.5349 205.503 40.8769C204.923 41.219 204.321 41.5001 203.696 41.7204C203.07 41.9408 202.429 42.0738 201.774 42.1192L203.192 26.9847C203.284 26.6655 203.238 26.3847 203.055 26.1415C202.872 25.8983 202.635 25.7312 202.346 25.6401C202.056 25.5488 201.747 25.5566 201.419 25.6627C201.091 25.7694 200.821 26.0126 200.607 26.3919C200.501 26.9697 200.39 27.7597 200.276 28.7625C200.161 29.7653 200.047 30.8595 199.933 32.0448C199.818 33.23 199.704 34.4532 199.589 35.7142C199.475 36.9759 199.376 38.1533 199.292 39.2472C199.29 39.2692 199.289 39.2891 199.287 39.3111C199.048 39.4219 198.786 39.519 198.503 39.6006C198.213 39.6844 197.885 39.7339 197.519 39.7489C197.58 39.4751 197.63 39.1712 197.668 38.8369C197.706 38.5029 197.737 38.1533 197.76 37.7884C197.782 37.4241 197.79 37.0591 197.782 36.6945C197.774 36.3296 197.755 35.9956 197.725 35.6914C197.649 35.0385 197.508 34.4191 197.302 33.8338C197.096 33.2491 196.818 32.7593 196.467 32.3637C196.116 31.9687 195.678 31.7027 195.151 31.5662C194.626 31.4294 194.012 31.4748 193.31 31.7027C192.273 31.5662 191.339 31.6613 190.508 31.9878C189.677 32.3149 188.956 32.7894 188.346 33.4122C187.736 34.0357 187.237 34.7684 186.848 35.6119C186.459 36.4551 186.2 37.3214 186.07 38.21C186.015 38.5868 185.988 38.9618 185.98 39.336C185.744 39.8177 185.486 40.2388 185.201 40.5921C184.797 41.0935 184.377 41.5038 183.943 41.8228C183.508 42.142 183.077 42.3852 182.65 42.5523C182.223 42.7198 181.842 42.8337 181.507 42.8941C181.11 42.9702 180.729 42.978 180.363 42.917C179.997 42.8565 179.661 42.6816 179.357 42.3927C179.112 42.1802 178.925 41.8381 178.796 41.3671C178.666 40.896 178.59 40.3608 178.567 39.7602C178.544 39.1599 178.567 38.533 178.636 37.8798C178.705 37.2266 178.822 36.6072 178.99 36.0222C179.158 35.4372 179.371 34.913 179.631 34.4492C179.89 33.9862 180.195 33.6554 180.546 33.4579C180.744 33.4886 180.866 33.606 180.912 33.811C180.958 34.0163 180.969 34.2595 180.946 34.5405C180.923 34.8219 180.889 35.1105 180.843 35.4066C180.797 35.703 180.775 35.9502 180.775 36.1474C180.851 36.5577 180.999 36.877 181.221 37.1048C181.441 37.3327 181.69 37.466 181.964 37.5036C182.239 37.5417 182.509 37.4773 182.776 37.3098C183.043 37.143 183.26 36.877 183.428 36.512C183.443 36.5274 183.466 36.5349 183.497 36.5349L183.817 33.6404C183.909 33.2451 183.847 32.8958 183.634 32.5919C183.42 32.288 183.138 32.113 182.788 32.0676C182.345 31.4294 181.747 31.0914 180.992 31.0532C180.237 31.0154 179.463 31.2623 178.67 31.7941C178.182 32.144 177.751 32.626 177.378 33.2413C177.004 33.857 176.699 34.5405 176.463 35.2926C176.226 36.0448 176.058 36.8391 175.959 37.6748C175.86 38.5104 175.841 39.3236 175.902 40.1133C175.963 40.9038 176.104 41.6484 176.325 42.347C176.546 43.0462 176.855 43.6312 177.252 44.102C177.587 44.5123 177.968 44.8127 178.395 45.0027C178.822 45.1927 179.268 45.3101 179.734 45.3558C180.199 45.4012 180.66 45.3821 181.118 45.2988C181.575 45.2155 182.01 45.0978 182.421 44.9454C182.955 44.7482 183.505 44.4972 184.069 44.1933C184.633 43.8897 185.174 43.5248 185.693 43.0991C185.966 42.8753 186.228 42.6313 186.482 42.3696C186.598 42.6553 186.727 42.9317 186.882 43.1905C187.294 43.8741 187.85 44.429 188.552 44.8544C189.253 45.2797 190.115 45.4844 191.137 45.4697C192.235 45.4544 193.249 45.1774 194.18 44.6378C195.11 44.0988 195.872 43.3042 196.467 42.256C197.358 42.256 198.234 42.1096 199.096 41.819C199.089 41.911 199.081 42.0079 199.075 42.0966C199.014 42.9019 198.983 43.4487 198.983 43.7376C198.968 44.239 198.934 44.8581 198.88 45.5949C198.827 46.332 198.793 47.1069 198.778 47.9198C198.763 48.7326 198.793 49.5532 198.869 50.3817C198.945 51.2096 199.105 51.962 199.349 52.6383C199.593 53.3141 199.94 53.8878 200.39 54.3591C200.84 54.8299 201.431 55.1112 202.163 55.2023C202.941 55.3084 203.612 55.1717 204.176 54.792C204.74 54.412 205.198 53.8918 205.549 53.2308C205.899 52.5695 206.147 51.8061 206.292 50.9401C206.437 50.074 206.479 49.2039 206.418 48.3301C206.357 47.4562 206.196 46.6321 205.937 45.8575C205.678 45.0822 205.319 44.444 204.862 43.9423C205.137 43.8669 205.465 43.7226 205.846 43.5095C206.227 43.2969 206.62 43.0575 207.024 42.7915C207.123 42.7261 207.221 42.6573 207.32 42.5902C207.283 43.1286 207.264 43.5126 207.264 43.7376C207.249 44.239 207.215 44.8581 207.161 45.5949C207.108 46.332 207.073 47.1069 207.058 47.9198C207.043 48.7326 207.073 49.5532 207.15 50.3817C207.226 51.2096 207.386 51.962 207.63 52.6383C207.874 53.3141 208.221 53.8878 208.671 54.3591C209.121 54.8299 209.712 55.1112 210.444 55.2023C211.221 55.3084 211.892 55.1717 212.457 54.792C213.021 54.412 213.478 53.8918 213.83 53.2308C214.18 52.5695 214.428 51.8061 214.573 50.9401C214.718 50.074 214.759 49.2039 214.699 48.3301C214.637 47.4562 214.477 46.6321 214.218 45.8575C213.959 45.0822 213.601 44.444 213.143 43.9423C213.418 43.8669 213.745 43.7226 214.127 43.5095C214.508 43.2969 214.9 43.0575 215.305 42.7915C215.515 42.6533 215.724 42.5107 215.932 42.3641C216.01 43.1072 216.179 43.759 216.448 44.3073C216.776 44.9761 217.222 45.4925 217.787 45.8575C218.351 46.2218 219.014 46.4234 219.777 46.4612C220.539 46.4988 221.37 46.3586 222.271 46.0393C222.941 45.7965 223.525 45.4925 224.02 45.1279C224.516 44.763 224.962 44.3185 225.358 43.7946C225.381 43.7642 225.403 43.7313 225.425 43.7006C225.496 43.9134 225.574 44.1179 225.667 44.3073C225.995 44.9761 226.441 45.4925 227.006 45.8575C227.569 46.2218 228.233 46.4234 228.996 46.4612C229.758 46.4988 230.589 46.3586 231.489 46.0393C232.16 45.7965 232.744 45.4925 233.239 45.1279C233.735 44.763 234.181 44.3185 234.577 43.7946C234.974 43.27 235.336 42.666 235.664 41.9824C235.992 41.2985 236.323 40.5164 236.659 39.6347C236.72 39.3918 236.663 39.1752 236.488 38.9852Z" fill="#0D0C23"/> 14079 </svg>`; 14080 var paypal = ` 14081 <svg xmlns="http://www.w3.org/2000/svg" width="150" height="40"> 14082 <path fill="#253B80" d="M46.211 6.749h-6.839a.95.95 0 0 0-.939.802l-2.766 17.537a.57.57 0 0 0 .564.658h3.265a.95.95 0 0 0 .939-.803l.746-4.73a.95.95 0 0 1 .938-.803h2.165c4.505 0 7.105-2.18 7.784-6.5.306-1.89.013-3.375-.872-4.415-.972-1.142-2.696-1.746-4.985-1.746zM47 13.154c-.374 2.454-2.249 2.454-4.062 2.454h-1.032l.724-4.583a.57.57 0 0 1 .563-.481h.473c1.235 0 2.4 0 3.002.704.359.42.469 1.044.332 1.906zM66.654 13.075h-3.275a.57.57 0 0 0-.563.481l-.145.916-.229-.332c-.709-1.029-2.29-1.373-3.868-1.373-3.619 0-6.71 2.741-7.312 6.586-.313 1.918.132 3.752 1.22 5.031.998 1.176 2.426 1.666 4.125 1.666 2.916 0 4.533-1.875 4.533-1.875l-.146.91a.57.57 0 0 0 .562.66h2.95a.95.95 0 0 0 .939-.803l1.77-11.209a.568.568 0 0 0-.561-.658zm-4.565 6.374c-.316 1.871-1.801 3.127-3.695 3.127-.951 0-1.711-.305-2.199-.883-.484-.574-.668-1.391-.514-2.301.295-1.855 1.805-3.152 3.67-3.152.93 0 1.686.309 2.184.892.499.589.697 1.411.554 2.317zM84.096 13.075h-3.291a.954.954 0 0 0-.787.417l-4.539 6.686-1.924-6.425a.953.953 0 0 0-.912-.678h-3.234a.57.57 0 0 0-.541.754l3.625 10.638-3.408 4.811a.57.57 0 0 0 .465.9h3.287a.949.949 0 0 0 .781-.408l10.946-15.8a.57.57 0 0 0-.468-.895z"/> 14083 <path fill="#179BD7" d="M94.992 6.749h-6.84a.95.95 0 0 0-.938.802l-2.766 17.537a.569.569 0 0 0 .562.658h3.51a.665.665 0 0 0 .656-.562l.785-4.971a.95.95 0 0 1 .938-.803h2.164c4.506 0 7.105-2.18 7.785-6.5.307-1.89.012-3.375-.873-4.415-.971-1.142-2.694-1.746-4.983-1.746zm.789 6.405c-.373 2.454-2.248 2.454-4.062 2.454h-1.031l.725-4.583a.568.568 0 0 1 .562-.481h.473c1.234 0 2.4 0 3.002.704.359.42.468 1.044.331 1.906zM115.434 13.075h-3.273a.567.567 0 0 0-.562.481l-.145.916-.23-.332c-.709-1.029-2.289-1.373-3.867-1.373-3.619 0-6.709 2.741-7.311 6.586-.312 1.918.131 3.752 1.219 5.031 1 1.176 2.426 1.666 4.125 1.666 2.916 0 4.533-1.875 4.533-1.875l-.146.91a.57.57 0 0 0 .564.66h2.949a.95.95 0 0 0 .938-.803l1.771-11.209a.571.571 0 0 0-.565-.658zm-4.565 6.374c-.314 1.871-1.801 3.127-3.695 3.127-.949 0-1.711-.305-2.199-.883-.484-.574-.666-1.391-.514-2.301.297-1.855 1.805-3.152 3.67-3.152.93 0 1.686.309 2.184.892.501.589.699 1.411.554 2.317zM119.295 7.23l-2.807 17.858a.569.569 0 0 0 .562.658h2.822c.469 0 .867-.34.939-.803l2.768-17.536a.57.57 0 0 0-.562-.659h-3.16a.571.571 0 0 0-.562.482z"/> 14084 <path fill="#253B80" d="M7.266 29.154l.523-3.322-1.165-.027H1.061L4.927 1.292a.316.316 0 0 1 .314-.268h9.38c3.114 0 5.263.648 6.385 1.927.526.6.861 1.227 1.023 1.917.17.724.173 1.589.007 2.644l-.012.077v.676l.526.298a3.69 3.69 0 0 1 1.065.812c.45.513.741 1.165.864 1.938.127.795.085 1.741-.123 2.812-.24 1.232-.628 2.305-1.152 3.183a6.547 6.547 0 0 1-1.825 2c-.696.494-1.523.869-2.458 1.109-.906.236-1.939.355-3.072.355h-.73c-.522 0-1.029.188-1.427.525a2.21 2.21 0 0 0-.744 1.328l-.055.299-.924 5.855-.042.215c-.011.068-.03.102-.058.125a.155.155 0 0 1-.096.035H7.266z"/> 14085 <path fill="#179BD7" d="M23.048 7.667c-.028.179-.06.362-.096.55-1.237 6.351-5.469 8.545-10.874 8.545H9.326c-.661 0-1.218.48-1.321 1.132L6.596 26.83l-.399 2.533a.704.704 0 0 0 .695.814h4.881c.578 0 1.069-.42 1.16-.99l.048-.248.919-5.832.059-.32c.09-.572.582-.992 1.16-.992h.73c4.729 0 8.431-1.92 9.513-7.476.452-2.321.218-4.259-.978-5.622a4.667 4.667 0 0 0-1.336-1.03z"/> 14086 <path fill="#222D65" d="M21.754 7.151a9.757 9.757 0 0 0-1.203-.267 15.284 15.284 0 0 0-2.426-.177h-7.352a1.172 1.172 0 0 0-1.159.992L8.05 17.605l-.045.289a1.336 1.336 0 0 1 1.321-1.132h2.752c5.405 0 9.637-2.195 10.874-8.545.037-.188.068-.371.096-.55a6.594 6.594 0 0 0-1.017-.429 9.045 9.045 0 0 0-.277-.087z"/> 14087 <path fill="#253B80" d="M9.614 7.699a1.169 1.169 0 0 1 1.159-.991h7.352c.871 0 1.684.057 2.426.177a9.757 9.757 0 0 1 1.481.353c.365.121.704.264 1.017.429.368-2.347-.003-3.945-1.272-5.392C20.378.682 17.853 0 14.622 0h-9.38c-.66 0-1.223.48-1.325 1.133L.01 25.898a.806.806 0 0 0 .795.932h5.791l1.454-9.225 1.564-9.906z"/> 14088 </svg>`; 14089 /*! Bundled license information: 14090 14091 decimal.js/decimal.js: 14092 (*! 14093 * decimal.js v10.4.3 14094 * An arbitrary-precision Decimal type for JavaScript. 14095 * https://github.com/MikeMcl/decimal.js 14096 * Copyright (c) 2022 Michael Mclaughlin <M8ch88l@gmail.com> 14097 * MIT Licence 14098 *) 14099 14100 lodash/lodash.js: 14101 (** 14102 * @license 14103 * Lodash <https://lodash.com/> 14104 * Copyright OpenJS Foundation and other contributors <https://openjsf.org/> 14105 * Released under MIT license <https://lodash.com/license> 14106 * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> 14107 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors 14108 *) 14109 */