1import { G as getDefaultExportFromCjs, p as prop, i as if_block, d as bind_this, a as set_attribute, b as set_class, h as clsx } from './i18n-dpAHICcw.js'; 2import { R as push, u as state, v as proxy, a4 as createEventDispatcher, y as user_effect, w as get, x as set, a6 as comment, S as first_child, a as append, T as pop, V as child, X as sibling, Y as reset, a8 as next, t as template_effect, a0 as set_text, W as from_html, a5 as user_derived, au as to_array, b1 as noop } from './index-CDZuCcOm.js'; 3import { s as snapshot } from './clone-dZfS06Ds.js'; 4import { s as snippet } from './snippet-DVkMfmSq.js'; 5 6var handlebars = {exports: {}}; 7 8var handlebars_runtime = {exports: {}}; 9 10var base$1 = {}; 11 12var utils = {}; 13 14var hasRequiredUtils; 15 16function requireUtils () { 17 if (hasRequiredUtils) return utils; 18 hasRequiredUtils = 1; 19 20 utils.__esModule = true; 21 utils.extend = extend; 22 utils.indexOf = indexOf; 23 utils.escapeExpression = escapeExpression; 24 utils.isEmpty = isEmpty; 25 utils.createFrame = createFrame; 26 utils.blockParams = blockParams; 27 utils.appendContextPath = appendContextPath; 28 var escape = { 29 '&': '&', 30 '<': '<', 31 '>': '>', 32 '"': '"', 33 "'": ''', 34 '`': '`', 35 '=': '=' 36 }; 37 38 var badChars = /[&<>"'`=]/g, 39 possible = /[&<>"'`=]/; 40 41 function escapeChar(chr) { 42 return escape[chr]; 43 } 44 45 function extend(obj /* , ...source */) { 46 for (var i = 1; i < arguments.length; i++) { 47 for (var key in arguments[i]) { 48 if (Object.prototype.hasOwnProperty.call(arguments[i], key)) { 49 obj[key] = arguments[i][key]; 50 } 51 } 52 } 53 54 return obj; 55 } 56 57 var toString = Object.prototype.toString; 58 59 utils.toString = toString; 60 // Sourced from lodash 61 // https://github.com/bestiejs/lodash/blob/master/LICENSE.txt 62 /* eslint-disable func-style */ 63 var isFunction = function isFunction(value) { 64 return typeof value === 'function'; 65 }; 66 // fallback for older versions of Chrome and Safari 67 /* istanbul ignore next */ 68 if (isFunction(/x/)) { 69 utils.isFunction = isFunction = function (value) { 70 return typeof value === 'function' && toString.call(value) === '[object Function]'; 71 }; 72 } 73 utils.isFunction = isFunction; 74 75 /* eslint-enable func-style */ 76 77 /* istanbul ignore next */ 78 var isArray = Array.isArray || function (value) { 79 return value && typeof value === 'object' ? toString.call(value) === '[object Array]' : false; 80 }; 81 82 utils.isArray = isArray; 83 // Older IE versions do not directly support indexOf so we must implement our own, sadly. 84 85 function indexOf(array, value) { 86 for (var i = 0, len = array.length; i < len; i++) { 87 if (array[i] === value) { 88 return i; 89 } 90 } 91 return -1; 92 } 93 94 function escapeExpression(string) { 95 if (typeof string !== 'string') { 96 // don't escape SafeStrings, since they're already safe 97 if (string && string.toHTML) { 98 return string.toHTML(); 99 } else if (string == null) { 100 return ''; 101 } else if (!string) { 102 return string + ''; 103 } 104 105 // Force a string conversion as this will be done by the append regardless and 106 // the regex test will do this transparently behind the scenes, causing issues if 107 // an object's to string has escaped characters in it. 108 string = '' + string; 109 } 110 111 if (!possible.test(string)) { 112 return string; 113 } 114 return string.replace(badChars, escapeChar); 115 } 116 117 function isEmpty(value) { 118 if (!value && value !== 0) { 119 return true; 120 } else if (isArray(value) && value.length === 0) { 121 return true; 122 } else { 123 return false; 124 } 125 } 126 127 function createFrame(object) { 128 var frame = extend({}, object); 129 frame._parent = object; 130 return frame; 131 } 132 133 function blockParams(params, ids) { 134 params.path = ids; 135 return params; 136 } 137 138 function appendContextPath(contextPath, id) { 139 return (contextPath ? contextPath + '.' : '') + id; 140 } 141 142 return utils; 143} 144 145var exception = {exports: {}}; 146 147var hasRequiredException; 148 149function requireException () { 150 if (hasRequiredException) return exception.exports; 151 hasRequiredException = 1; 152 (function (module, exports$1) { 153 154 exports$1.__esModule = true; 155 var errorProps = ['description', 'fileName', 'lineNumber', 'endLineNumber', 'message', 'name', 'number', 'stack']; 156 157 function Exception(message, node) { 158 var loc = node && node.loc, 159 line = undefined, 160 endLineNumber = undefined, 161 column = undefined, 162 endColumn = undefined; 163 164 if (loc) { 165 line = loc.start.line; 166 endLineNumber = loc.end.line; 167 column = loc.start.column; 168 endColumn = loc.end.column; 169
vendor: 10,174 bytes, lines 170-540
170 message += ' - ' + line + ':' + column; 171 } 172 173 var tmp = Error.prototype.constructor.call(this, message); 174 175 // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work. 176 for (var idx = 0; idx < errorProps.length; idx++) { 177 this[errorProps[idx]] = tmp[errorProps[idx]]; 178 } 179 180 /* istanbul ignore else */ 181 if (Error.captureStackTrace) { 182 Error.captureStackTrace(this, Exception); 183 } 184 185 try { 186 if (loc) { 187 this.lineNumber = line; 188 this.endLineNumber = endLineNumber; 189 190 // Work around issue under safari where we can't directly set the column value 191 /* istanbul ignore next */ 192 if (Object.defineProperty) { 193 Object.defineProperty(this, 'column', { 194 value: column, 195 enumerable: true 196 }); 197 Object.defineProperty(this, 'endColumn', { 198 value: endColumn, 199 enumerable: true 200 }); 201 } else { 202 this.column = column; 203 this.endColumn = endColumn; 204 } 205 } 206 } catch (nop) { 207 /* Ignore if the browser is very particular */ 208 } 209 } 210 211 Exception.prototype = new Error(); 212 213 exports$1['default'] = Exception; 214 module.exports = exports$1['default']; 215 216 } (exception, exception.exports)); 217 return exception.exports; 218} 219 220var helpers$1 = {}; 221 222var blockHelperMissing = {exports: {}}; 223 224var hasRequiredBlockHelperMissing; 225 226function requireBlockHelperMissing () { 227 if (hasRequiredBlockHelperMissing) return blockHelperMissing.exports; 228 hasRequiredBlockHelperMissing = 1; 229 (function (module, exports$1) { 230 231 exports$1.__esModule = true; 232 233 var _utils = requireUtils(); 234 235 exports$1['default'] = function (instance) { 236 instance.registerHelper('blockHelperMissing', function (context, options) { 237 var inverse = options.inverse, 238 fn = options.fn; 239 240 if (context === true) { 241 return fn(this); 242 } else if (context === false || context == null) { 243 return inverse(this); 244 } else if (_utils.isArray(context)) { 245 if (context.length > 0) { 246 if (options.ids) { 247 options.ids = [options.name]; 248 } 249 250 return instance.helpers.each(context, options); 251 } else { 252 return inverse(this); 253 } 254 } else { 255 if (options.data && options.ids) { 256 var data = _utils.createFrame(options.data); 257 data.contextPath = _utils.appendContextPath(options.data.contextPath, options.name); 258 options = { data: data }; 259 } 260 261 return fn(context, options); 262 } 263 }); 264 }; 265 266 module.exports = exports$1['default']; 267 268 } (blockHelperMissing, blockHelperMissing.exports)); 269 return blockHelperMissing.exports; 270} 271 272var each = {exports: {}}; 273 274var hasRequiredEach; 275 276function requireEach () { 277 if (hasRequiredEach) return each.exports; 278 hasRequiredEach = 1; 279 (function (module, exports$1) { 280 281 exports$1.__esModule = true; 282 // istanbul ignore next 283 284 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 285 286 var _utils = requireUtils(); 287 288 var _exception = requireException(); 289 290 var _exception2 = _interopRequireDefault(_exception); 291 292 exports$1['default'] = function (instance) { 293 instance.registerHelper('each', function (context, options) { 294 if (!options) { 295 throw new _exception2['default']('Must pass iterator to #each'); 296 } 297 298 var fn = options.fn, 299 inverse = options.inverse, 300 i = 0, 301 ret = '', 302 data = undefined, 303 contextPath = undefined; 304 305 if (options.data && options.ids) { 306 contextPath = _utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.'; 307 } 308 309 if (_utils.isFunction(context)) { 310 context = context.call(this); 311 } 312 313 if (options.data) { 314 data = _utils.createFrame(options.data); 315 } 316 317 function execIteration(field, index, last) { 318 if (data) { 319 data.key = field; 320 data.index = index; 321 data.first = index === 0; 322 data.last = !!last; 323 324 if (contextPath) { 325 data.contextPath = contextPath + field; 326 } 327 } 328 329 ret = ret + fn(context[field], { 330 data: data, 331 blockParams: _utils.blockParams([context[field], field], [contextPath + field, null]) 332 }); 333 } 334 335 if (context && typeof context === 'object') { 336 if (_utils.isArray(context)) { 337 for (var j = context.length; i < j; i++) { 338 if (i in context) { 339 execIteration(i, i, i === context.length - 1); 340 } 341 } 342 } else if (typeof Symbol === 'function' && context[Symbol.iterator]) { 343 var newContext = []; 344 var iterator = context[Symbol.iterator](); 345 for (var it = iterator.next(); !it.done; it = iterator.next()) { 346 newContext.push(it.value); 347 } 348 context = newContext; 349 for (var j = context.length; i < j; i++) { 350 execIteration(i, i, i === context.length - 1); 351 } 352 } else { 353 (function () { 354 var priorKey = undefined; 355 356 Object.keys(context).forEach(function (key) { 357 // We're running the iterations one step out of sync so we can detect 358 // the last iteration without have to scan the object twice and create 359 // an itermediate keys array. 360 if (priorKey !== undefined) { 361 execIteration(priorKey, i - 1); 362 } 363 priorKey = key; 364 i++; 365 }); 366 if (priorKey !== undefined) { 367 execIteration(priorKey, i - 1, true); 368 } 369 })(); 370 } 371 } 372 373 if (i === 0) { 374 ret = inverse(this); 375 } 376 377 return ret; 378 }); 379 }; 380 381 module.exports = exports$1['default']; 382 383 } (each, each.exports)); 384 return each.exports; 385} 386 387var helperMissing = {exports: {}}; 388 389var hasRequiredHelperMissing; 390 391function requireHelperMissing () { 392 if (hasRequiredHelperMissing) return helperMissing.exports; 393 hasRequiredHelperMissing = 1; 394 (function (module, exports$1) { 395 396 exports$1.__esModule = true; 397 // istanbul ignore next 398 399 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 400 401 var _exception = requireException(); 402 403 var _exception2 = _interopRequireDefault(_exception); 404 405 exports$1['default'] = function (instance) { 406 instance.registerHelper('helperMissing', function () /* [args, ]options */{ 407 if (arguments.length === 1) { 408 // A missing field in a {{foo}} construct. 409 return undefined; 410 } else { 411 // Someone is actually trying to call something, blow up. 412 throw new _exception2['default']('Missing helper: "' + arguments[arguments.length - 1].name + '"'); 413 } 414 }); 415 }; 416 417 module.exports = exports$1['default']; 418 419 } (helperMissing, helperMissing.exports)); 420 return helperMissing.exports; 421} 422 423var _if = {exports: {}}; 424 425var hasRequired_if; 426 427function require_if () { 428 if (hasRequired_if) return _if.exports; 429 hasRequired_if = 1; 430 (function (module, exports$1) { 431 432 exports$1.__esModule = true; 433 // istanbul ignore next 434 435 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 436 437 var _utils = requireUtils(); 438 439 var _exception = requireException(); 440 441 var _exception2 = _interopRequireDefault(_exception); 442 443 exports$1['default'] = function (instance) { 444 instance.registerHelper('if', function (conditional, options) { 445 if (arguments.length != 2) { 446 throw new _exception2['default']('#if requires exactly one argument'); 447 } 448 if (_utils.isFunction(conditional)) { 449 conditional = conditional.call(this); 450 } 451 452 // Default behavior is to render the positive path if the value is truthy and not empty. 453 // The `includeZero` option may be set to treat the condtional as purely not empty based on the 454 // behavior of isEmpty. Effectively this determines if 0 is handled by the positive path or negative. 455 if (!options.hash.includeZero && !conditional || _utils.isEmpty(conditional)) { 456 return options.inverse(this); 457 } else { 458 return options.fn(this); 459 } 460 }); 461 462 instance.registerHelper('unless', function (conditional, options) { 463 if (arguments.length != 2) { 464 throw new _exception2['default']('#unless requires exactly one argument'); 465 } 466 return instance.helpers['if'].call(this, conditional, { 467 fn: options.inverse, 468 inverse: options.fn, 469 hash: options.hash 470 }); 471 }); 472 }; 473 474 module.exports = exports$1['default']; 475 476 } (_if, _if.exports)); 477 return _if.exports; 478} 479 480var log = {exports: {}}; 481 482var hasRequiredLog; 483 484function requireLog () { 485 if (hasRequiredLog) return log.exports; 486 hasRequiredLog = 1; 487 (function (module, exports$1) { 488 489 exports$1.__esModule = true; 490 491 exports$1['default'] = function (instance) { 492 instance.registerHelper('log', function () /* message, options */{ 493 var args = [undefined], 494 options = arguments[arguments.length - 1]; 495 for (var i = 0; i < arguments.length - 1; i++) { 496 args.push(arguments[i]); 497 } 498 499 var level = 1; 500 if (options.hash.level != null) { 501 level = options.hash.level; 502 } else if (options.data && options.data.level != null) { 503 level = options.data.level; 504 } 505 args[0] = level; 506 507 instance.log.apply(instance, args); 508 }); 509 }; 510 511 module.exports = exports$1['default']; 512 513 } (log, log.exports)); 514 return log.exports; 515} 516 517var lookup = {exports: {}}; 518 519var hasRequiredLookup; 520 521function requireLookup () { 522 if (hasRequiredLookup) return lookup.exports; 523 hasRequiredLookup = 1; 524 (function (module, exports$1) { 525 526 exports$1.__esModule = true; 527 528 exports$1['default'] = function (instance) { 529 instance.registerHelper('lookup', function (obj, field, options) { 530 if (!obj) { 531 // Note for 5.0: Change to "obj == null" in 5.0 532 return obj; 533 } 534 return options.lookupProperty(obj, field); 535 }); 536 }; 537 538 module.exports = exports$1['default']; 539 540 }
540 (lookup, lookup.exports)); 541 return lookup.exports; 542} 543 544var _with = {exports: {}}; 545 546var hasRequired_with; 547 548function require_with () { 549 if (hasRequired_with) return _with.exports; 550 hasRequired_with = 1; 551 (function (module, exports$1) { 552 553 exports$1.__esModule = true; 554 // istanbul ignore next 555 556 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 557 558 var _utils = requireUtils(); 559 560 var _exception = requireException(); 561 562 var _exception2 = _interopRequireDefault(_exception); 563 564 exports$1['default'] = function (instance) { 565 instance.registerHelper('with', function (context, options) { 566 if (arguments.length != 2) { 567 throw new _exception2['default']('#with requires exactly one argument'); 568 } 569 if (_utils.isFunction(context)) { 570 context = context.call(this); 571 } 572 573 var fn = options.fn; 574 575 if (!_utils.isEmpty(context)) { 576 var data = options.data; 577 if (options.data && options.ids) { 578 data = _utils.createFrame(options.data); 579 data.contextPath = _utils.appendContextPath(options.data.contextPath, options.ids[0]); 580 } 581 582 return fn(context, { 583 data: data, 584 blockParams: _utils.blockParams([context], [data && data.contextPath]) 585 }); 586 } else { 587 return options.inverse(this); 588 } 589 }); 590 }; 591 592 module.exports = exports$1['default']; 593 594 } (_with, _with.exports)); 595 return _with.exports; 596} 597 598var hasRequiredHelpers$1; 599 600function requireHelpers$1 () { 601 if (hasRequiredHelpers$1) return helpers$1; 602 hasRequiredHelpers$1 = 1; 603 604 helpers$1.__esModule = true; 605 helpers$1.registerDefaultHelpers = registerDefaultHelpers; 606 helpers$1.moveHelperToHooks = moveHelperToHooks; 607 // istanbul ignore next 608 609 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 610 611 var _helpersBlockHelperMissing = requireBlockHelperMissing(); 612 613 var _helpersBlockHelperMissing2 = _interopRequireDefault(_helpersBlockHelperMissing); 614 615 var _helpersEach = requireEach(); 616 617 var _helpersEach2 = _interopRequireDefault(_helpersEach); 618 619 var _helpersHelperMissing = requireHelperMissing(); 620 621 var _helpersHelperMissing2 = _interopRequireDefault(_helpersHelperMissing); 622 623 var _helpersIf = require_if(); 624 625 var _helpersIf2 = _interopRequireDefault(_helpersIf); 626 627 var _helpersLog = requireLog(); 628 629 var _helpersLog2 = _interopRequireDefault(_helpersLog); 630 631 var _helpersLookup = requireLookup(); 632 633 var _helpersLookup2 = _interopRequireDefault(_helpersLookup); 634 635 var _helpersWith = require_with(); 636 637 var _helpersWith2 = _interopRequireDefault(_helpersWith); 638 639 function registerDefaultHelpers(instance) { 640 _helpersBlockHelperMissing2['default'](instance); 641 _helpersEach2['default'](instance); 642 _helpersHelperMissing2['default'](instance); 643 _helpersIf2['default'](instance); 644 _helpersLog2['default'](instance); 645 _helpersLookup2['default'](instance); 646 _helpersWith2['default'](instance); 647 } 648 649 function moveHelperToHooks(instance, helperName, keepHelper) { 650 if (instance.helpers[helperName]) { 651 instance.hooks[helperName] = instance.helpers[helperName]; 652 if (!keepHelper) { 653 delete instance.helpers[helperName]; 654 } 655 } 656 } 657 658 return helpers$1; 659} 660 661var decorators = {}; 662 663var inline = {exports: {}}; 664 665var hasRequiredInline; 666 667function requireInline () { 668 if (hasRequiredInline) return inline.exports; 669 hasRequiredInline = 1; 670 (function (module, exports$1) { 671 672 exports$1.__esModule = true; 673 674 var _utils = requireUtils(); 675 676 exports$1['default'] = function (instance) { 677 instance.registerDecorator('inline', function (fn, props, container, options) { 678 var ret = fn; 679 if (!props.partials) { 680 props.partials = {}; 681 ret = function (context, options) { 682 // Create a new partials stack frame prior to exec. 683 var original = container.partials; 684 container.partials = _utils.extend({}, original, props.partials); 685 var ret = fn(context, options); 686 container.partials = original; 687 return ret; 688 }; 689 } 690 691 props.partials[options.args[0]] = options.fn; 692 693 return ret; 694 }); 695 }; 696 697 module.exports = exports$1['default']; 698 699 } (inline, inline.exports)); 700 return inline.exports; 701} 702 703var hasRequiredDecorators; 704 705function requireDecorators () { 706 if (hasRequiredDecorators) return decorators; 707 hasRequiredDecorators = 1; 708 709 decorators.__esModule = true; 710 decorators.registerDefaultDecorators = registerDefaultDecorators; 711 // istanbul ignore next 712 713 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 714 715 var _decoratorsInline = requireInline(); 716 717 var _decoratorsInline2 = _interopRequireDefault(_decoratorsInline); 718 719 function registerDefaultDecorators(instance) { 720 _decoratorsInline2['default'](instance); 721 } 722 723 return decorators; 724} 725 726var logger = {exports: {}}; 727 728var hasRequiredLogger; 729 730function requireLogger () { 731 if (hasRequiredLogger) return logger.exports; 732 hasRequiredLogger = 1; 733 (function (module, exports$1) { 734 735 exports$1.__esModule = true; 736 737 var _utils = requireUtils(); 738 739 var logger = { 740 methodMap: ['debug', 'info', 'warn', 'error'], 741 level: 'info', 742 743 // Maps a given level value to the `methodMap` indexes above. 744 lookupLevel: function lookupLevel(level) { 745 if (typeof level === 'string') { 746 var levelMap = _utils.indexOf(logger.methodMap, level.toLowerCase()); 747 if (levelMap >= 0) { 748 level = levelMap; 749 } else { 750 level = parseInt(level, 10); 751 } 752 } 753 754 return level; 755 }, 756 757 // Can be overridden in the host environment 758 log: function log(level) { 759 level = logger.lookupLevel(level); 760 761 if (typeof console !== 'undefined' && logger.lookupLevel(logger.level) <= level) { 762 var method = logger.methodMap[level]; 763 // eslint-disable-next-line no-console 764 if (!console[method]) { 765 method = 'log'; 766 } 767 768 for (var _len = arguments.length, message = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { 769 message[_key - 1] = arguments[_key]; 770 } 771 772 console[method].apply(console, message); // eslint-disable-line no-console 773 } 774 } 775 }; 776 777 exports$1['default'] = logger; 778 module.exports = exports$1['default']; 779 780 } (logger, logger.exports)); 781 return logger.exports; 782} 783 784var protoAccess = {}; 785 786var createNewLookupObject = {}; 787 788var hasRequiredCreateNewLookupObject; 789 790function requireCreateNewLookupObject () { 791 if (hasRequiredCreateNewLookupObject) return createNewLookupObject; 792 hasRequiredCreateNewLookupObject = 1; 793
794 createNewLookupObject.__esModule = true; 795 createNewLookupObject.createNewLookupObject = createNewLookupObject$1; 796 797 var _utils = requireUtils(); 798 799 /** 800 * Create a new object with "null"-prototype to avoid truthy results on prototype properties. 801 * The resulting object can be used with "object[property]" to check if a property exists 802 * @param {...object} sources a varargs parameter of source objects that will be merged 803 * @returns {object} 804 */ 805 806 function createNewLookupObject$1() { 807 for (var _len = arguments.length, sources = Array(_len), _key = 0; _key < _len; _key++) { 808 sources[_key] = arguments[_key]; 809 } 810 811 return _utils.extend.apply(undefined, [Object.create(null)].concat(sources)); 812 } 813 814 return createNewLookupObject; 815} 816 817var hasRequiredProtoAccess; 818 819function requireProtoAccess () { 820 if (hasRequiredProtoAccess) return protoAccess; 821 hasRequiredProtoAccess = 1; 822 823 protoAccess.__esModule = true; 824 protoAccess.createProtoAccessControl = createProtoAccessControl; 825 protoAccess.resultIsAllowed = resultIsAllowed; 826 protoAccess.resetLoggedProperties = resetLoggedProperties; 827 // istanbul ignore next 828 829 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 830 831 var _createNewLookupObject = requireCreateNewLookupObject(); 832 833 var _logger = requireLogger(); 834 835 var _logger2 = _interopRequireDefault(_logger); 836 837 var loggedProperties = Object.create(null); 838 839 function createProtoAccessControl(runtimeOptions) { 840 var defaultMethodWhiteList = Object.create(null); 841 defaultMethodWhiteList['constructor'] = false; 842 defaultMethodWhiteList['__defineGetter__'] = false; 843 defaultMethodWhiteList['__defineSetter__'] = false; 844 defaultMethodWhiteList['__lookupGetter__'] = false; 845 846 var defaultPropertyWhiteList = Object.create(null); 847 // eslint-disable-next-line no-proto 848 defaultPropertyWhiteList['__proto__'] = false; 849 850 return { 851 properties: { 852 whitelist: _createNewLookupObject.createNewLookupObject(defaultPropertyWhiteList, runtimeOptions.allowedProtoProperties), 853 defaultValue: runtimeOptions.allowProtoPropertiesByDefault 854 }, 855 methods: { 856 whitelist: _createNewLookupObject.createNewLookupObject(defaultMethodWhiteList, runtimeOptions.allowedProtoMethods), 857 defaultValue: runtimeOptions.allowProtoMethodsByDefault 858 } 859 }; 860 } 861 862 function resultIsAllowed(result, protoAccessControl, propertyName) { 863 if (typeof result === 'function') { 864 return checkWhiteList(protoAccessControl.methods, propertyName); 865 } else { 866 return checkWhiteList(protoAccessControl.properties, propertyName); 867 } 868 } 869 870 function checkWhiteList(protoAccessControlForType, propertyName) { 871 if (protoAccessControlForType.whitelist[propertyName] !== undefined) { 872 return protoAccessControlForType.whitelist[propertyName] === true; 873 } 874 if (protoAccessControlForType.defaultValue !== undefined) { 875 return protoAccessControlForType.defaultValue; 876 } 877 logUnexpecedPropertyAccessOnce(propertyName); 878 return false; 879 } 880 881 function logUnexpecedPropertyAccessOnce(propertyName) { 882 if (loggedProperties[propertyName] !== true) { 883 loggedProperties[propertyName] = true; 884 _logger2['default'].log('error', 'Handlebars: Access has been denied to resolve the property "' + propertyName + '" because it is not an "own property" of its parent.\n' + 'You can add a runtime option to disable the check or this warning:\n' + 'See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details'); 885 } 886 } 887 888 function resetLoggedProperties() { 889 Object.keys(loggedProperties).forEach(function (propertyName) { 890 delete loggedProperties[propertyName]; 891 }); 892 } 893 894 return protoAccess; 895} 896 897var hasRequiredBase$1; 898 899function requireBase$1 () { 900 if (hasRequiredBase$1) return base$1; 901 hasRequiredBase$1 = 1; 902 903 base$1.__esModule = true; 904 base$1.HandlebarsEnvironment = HandlebarsEnvironment; 905 // istanbul ignore next 906 907 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 908 909 var _utils = requireUtils(); 910 911 var _exception = requireException(); 912 913 var _exception2 = _interopRequireDefault(_exception); 914 915 var _helpers = requireHelpers$1(); 916 917 var _decorators = requireDecorators(); 918 919 var _logger = requireLogger(); 920 921 var _logger2 = _interopRequireDefault(_logger); 922 923 var _internalProtoAccess = requireProtoAccess(); 924 925 var VERSION = '4.7.8'; 926 base$1.VERSION = VERSION;
927 var COMPILER_REVISION = 8; 928 base$1.COMPILER_REVISION = COMPILER_REVISION; 929 var LAST_COMPATIBLE_COMPILER_REVISION = 7; 930 931 base$1.LAST_COMPATIBLE_COMPILER_REVISION = LAST_COMPATIBLE_COMPILER_REVISION; 932 var REVISION_CHANGES = { 933 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it 934 2: '== 1.0.0-rc.3', 935 3: '== 1.0.0-rc.4', 936 4: '== 1.x.x', 937 5: '== 2.0.0-alpha.x', 938 6: '>= 2.0.0-beta.1', 939 7: '>= 4.0.0 <4.3.0', 940 8: '>= 4.3.0' 941 }; 942 943 base$1.REVISION_CHANGES = REVISION_CHANGES; 944 var objectType = '[object Object]'; 945 946 function HandlebarsEnvironment(helpers, partials, decorators) { 947 this.helpers = helpers || {}; 948 this.partials = partials || {}; 949 this.decorators = decorators || {}; 950 951 _helpers.registerDefaultHelpers(this); 952 _decorators.registerDefaultDecorators(this); 953 } 954 955 HandlebarsEnvironment.prototype = { 956 constructor: HandlebarsEnvironment, 957 958 logger: _logger2['default'], 959 log: _logger2['default'].log, 960 961 registerHelper: function registerHelper(name, fn) { 962 if (_utils.toString.call(name) === objectType) { 963 if (fn) { 964 throw new _exception2['default']('Arg not supported with multiple helpers'); 965 } 966 _utils.extend(this.helpers, name); 967 } else { 968 this.helpers[name] = fn; 969 } 970 }, 971 unregisterHelper: function unregisterHelper(name) { 972 delete this.helpers[name]; 973 }, 974 975 registerPartial: function registerPartial(name, partial) { 976 if (_utils.toString.call(name) === objectType) { 977 _utils.extend(this.partials, name); 978 } else { 979 if (typeof partial === 'undefined') { 980 throw new _exception2['default']('Attempting to register a partial called "' + name + '" as undefined'); 981 } 982 this.partials[name] = partial; 983 } 984 }, 985 unregisterPartial: function unregisterPartial(name) { 986 delete this.partials[name]; 987 }, 988 989 registerDecorator: function registerDecorator(name, fn) { 990 if (_utils.toString.call(name) === objectType) { 991 if (fn) { 992 throw new _exception2['default']('Arg not supported with multiple decorators'); 993 } 994 _utils.extend(this.decorators, name); 995 } else { 996 this.decorators[name] = fn; 997 } 998 }, 999 unregisterDecorator: function unregisterDecorator(name) { 1000 delete this.decorators[name]; 1001 }, 1002 /** 1003 * Reset the memory of illegal property accesses that have already been logged. 1004 * @deprecated should only be used in handlebars test-cases 1005 */ 1006 resetLoggedPropertyAccesses: function resetLoggedPropertyAccesses() { 1007 _internalProtoAccess.resetLoggedProperties(); 1008 } 1009 }; 1010 1011 var log = _logger2['default'].log; 1012 1013 base$1.log = log; 1014 base$1.createFrame = _utils.createFrame; 1015 base$1.logger = _logger2['default']; 1016 1017 return base$1; 1018} 1019 1020var safeString = {exports: {}}; 1021 1022var hasRequiredSafeString; 1023 1024function requireSafeString () { 1025 if (hasRequiredSafeString) return safeString.exports; 1026 hasRequiredSafeString = 1; 1027 (function (module, exports$1) { 1028 1029 exports$1.__esModule = true; 1030 function SafeString(string) { 1031 this.string = string; 1032 } 1033 1034 SafeString.prototype.toString = SafeString.prototype.toHTML = function () { 1035 return '' + this.string; 1036 }; 1037 1038 exports$1['default'] = SafeString; 1039 module.exports = exports$1['default']; 1040 1041 } (safeString, safeString.exports)); 1042 return safeString.exports; 1043} 1044 1045var runtime = {}; 1046 1047var wrapHelper = {}; 1048 1049var hasRequiredWrapHelper; 1050 1051function requireWrapHelper () { 1052 if (hasRequiredWrapHelper) return wrapHelper; 1053 hasRequiredWrapHelper = 1; 1054 1055 wrapHelper.__esModule = true; 1056 wrapHelper.wrapHelper = wrapHelper$1; 1057 1058 function wrapHelper$1(helper, transformOptionsFn) { 1059 if (typeof helper !== 'function') { 1060 // This should not happen, but apparently it does in https://github.com/wycats/handlebars.js/issues/1639 1061 // We try to make the wrapper least-invasive by not wrapping it, if the helper is not a function. 1062 return helper; 1063 } 1064 var wrapper = function wrapper() /* dynamic arguments */{ 1065 var options = arguments[arguments.length - 1]; 1066 arguments[arguments.length - 1] = transformOptionsFn(options); 1067 return helper.apply(this, arguments); 1068 }; 1069 return wrapper; 1070 } 1071 1072 return wrapHelper; 1073} 1074 1075var hasRequiredRuntime; 1076
vendor: 8,283 bytes, lines 1077-1308
1077function requireRuntime () { 1078 if (hasRequiredRuntime) return runtime; 1079 hasRequiredRuntime = 1; 1080 1081 runtime.__esModule = true; 1082 runtime.checkRevision = checkRevision; 1083 runtime.template = template; 1084 runtime.wrapProgram = wrapProgram; 1085 runtime.resolvePartial = resolvePartial; 1086 runtime.invokePartial = invokePartial; 1087 runtime.noop = noop; 1088 // istanbul ignore next 1089 1090 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 1091 1092 // istanbul ignore next 1093 1094 function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } } 1095 1096 var _utils = requireUtils(); 1097 1098 var Utils = _interopRequireWildcard(_utils); 1099 1100 var _exception = requireException(); 1101 1102 var _exception2 = _interopRequireDefault(_exception); 1103 1104 var _base = requireBase$1(); 1105 1106 var _helpers = requireHelpers$1(); 1107 1108 var _internalWrapHelper = requireWrapHelper(); 1109 1110 var _internalProtoAccess = requireProtoAccess(); 1111 1112 function checkRevision(compilerInfo) { 1113 var compilerRevision = compilerInfo && compilerInfo[0] || 1, 1114 currentRevision = _base.COMPILER_REVISION; 1115 1116 if (compilerRevision >= _base.LAST_COMPATIBLE_COMPILER_REVISION && compilerRevision <= _base.COMPILER_REVISION) { 1117 return; 1118 } 1119 1120 if (compilerRevision < _base.LAST_COMPATIBLE_COMPILER_REVISION) { 1121 var runtimeVersions = _base.REVISION_CHANGES[currentRevision], 1122 compilerVersions = _base.REVISION_CHANGES[compilerRevision]; 1123 throw new _exception2['default']('Template was precompiled with an older version of Handlebars than the current runtime. ' + 'Please update your precompiler to a newer version (' + runtimeVersions + ') or downgrade your runtime to an older version (' + compilerVersions + ').'); 1124 } else { 1125 // Use the embedded version info since the runtime doesn't know about this revision yet 1126 throw new _exception2['default']('Template was precompiled with a newer version of Handlebars than the current runtime. ' + 'Please update your runtime to a newer version (' + compilerInfo[1] + ').'); 1127 } 1128 } 1129 1130 function template(templateSpec, env) { 1131 /* istanbul ignore next */ 1132 if (!env) { 1133 throw new _exception2['default']('No environment passed to template'); 1134 } 1135 if (!templateSpec || !templateSpec.main) { 1136 throw new _exception2['default']('Unknown template object: ' + typeof templateSpec); 1137 } 1138 1139 templateSpec.main.decorator = templateSpec.main_d; 1140 1141 // Note: Using env.VM references rather than local var references throughout this section to allow 1142 // for external users to override these as pseudo-supported APIs. 1143 env.VM.checkRevision(templateSpec.compiler); 1144 1145 // backwards compatibility for precompiled templates with compiler-version 7 (<4.3.0) 1146 var templateWasPrecompiledWithCompilerV7 = templateSpec.compiler && templateSpec.compiler[0] === 7; 1147 1148 function invokePartialWrapper(partial, context, options) { 1149 if (options.hash) { 1150 context = Utils.extend({}, context, options.hash); 1151 if (options.ids) { 1152 options.ids[0] = true; 1153 } 1154 } 1155 partial = env.VM.resolvePartial.call(this, partial, context, options); 1156 1157 var extendedOptions = Utils.extend({}, options, { 1158 hooks: this.hooks, 1159 protoAccessControl: this.protoAccessControl 1160 }); 1161 1162 var result = env.VM.invokePartial.call(this, partial, context, extendedOptions); 1163 1164 if (result == null && env.compile) { 1165 options.partials[options.name] = env.compile(partial, templateSpec.compilerOptions, env); 1166 result = options.partials[options.name](context, extendedOptions); 1167 } 1168 if (result != null) { 1169 if (options.indent) { 1170 var lines = result.split('\n'); 1171 for (var i = 0, l = lines.length; i < l; i++) { 1172 if (!lines[i] && i + 1 === l) { 1173 break; 1174 } 1175 1176 lines[i] = options.indent + lines[i]; 1177 } 1178 result = lines.join('\n'); 1179 } 1180 return result; 1181 } else { 1182 throw new _exception2['default']('The partial ' + options.name + ' could not be compiled when running in runtime-only mode'); 1183 } 1184 } 1185 1186 // Just add water 1187 var container = { 1188 strict: function strict(obj, name, loc) { 1189 if (!obj || !(name in obj)) { 1190 throw new _exception2['default']('"' + name + '" not defined in ' + obj, { 1191 loc: loc 1192 }); 1193 } 1194 return container.lookupProperty(obj, name); 1195 }, 1196 lookupProperty: function lookupProperty(parent, propertyName) { 1197 var result = parent[propertyName]; 1198 if (result == null) { 1199 return result; 1200 } 1201 if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { 1202 return result; 1203 } 1204 1205 if (_internalProtoAccess.resultIsAllowed(result, container.protoAccessControl, propertyName)) { 1206 return result; 1207 } 1208 return undefined; 1209 }, 1210 lookup: function lookup(depths, name) { 1211 var len = depths.length; 1212 for (var i = 0; i < len; i++) { 1213 var result = depths[i] && container.lookupProperty(depths[i], name); 1214 if (result != null) { 1215 return depths[i][name]; 1216 } 1217 } 1218 }, 1219 lambda: function lambda(current, context) { 1220 return typeof current === 'function' ? current.call(context) : current; 1221 }, 1222 1223 escapeExpression: Utils.escapeExpression, 1224 invokePartial: invokePartialWrapper, 1225 1226 fn: function fn(i) { 1227 var ret = templateSpec[i]; 1228 ret.decorator = templateSpec[i + '_d']; 1229 return ret; 1230 }, 1231 1232 programs: [], 1233 program: function program(i, data, declaredBlockParams, blockParams, depths) { 1234 var programWrapper = this.programs[i], 1235 fn = this.fn(i); 1236 if (data || depths || blockParams || declaredBlockParams) { 1237 programWrapper = wrapProgram(this, i, fn, data, declaredBlockParams, blockParams, depths); 1238 } else if (!programWrapper) { 1239 programWrapper = this.programs[i] = wrapProgram(this, i, fn); 1240 } 1241 return programWrapper; 1242 }, 1243 1244 data: function data(value, depth) { 1245 while (value && depth--) { 1246 value = value._parent; 1247 } 1248 return value; 1249 }, 1250 mergeIfNeeded: function mergeIfNeeded(param, common) { 1251 var obj = param || common; 1252 1253 if (param && common && param !== common) { 1254 obj = Utils.extend({}, common, param); 1255 } 1256 1257 return obj; 1258 }, 1259 // An empty object to use as replacement for null-contexts 1260 nullContext: Object.seal({}), 1261 1262 noop: env.VM.noop, 1263 compilerInfo: templateSpec.compiler 1264 }; 1265 1266 function ret(context) { 1267 var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; 1268 1269 var data = options.data; 1270 1271 ret._setup(options); 1272 if (!options.partial && templateSpec.useData) { 1273 data = initData(context, data); 1274 } 1275 var depths = undefined, 1276 blockParams = templateSpec.useBlockParams ? [] : undefined; 1277 if (templateSpec.useDepths) { 1278 if (options.depths) { 1279 depths = context != options.depths[0] ? [context].concat(options.depths) : options.depths; 1280 } else { 1281 depths = [context]; 1282 } 1283 } 1284 1285 function main(context /*, options*/) { 1286 return '' + templateSpec.main(container, context, container.helpers, container.partials, data, blockParams, depths); 1287 } 1288 1289 main = executeDecorators(templateSpec.main, main, container, options.depths || [], data, blockParams); 1290 return main(context, options); 1291 } 1292 1293 ret.isTop = true; 1294 1295 ret._setup = function (options) { 1296 if (!options.partial) { 1297 var mergedHelpers = Utils.extend({}, env.helpers, options.helpers); 1298 wrapHelpersToPassLookupProperty(mergedHelpers, container); 1299 container.helpers = mergedHelpers; 1300 1301 if (templateSpec.usePartial) { 1302 // Use mergeIfNeeded here to prevent compiling global partials multiple times 1303 container.partials = container.mergeIfNeeded(options.partials, env.partials); 1304 } 1305 if (templateSpec.usePartial || templateSpec.useDecorators) { 1306 container.decorators = Utils.extend({}, env.decorators, options.decorators); 1307 } 1308
vendor: 4,565 bytes, lines 1309-1437
1309 container.hooks = {}; 1310 container.protoAccessControl = _internalProtoAccess.createProtoAccessControl(options); 1311 1312 var keepHelperInHelpers = options.allowCallsToHelperMissing || templateWasPrecompiledWithCompilerV7; 1313 _helpers.moveHelperToHooks(container, 'helperMissing', keepHelperInHelpers); 1314 _helpers.moveHelperToHooks(container, 'blockHelperMissing', keepHelperInHelpers); 1315 } else { 1316 container.protoAccessControl = options.protoAccessControl; // internal option 1317 container.helpers = options.helpers; 1318 container.partials = options.partials; 1319 container.decorators = options.decorators; 1320 container.hooks = options.hooks; 1321 } 1322 }; 1323 1324 ret._child = function (i, data, blockParams, depths) { 1325 if (templateSpec.useBlockParams && !blockParams) { 1326 throw new _exception2['default']('must pass block params'); 1327 } 1328 if (templateSpec.useDepths && !depths) { 1329 throw new _exception2['default']('must pass parent depths'); 1330 } 1331 1332 return wrapProgram(container, i, templateSpec[i], data, 0, blockParams, depths); 1333 }; 1334 return ret; 1335 } 1336 1337 function wrapProgram(container, i, fn, data, declaredBlockParams, blockParams, depths) { 1338 function prog(context) { 1339 var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; 1340 1341 var currentDepths = depths; 1342 if (depths && context != depths[0] && !(context === container.nullContext && depths[0] === null)) { 1343 currentDepths = [context].concat(depths); 1344 } 1345 1346 return fn(container, context, container.helpers, container.partials, options.data || data, blockParams && [options.blockParams].concat(blockParams), currentDepths); 1347 } 1348 1349 prog = executeDecorators(fn, prog, container, depths, data, blockParams); 1350 1351 prog.program = i; 1352 prog.depth = depths ? depths.length : 0; 1353 prog.blockParams = declaredBlockParams || 0; 1354 return prog; 1355 } 1356 1357 /** 1358 * This is currently part of the official API, therefore implementation details should not be changed. 1359 */ 1360 1361 function resolvePartial(partial, context, options) { 1362 if (!partial) { 1363 if (options.name === '@partial-block') { 1364 partial = options.data['partial-block']; 1365 } else { 1366 partial = options.partials[options.name]; 1367 } 1368 } else if (!partial.call && !options.name) { 1369 // This is a dynamic partial that returned a string 1370 options.name = partial; 1371 partial = options.partials[partial]; 1372 } 1373 return partial; 1374 } 1375 1376 function invokePartial(partial, context, options) { 1377 // Use the current closure context to save the partial-block if this partial 1378 var currentPartialBlock = options.data && options.data['partial-block']; 1379 options.partial = true; 1380 if (options.ids) { 1381 options.data.contextPath = options.ids[0] || options.data.contextPath; 1382 } 1383 1384 var partialBlock = undefined; 1385 if (options.fn && options.fn !== noop) { 1386 (function () { 1387 options.data = _base.createFrame(options.data); 1388 // Wrapper function to get access to currentPartialBlock from the closure 1389 var fn = options.fn; 1390 partialBlock = options.data['partial-block'] = function partialBlockWrapper(context) { 1391 var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; 1392 1393 // Restore the partial-block from the closure for the execution of the block 1394 // i.e. the part inside the block of the partial call. 1395 options.data = _base.createFrame(options.data); 1396 options.data['partial-block'] = currentPartialBlock; 1397 return fn(context, options); 1398 }; 1399 if (fn.partials) { 1400 options.partials = Utils.extend({}, options.partials, fn.partials); 1401 } 1402 })(); 1403 } 1404 1405 if (partial === undefined && partialBlock) { 1406 partial = partialBlock; 1407 } 1408 1409 if (partial === undefined) { 1410 throw new _exception2['default']('The partial ' + options.name + ' could not be found'); 1411 } else if (partial instanceof Function) { 1412 return partial(context, options); 1413 } 1414 } 1415 1416 function noop() { 1417 return ''; 1418 } 1419 1420 function initData(context, data) { 1421 if (!data || !('root' in data)) { 1422 data = data ? _base.createFrame(data) : {}; 1423 data.root = context; 1424 } 1425 return data; 1426 } 1427 1428 function executeDecorators(fn, prog, container, depths, data, blockParams) { 1429 if (fn.decorator) { 1430 var props = {}; 1431 prog = fn.decorator(prog, props, container, depths && depths[0], data, blockParams, depths); 1432 Utils.extend(prog, props); 1433 } 1434 return prog; 1435 } 1436 1437 function wrapHelpersToPassLookupProperty(mergedHelpers, container) {
1438 Object.keys(mergedHelpers).forEach(function (helperName) { 1439 var helper = mergedHelpers[helperName]; 1440 mergedHelpers[helperName] = passLookupPropertyOption(helper, container); 1441 }); 1442 } 1443 1444 function passLookupPropertyOption(helper, container) { 1445 var lookupProperty = container.lookupProperty; 1446 return _internalWrapHelper.wrapHelper(helper, function (options) { 1447 return Utils.extend({ lookupProperty: lookupProperty }, options); 1448 }); 1449 } 1450 1451 return runtime; 1452} 1453 1454var noConflict = {exports: {}}; 1455 1456/* global globalThis */ 1457 1458var hasRequiredNoConflict; 1459 1460function requireNoConflict () { 1461 if (hasRequiredNoConflict) return noConflict.exports; 1462 hasRequiredNoConflict = 1; 1463 (function (module, exports$1) { 1464 1465 exports$1.__esModule = true; 1466 1467 exports$1['default'] = function (Handlebars) { 1468 /* istanbul ignore next */ 1469 // https://mathiasbynens.be/notes/globalthis 1470 (function () { 1471 if (typeof globalThis === 'object') return; 1472 Object.prototype.__defineGetter__('__magic__', function () { 1473 return this; 1474 }); 1475 __magic__.globalThis = __magic__; // eslint-disable-line no-undef 1476 delete Object.prototype.__magic__; 1477 })(); 1478 1479 var $Handlebars = globalThis.Handlebars; 1480 1481 /* istanbul ignore next */ 1482 Handlebars.noConflict = function () { 1483 if (globalThis.Handlebars === Handlebars) { 1484 globalThis.Handlebars = $Handlebars; 1485 } 1486 return Handlebars; 1487 }; 1488 }; 1489 1490 module.exports = exports$1['default']; 1491 1492 } (noConflict, noConflict.exports)); 1493 return noConflict.exports; 1494} 1495 1496var hasRequiredHandlebars_runtime; 1497 1498function requireHandlebars_runtime () { 1499 if (hasRequiredHandlebars_runtime) return handlebars_runtime.exports; 1500 hasRequiredHandlebars_runtime = 1; 1501 (function (module, exports$1) { 1502 1503 exports$1.__esModule = true; 1504 // istanbul ignore next 1505 1506 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 1507 1508 // istanbul ignore next 1509 1510 function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } } 1511 1512 var _handlebarsBase = requireBase$1(); 1513 1514 var base = _interopRequireWildcard(_handlebarsBase); 1515 1516 // Each of these augment the Handlebars object. No need to setup here. 1517 // (This is done to easily share code between commonjs and browse envs) 1518 1519 var _handlebarsSafeString = requireSafeString(); 1520 1521 var _handlebarsSafeString2 = _interopRequireDefault(_handlebarsSafeString); 1522 1523 var _handlebarsException = requireException(); 1524 1525 var _handlebarsException2 = _interopRequireDefault(_handlebarsException); 1526 1527 var _handlebarsUtils = requireUtils(); 1528 1529 var Utils = _interopRequireWildcard(_handlebarsUtils); 1530 1531 var _handlebarsRuntime = requireRuntime(); 1532 1533 var runtime = _interopRequireWildcard(_handlebarsRuntime); 1534 1535 var _handlebarsNoConflict = requireNoConflict(); 1536 1537 var _handlebarsNoConflict2 = _interopRequireDefault(_handlebarsNoConflict); 1538 1539 // For compatibility and usage outside of module systems, make the Handlebars object a namespace 1540 function create() { 1541 var hb = new base.HandlebarsEnvironment(); 1542 1543 Utils.extend(hb, base); 1544 hb.SafeString = _handlebarsSafeString2['default']; 1545 hb.Exception = _handlebarsException2['default']; 1546 hb.Utils = Utils; 1547 hb.escapeExpression = Utils.escapeExpression; 1548 1549 hb.VM = runtime; 1550 hb.template = function (spec) { 1551 return runtime.template(spec, hb); 1552 }; 1553 1554 return hb; 1555 } 1556 1557 var inst = create(); 1558 inst.create = create; 1559 1560 _handlebarsNoConflict2['default'](inst); 1561 1562 inst['default'] = inst; 1563 1564 exports$1['default'] = inst; 1565 module.exports = exports$1['default']; 1566 1567 } (handlebars_runtime, handlebars_runtime.exports)); 1568 return handlebars_runtime.exports; 1569} 1570 1571var ast = {exports: {}}; 1572 1573var hasRequiredAst; 1574 1575function requireAst () { 1576 if (hasRequiredAst) return ast.exports; 1577 hasRequiredAst = 1; 1578 (function (module, exports$1) { 1579 1580 exports$1.__esModule = true; 1581 var AST = { 1582 // Public API used to evaluate derived attributes regarding AST nodes 1583 helpers: { 1584 // a mustache is definitely a helper if: 1585 // * it is an eligible helper, and 1586 // * it has at least one parameter or hash segment 1587 helperExpression: function helperExpression(node) { 1588 return node.type === 'SubExpression' || (node.type === 'MustacheStatement' || node.type === 'BlockStatement') && !!(node.params && node.params.length || node.hash); 1589 }, 1590 1591 scopedId: function scopedId(path) { 1592 return (/^\.|this\b/.test(path.original) 1593 ); 1594 }, 1595 1596 // an ID is simple if it only has one part, and that part is not 1597 // `..` or `this`. 1598 simpleId: function simpleId(path) { 1599 return path.parts.length === 1 && !AST.helpers.scopedId(path) && !path.depth; 1600 } 1601 } 1602 }; 1603 1604 // Must be exported as an object rather than the root of the module as the jison lexer 1605 // must modify the object to operate properly. 1606 exports$1['default'] = AST; 1607 module.exports = exports$1['default']; 1608 1609 } (ast, ast.exports)); 1610 return ast.exports; 1611} 1612 1613var base = {}; 1614 1615var parser = {exports: {}}; 1616 1617var hasRequiredParser; 1618 1619function requireParser () { 1620 if (hasRequiredParser) return parser.exports; 1621 hasRequiredParser = 1; 1622 (function (module, exports$1) { 1623 1624 exports$1.__esModule = true; 1625 var handlebars = (function () { 1626 var parser = { trace: function trace() {}, 1627 yy: {}, 1628 symbols_: { "error": 2, "root": 3, "program": 4, "EOF": 5, "program_repetition0": 6, "statement": 7, "mustache": 8, "block": 9, "rawBlock": 10, "partial": 11, "partialBlock": 12, "content": 13, "COMMENT": 14, "CONTENT": 15, "openRawBlock": 16, "rawBlock_repetition0": 17, "END_RAW_BLOCK": 18, "OPEN_RAW_BLOCK": 19, "helperName": 20, "openRawBlock_repetition0": 21, "openRawBlock_option0": 22, "CLOSE_RAW_BLOCK": 23, "openBlock": 24, "block_option0": 25, "closeBlock": 26, "openInverse": 27, "block_option1": 28, "OPEN_BLOCK": 29, "openBlock_repetition0": 30, "openBlock_option0": 31, "openBlock_option1": 32, "CLOSE": 33, "OPEN_INVERSE": 34, "openInverse_repetition0": 35, "openInverse_option0": 36, "openInverse_option1": 37, "openInverseChain": 38, "OPEN_INVERSE_CHAIN": 39, "openInverseChain_repetition0": 40, "openInverseChain_option0": 41, "openInverseChain_option1": 42, "inverseAndProgram": 43, "INVERSE": 44, "inverseChain": 45, "inverseChain_option0": 46, "OPEN_ENDBLOCK": 47, "OPEN": 48, "mustache_repetition0": 49, "mustache_option0": 50, "OPEN_UNESCAPED": 51, "mustache_repetition1": 52, "mustache_option1": 53, "CLOSE_UNESCAPED": 54, "OPEN_PARTIAL": 55, "partialName": 56, "partial_repetition0": 57, "partial_option0": 58, "openPartialBlock": 59, "OPEN_PARTIAL_BLOCK": 60, "openPartialBlock_repetition0": 61, "openPartialBlock_option0": 62, "param": 63, "sexpr": 64, "OPEN_SEXPR": 65, "sexpr_repetition0": 66, "sexpr_option0": 67, "CLOSE_SEXPR": 68, "hash": 69, "hash_repetition_plus0": 70, "hashSegment": 71, "ID": 72, "EQUALS": 73, "blockParams": 74, "OPEN_BLOCK_PARAMS": 75, "blockParams_repetition_plus0": 76, "CLOSE_BLOCK_PARAMS": 77, "path": 78, "dataName": 79, "STRING": 80, "NUMBER": 81, "BOOLEAN": 82, "UNDEFINED": 83, "NULL": 84, "DATA": 85, "pathSegments": 86, "SEP": 87, "$accept": 0, "$end": 1 }, 1629 terminals_: { 2: "error", 5: "EOF", 14: "COMMENT", 15: "CONTENT",
vendor: 11,617 bytes, lines 1629-1882
162918: "END_RAW_BLOCK", 19: "OPEN_RAW_BLOCK", 23: "CLOSE_RAW_BLOCK", 29: "OPEN_BLOCK", 33: "CLOSE", 34: "OPEN_INVERSE", 39: "OPEN_INVERSE_CHAIN", 44: "INVERSE", 47: "OPEN_ENDBLOCK", 48: "OPEN", 51: "OPEN_UNESCAPED", 54: "CLOSE_UNESCAPED", 55: "OPEN_PARTIAL", 60: "OPEN_PARTIAL_BLOCK", 65: "OPEN_SEXPR", 68: "CLOSE_SEXPR", 72: "ID", 73: "EQUALS", 75: "OPEN_BLOCK_PARAMS", 77: "CLOSE_BLOCK_PARAMS", 80: "STRING", 81: "NUMBER", 82: "BOOLEAN", 83: "UNDEFINED", 84: "NULL", 85: "DATA", 87: "SEP" }, 1630 productions_: [0, [3, 2], [4, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [13, 1], [10, 3], [16, 5], [9, 4], [9, 4], [24, 6], [27, 6], [38, 6], [43, 2], [45, 3], [45, 1], [26, 3], [8, 5], [8, 5], [11, 5], [12, 3], [59, 5], [63, 1], [63, 1], [64, 5], [69, 1], [71, 3], [74, 3], [20, 1], [20, 1], [20, 1], [20, 1], [20, 1], [20, 1], [20, 1], [56, 1], [56, 1], [79, 2], [78, 1], [86, 3], [86, 1], [6, 0], [6, 2], [17, 0], [17, 2], [21, 0], [21, 2], [22, 0], [22, 1], [25, 0], [25, 1], [28, 0], [28, 1], [30, 0], [30, 2], [31, 0], [31, 1], [32, 0], [32, 1], [35, 0], [35, 2], [36, 0], [36, 1], [37, 0], [37, 1], [40, 0], [40, 2], [41, 0], [41, 1], [42, 0], [42, 1], [46, 0], [46, 1], [49, 0], [49, 2], [50, 0], [50, 1], [52, 0], [52, 2], [53, 0], [53, 1], [57, 0], [57, 2], [58, 0], [58, 1], [61, 0], [61, 2], [62, 0], [62, 1], [66, 0], [66, 2], [67, 0], [67, 1], [70, 1], [70, 2], [76, 1], [76, 2]], 1631 performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) { 1632 1633 var $0 = $$.length - 1; 1634 switch (yystate) { 1635 case 1: 1636 return $$[$0 - 1]; 1637 case 2: 1638 this.$ = yy.prepareProgram($$[$0]); 1639 break; 1640 case 3: 1641 this.$ = $$[$0]; 1642 break; 1643 case 4: 1644 this.$ = $$[$0]; 1645 break; 1646 case 5: 1647 this.$ = $$[$0]; 1648 break; 1649 case 6: 1650 this.$ = $$[$0]; 1651 break; 1652 case 7: 1653 this.$ = $$[$0]; 1654 break; 1655 case 8: 1656 this.$ = $$[$0]; 1657 break; 1658 case 9: 1659 this.$ = { 1660 type: 'CommentStatement', 1661 value: yy.stripComment($$[$0]), 1662 strip: yy.stripFlags($$[$0], $$[$0]), 1663 loc: yy.locInfo(this._$) 1664 }; 1665 1666 break; 1667 case 10: 1668 this.$ = { 1669 type: 'ContentStatement', 1670 original: $$[$0], 1671 value: $$[$0], 1672 loc: yy.locInfo(this._$) 1673 }; 1674 1675 break; 1676 case 11: 1677 this.$ = yy.prepareRawBlock($$[$0 - 2], $$[$0 - 1], $$[$0], this._$); 1678 break; 1679 case 12: 1680 this.$ = { path: $$[$0 - 3], params: $$[$0 - 2], hash: $$[$0 - 1] }; 1681 break; 1682 case 13: 1683 this.$ = yy.prepareBlock($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0], false, this._$); 1684 break; 1685 case 14: 1686 this.$ = yy.prepareBlock($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0], true, this._$); 1687 break; 1688 case 15: 1689 this.$ = { open: $$[$0 - 5], path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) }; 1690 break; 1691 case 16: 1692 this.$ = { path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) }; 1693 break; 1694 case 17: 1695 this.$ = { path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) }; 1696 break; 1697 case 18: 1698 this.$ = { strip: yy.stripFlags($$[$0 - 1], $$[$0 - 1]), program: $$[$0] }; 1699 break; 1700 case 19: 1701 var inverse = yy.prepareBlock($$[$0 - 2], $$[$0 - 1], $$[$0], $$[$0], false, this._$), 1702 program = yy.prepareProgram([inverse], $$[$0 - 1].loc); 1703 program.chained = true; 1704 1705 this.$ = { strip: $$[$0 - 2].strip, program: program, chain: true }; 1706 1707 break; 1708 case 20: 1709 this.$ = $$[$0]; 1710 break; 1711 case 21: 1712 this.$ = { path: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 2], $$[$0]) }; 1713 break; 1714 case 22: 1715 this.$ = yy.prepareMustache($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0 - 4], yy.stripFlags($$[$0 - 4], $$[$0]), this._$); 1716 break; 1717 case 23: 1718 this.$ = yy.prepareMustache($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0 - 4], yy.stripFlags($$[$0 - 4], $$[$0]), this._$); 1719 break; 1720 case 24: 1721 this.$ = { 1722 type: 'PartialStatement', 1723 name: $$[$0 - 3], 1724 params: $$[$0 - 2], 1725 hash: $$[$0 - 1], 1726 indent: '', 1727 strip: yy.stripFlags($$[$0 - 4], $$[$0]), 1728 loc: yy.locInfo(this._$) 1729 }; 1730 1731 break; 1732 case 25: 1733 this.$ = yy.preparePartialBlock($$[$0 - 2], $$[$0 - 1], $$[$0], this._$); 1734 break; 1735 case 26: 1736 this.$ = { path: $$[$0 - 3], params: $$[$0 - 2], hash: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 4], $$[$0]) }; 1737 break; 1738 case 27: 1739 this.$ = $$[$0]; 1740 break; 1741 case 28: 1742 this.$ = $$[$0]; 1743 break; 1744 case 29: 1745 this.$ = { 1746 type: 'SubExpression', 1747 path: $$[$0 - 3], 1748 params: $$[$0 - 2], 1749 hash: $$[$0 - 1], 1750 loc: yy.locInfo(this._$) 1751 }; 1752 1753 break; 1754 case 30: 1755 this.$ = { type: 'Hash', pairs: $$[$0], loc: yy.locInfo(this._$) }; 1756 break; 1757 case 31: 1758 this.$ = { type: 'HashPair', key: yy.id($$[$0 - 2]), value: $$[$0], loc: yy.locInfo(this._$) }; 1759 break; 1760 case 32: 1761 this.$ = yy.id($$[$0 - 1]); 1762 break; 1763 case 33: 1764 this.$ = $$[$0]; 1765 break; 1766 case 34: 1767 this.$ = $$[$0]; 1768 break; 1769 case 35: 1770 this.$ = { type: 'StringLiteral', value: $$[$0], original: $$[$0], loc: yy.locInfo(this._$) }; 1771 break; 1772 case 36: 1773 this.$ = { type: 'NumberLiteral', value: Number($$[$0]), original: Number($$[$0]), loc: yy.locInfo(this._$) }; 1774 break; 1775 case 37: 1776 this.$ = { type: 'BooleanLiteral', value: $$[$0] === 'true', original: $$[$0] === 'true', loc: yy.locInfo(this._$) }; 1777 break; 1778 case 38: 1779 this.$ = { type: 'UndefinedLiteral', original: undefined, value: undefined, loc: yy.locInfo(this._$) }; 1780 break; 1781 case 39: 1782 this.$ = { type: 'NullLiteral', original: null, value: null, loc: yy.locInfo(this._$) }; 1783 break; 1784 case 40: 1785 this.$ = $$[$0]; 1786 break; 1787 case 41: 1788 this.$ = $$[$0]; 1789 break; 1790 case 42: 1791 this.$ = yy.preparePath(true, $$[$0], this._$); 1792 break; 1793 case 43: 1794 this.$ = yy.preparePath(false, $$[$0], this._$); 1795 break; 1796 case 44: 1797 $$[$0 - 2].push({ part: yy.id($$[$0]), original: $$[$0], separator: $$[$0 - 1] });this.$ = $$[$0 - 2]; 1798 break; 1799 case 45: 1800 this.$ = [{ part: yy.id($$[$0]), original: $$[$0] }]; 1801 break; 1802 case 46: 1803 this.$ = []; 1804 break; 1805 case 47: 1806 $$[$0 - 1].push($$[$0]); 1807 break; 1808 case 48: 1809 this.$ = []; 1810 break; 1811 case 49: 1812 $$[$0 - 1].push($$[$0]); 1813 break; 1814 case 50: 1815 this.$ = []; 1816 break; 1817 case 51: 1818 $$[$0 - 1].push($$[$0]); 1819 break; 1820 case 58: 1821 this.$ = []; 1822 break; 1823 case 59: 1824 $$[$0 - 1].push($$[$0]); 1825 break; 1826 case 64: 1827 this.$ = []; 1828 break; 1829 case 65: 1830 $$[$0 - 1].push($$[$0]); 1831 break; 1832 case 70: 1833 this.$ = []; 1834 break; 1835 case 71: 1836 $$[$0 - 1].push($$[$0]); 1837 break; 1838 case 78: 1839 this.$ = []; 1840 break; 1841 case 79: 1842 $$[$0 - 1].push($$[$0]); 1843 break; 1844 case 82: 1845 this.$ = []; 1846 break; 1847 case 83: 1848 $$[$0 - 1].push($$[$0]); 1849 break; 1850 case 86: 1851 this.$ = []; 1852 break; 1853 case 87: 1854 $$[$0 - 1].push($$[$0]); 1855 break; 1856 case 90: 1857 this.$ = []; 1858 break; 1859 case 91: 1860 $$[$0 - 1].push($$[$0]); 1861 break; 1862 case 94: 1863 this.$ = []; 1864 break; 1865 case 95: 1866 $$[$0 - 1].push($$[$0]); 1867 break; 1868 case 98: 1869 this.$ = [$$[$0]]; 1870 break; 1871 case 99: 1872 $$[$0 - 1].push($$[$0]); 1873 break; 1874 case 100: 1875 this.$ = [$$[$0]]; 1876 break; 1877 case 101: 1878 $$[$0 - 1].push($$[$0]); 1879 break; 1880 } 1881 }, 1882
vendor: 14,911 bytes, line 1882
1882 table: [{ 3: 1, 4: 2, 5: [2, 46], 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 1: [3] }, { 5: [1, 4] }, { 5: [2, 2], 7: 5, 8: 6, 9: 7, 10: 8, 11: 9, 12: 10, 13: 11, 14: [1, 12], 15: [1, 20], 16: 17, 19: [1, 23], 24: 15, 27: 16, 29: [1, 21], 34: [1, 22], 39: [2, 2], 44: [2, 2], 47: [2, 2], 48: [1, 13], 51: [1, 14], 55: [1, 18], 59: 19, 60: [1, 24] }, { 1: [2, 1] }, { 5: [2, 47], 14: [2, 47], 15: [2, 47], 19: [2, 47], 29: [2, 47], 34: [2, 47], 39: [2, 47], 44: [2, 47], 47: [2, 47], 48: [2, 47], 51: [2, 47], 55: [2, 47], 60: [2, 47] }, { 5: [2, 3], 14: [2, 3], 15: [2, 3], 19: [2, 3], 29: [2, 3], 34: [2, 3], 39: [2, 3], 44: [2, 3], 47: [2, 3], 48: [2, 3], 51: [2, 3], 55: [2, 3], 60: [2, 3] }, { 5: [2, 4], 14: [2, 4], 15: [2, 4], 19: [2, 4], 29: [2, 4], 34: [2, 4], 39: [2, 4], 44: [2, 4], 47: [2, 4], 48: [2, 4], 51: [2, 4], 55: [2, 4], 60: [2, 4] }, { 5: [2, 5], 14: [2, 5], 15: [2, 5], 19: [2, 5], 29: [2, 5], 34: [2, 5], 39: [2, 5], 44: [2, 5], 47: [2, 5], 48: [2, 5], 51: [2, 5], 55: [2, 5], 60: [2, 5] }, { 5: [2, 6], 14: [2, 6], 15: [2, 6], 19: [2, 6], 29: [2, 6], 34: [2, 6], 39: [2, 6], 44: [2, 6], 47: [2, 6], 48: [2, 6], 51: [2, 6], 55: [2, 6], 60: [2, 6] }, { 5: [2, 7], 14: [2, 7], 15: [2, 7], 19: [2, 7], 29: [2, 7], 34: [2, 7], 39: [2, 7], 44: [2, 7], 47: [2, 7], 48: [2, 7], 51: [2, 7], 55: [2, 7], 60: [2, 7] }, { 5: [2, 8], 14: [2, 8], 15: [2, 8], 19: [2, 8], 29: [2, 8], 34: [2, 8], 39: [2, 8], 44: [2, 8], 47: [2, 8], 48: [2, 8], 51: [2, 8], 55: [2, 8], 60: [2, 8] }, { 5: [2, 9], 14: [2, 9], 15: [2, 9], 19: [2, 9], 29: [2, 9], 34: [2, 9], 39: [2, 9], 44: [2, 9], 47: [2, 9], 48: [2, 9], 51: [2, 9], 55: [2, 9], 60: [2, 9] }, { 20: 25, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 36, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 4: 37, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 39: [2, 46], 44: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 4: 38, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 44: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 15: [2, 48], 17: 39, 18: [2, 48] }, { 20: 41, 56: 40, 64: 42, 65: [1, 43], 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 4: 44, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 5: [2, 10], 14: [2, 10], 15: [2, 10], 18: [2, 10], 19: [2, 10], 29: [2, 10], 34: [2, 10], 39: [2, 10], 44: [2, 10], 47: [2, 10], 48: [2, 10], 51: [2, 10], 55: [2, 10], 60: [2, 10] }, { 20: 45, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 46, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 47, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 41, 56: 48, 64: 42, 65: [1, 43], 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 33: [2, 78], 49: 49, 65: [2, 78], 72: [2, 78], 80: [2, 78], 81: [2, 78], 82: [2, 78], 83: [2, 78], 84: [2, 78], 85: [2, 78] }, { 23: [2, 33], 33: [2, 33], 54: [2, 33], 65: [2, 33], 68: [2, 33], 72: [2, 33], 75: [2, 33], 80: [2, 33], 81: [2, 33], 82: [2, 33], 83: [2, 33], 84: [2, 33], 85: [2, 33] }, { 23: [2, 34], 33: [2, 34], 54: [2, 34], 65: [2, 34], 68: [2, 34], 72: [2, 34], 75: [2, 34], 80: [2, 34], 81: [2, 34], 82: [2, 34], 83: [2, 34], 84: [2, 34], 85: [2, 34] }, { 23: [2, 35], 33: [2, 35], 54: [2, 35], 65: [2, 35], 68: [2, 35], 72: [2, 35], 75: [2, 35], 80: [2, 35], 81: [2, 35], 82: [2, 35], 83: [2, 35], 84: [2, 35], 85: [2, 35] }, { 23: [2, 36], 33: [2, 36], 54: [2, 36], 65: [2, 36], 68: [2, 36], 72: [2, 36], 75: [2, 36], 80: [2, 36], 81: [2, 36], 82: [2, 36], 83: [2, 36], 84: [2, 36], 85: [2, 36] }, { 23: [2, 37], 33: [2, 37], 54: [2, 37], 65: [2, 37], 68: [2, 37], 72: [2, 37], 75: [2, 37], 80: [2, 37], 81: [2, 37], 82: [2, 37], 83: [2, 37], 84: [2, 37], 85: [2, 37] }, { 23: [2, 38], 33: [2, 38], 54: [2, 38], 65: [2, 38], 68: [2, 38], 72: [2, 38], 75: [2, 38], 80: [2, 38], 81: [2, 38], 82: [2, 38], 83: [2, 38], 84: [2, 38], 85: [2, 38] }, { 23: [2, 39], 33: [2, 39], 54: [2, 39], 65: [2, 39], 68: [2, 39], 72: [2, 39], 75: [2, 39], 80: [2, 39], 81: [2, 39], 82: [2, 39], 83: [2, 39], 84: [2, 39], 85: [2, 39] }, { 23: [2, 43], 33: [2, 43], 54: [2, 43], 65: [2, 43], 68: [2, 43], 72: [2, 43], 75: [2, 43], 80: [2, 43], 81: [2, 43], 82: [2, 43], 83: [2, 43], 84: [2, 43], 85: [2, 43], 87: [1, 50] }, { 72: [1, 35], 86: 51 }, { 23: [2, 45], 33: [2, 45], 54: [2, 45], 65: [2, 45], 68: [2, 45], 72: [2, 45], 75: [2, 45], 80: [2, 45], 81: [2, 45], 82: [2, 45], 83: [2, 45], 84: [2, 45], 85: [2, 45], 87: [2, 45] }, { 52: 52, 54: [2, 82], 65: [2, 82], 72: [2, 82], 80: [2, 82], 81: [2, 82], 82: [2, 82], 83: [2, 82], 84: [2, 82], 85: [2, 82] }, { 25: 53, 38: 55, 39: [1, 57], 43: 56, 44: [1, 58], 45: 54, 47: [2, 54] }, { 28: 59, 43: 60, 44: [1, 58], 47: [2, 56] }, { 13: 62, 15: [1, 20], 18: [1, 61] }, { 33: [2, 86], 57: 63, 65: [2, 86], 72: [2, 86], 80: [2, 86], 81: [2, 86], 82: [2, 86], 83: [2, 86], 84: [2, 86], 85: [2, 86] }, { 33: [2, 40], 65: [2, 40], 72: [2, 40], 80: [2, 40], 81: [2, 40], 82: [2, 40], 83: [2, 40], 84: [2, 40], 85: [2, 40] }, { 33: [2, 41], 65: [2, 41], 72: [2, 41], 80: [2, 41], 81: [2, 41], 82: [2, 41], 83: [2, 41], 84: [2, 41], 85: [2, 41] }, { 20: 64, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 26: 65, 47: [1, 66] }, { 30: 67, 33: [2, 58], 65: [2, 58], 72: [2, 58], 75: [2, 58], 80: [2, 58], 81: [2, 58], 82: [2, 58], 83: [2, 58], 84: [2, 58], 85: [2, 58] }, { 33: [2, 64], 35: 68, 65: [2, 64], 72: [2, 64], 75: [2, 64], 80: [2, 64], 81: [2, 64], 82: [2, 64], 83: [2, 64], 84: [2, 64], 85: [2, 64] }, { 21: 69, 23: [2, 50], 65: [2, 50], 72: [2, 50], 80: [2, 50], 81: [2, 50], 82: [2, 50], 83: [2, 50], 84: [2, 50], 85: [2, 50] }, { 33: [2, 90], 61: 70, 65: [2, 90], 72: [2, 90], 80: [2, 90], 81: [2, 90], 82: [2, 90], 83: [2, 90], 84: [2, 90], 85: [2, 90] }, { 20: 74, 33: [2, 80], 50: 71, 63: 72, 64: 75, 65: [1, 43], 69: 73, 70: 76, 71: 77, 72: [1, 78], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 72: [1, 79] }, { 23: [2, 42], 33: [2, 42], 54: [2, 42], 65: [2, 42], 68: [2, 42], 72: [2, 42], 75: [2, 42], 80: [2, 42], 81: [2, 42], 82: [2, 42], 83: [2, 42], 84: [2, 42], 85: [2, 42], 87: [1, 50] }, { 20: 74, 53: 80, 54: [2, 84], 63: 81, 64: 75, 65: [1, 43], 69: 82, 70: 76, 71: 77, 72: [1, 78], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 26: 83, 47: [1, 66] }, { 47: [2, 55] }, { 4: 84, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 39: [2, 46], 44: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 47: [2, 20] }, { 20: 85, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 4: 86, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 26: 87, 47: [1, 66] }, { 47: [2, 57] }, { 5: [2, 11], 14: [2, 11], 15: [2, 11], 19: [2, 11], 29: [2, 11], 34: [2, 11], 39: [2, 11], 44: [2, 11], 47: [2, 11], 48: [2, 11], 51: [2, 11], 55: [2, 11], 60: [2, 11] }, { 15: [2, 49], 18: [2, 49] }, { 20: 74, 33: [2, 88], 58: 88, 63: 89, 64: 75, 65: [1, 43], 69: 90, 70: 76, 71: 77, 72: [1, 78], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 65: [2, 94], 66: 91, 68: [2, 94], 72: [2, 94], 80: [2, 94], 81: [2, 94], 82: [2, 94], 83: [2, 94], 84: [2, 94], 85: [2, 94] }, { 5: [2, 25], 14: [2, 25], 15: [2, 25], 19: [2, 25], 29: [2, 25], 34: [2, 25], 39: [2, 25], 44: [2, 25], 47: [2, 25], 48: [2, 25], 51: [2, 25], 55: [2, 25], 60: [2, 25] }, { 20: 92, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 74, 31: 93, 33: [2, 60], 63: 94, 64: 75, 65: [1, 43], 69: 95, 70: 76, 71: 77, 72: [1, 78], 75: [2, 60], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 74, 33: [2, 66], 36: 96, 63: 97, 64: 75, 65: [1, 43], 69: 98, 70: 76, 71: 77, 72: [1, 78], 75: [2, 66], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 74, 22: 99, 23: [2, 52], 63: 100, 64: 75, 65: [1, 43], 69: 101, 70: 76, 71: 77, 72: [1, 78], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 74, 33: [2, 92], 62: 102, 63: 103, 64: 75, 65: [1, 43], 69: 104, 70: 76, 71: 77, 72: [1, 78], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 33: [1, 105] }, { 33: [2, 79], 65: [2, 79], 72: [2, 79], 80: [2, 79], 81: [2, 79], 82: [2, 79], 83: [2, 79], 84: [2, 79], 85: [2, 79] }, { 33: [2, 81] }, { 23: [2, 27], 33: [2, 27], 54: [2, 27], 65: [2, 27], 68: [2, 27], 72: [2, 27], 75: [2, 27], 80: [2, 27], 81: [2, 27], 82: [2, 27], 83: [2, 27], 84: [2, 27], 85: [2, 27] }, { 23: [2, 28], 33: [2, 28], 54: [2, 28], 65: [2, 28], 68: [2, 28], 72: [2, 28], 75: [2, 28], 80: [2, 28], 81: [2, 28], 82: [2, 28], 83: [2, 28], 84: [2, 28], 85: [2, 28] }, { 23: [2, 30], 33: [2, 30], 54: [2, 30], 68: [2, 30], 71: 106, 72: [1, 107], 75: [2, 30] }, { 23: [2, 98], 33: [2, 98], 54: [2, 98], 68: [2, 98], 72: [2, 98], 75: [2, 98] }, { 23: [2, 45], 33: [2, 45], 54: [2, 45], 65: [2, 45], 68: [2, 45], 72: [2, 45], 73: [1, 108], 75: [2, 45], 80: [2, 45], 81: [2, 45], 82: [2, 45], 83: [2, 45], 84: [2, 45], 85: [2, 45], 87: [2, 45] }, { 23: [2, 44], 33: [2, 44], 54: [2, 44], 65: [2, 44], 68: [2, 44], 72: [2, 44], 75: [2, 44], 80: [2, 44], 81: [2, 44], 82: [2, 44], 83: [2, 44], 84: [2, 44], 85: [2, 44], 87: [2, 44] }, { 54: [1, 109] }, { 54: [2, 83], 65: [2, 83], 72: [2, 83], 80: [2, 83], 81: [2, 83], 82: [2, 83], 83: [2, 83], 84: [2, 83], 85: [2, 83] }, { 54: [2, 85] }, { 5: [2, 13], 14: [2, 13], 15: [2, 13], 19: [2, 13], 29: [2, 13], 34: [2, 13], 39: [2, 13], 44: [2, 13], 47: [2, 13], 48: [2, 13], 51: [2, 13], 55: [2, 13], 60: [2, 13] }, { 38: 55, 39: [1, 57], 43: 56, 44: [1, 58], 45: 111, 46: 110, 47: [2, 76] }, { 33: [2, 70], 40: 112, 65: [2, 70], 72: [2, 70], 75: [2, 70], 80: [2, 70], 81: [2, 70], 82: [2, 70], 83: [2, 70], 84: [2, 70], 85: [2, 70] }, { 47: [2, 18] }, { 5: [2, 14], 14: [2, 14], 15: [2, 14], 19: [2, 14], 29: [2, 14], 34: [2, 14], 39: [2, 14], 44: [2, 14], 47: [2, 14], 48: [2, 14], 51: [2, 14], 55: [2, 14], 60: [2, 14] }, { 33: [1, 113] }, { 33: [2, 87], 65: [2, 87], 72: [2, 87], 80: [2, 87], 81: [2, 87], 82: [2, 87], 83: [2, 87], 84: [2, 87], 85: [2, 87] }, { 33: [2, 89] }, { 20: 74, 63: 115, 64: 75, 65: [1, 43], 67: 114, 68: [2, 96], 69: 116, 70: 76, 71: 77, 72: [1, 78], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 33: [1, 117] }, { 32: 118, 33: [2, 62], 74: 119, 75: [1, 120] }, { 33: [2, 59], 65: [2, 59], 72: [2, 59], 75: [2, 59], 80: [2, 59], 81: [2, 59], 82: [2, 59], 83: [2, 59], 84: [2, 59], 85: [2, 59] }, { 33: [2, 61], 75: [2, 61] }, { 33: [2, 68], 37: 121, 74: 122, 75: [1, 120] }, { 33: [2, 65], 65: [2, 65], 72: [2, 65], 75: [2, 65], 80: [2, 65], 81: [2, 65], 82: [2, 65], 83: [2, 65], 84: [2, 65], 85: [2, 65] }, { 33: [2, 67], 75: [2, 67] }, { 23: [1, 123] }, { 23: [2, 51], 65: [2, 51], 72: [2, 51], 80: [2, 51], 81: [2, 51], 82: [2, 51], 83: [2, 51], 84: [2, 51], 85: [2, 51] }, { 23: [2, 53] }, { 33: [1, 124] }, { 33: [2, 91], 65: [2, 91], 72: [2, 91], 80: [2, 91], 81: [2, 91], 82: [2, 91], 83: [2, 91], 84: [2, 91], 85: [2, 91] }, { 33: [2, 93] }, { 5: [2, 22], 14: [2, 22], 15: [2, 22], 19: [2, 22], 29: [2, 22], 34: [2, 22], 39: [2, 22], 44: [2, 22], 47: [2, 22], 48: [2, 22], 51: [2, 22], 55: [2, 22], 60: [2, 22] }, { 23: [2, 99], 33: [2, 99], 54: [2, 99], 68: [2, 99], 72: [2, 99], 75: [2, 99] }, { 73: [1, 108] }, { 20: 74, 63: 125, 64: 75, 65: [1, 43], 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 5: [2, 23], 14: [2, 23], 15: [2, 23], 19: [2, 23], 29: [2, 23], 34: [2, 23], 39: [2, 23], 44: [2, 23], 47: [2, 23], 48: [2, 23], 51: [2, 23], 55: [2, 23], 60: [2, 23] }, { 47: [2, 19] }, { 47: [2, 77] }, { 20: 74, 33: [2, 72], 41: 126, 63: 127, 64: 75, 65: [1, 43], 69: 128, 70: 76, 71: 77, 72: [1, 78], 75: [2, 72], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 5: [2, 24], 14: [2, 24], 15: [2, 24], 19: [2, 24], 29: [2, 24], 34: [2, 24], 39: [2, 24], 44: [2, 24], 47: [2, 24], 48: [2, 24], 51: [2, 24], 55: [2, 24], 60: [2, 24] }, { 68: [1, 129] }, { 65: [2, 95], 68: [2, 95], 72: [2, 95], 80: [2, 95], 81: [2, 95], 82: [2, 95], 83: [2, 95], 84: [2, 95], 85: [2, 95] }, { 68: [2, 97] }, { 5: [2, 21], 14: [2, 21], 15: [2, 21], 19: [2, 21], 29: [2, 21], 34: [2, 21], 39: [2, 21], 44: [2, 21], 47: [2, 21], 48: [2, 21], 51: [2, 21], 55: [2, 21], 60: [2, 21] }, { 33: [1, 130] }, { 33: [2, 63] }, { 72: [1, 132], 76: 131 }, { 33: [1, 133] }, { 33: [2, 69] }, { 15: [2, 12], 18: [2, 12] }, { 14: [2, 26], 15: [2, 26], 19: [2, 26], 29: [2, 26], 34: [2, 26], 47: [2, 26], 48: [2, 26], 51: [2, 26], 55: [2, 26], 60: [2, 26] }, { 23: [2, 31], 33: [2, 31], 54: [2, 31], 68: [2, 31], 72: [2, 31], 75: [2, 31] }, { 33: [2, 74], 42: 134, 74: 135, 75: [1, 120] }, { 33: [2, 71], 65: [2, 71], 72: [2, 71], 75: [2, 71], 80: [2, 71], 81: [2, 71], 82: [2, 71], 83: [2, 71], 84: [2, 71], 85: [2, 71] }, { 33: [2, 73], 75: [2, 73] }, { 23: [2, 29], 33: [2, 29], 54: [2, 29], 65: [2, 29], 68: [2, 29], 72: [2, 29], 75: [2, 29], 80: [2, 29], 81: [2, 29], 82: [2, 29], 83: [2, 29], 84: [2, 29], 85: [2, 29] }, { 14: [2, 15], 15: [2, 15], 19: [2, 15], 29: [2, 15], 34: [2, 15], 39: [2, 15], 44: [2, 15], 47: [2, 15], 48: [2, 15], 51: [2, 15], 55: [2, 15], 60: [2, 15] }, { 72: [1, 137], 77: [1, 136] }, { 72: [2, 100], 77: [2, 100] }, { 14: [2, 16], 15: [2, 16], 19: [2, 16], 29: [2, 16], 34: [2, 16], 44: [2, 16], 47: [2, 16], 48: [2, 16], 51: [2, 16], 55: [2, 16], 60: [2, 16] }, { 33: [1, 138] }, { 33: [2, 75] }, { 33: [2, 32] }, { 72: [2, 101], 77: [2, 101] }, { 14: [2, 17], 15: [2, 17], 19: [2, 17], 29: [2, 17], 34: [2, 17], 39: [2, 17], 44: [2, 17], 47: [2, 17], 48: [2, 17], 51: [2, 17], 55: [2, 17], 60: [2, 17] }],
vendor: 12,957 bytes, lines 1883-2145
1883 defaultActions: { 4: [2, 1], 54: [2, 55], 56: [2, 20], 60: [2, 57], 73: [2, 81], 82: [2, 85], 86: [2, 18], 90: [2, 89], 101: [2, 53], 104: [2, 93], 110: [2, 19], 111: [2, 77], 116: [2, 97], 119: [2, 63], 122: [2, 69], 135: [2, 75], 136: [2, 32] }, 1884 parseError: function parseError(str, hash) { 1885 throw new Error(str); 1886 }, 1887 parse: function parse(input) { 1888 var self = this, 1889 stack = [0], 1890 vstack = [null], 1891 lstack = [], 1892 table = this.table, 1893 yytext = "", 1894 yylineno = 0, 1895 yyleng = 0; 1896 this.lexer.setInput(input); 1897 this.lexer.yy = this.yy; 1898 this.yy.lexer = this.lexer; 1899 this.yy.parser = this; 1900 if (typeof this.lexer.yylloc == "undefined") this.lexer.yylloc = {}; 1901 var yyloc = this.lexer.yylloc; 1902 lstack.push(yyloc); 1903 var ranges = this.lexer.options && this.lexer.options.ranges; 1904 if (typeof this.yy.parseError === "function") this.parseError = this.yy.parseError; 1905 function lex() { 1906 var token; 1907 token = self.lexer.lex() || 1; 1908 if (typeof token !== "number") { 1909 token = self.symbols_[token] || token; 1910 } 1911 return token; 1912 } 1913 var symbol, 1914 state, 1915 action, 1916 r, 1917 yyval = {}, 1918 p, 1919 len, 1920 newState, 1921 expected; 1922 while (true) { 1923 state = stack[stack.length - 1]; 1924 if (this.defaultActions[state]) { 1925 action = this.defaultActions[state]; 1926 } else { 1927 if (symbol === null || typeof symbol == "undefined") { 1928 symbol = lex(); 1929 } 1930 action = table[state] && table[state][symbol]; 1931 } 1932 if (typeof action === "undefined" || !action.length || !action[0]) { 1933 var errStr = ""; 1934 { 1935 expected = []; 1936 for (p in table[state]) if (this.terminals_[p] && p > 2) { 1937 expected.push("'" + this.terminals_[p] + "'"); 1938 } 1939 if (this.lexer.showPosition) { 1940 errStr = "Parse error on line " + (yylineno + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; 1941 } else { 1942 errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == 1 ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'"); 1943 } 1944 this.parseError(errStr, { text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected }); 1945 } 1946 } 1947 if (action[0] instanceof Array && action.length > 1) { 1948 throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol); 1949 } 1950 switch (action[0]) { 1951 case 1: 1952 stack.push(symbol); 1953 vstack.push(this.lexer.yytext); 1954 lstack.push(this.lexer.yylloc); 1955 stack.push(action[1]); 1956 symbol = null; 1957 { 1958 yyleng = this.lexer.yyleng; 1959 yytext = this.lexer.yytext; 1960 yylineno = this.lexer.yylineno; 1961 yyloc = this.lexer.yylloc; 1962 } 1963 break; 1964 case 2: 1965 len = this.productions_[action[1]][1]; 1966 yyval.$ = vstack[vstack.length - len]; 1967 yyval._$ = { first_line: lstack[lstack.length - (len || 1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len || 1)].first_column, last_column: lstack[lstack.length - 1].last_column }; 1968 if (ranges) { 1969 yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]]; 1970 } 1971 r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack); 1972 if (typeof r !== "undefined") { 1973 return r; 1974 } 1975 if (len) { 1976 stack = stack.slice(0, -1 * len * 2); 1977 vstack = vstack.slice(0, -1 * len); 1978 lstack = lstack.slice(0, -1 * len); 1979 } 1980 stack.push(this.productions_[action[1]][0]); 1981 vstack.push(yyval.$); 1982 lstack.push(yyval._$); 1983 newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; 1984 stack.push(newState); 1985 break; 1986 case 3: 1987 return true; 1988 } 1989 } 1990 return true; 1991 } 1992 }; 1993 /* Jison generated lexer */ 1994 var lexer = (function () { 1995 var lexer = { EOF: 1, 1996 parseError: function parseError(str, hash) { 1997 if (this.yy.parser) { 1998 this.yy.parser.parseError(str, hash); 1999 } else { 2000 throw new Error(str); 2001 } 2002 }, 2003 setInput: function setInput(input) { 2004 this._input = input; 2005 this._more = this._less = this.done = false; 2006 this.yylineno = this.yyleng = 0; 2007 this.yytext = this.matched = this.match = ''; 2008 this.conditionStack = ['INITIAL']; 2009 this.yylloc = { first_line: 1, first_column: 0, last_line: 1, last_column: 0 }; 2010 if (this.options.ranges) this.yylloc.range = [0, 0]; 2011 this.offset = 0; 2012 return this; 2013 }, 2014 input: function input() { 2015 var ch = this._input[0]; 2016 this.yytext += ch; 2017 this.yyleng++; 2018 this.offset++; 2019 this.match += ch; 2020 this.matched += ch; 2021 var lines = ch.match(/(?:\r\n?|\n).*/g); 2022 if (lines) { 2023 this.yylineno++; 2024 this.yylloc.last_line++; 2025 } else { 2026 this.yylloc.last_column++; 2027 } 2028 if (this.options.ranges) this.yylloc.range[1]++; 2029 2030 this._input = this._input.slice(1); 2031 return ch; 2032 }, 2033 unput: function unput(ch) { 2034 var len = ch.length; 2035 var lines = ch.split(/(?:\r\n?|\n)/g); 2036 2037 this._input = ch + this._input; 2038 this.yytext = this.yytext.substr(0, this.yytext.length - len - 1); 2039 //this.yyleng -= len; 2040 this.offset -= len; 2041 var oldLines = this.match.split(/(?:\r\n?|\n)/g); 2042 this.match = this.match.substr(0, this.match.length - 1); 2043 this.matched = this.matched.substr(0, this.matched.length - 1); 2044 2045 if (lines.length - 1) this.yylineno -= lines.length - 1; 2046 var r = this.yylloc.range; 2047 2048 this.yylloc = { first_line: this.yylloc.first_line, 2049 last_line: this.yylineno + 1, 2050 first_column: this.yylloc.first_column, 2051 last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len 2052 }; 2053 2054 if (this.options.ranges) { 2055 this.yylloc.range = [r[0], r[0] + this.yyleng - len]; 2056 } 2057 return this; 2058 }, 2059 more: function more() { 2060 this._more = true; 2061 return this; 2062 }, 2063 less: function less(n) { 2064 this.unput(this.match.slice(n)); 2065 }, 2066 pastInput: function pastInput() { 2067 var past = this.matched.substr(0, this.matched.length - this.match.length); 2068 return (past.length > 20 ? '...' : '') + past.substr(-20).replace(/\n/g, ""); 2069 }, 2070 upcomingInput: function upcomingInput() { 2071 var next = this.match; 2072 if (next.length < 20) { 2073 next += this._input.substr(0, 20 - next.length); 2074 } 2075 return (next.substr(0, 20) + (next.length > 20 ? '...' : '')).replace(/\n/g, ""); 2076 }, 2077 showPosition: function showPosition() { 2078 var pre = this.pastInput(); 2079 var c = new Array(pre.length + 1).join("-"); 2080 return pre + this.upcomingInput() + "\n" + c + "^"; 2081 }, 2082 next: function next() { 2083 if (this.done) { 2084 return this.EOF; 2085 } 2086 if (!this._input) this.done = true; 2087 2088 var token, match, tempMatch, index, lines; 2089 if (!this._more) { 2090 this.yytext = ''; 2091 this.match = ''; 2092 } 2093 var rules = this._currentRules(); 2094 for (var i = 0; i < rules.length; i++) { 2095 tempMatch = this._input.match(this.rules[rules[i]]); 2096 if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { 2097 match = tempMatch; 2098 index = i; 2099 if (!this.options.flex) break; 2100 } 2101 } 2102 if (match) { 2103 lines = match[0].match(/(?:\r\n?|\n).*/g); 2104 if (lines) this.yylineno += lines.length; 2105 this.yylloc = { first_line: this.yylloc.last_line, 2106 last_line: this.yylineno + 1, 2107 first_column: this.yylloc.last_column, 2108 last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length }; 2109 this.yytext += match[0]; 2110 this.match += match[0]; 2111 this.matches = match; 2112 this.yyleng = this.yytext.length; 2113 if (this.options.ranges) { 2114 this.yylloc.range = [this.offset, this.offset += this.yyleng]; 2115 } 2116 this._more = false; 2117 this._input = this._input.slice(match[0].length); 2118 this.matched += match[0]; 2119 token = this.performAction.call(this, this.yy, this, rules[index], this.conditionStack[this.conditionStack.length - 1]); 2120 if (this.done && this._input) this.done = false; 2121 if (token) return token;else return; 2122 } 2123 if (this._input === "") { 2124 return this.EOF; 2125 } else { 2126 return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { text: "", token: null, line: this.yylineno }); 2127 } 2128 }, 2129 lex: function lex() { 2130 var r = this.next(); 2131 if (typeof r !== 'undefined') { 2132 return r; 2133 } else { 2134 return this.lex(); 2135 } 2136 }, 2137 begin: function begin(condition) { 2138 this.conditionStack.push(condition); 2139 }, 2140 popState: function popState() { 2141 return this.conditionStack.pop(); 2142 }, 2143 _currentRules: function _currentRules() { 2144 return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; 2145 },
2146 topState: function topState() { 2147 return this.conditionStack[this.conditionStack.length - 2]; 2148 }, 2149 pushState: function begin(condition) { 2150 this.begin(condition); 2151 } }; 2152 lexer.options = {}; 2153 lexer.performAction = function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { 2154 2155 function strip(start, end) { 2156 return yy_.yytext = yy_.yytext.substring(start, yy_.yyleng - end + start); 2157 } 2158 switch ($avoiding_name_collisions) { 2159 case 0: 2160 if (yy_.yytext.slice(-2) === "\\\\") { 2161 strip(0, 1); 2162 this.begin("mu"); 2163 } else if (yy_.yytext.slice(-1) === "\\") { 2164 strip(0, 1); 2165 this.begin("emu"); 2166 } else { 2167 this.begin("mu"); 2168 } 2169 if (yy_.yytext) return 15; 2170 2171 break; 2172 case 1: 2173 return 15; 2174 case 2: 2175 this.popState(); 2176 return 15; 2177 case 3: 2178 this.begin('raw');return 15; 2179 case 4: 2180 this.popState(); 2181 // Should be using `this.topState()` below, but it currently 2182 // returns the second top instead of the first top. Opened an 2183 // issue about it at https://github.com/zaach/jison/issues/291 2184 if (this.conditionStack[this.conditionStack.length - 1] === 'raw') { 2185 return 15; 2186 } else { 2187 strip(5, 9); 2188 return 'END_RAW_BLOCK'; 2189 } 2190 case 5: 2191 return 15; 2192 case 6: 2193 this.popState(); 2194 return 14; 2195 case 7: 2196 return 65; 2197 case 8: 2198 return 68; 2199 case 9: 2200 return 19; 2201 case 10: 2202 this.popState(); 2203 this.begin('raw'); 2204 return 23; 2205 case 11: 2206 return 55; 2207 case 12: 2208 return 60; 2209 case 13: 2210 return 29; 2211 case 14: 2212 return 47; 2213 case 15: 2214 this.popState();return 44; 2215 case 16: 2216 this.popState();return 44; 2217 case 17: 2218 return 34; 2219 case 18: 2220 return 39; 2221 case 19: 2222 return 51; 2223 case 20: 2224 return 48; 2225 case 21: 2226 this.unput(yy_.yytext); 2227 this.popState(); 2228 this.begin('com'); 2229 2230 break; 2231 case 22: 2232 this.popState(); 2233 return 14; 2234 case 23: 2235 return 48; 2236 case 24: 2237 return 73; 2238 case 25: 2239 return 72; 2240 case 26: 2241 return 72; 2242 case 27: 2243 return 87; 2244 case 28: 2245 // ignore whitespace 2246 break; 2247 case 29: 2248 this.popState();return 54; 2249 case 30: 2250 this.popState();return 33; 2251 case 31: 2252 yy_.yytext = strip(1, 2).replace(/\\"/g, '"');return 80; 2253 case 32: 2254 yy_.yytext = strip(1, 2).replace(/\\'/g, "'");return 80; 2255 case 33: 2256 return 85; 2257 case 34: 2258 return 82; 2259 case 35: 2260 return 82; 2261 case 36: 2262 return 83; 2263 case 37: 2264 return 84; 2265 case 38: 2266 return 81; 2267 case 39: 2268 return 75; 2269 case 40: 2270 return 77; 2271 case 41: 2272 return 72; 2273 case 42: 2274 yy_.yytext = yy_.yytext.replace(/\\([\\\]])/g, '$1');return 72; 2275 case 43: 2276 return 'INVALID'; 2277 case 44: 2278 return 5; 2279 } 2280 }; 2281 lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/, /^(?:[^\x00]+)/, /^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/, /^(?:\{\{\{\{(?=[^/]))/, /^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/, /^(?:[^\x00]+?(?=(\{\{\{\{)))/, /^(?:[\s\S]*?--(~)?\}\})/, /^(?:\()/, /^(?:\))/, /^(?:\{\{\{\{)/, /^(?:\}\}\}\})/, /^(?:\{\{(~)?>)/, /^(?:\{\{(~)?#>)/, /^(?:\{\{(~)?#\*?)/, /^(?:\{\{(~)?\/)/, /^(?:\{\{(~)?\^\s*(~)?\}\})/, /^(?:\{\{(~)?\s*else\s*(~)?\}\})/, /^(?:\{\{(~)?\^)/, /^(?:\{\{(~)?\s*else\b)/, /^(?:\{\{(~)?\{)/, /^(?:\{\{(~)?&)/, /^(?:\{\{(~)?!--)/, /^(?:\{\{(~)?![\s\S]*?\}\})/, /^(?:\{\{(~)?\*?)/, /^(?:=)/, /^(?:\.\.)/, /^(?:\.(?=([=~}\s\/.)|])))/, /^(?:[\/.])/, /^(?:\s+)/, /^(?:\}(~)?\}\})/, /^(?:(~)?\}\})/, /^(?:"(\\["]|[^"])*")/, /^(?:'(\\[']|[^'])*')/, /^(?:@)/, /^(?:true(?=([~}\s)])))/, /^(?:false(?=([~}\s)])))/, /^(?:undefined(?=([~}\s)])))/, /^(?:null(?=([~}\s)])))/, /^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/, /^(?:as\s+\|)/, /^(?:\|)/, /^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/, /^(?:\[(\\\]|[^\]])*\])/, /^(?:.)/, /^(?:$)/]; 2282 lexer.conditions = { "mu": { "rules": [7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44], "inclusive": false }, "emu": { "rules": [2], "inclusive": false }, "com": { "rules": [6], "inclusive": false }, "raw": { "rules": [3, 4, 5], "inclusive": false }, "INITIAL": { "rules": [0, 1, 44], "inclusive": true } }; 2283 return lexer;
2284 })(); 2285 parser.lexer = lexer; 2286 function Parser() { 2287 this.yy = {}; 2288 }Parser.prototype = parser;parser.Parser = Parser; 2289 return new Parser(); 2290 })();exports$1["default"] = handlebars; 2291 module.exports = exports$1["default"]; 2292 2293 } (parser, parser.exports)); 2294 return parser.exports; 2295} 2296 2297var whitespaceControl = {exports: {}}; 2298 2299var visitor = {exports: {}}; 2300 2301var hasRequiredVisitor; 2302 2303function requireVisitor () { 2304 if (hasRequiredVisitor) return visitor.exports; 2305 hasRequiredVisitor = 1; 2306 (function (module, exports$1) { 2307 2308 exports$1.__esModule = true; 2309 // istanbul ignore next 2310 2311 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 2312 2313 var _exception = requireException(); 2314 2315 var _exception2 = _interopRequireDefault(_exception); 2316 2317 function Visitor() { 2318 this.parents = []; 2319 } 2320 2321 Visitor.prototype = { 2322 constructor: Visitor, 2323 mutating: false, 2324 2325 // Visits a given value. If mutating, will replace the value if necessary. 2326 acceptKey: function acceptKey(node, name) { 2327 var value = this.accept(node[name]); 2328 if (this.mutating) { 2329 // Hacky sanity check: This may have a few false positives for type for the helper 2330 // methods but will generally do the right thing without a lot of overhead. 2331 if (value && !Visitor.prototype[value.type]) { 2332 throw new _exception2['default']('Unexpected node type "' + value.type + '" found when accepting ' + name + ' on ' + node.type); 2333 } 2334 node[name] = value; 2335 } 2336 }, 2337 2338 // Performs an accept operation with added sanity check to ensure 2339 // required keys are not removed. 2340 acceptRequired: function acceptRequired(node, name) { 2341 this.acceptKey(node, name); 2342 2343 if (!node[name]) { 2344 throw new _exception2['default'](node.type + ' requires ' + name); 2345 } 2346 }, 2347 2348 // Traverses a given array. If mutating, empty respnses will be removed 2349 // for child elements. 2350 acceptArray: function acceptArray(array) { 2351 for (var i = 0, l = array.length; i < l; i++) { 2352 this.acceptKey(array, i); 2353 2354 if (!array[i]) { 2355 array.splice(i, 1); 2356 i--; 2357 l--; 2358 } 2359 } 2360 }, 2361 2362 accept: function accept(object) { 2363 if (!object) { 2364 return; 2365 } 2366 2367 /* istanbul ignore next: Sanity code */ 2368 if (!this[object.type]) { 2369 throw new _exception2['default']('Unknown type: ' + object.type, object); 2370 } 2371 2372 if (this.current) { 2373 this.parents.unshift(this.current); 2374 } 2375 this.current = object; 2376 2377 var ret = this[object.type](object); 2378 2379 this.current = this.parents.shift(); 2380 2381 if (!this.mutating || ret) { 2382 return ret; 2383 } else if (ret !== false) { 2384 return object; 2385 } 2386 }, 2387 2388 Program: function Program(program) { 2389 this.acceptArray(program.body); 2390 }, 2391 2392 MustacheStatement: visitSubExpression, 2393 Decorator: visitSubExpression, 2394 2395 BlockStatement: visitBlock, 2396 DecoratorBlock: visitBlock, 2397 2398 PartialStatement: visitPartial, 2399 PartialBlockStatement: function PartialBlockStatement(partial) { 2400 visitPartial.call(this, partial); 2401 2402 this.acceptKey(partial, 'program'); 2403 }, 2404 2405 ContentStatement: function ContentStatement() /* content */{}, 2406 CommentStatement: function CommentStatement() /* comment */{}, 2407 2408 SubExpression: visitSubExpression, 2409 2410 PathExpression: function PathExpression() /* path */{}, 2411 2412 StringLiteral: function StringLiteral() /* string */{}, 2413 NumberLiteral: function NumberLiteral() /* number */{}, 2414 BooleanLiteral: function BooleanLiteral() /* bool */{}, 2415 UndefinedLiteral: function UndefinedLiteral() /* literal */{}, 2416 NullLiteral: function NullLiteral() /* literal */{}, 2417 2418 Hash: function Hash(hash) { 2419 this.acceptArray(hash.pairs); 2420 }, 2421 HashPair: function HashPair(pair) { 2422 this.acceptRequired(pair, 'value'); 2423 } 2424 }; 2425 2426 function visitSubExpression(mustache) { 2427 this.acceptRequired(mustache, 'path'); 2428 this.acceptArray(mustache.params); 2429 this.acceptKey(mustache, 'hash'); 2430 } 2431 function visitBlock(block) { 2432 visitSubExpression.call(this, block); 2433 2434 this.acceptKey(block, 'program'); 2435 this.acceptKey(block, 'inverse'); 2436 } 2437 function visitPartial(partial) { 2438 this.acceptRequired(partial, 'name'); 2439 this.acceptArray(partial.params); 2440 this.acceptKey(partial, 'hash'); 2441 } 2442 2443 exports$1['default'] = Visitor; 2444 module.exports = exports$1['default']; 2445 2446 } (visitor, visitor.exports)); 2447 return visitor.exports; 2448} 2449 2450var hasRequiredWhitespaceControl; 2451 2452function requireWhitespaceControl () { 2453 if (hasRequiredWhitespaceControl) return whitespaceControl.exports; 2454 hasRequiredWhitespaceControl = 1; 2455 (function (module, exports$1) { 2456 2457 exports$1.__esModule = true; 2458 // istanbul ignore next 2459 2460 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 2461 2462 var _visitor = requireVisitor(); 2463 2464 var _visitor2 = _interopRequireDefault(_visitor); 2465 2466 function WhitespaceControl() { 2467 var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; 2468 2469 this.options = options; 2470 } 2471 WhitespaceControl.prototype = new _visitor2['default'](); 2472 2473 WhitespaceControl.prototype.Program = function (program) { 2474 var doStandalone = !this.options.ignoreStandalone; 2475
vendor: 6,942 bytes, lines 2476-2697
2476 var isRoot = !this.isRootSeen; 2477 this.isRootSeen = true; 2478 2479 var body = program.body; 2480 for (var i = 0, l = body.length; i < l; i++) { 2481 var current = body[i], 2482 strip = this.accept(current); 2483 2484 if (!strip) { 2485 continue; 2486 } 2487 2488 var _isPrevWhitespace = isPrevWhitespace(body, i, isRoot), 2489 _isNextWhitespace = isNextWhitespace(body, i, isRoot), 2490 openStandalone = strip.openStandalone && _isPrevWhitespace, 2491 closeStandalone = strip.closeStandalone && _isNextWhitespace, 2492 inlineStandalone = strip.inlineStandalone && _isPrevWhitespace && _isNextWhitespace; 2493 2494 if (strip.close) { 2495 omitRight(body, i, true); 2496 } 2497 if (strip.open) { 2498 omitLeft(body, i, true); 2499 } 2500 2501 if (doStandalone && inlineStandalone) { 2502 omitRight(body, i); 2503 2504 if (omitLeft(body, i)) { 2505 // If we are on a standalone node, save the indent info for partials 2506 if (current.type === 'PartialStatement') { 2507 // Pull out the whitespace from the final line 2508 current.indent = /([ \t]+$)/.exec(body[i - 1].original)[1]; 2509 } 2510 } 2511 } 2512 if (doStandalone && openStandalone) { 2513 omitRight((current.program || current.inverse).body); 2514 2515 // Strip out the previous content node if it's whitespace only 2516 omitLeft(body, i); 2517 } 2518 if (doStandalone && closeStandalone) { 2519 // Always strip the next node 2520 omitRight(body, i); 2521 2522 omitLeft((current.inverse || current.program).body); 2523 } 2524 } 2525 2526 return program; 2527 }; 2528 2529 WhitespaceControl.prototype.BlockStatement = WhitespaceControl.prototype.DecoratorBlock = WhitespaceControl.prototype.PartialBlockStatement = function (block) { 2530 this.accept(block.program); 2531 this.accept(block.inverse); 2532 2533 // Find the inverse program that is involed with whitespace stripping. 2534 var program = block.program || block.inverse, 2535 inverse = block.program && block.inverse, 2536 firstInverse = inverse, 2537 lastInverse = inverse; 2538 2539 if (inverse && inverse.chained) { 2540 firstInverse = inverse.body[0].program; 2541 2542 // Walk the inverse chain to find the last inverse that is actually in the chain. 2543 while (lastInverse.chained) { 2544 lastInverse = lastInverse.body[lastInverse.body.length - 1].program; 2545 } 2546 } 2547 2548 var strip = { 2549 open: block.openStrip.open, 2550 close: block.closeStrip.close, 2551 2552 // Determine the standalone candiacy. Basically flag our content as being possibly standalone 2553 // so our parent can determine if we actually are standalone 2554 openStandalone: isNextWhitespace(program.body), 2555 closeStandalone: isPrevWhitespace((firstInverse || program).body) 2556 }; 2557 2558 if (block.openStrip.close) { 2559 omitRight(program.body, null, true); 2560 } 2561 2562 if (inverse) { 2563 var inverseStrip = block.inverseStrip; 2564 2565 if (inverseStrip.open) { 2566 omitLeft(program.body, null, true); 2567 } 2568 2569 if (inverseStrip.close) { 2570 omitRight(firstInverse.body, null, true); 2571 } 2572 if (block.closeStrip.open) { 2573 omitLeft(lastInverse.body, null, true); 2574 } 2575 2576 // Find standalone else statments 2577 if (!this.options.ignoreStandalone && isPrevWhitespace(program.body) && isNextWhitespace(firstInverse.body)) { 2578 omitLeft(program.body); 2579 omitRight(firstInverse.body); 2580 } 2581 } else if (block.closeStrip.open) { 2582 omitLeft(program.body, null, true); 2583 } 2584 2585 return strip; 2586 }; 2587 2588 WhitespaceControl.prototype.Decorator = WhitespaceControl.prototype.MustacheStatement = function (mustache) { 2589 return mustache.strip; 2590 }; 2591 2592 WhitespaceControl.prototype.PartialStatement = WhitespaceControl.prototype.CommentStatement = function (node) { 2593 /* istanbul ignore next */ 2594 var strip = node.strip || {}; 2595 return { 2596 inlineStandalone: true, 2597 open: strip.open, 2598 close: strip.close 2599 }; 2600 }; 2601 2602 function isPrevWhitespace(body, i, isRoot) { 2603 if (i === undefined) { 2604 i = body.length; 2605 } 2606 2607 // Nodes that end with newlines are considered whitespace (but are special 2608 // cased for strip operations) 2609 var prev = body[i - 1], 2610 sibling = body[i - 2]; 2611 if (!prev) { 2612 return isRoot; 2613 } 2614 2615 if (prev.type === 'ContentStatement') { 2616 return (sibling || !isRoot ? /\r?\n\s*?$/ : /(^|\r?\n)\s*?$/).test(prev.original); 2617 } 2618 } 2619 function isNextWhitespace(body, i, isRoot) { 2620 if (i === undefined) { 2621 i = -1; 2622 } 2623 2624 var next = body[i + 1], 2625 sibling = body[i + 2]; 2626 if (!next) { 2627 return isRoot; 2628 } 2629 2630 if (next.type === 'ContentStatement') { 2631 return (sibling || !isRoot ? /^\s*?\r?\n/ : /^\s*?(\r?\n|$)/).test(next.original); 2632 } 2633 } 2634 2635 // Marks the node to the right of the position as omitted. 2636 // I.e. {{foo}}' ' will mark the ' ' node as omitted. 2637 // 2638 // If i is undefined, then the first child will be marked as such. 2639 // 2640 // If mulitple is truthy then all whitespace will be stripped out until non-whitespace 2641 // content is met. 2642 function omitRight(body, i, multiple) { 2643 var current = body[i == null ? 0 : i + 1]; 2644 if (!current || current.type !== 'ContentStatement' || !multiple && current.rightStripped) { 2645 return; 2646 } 2647 2648 var original = current.value; 2649 current.value = current.value.replace(multiple ? /^\s+/ : /^[ \t]*\r?\n?/, ''); 2650 current.rightStripped = current.value !== original; 2651 } 2652 2653 // Marks the node to the left of the position as omitted. 2654 // I.e. ' '{{foo}} will mark the ' ' node as omitted. 2655 // 2656 // If i is undefined then the last child will be marked as such. 2657 // 2658 // If mulitple is truthy then all whitespace will be stripped out until non-whitespace 2659 // content is met. 2660 function omitLeft(body, i, multiple) { 2661 var current = body[i == null ? body.length - 1 : i - 1]; 2662 if (!current || current.type !== 'ContentStatement' || !multiple && current.leftStripped) { 2663 return; 2664 } 2665 2666 // We omit the last node if it's whitespace only and not preceded by a non-content node. 2667 var original = current.value; 2668 current.value = current.value.replace(multiple ? /\s+$/ : /[ \t]+$/, ''); 2669 current.leftStripped = current.value !== original; 2670 return current.leftStripped; 2671 } 2672 2673 exports$1['default'] = WhitespaceControl; 2674 module.exports = exports$1['default']; 2675 2676 } (whitespaceControl, whitespaceControl.exports)); 2677 return whitespaceControl.exports; 2678} 2679 2680var helpers = {}; 2681 2682var hasRequiredHelpers; 2683 2684function requireHelpers () { 2685 if (hasRequiredHelpers) return helpers; 2686 hasRequiredHelpers = 1; 2687 2688 helpers.__esModule = true; 2689 helpers.SourceLocation = SourceLocation; 2690 helpers.id = id; 2691 helpers.stripFlags = stripFlags; 2692 helpers.stripComment = stripComment; 2693 helpers.preparePath = preparePath; 2694 helpers.prepareMustache = prepareMustache; 2695 helpers.prepareRawBlock = prepareRawBlock; 2696 helpers.prepareBlock = prepareBlock; 2697 helpers.prepareProgram = prepareProgram;
vendor: 3,259 bytes, lines 2698-2829
2698 helpers.preparePartialBlock = preparePartialBlock; 2699 // istanbul ignore next 2700 2701 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 2702 2703 var _exception = requireException(); 2704 2705 var _exception2 = _interopRequireDefault(_exception); 2706 2707 function validateClose(open, close) { 2708 close = close.path ? close.path.original : close; 2709 2710 if (open.path.original !== close) { 2711 var errorNode = { loc: open.path.loc }; 2712 2713 throw new _exception2['default'](open.path.original + " doesn't match " + close, errorNode); 2714 } 2715 } 2716 2717 function SourceLocation(source, locInfo) { 2718 this.source = source; 2719 this.start = { 2720 line: locInfo.first_line, 2721 column: locInfo.first_column 2722 }; 2723 this.end = { 2724 line: locInfo.last_line, 2725 column: locInfo.last_column 2726 }; 2727 } 2728 2729 function id(token) { 2730 if (/^\[.*\]$/.test(token)) { 2731 return token.substring(1, token.length - 1); 2732 } else { 2733 return token; 2734 } 2735 } 2736 2737 function stripFlags(open, close) { 2738 return { 2739 open: open.charAt(2) === '~', 2740 close: close.charAt(close.length - 3) === '~' 2741 }; 2742 } 2743 2744 function stripComment(comment) { 2745 return comment.replace(/^\{\{~?!-?-?/, '').replace(/-?-?~?\}\}$/, ''); 2746 } 2747 2748 function preparePath(data, parts, loc) { 2749 loc = this.locInfo(loc); 2750 2751 var original = data ? '@' : '', 2752 dig = [], 2753 depth = 0; 2754 2755 for (var i = 0, l = parts.length; i < l; i++) { 2756 var part = parts[i].part, 2757 2758 // If we have [] syntax then we do not treat path references as operators, 2759 // i.e. foo.[this] resolves to approximately context.foo['this'] 2760 isLiteral = parts[i].original !== part; 2761 original += (parts[i].separator || '') + part; 2762 2763 if (!isLiteral && (part === '..' || part === '.' || part === 'this')) { 2764 if (dig.length > 0) { 2765 throw new _exception2['default']('Invalid path: ' + original, { loc: loc }); 2766 } else if (part === '..') { 2767 depth++; 2768 } 2769 } else { 2770 dig.push(part); 2771 } 2772 } 2773 2774 return { 2775 type: 'PathExpression', 2776 data: data, 2777 depth: depth, 2778 parts: dig, 2779 original: original, 2780 loc: loc 2781 }; 2782 } 2783 2784 function prepareMustache(path, params, hash, open, strip, locInfo) { 2785 // Must use charAt to support IE pre-10 2786 var escapeFlag = open.charAt(3) || open.charAt(2), 2787 escaped = escapeFlag !== '{' && escapeFlag !== '&'; 2788 2789 var decorator = /\*/.test(open); 2790 return { 2791 type: decorator ? 'Decorator' : 'MustacheStatement', 2792 path: path, 2793 params: params, 2794 hash: hash, 2795 escaped: escaped, 2796 strip: strip, 2797 loc: this.locInfo(locInfo) 2798 }; 2799 } 2800 2801 function prepareRawBlock(openRawBlock, contents, close, locInfo) { 2802 validateClose(openRawBlock, close); 2803 2804 locInfo = this.locInfo(locInfo); 2805 var program = { 2806 type: 'Program', 2807 body: contents, 2808 strip: {}, 2809 loc: locInfo 2810 }; 2811 2812 return { 2813 type: 'BlockStatement', 2814 path: openRawBlock.path, 2815 params: openRawBlock.params, 2816 hash: openRawBlock.hash, 2817 program: program, 2818 openStrip: {}, 2819 inverseStrip: {}, 2820 closeStrip: {}, 2821 loc: locInfo 2822 }; 2823 } 2824 2825 function prepareBlock(openBlock, program, inverseAndProgram, close, inverted, locInfo) { 2826 if (close && close.path) { 2827 validateClose(openBlock, close); 2828 } 2829
2830 var decorator = /\*/.test(openBlock.open); 2831 2832 program.blockParams = openBlock.blockParams; 2833 2834 var inverse = undefined, 2835 inverseStrip = undefined; 2836 2837 if (inverseAndProgram) { 2838 if (decorator) { 2839 throw new _exception2['default']('Unexpected inverse block on decorator', inverseAndProgram); 2840 } 2841 2842 if (inverseAndProgram.chain) { 2843 inverseAndProgram.program.body[0].closeStrip = close.strip; 2844 } 2845 2846 inverseStrip = inverseAndProgram.strip; 2847 inverse = inverseAndProgram.program; 2848 } 2849 2850 if (inverted) { 2851 inverted = inverse; 2852 inverse = program; 2853 program = inverted; 2854 } 2855 2856 return { 2857 type: decorator ? 'DecoratorBlock' : 'BlockStatement', 2858 path: openBlock.path, 2859 params: openBlock.params, 2860 hash: openBlock.hash, 2861 program: program, 2862 inverse: inverse, 2863 openStrip: openBlock.strip, 2864 inverseStrip: inverseStrip, 2865 closeStrip: close && close.strip, 2866 loc: this.locInfo(locInfo) 2867 }; 2868 } 2869 2870 function prepareProgram(statements, loc) { 2871 if (!loc && statements.length) { 2872 var firstLoc = statements[0].loc, 2873 lastLoc = statements[statements.length - 1].loc; 2874 2875 /* istanbul ignore else */ 2876 if (firstLoc && lastLoc) { 2877 loc = { 2878 source: firstLoc.source, 2879 start: { 2880 line: firstLoc.start.line, 2881 column: firstLoc.start.column 2882 }, 2883 end: { 2884 line: lastLoc.end.line, 2885 column: lastLoc.end.column 2886 } 2887 }; 2888 } 2889 } 2890 2891 return { 2892 type: 'Program', 2893 body: statements, 2894 strip: {}, 2895 loc: loc 2896 }; 2897 } 2898 2899 function preparePartialBlock(open, program, close, locInfo) { 2900 validateClose(open, close); 2901 2902 return { 2903 type: 'PartialBlockStatement', 2904 name: open.path, 2905 params: open.params, 2906 hash: open.hash, 2907 program: program, 2908 openStrip: open.strip, 2909 closeStrip: close && close.strip, 2910 loc: this.locInfo(locInfo) 2911 }; 2912 } 2913 2914 return helpers; 2915} 2916 2917var hasRequiredBase; 2918 2919function requireBase () { 2920 if (hasRequiredBase) return base; 2921 hasRequiredBase = 1; 2922 2923 base.__esModule = true; 2924 base.parseWithoutProcessing = parseWithoutProcessing; 2925 base.parse = parse; 2926 // istanbul ignore next 2927 2928 function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } } 2929 2930 // istanbul ignore next 2931 2932 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 2933 2934 var _parser = requireParser(); 2935 2936 var _parser2 = _interopRequireDefault(_parser); 2937 2938 var _whitespaceControl = requireWhitespaceControl(); 2939 2940 var _whitespaceControl2 = _interopRequireDefault(_whitespaceControl); 2941 2942 var _helpers = requireHelpers(); 2943 2944 var Helpers = _interopRequireWildcard(_helpers); 2945 2946 var _utils = requireUtils(); 2947 2948 base.parser = _parser2['default']; 2949 2950 var yy = {}; 2951 _utils.extend(yy, Helpers); 2952 2953 function parseWithoutProcessing(input, options) { 2954 // Just return if an already-compiled AST was passed in. 2955 if (input.type === 'Program') { 2956 return input; 2957 } 2958 2959 _parser2['default'].yy = yy; 2960 2961 // Altering the shared object here, but this is ok as parser is a sync operation 2962 yy.locInfo = function (locInfo) { 2963 return new yy.SourceLocation(options && options.srcName, locInfo); 2964 }; 2965 2966 var ast = _parser2['default'].parse(input); 2967 2968 return ast; 2969 } 2970 2971 function parse(input, options) { 2972 var ast = parseWithoutProcessing(input, options); 2973 var strip = new _whitespaceControl2['default'](options); 2974 2975 return strip.accept(ast); 2976 } 2977 2978 return base; 2979} 2980 2981var compiler = {}; 2982 2983/* eslint-disable new-cap */ 2984 2985var hasRequiredCompiler; 2986 2987function requireCompiler () { 2988 if (hasRequiredCompiler) return compiler; 2989 hasRequiredCompiler = 1; 2990 2991 compiler.__esModule = true; 2992 compiler.Compiler = Compiler; 2993 compiler.precompile = precompile; 2994 compiler.compile = compile; 2995 // istanbul ignore next 2996 2997 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 2998 2999 var _exception = requireException(); 3000 3001 var _exception2 = _interopRequireDefault(_exception); 3002 3003 var _utils = requireUtils(); 3004 3005 var _ast = requireAst(); 3006 3007 var _ast2 = _interopRequireDefault(_ast); 3008 3009 var slice = [].slice; 3010 3011 function Compiler() {} 3012 3013 // the foundHelper register will disambiguate helper lookup from finding a 3014 // function in a context. This is necessary for mustache compatibility, which 3015 // requires that context functions in blocks are evaluated by blockHelperMissing, 3016 // and then proceed as if the resulting value was provided to blockHelperMissing. 3017 3018 Compiler.prototype = { 3019 compiler: Compiler, 3020 3021 equals: function equals(other) { 3022 var len = this.opcodes.length; 3023 if (other.opcodes.length !== len) { 3024 return false;
vendor: 14,589 bytes, lines 3025-3522
3025 } 3026 3027 for (var i = 0; i < len; i++) { 3028 var opcode = this.opcodes[i], 3029 otherOpcode = other.opcodes[i]; 3030 if (opcode.opcode !== otherOpcode.opcode || !argEquals(opcode.args, otherOpcode.args)) { 3031 return false; 3032 } 3033 } 3034 3035 // We know that length is the same between the two arrays because they are directly tied 3036 // to the opcode behavior above. 3037 len = this.children.length; 3038 for (var i = 0; i < len; i++) { 3039 if (!this.children[i].equals(other.children[i])) { 3040 return false; 3041 } 3042 } 3043 3044 return true; 3045 }, 3046 3047 guid: 0, 3048 3049 compile: function compile(program, options) { 3050 this.sourceNode = []; 3051 this.opcodes = []; 3052 this.children = []; 3053 this.options = options; 3054 this.stringParams = options.stringParams; 3055 this.trackIds = options.trackIds; 3056 3057 options.blockParams = options.blockParams || []; 3058 3059 options.knownHelpers = _utils.extend(Object.create(null), { 3060 helperMissing: true, 3061 blockHelperMissing: true, 3062 each: true, 3063 'if': true, 3064 unless: true, 3065 'with': true, 3066 log: true, 3067 lookup: true 3068 }, options.knownHelpers); 3069 3070 return this.accept(program); 3071 }, 3072 3073 compileProgram: function compileProgram(program) { 3074 var childCompiler = new this.compiler(), 3075 // eslint-disable-line new-cap 3076 result = childCompiler.compile(program, this.options), 3077 guid = this.guid++; 3078 3079 this.usePartial = this.usePartial || result.usePartial; 3080 3081 this.children[guid] = result; 3082 this.useDepths = this.useDepths || result.useDepths; 3083 3084 return guid; 3085 }, 3086 3087 accept: function accept(node) { 3088 /* istanbul ignore next: Sanity code */ 3089 if (!this[node.type]) { 3090 throw new _exception2['default']('Unknown type: ' + node.type, node); 3091 } 3092 3093 this.sourceNode.unshift(node); 3094 var ret = this[node.type](node); 3095 this.sourceNode.shift(); 3096 return ret; 3097 }, 3098 3099 Program: function Program(program) { 3100 this.options.blockParams.unshift(program.blockParams); 3101 3102 var body = program.body, 3103 bodyLength = body.length; 3104 for (var i = 0; i < bodyLength; i++) { 3105 this.accept(body[i]); 3106 } 3107 3108 this.options.blockParams.shift(); 3109 3110 this.isSimple = bodyLength === 1; 3111 this.blockParams = program.blockParams ? program.blockParams.length : 0; 3112 3113 return this; 3114 }, 3115 3116 BlockStatement: function BlockStatement(block) { 3117 transformLiteralToPath(block); 3118 3119 var program = block.program, 3120 inverse = block.inverse; 3121 3122 program = program && this.compileProgram(program); 3123 inverse = inverse && this.compileProgram(inverse); 3124 3125 var type = this.classifySexpr(block); 3126 3127 if (type === 'helper') { 3128 this.helperSexpr(block, program, inverse); 3129 } else if (type === 'simple') { 3130 this.simpleSexpr(block); 3131 3132 // now that the simple mustache is resolved, we need to 3133 // evaluate it by executing `blockHelperMissing` 3134 this.opcode('pushProgram', program); 3135 this.opcode('pushProgram', inverse); 3136 this.opcode('emptyHash'); 3137 this.opcode('blockValue', block.path.original); 3138 } else { 3139 this.ambiguousSexpr(block, program, inverse); 3140 3141 // now that the simple mustache is resolved, we need to 3142 // evaluate it by executing `blockHelperMissing` 3143 this.opcode('pushProgram', program); 3144 this.opcode('pushProgram', inverse); 3145 this.opcode('emptyHash'); 3146 this.opcode('ambiguousBlockValue'); 3147 } 3148 3149 this.opcode('append'); 3150 }, 3151 3152 DecoratorBlock: function DecoratorBlock(decorator) { 3153 var program = decorator.program && this.compileProgram(decorator.program); 3154 var params = this.setupFullMustacheParams(decorator, program, undefined), 3155 path = decorator.path; 3156 3157 this.useDecorators = true; 3158 this.opcode('registerDecorator', params.length, path.original); 3159 }, 3160 3161 PartialStatement: function PartialStatement(partial) { 3162 this.usePartial = true; 3163 3164 var program = partial.program; 3165 if (program) { 3166 program = this.compileProgram(partial.program); 3167 } 3168 3169 var params = partial.params; 3170 if (params.length > 1) { 3171 throw new _exception2['default']('Unsupported number of partial arguments: ' + params.length, partial); 3172 } else if (!params.length) { 3173 if (this.options.explicitPartialContext) { 3174 this.opcode('pushLiteral', 'undefined'); 3175 } else { 3176 params.push({ type: 'PathExpression', parts: [], depth: 0 }); 3177 } 3178 } 3179 3180 var partialName = partial.name.original, 3181 isDynamic = partial.name.type === 'SubExpression'; 3182 if (isDynamic) { 3183 this.accept(partial.name); 3184 } 3185 3186 this.setupFullMustacheParams(partial, program, undefined, true); 3187 3188 var indent = partial.indent || ''; 3189 if (this.options.preventIndent && indent) { 3190 this.opcode('appendContent', indent); 3191 indent = ''; 3192 } 3193 3194 this.opcode('invokePartial', isDynamic, partialName, indent); 3195 this.opcode('append'); 3196 }, 3197 PartialBlockStatement: function PartialBlockStatement(partialBlock) { 3198 this.PartialStatement(partialBlock); 3199 }, 3200 3201 MustacheStatement: function MustacheStatement(mustache) { 3202 this.SubExpression(mustache); 3203 3204 if (mustache.escaped && !this.options.noEscape) { 3205 this.opcode('appendEscaped'); 3206 } else { 3207 this.opcode('append'); 3208 } 3209 }, 3210 Decorator: function Decorator(decorator) { 3211 this.DecoratorBlock(decorator); 3212 }, 3213 3214 ContentStatement: function ContentStatement(content) { 3215 if (content.value) { 3216 this.opcode('appendContent', content.value); 3217 } 3218 }, 3219 3220 CommentStatement: function CommentStatement() {}, 3221 3222 SubExpression: function SubExpression(sexpr) { 3223 transformLiteralToPath(sexpr); 3224 var type = this.classifySexpr(sexpr); 3225 3226 if (type === 'simple') { 3227 this.simpleSexpr(sexpr); 3228 } else if (type === 'helper') { 3229 this.helperSexpr(sexpr); 3230 } else { 3231 this.ambiguousSexpr(sexpr); 3232 } 3233 }, 3234 ambiguousSexpr: function ambiguousSexpr(sexpr, program, inverse) { 3235 var path = sexpr.path, 3236 name = path.parts[0], 3237 isBlock = program != null || inverse != null; 3238 3239 this.opcode('getContext', path.depth); 3240 3241 this.opcode('pushProgram', program); 3242 this.opcode('pushProgram', inverse); 3243 3244 path.strict = true; 3245 this.accept(path); 3246 3247 this.opcode('invokeAmbiguous', name, isBlock); 3248 }, 3249 3250 simpleSexpr: function simpleSexpr(sexpr) { 3251 var path = sexpr.path; 3252 path.strict = true; 3253 this.accept(path); 3254 this.opcode('resolvePossibleLambda'); 3255 }, 3256 3257 helperSexpr: function helperSexpr(sexpr, program, inverse) { 3258 var params = this.setupFullMustacheParams(sexpr, program, inverse), 3259 path = sexpr.path, 3260 name = path.parts[0]; 3261 3262 if (this.options.knownHelpers[name]) { 3263 this.opcode('invokeKnownHelper', params.length, name); 3264 } else if (this.options.knownHelpersOnly) { 3265 throw new _exception2['default']('You specified knownHelpersOnly, but used the unknown helper ' + name, sexpr); 3266 } else { 3267 path.strict = true; 3268 path.falsy = true; 3269 3270 this.accept(path); 3271 this.opcode('invokeHelper', params.length, path.original, _ast2['default'].helpers.simpleId(path)); 3272 } 3273 }, 3274 3275 PathExpression: function PathExpression(path) { 3276 this.addDepth(path.depth); 3277 this.opcode('getContext', path.depth); 3278 3279 var name = path.parts[0], 3280 scoped = _ast2['default'].helpers.scopedId(path), 3281 blockParamId = !path.depth && !scoped && this.blockParamIndex(name); 3282 3283 if (blockParamId) { 3284 this.opcode('lookupBlockParam', blockParamId, path.parts); 3285 } else if (!name) { 3286 // Context reference, i.e. `{{foo .}}` or `{{foo ..}}` 3287 this.opcode('pushContext'); 3288 } else if (path.data) { 3289 this.options.data = true; 3290 this.opcode('lookupData', path.depth, path.parts, path.strict); 3291 } else { 3292 this.opcode('lookupOnContext', path.parts, path.falsy, path.strict, scoped); 3293 } 3294 }, 3295 3296 StringLiteral: function StringLiteral(string) { 3297 this.opcode('pushString', string.value); 3298 }, 3299 3300 NumberLiteral: function NumberLiteral(number) { 3301 this.opcode('pushLiteral', number.value); 3302 }, 3303 3304 BooleanLiteral: function BooleanLiteral(bool) { 3305 this.opcode('pushLiteral', bool.value); 3306 }, 3307 3308 UndefinedLiteral: function UndefinedLiteral() { 3309 this.opcode('pushLiteral', 'undefined'); 3310 }, 3311 3312 NullLiteral: function NullLiteral() { 3313 this.opcode('pushLiteral', 'null'); 3314 }, 3315 3316 Hash: function Hash(hash) { 3317 var pairs = hash.pairs, 3318 i = 0, 3319 l = pairs.length; 3320 3321 this.opcode('pushHash'); 3322 3323 for (; i < l; i++) { 3324 this.pushParam(pairs[i].value); 3325 } 3326 while (i--) { 3327 this.opcode('assignToHash', pairs[i].key); 3328 } 3329 this.opcode('popHash'); 3330 }, 3331 3332 // HELPERS 3333 opcode: function opcode(name) { 3334 this.opcodes.push({ 3335 opcode: name, 3336 args: slice.call(arguments, 1), 3337 loc: this.sourceNode[0].loc 3338 }); 3339 }, 3340 3341 addDepth: function addDepth(depth) { 3342 if (!depth) { 3343 return; 3344 } 3345 3346 this.useDepths = true; 3347 }, 3348 3349 classifySexpr: function classifySexpr(sexpr) { 3350 var isSimple = _ast2['default'].helpers.simpleId(sexpr.path); 3351 3352 var isBlockParam = isSimple && !!this.blockParamIndex(sexpr.path.parts[0]); 3353 3354 // a mustache is an eligible helper if: 3355 // * its id is simple (a single part, not `this` or `..`) 3356 var isHelper = !isBlockParam && _ast2['default'].helpers.helperExpression(sexpr); 3357 3358 // if a mustache is an eligible helper but not a definite 3359 // helper, it is ambiguous, and will be resolved in a later 3360 // pass or at runtime. 3361 var isEligible = !isBlockParam && (isHelper || isSimple); 3362 3363 // if ambiguous, we can possibly resolve the ambiguity now 3364 // An eligible helper is one that does not have a complex path, i.e. `this.foo`, `../foo` etc. 3365 if (isEligible && !isHelper) { 3366 var _name = sexpr.path.parts[0], 3367 options = this.options; 3368 if (options.knownHelpers[_name]) { 3369 isHelper = true; 3370 } else if (options.knownHelpersOnly) { 3371 isEligible = false; 3372 } 3373 } 3374 3375 if (isHelper) { 3376 return 'helper'; 3377 } else if (isEligible) { 3378 return 'ambiguous'; 3379 } else { 3380 return 'simple'; 3381 } 3382 }, 3383 3384 pushParams: function pushParams(params) { 3385 for (var i = 0, l = params.length; i < l; i++) { 3386 this.pushParam(params[i]); 3387 } 3388 }, 3389 3390 pushParam: function pushParam(val) { 3391 var value = val.value != null ? val.value : val.original || ''; 3392 3393 if (this.stringParams) { 3394 if (value.replace) { 3395 value = value.replace(/^(\.?\.\/)*/g, '').replace(/\//g, '.'); 3396 } 3397 3398 if (val.depth) { 3399 this.addDepth(val.depth); 3400 } 3401 this.opcode('getContext', val.depth || 0); 3402 this.opcode('pushStringParam', value, val.type); 3403 3404 if (val.type === 'SubExpression') { 3405 // SubExpressions get evaluated and passed in 3406 // in string params mode. 3407 this.accept(val); 3408 } 3409 } else { 3410 if (this.trackIds) { 3411 var blockParamIndex = undefined; 3412 if (val.parts && !_ast2['default'].helpers.scopedId(val) && !val.depth) { 3413 blockParamIndex = this.blockParamIndex(val.parts[0]); 3414 } 3415 if (blockParamIndex) { 3416 var blockParamChild = val.parts.slice(1).join('.'); 3417 this.opcode('pushId', 'BlockParam', blockParamIndex, blockParamChild); 3418 } else { 3419 value = val.original || value; 3420 if (value.replace) { 3421 value = value.replace(/^this(?:\.|$)/, '').replace(/^\.\//, '').replace(/^\.$/, ''); 3422 } 3423 3424 this.opcode('pushId', val.type, value); 3425 } 3426 } 3427 this.accept(val); 3428 } 3429 }, 3430 3431 setupFullMustacheParams: function setupFullMustacheParams(sexpr, program, inverse, omitEmpty) { 3432 var params = sexpr.params; 3433 this.pushParams(params); 3434 3435 this.opcode('pushProgram', program); 3436 this.opcode('pushProgram', inverse); 3437 3438 if (sexpr.hash) { 3439 this.accept(sexpr.hash); 3440 } else { 3441 this.opcode('emptyHash', omitEmpty); 3442 } 3443 3444 return params; 3445 }, 3446 3447 blockParamIndex: function blockParamIndex(name) { 3448 for (var depth = 0, len = this.options.blockParams.length; depth < len; depth++) { 3449 var blockParams = this.options.blockParams[depth], 3450 param = blockParams && _utils.indexOf(blockParams, name); 3451 if (blockParams && param >= 0) { 3452 return [depth, param]; 3453 } 3454 } 3455 } 3456 }; 3457 3458 function precompile(input, options, env) { 3459 if (input == null || typeof input !== 'string' && input.type !== 'Program') { 3460 throw new _exception2['default']('You must pass a string or Handlebars AST to Handlebars.precompile. You passed ' + input); 3461 } 3462 3463 options = options || {}; 3464 if (!('data' in options)) { 3465 options.data = true; 3466 } 3467 if (options.compat) { 3468 options.useDepths = true; 3469 } 3470 3471 var ast = env.parse(input, options), 3472 environment = new env.Compiler().compile(ast, options); 3473 return new env.JavaScriptCompiler().compile(environment, options); 3474 } 3475 3476 function compile(input, options, env) { 3477 if (options === undefined) options = {}; 3478 3479 if (input == null || typeof input !== 'string' && input.type !== 'Program') { 3480 throw new _exception2['default']('You must pass a string or Handlebars AST to Handlebars.compile. You passed ' + input); 3481 } 3482 3483 options = _utils.extend({}, options); 3484 if (!('data' in options)) { 3485 options.data = true; 3486 } 3487 if (options.compat) { 3488 options.useDepths = true; 3489 } 3490 3491 var compiled = undefined; 3492 3493 function compileInput() { 3494 var ast = env.parse(input, options), 3495 environment = new env.Compiler().compile(ast, options), 3496 templateSpec = new env.JavaScriptCompiler().compile(environment, options, undefined, true); 3497 return env.template(templateSpec); 3498 } 3499 3500 // Template is only compiled on first use and cached after that point. 3501 function ret(context, execOptions) { 3502 if (!compiled) { 3503 compiled = compileInput(); 3504 } 3505 return compiled.call(this, context, execOptions); 3506 } 3507 ret._setup = function (setupOptions) { 3508 if (!compiled) { 3509 compiled = compileInput(); 3510 } 3511 return compiled._setup(setupOptions); 3512 }; 3513 ret._child = function (i, data, blockParams, depths) { 3514 if (!compiled) { 3515 compiled = compileInput(); 3516 } 3517 return compiled._child(i, data, blockParams, depths); 3518 }; 3519 return ret; 3520 } 3521 3522 function argEquals(a, b) {
3523 if (a === b) { 3524 return true; 3525 } 3526 3527 if (_utils.isArray(a) && _utils.isArray(b) && a.length === b.length) { 3528 for (var i = 0; i < a.length; i++) { 3529 if (!argEquals(a[i], b[i])) { 3530 return false; 3531 } 3532 } 3533 return true; 3534 } 3535 } 3536 3537 function transformLiteralToPath(sexpr) { 3538 if (!sexpr.path.parts) { 3539 var literal = sexpr.path; 3540 // Casting to string here to make false and 0 literal values play nicely with the rest 3541 // of the system. 3542 sexpr.path = { 3543 type: 'PathExpression', 3544 data: false, 3545 depth: 0, 3546 parts: [literal.original + ''], 3547 original: literal.original + '', 3548 loc: literal.loc 3549 }; 3550 } 3551 } 3552 3553 return compiler; 3554} 3555 3556var javascriptCompiler = {exports: {}}; 3557 3558var codeGen = {exports: {}}; 3559 3560var sourceMap = {}; 3561 3562var sourceMapGenerator = {}; 3563 3564var base64Vlq = {}; 3565 3566var base64 = {}; 3567 3568/* -*- Mode: js; js-indent-level: 2; -*- */ 3569 3570var hasRequiredBase64; 3571 3572function requireBase64 () { 3573 if (hasRequiredBase64) return base64; 3574 hasRequiredBase64 = 1; 3575 /* 3576 * Copyright 2011 Mozilla Foundation and contributors 3577 * Licensed under the New BSD license. See LICENSE or: 3578 * http://opensource.org/licenses/BSD-3-Clause 3579 */ 3580 3581 var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split(''); 3582 3583 /** 3584 * Encode an integer in the range of 0 to 63 to a single base 64 digit. 3585 */ 3586 base64.encode = function (number) { 3587 if (0 <= number && number < intToCharMap.length) { 3588 return intToCharMap[number]; 3589 } 3590 throw new TypeError("Must be between 0 and 63: " + number); 3591 }; 3592 3593 /** 3594 * Decode a single base 64 character code digit to an integer. Returns -1 on 3595 * failure. 3596 */ 3597 base64.decode = function (charCode) { 3598 var bigA = 65; // 'A' 3599 var bigZ = 90; // 'Z' 3600 3601 var littleA = 97; // 'a' 3602 var littleZ = 122; // 'z' 3603 3604 var zero = 48; // '0' 3605 var nine = 57; // '9' 3606 3607 var plus = 43; // '+' 3608 var slash = 47; // '/' 3609 3610 var littleOffset = 26; 3611 var numberOffset = 52; 3612 3613 // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ 3614 if (bigA <= charCode && charCode <= bigZ) { 3615 return (charCode - bigA); 3616 } 3617 3618 // 26 - 51: abcdefghijklmnopqrstuvwxyz 3619 if (littleA <= charCode && charCode <= littleZ) { 3620 return (charCode - littleA + littleOffset); 3621 } 3622 3623 // 52 - 61: 0123456789 3624 if (zero <= charCode && charCode <= nine) { 3625 return (charCode - zero + numberOffset); 3626 } 3627 3628 // 62: + 3629 if (charCode == plus) { 3630 return 62; 3631 } 3632 3633 // 63: / 3634 if (charCode == slash) { 3635 return 63; 3636 } 3637 3638 // Invalid base64 digit. 3639 return -1; 3640 }; 3641 return base64; 3642} 3643 3644/* -*- Mode: js; js-indent-level: 2; -*- */ 3645 3646var hasRequiredBase64Vlq; 3647 3648function requireBase64Vlq () { 3649 if (hasRequiredBase64Vlq) return base64Vlq; 3650 hasRequiredBase64Vlq = 1; 3651 /* 3652 * Copyright 2011 Mozilla Foundation and contributors 3653 * Licensed under the New BSD license. See LICENSE or: 3654 * http://opensource.org/licenses/BSD-3-Clause 3655 * 3656 * Based on the Base 64 VLQ implementation in Closure Compiler: 3657 * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java 3658 * 3659 * Copyright 2011 The Closure Compiler Authors. All rights reserved. 3660 * Redistribution and use in source and binary forms, with or without 3661 * modification, are permitted provided that the following conditions are 3662 * met: 3663 * 3664 * * Redistributions of source code must retain the above copyright 3665 * notice, this list of conditions and the following disclaimer. 3666 * * Redistributions in binary form must reproduce the above 3667 * copyright notice, this list of conditions and the following 3668 * disclaimer in the documentation and/or other materials provided 3669 * with the distribution. 3670 * * Neither the name of Google Inc. nor the names of its 3671 * contributors may be used to endorse or promote products derived 3672 * from this software without specific prior written permission. 3673 * 3674 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 3675 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 3676 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 3677 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 3678 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
vendor: 23,888 bytes, lines 3679-4532
3679 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 3680 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 3681 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 3682 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 3683 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 3684 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 3685 */ 3686 3687 var base64 = requireBase64(); 3688 3689 // A single base 64 digit can contain 6 bits of data. For the base 64 variable 3690 // length quantities we use in the source map spec, the first bit is the sign, 3691 // the next four bits are the actual value, and the 6th bit is the 3692 // continuation bit. The continuation bit tells us whether there are more 3693 // digits in this value following this digit. 3694 // 3695 // Continuation 3696 // | Sign 3697 // | | 3698 // V V 3699 // 101011 3700 3701 var VLQ_BASE_SHIFT = 5; 3702 3703 // binary: 100000 3704 var VLQ_BASE = 1 << VLQ_BASE_SHIFT; 3705 3706 // binary: 011111 3707 var VLQ_BASE_MASK = VLQ_BASE - 1; 3708 3709 // binary: 100000 3710 var VLQ_CONTINUATION_BIT = VLQ_BASE; 3711 3712 /** 3713 * Converts from a two-complement value to a value where the sign bit is 3714 * placed in the least significant bit. For example, as decimals: 3715 * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary) 3716 * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary) 3717 */ 3718 function toVLQSigned(aValue) { 3719 return aValue < 0 3720 ? ((-aValue) << 1) + 1 3721 : (aValue << 1) + 0; 3722 } 3723 3724 /** 3725 * Converts to a two-complement value from a value where the sign bit is 3726 * placed in the least significant bit. For example, as decimals: 3727 * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1 3728 * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2 3729 */ 3730 function fromVLQSigned(aValue) { 3731 var isNegative = (aValue & 1) === 1; 3732 var shifted = aValue >> 1; 3733 return isNegative 3734 ? -shifted 3735 : shifted; 3736 } 3737 3738 /** 3739 * Returns the base 64 VLQ encoded value. 3740 */ 3741 base64Vlq.encode = function base64VLQ_encode(aValue) { 3742 var encoded = ""; 3743 var digit; 3744 3745 var vlq = toVLQSigned(aValue); 3746 3747 do { 3748 digit = vlq & VLQ_BASE_MASK; 3749 vlq >>>= VLQ_BASE_SHIFT; 3750 if (vlq > 0) { 3751 // There are still more digits in this value, so we must make sure the 3752 // continuation bit is marked. 3753 digit |= VLQ_CONTINUATION_BIT; 3754 } 3755 encoded += base64.encode(digit); 3756 } while (vlq > 0); 3757 3758 return encoded; 3759 }; 3760 3761 /** 3762 * Decodes the next base 64 VLQ value from the given string and returns the 3763 * value and the rest of the string via the out parameter. 3764 */ 3765 base64Vlq.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) { 3766 var strLen = aStr.length; 3767 var result = 0; 3768 var shift = 0; 3769 var continuation, digit; 3770 3771 do { 3772 if (aIndex >= strLen) { 3773 throw new Error("Expected more digits in base 64 VLQ value."); 3774 } 3775 3776 digit = base64.decode(aStr.charCodeAt(aIndex++)); 3777 if (digit === -1) { 3778 throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1)); 3779 } 3780 3781 continuation = !!(digit & VLQ_CONTINUATION_BIT); 3782 digit &= VLQ_BASE_MASK; 3783 result = result + (digit << shift); 3784 shift += VLQ_BASE_SHIFT; 3785 } while (continuation); 3786 3787 aOutParam.value = fromVLQSigned(result); 3788 aOutParam.rest = aIndex; 3789 }; 3790 return base64Vlq; 3791} 3792 3793var util = {}; 3794 3795/* -*- Mode: js; js-indent-level: 2; -*- */ 3796 3797var hasRequiredUtil; 3798 3799function requireUtil () { 3800 if (hasRequiredUtil) return util; 3801 hasRequiredUtil = 1; 3802 (function (exports$1) { 3803 /* 3804 * Copyright 2011 Mozilla Foundation and contributors 3805 * Licensed under the New BSD license. See LICENSE or: 3806 * http://opensource.org/licenses/BSD-3-Clause 3807 */ 3808 3809 /** 3810 * This is a helper function for getting values from parameter/options 3811 * objects. 3812 * 3813 * @param args The object we are extracting values from 3814 * @param name The name of the property we are getting. 3815 * @param defaultValue An optional value to return if the property is missing 3816 * from the object. If this is not specified and the property is missing, an 3817 * error will be thrown. 3818 */ 3819 function getArg(aArgs, aName, aDefaultValue) { 3820 if (aName in aArgs) { 3821 return aArgs[aName]; 3822 } else if (arguments.length === 3) { 3823 return aDefaultValue; 3824 } else { 3825 throw new Error('"' + aName + '" is a required argument.'); 3826 } 3827 } 3828 exports$1.getArg = getArg; 3829 3830 var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/; 3831 var dataUrlRegexp = /^data:.+\,.+$/; 3832 3833 function urlParse(aUrl) { 3834 var match = aUrl.match(urlRegexp); 3835 if (!match) { 3836 return null; 3837 } 3838 return { 3839 scheme: match[1], 3840 auth: match[2], 3841 host: match[3], 3842 port: match[4], 3843 path: match[5] 3844 }; 3845 } 3846 exports$1.urlParse = urlParse; 3847 3848 function urlGenerate(aParsedUrl) { 3849 var url = ''; 3850 if (aParsedUrl.scheme) { 3851 url += aParsedUrl.scheme + ':'; 3852 } 3853 url += '//'; 3854 if (aParsedUrl.auth) { 3855 url += aParsedUrl.auth + '@'; 3856 } 3857 if (aParsedUrl.host) { 3858 url += aParsedUrl.host; 3859 } 3860 if (aParsedUrl.port) { 3861 url += ":" + aParsedUrl.port; 3862 } 3863 if (aParsedUrl.path) { 3864 url += aParsedUrl.path; 3865 } 3866 return url; 3867 } 3868 exports$1.urlGenerate = urlGenerate; 3869 3870 /** 3871 * Normalizes a path, or the path portion of a URL: 3872 * 3873 * - Replaces consecutive slashes with one slash. 3874 * - Removes unnecessary '.' parts. 3875 * - Removes unnecessary '<dir>/..' parts. 3876 * 3877 * Based on code in the Node.js 'path' core module. 3878 * 3879 * @param aPath The path or url to normalize. 3880 */ 3881 function normalize(aPath) { 3882 var path = aPath; 3883 var url = urlParse(aPath); 3884 if (url) { 3885 if (!url.path) { 3886 return aPath; 3887 } 3888 path = url.path; 3889 } 3890 var isAbsolute = exports$1.isAbsolute(path); 3891 3892 var parts = path.split(/\/+/); 3893 for (var part, up = 0, i = parts.length - 1; i >= 0; i--) { 3894 part = parts[i]; 3895 if (part === '.') { 3896 parts.splice(i, 1); 3897 } else if (part === '..') { 3898 up++; 3899 } else if (up > 0) { 3900 if (part === '') { 3901 // The first part is blank if the path is absolute. Trying to go 3902 // above the root is a no-op. Therefore we can remove all '..' parts 3903 // directly after the root. 3904 parts.splice(i + 1, up); 3905 up = 0; 3906 } else { 3907 parts.splice(i, 2); 3908 up--; 3909 } 3910 } 3911 } 3912 path = parts.join('/'); 3913 3914 if (path === '') { 3915 path = isAbsolute ? '/' : '.'; 3916 } 3917 3918 if (url) { 3919 url.path = path; 3920 return urlGenerate(url); 3921 } 3922 return path; 3923 } 3924 exports$1.normalize = normalize; 3925 3926 /** 3927 * Joins two paths/URLs. 3928 * 3929 * @param aRoot The root path or URL. 3930 * @param aPath The path or URL to be joined with the root. 3931 * 3932 * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a 3933 * scheme-relative URL: Then the scheme of aRoot, if any, is prepended 3934 * first. 3935 * - Otherwise aPath is a path. If aRoot is a URL, then its path portion 3936 * is updated with the result and aRoot is returned. Otherwise the result 3937 * is returned. 3938 * - If aPath is absolute, the result is aPath. 3939 * - Otherwise the two paths are joined with a slash. 3940 * - Joining for example 'http://' and 'www.example.com' is also supported. 3941 */ 3942 function join(aRoot, aPath) { 3943 if (aRoot === "") { 3944 aRoot = "."; 3945 } 3946 if (aPath === "") { 3947 aPath = "."; 3948 } 3949 var aPathUrl = urlParse(aPath); 3950 var aRootUrl = urlParse(aRoot); 3951 if (aRootUrl) { 3952 aRoot = aRootUrl.path || '/'; 3953 } 3954 3955 // `join(foo, '//www.example.org')` 3956 if (aPathUrl && !aPathUrl.scheme) { 3957 if (aRootUrl) { 3958 aPathUrl.scheme = aRootUrl.scheme; 3959 } 3960 return urlGenerate(aPathUrl); 3961 } 3962 3963 if (aPathUrl || aPath.match(dataUrlRegexp)) { 3964 return aPath; 3965 } 3966 3967 // `join('http://', 'www.example.com')` 3968 if (aRootUrl && !aRootUrl.host && !aRootUrl.path) { 3969 aRootUrl.host = aPath; 3970 return urlGenerate(aRootUrl); 3971 } 3972 3973 var joined = aPath.charAt(0) === '/' 3974 ? aPath 3975 : normalize(aRoot.replace(/\/+$/, '') + '/' + aPath); 3976 3977 if (aRootUrl) { 3978 aRootUrl.path = joined; 3979 return urlGenerate(aRootUrl); 3980 } 3981 return joined; 3982 } 3983 exports$1.join = join; 3984 3985 exports$1.isAbsolute = function (aPath) { 3986 return aPath.charAt(0) === '/' || urlRegexp.test(aPath); 3987 }; 3988 3989 /** 3990 * Make a path relative to a URL or another path. 3991 * 3992 * @param aRoot The root path or URL. 3993 * @param aPath The path or URL to be made relative to aRoot. 3994 */ 3995 function relative(aRoot, aPath) { 3996 if (aRoot === "") { 3997 aRoot = "."; 3998 } 3999 4000 aRoot = aRoot.replace(/\/$/, ''); 4001 4002 // It is possible for the path to be above the root. In this case, simply 4003 // checking whether the root is a prefix of the path won't work. Instead, we 4004 // need to remove components from the root one by one, until either we find 4005 // a prefix that fits, or we run out of components to remove. 4006 var level = 0; 4007 while (aPath.indexOf(aRoot + '/') !== 0) { 4008 var index = aRoot.lastIndexOf("/"); 4009 if (index < 0) { 4010 return aPath; 4011 } 4012 4013 // If the only part of the root that is left is the scheme (i.e. http://, 4014 // file:///, etc.), one or more slashes (/), or simply nothing at all, we 4015 // have exhausted all components, so the path is not relative to the root. 4016 aRoot = aRoot.slice(0, index); 4017 if (aRoot.match(/^([^\/]+:\/)?\/*$/)) { 4018 return aPath; 4019 } 4020 4021 ++level; 4022 } 4023 4024 // Make sure we add a "../" for each component we removed from the root. 4025 return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1); 4026 } 4027 exports$1.relative = relative; 4028 4029 var supportsNullProto = (function () { 4030 var obj = Object.create(null); 4031 return !('__proto__' in obj); 4032 }()); 4033 4034 function identity (s) { 4035 return s; 4036 } 4037 4038 /** 4039 * Because behavior goes wacky when you set `__proto__` on objects, we 4040 * have to prefix all the strings in our set with an arbitrary character. 4041 * 4042 * See https://github.com/mozilla/source-map/pull/31 and 4043 * https://github.com/mozilla/source-map/issues/30 4044 * 4045 * @param String aStr 4046 */ 4047 function toSetString(aStr) { 4048 if (isProtoString(aStr)) { 4049 return '$' + aStr; 4050 } 4051 4052 return aStr; 4053 } 4054 exports$1.toSetString = supportsNullProto ? identity : toSetString; 4055 4056 function fromSetString(aStr) { 4057 if (isProtoString(aStr)) { 4058 return aStr.slice(1); 4059 } 4060 4061 return aStr; 4062 } 4063 exports$1.fromSetString = supportsNullProto ? identity : fromSetString; 4064 4065 function isProtoString(s) { 4066 if (!s) { 4067 return false; 4068 } 4069 4070 var length = s.length; 4071 4072 if (length < 9 /* "__proto__".length */) { 4073 return false; 4074 } 4075 4076 if (s.charCodeAt(length - 1) !== 95 /* '_' */ || 4077 s.charCodeAt(length - 2) !== 95 /* '_' */ || 4078 s.charCodeAt(length - 3) !== 111 /* 'o' */ || 4079 s.charCodeAt(length - 4) !== 116 /* 't' */ || 4080 s.charCodeAt(length - 5) !== 111 /* 'o' */ || 4081 s.charCodeAt(length - 6) !== 114 /* 'r' */ || 4082 s.charCodeAt(length - 7) !== 112 /* 'p' */ || 4083 s.charCodeAt(length - 8) !== 95 /* '_' */ || 4084 s.charCodeAt(length - 9) !== 95 /* '_' */) { 4085 return false; 4086 } 4087 4088 for (var i = length - 10; i >= 0; i--) { 4089 if (s.charCodeAt(i) !== 36 /* '$' */) { 4090 return false; 4091 } 4092 } 4093 4094 return true; 4095 } 4096 4097 /** 4098 * Comparator between two mappings where the original positions are compared. 4099 * 4100 * Optionally pass in `true` as `onlyCompareGenerated` to consider two 4101 * mappings with the same original source/line/column, but different generated 4102 * line and column the same. Useful when searching for a mapping with a 4103 * stubbed out mapping. 4104 */ 4105 function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) { 4106 var cmp = strcmp(mappingA.source, mappingB.source); 4107 if (cmp !== 0) { 4108 return cmp; 4109 } 4110 4111 cmp = mappingA.originalLine - mappingB.originalLine; 4112 if (cmp !== 0) { 4113 return cmp; 4114 } 4115 4116 cmp = mappingA.originalColumn - mappingB.originalColumn; 4117 if (cmp !== 0 || onlyCompareOriginal) { 4118 return cmp; 4119 } 4120 4121 cmp = mappingA.generatedColumn - mappingB.generatedColumn; 4122 if (cmp !== 0) { 4123 return cmp; 4124 } 4125 4126 cmp = mappingA.generatedLine - mappingB.generatedLine; 4127 if (cmp !== 0) { 4128 return cmp; 4129 } 4130 4131 return strcmp(mappingA.name, mappingB.name); 4132 } 4133 exports$1.compareByOriginalPositions = compareByOriginalPositions; 4134 4135 /** 4136 * Comparator between two mappings with deflated source and name indices where 4137 * the generated positions are compared. 4138 * 4139 * Optionally pass in `true` as `onlyCompareGenerated` to consider two 4140 * mappings with the same generated line and column, but different 4141 * source/name/original line and column the same. Useful when searching for a 4142 * mapping with a stubbed out mapping. 4143 */ 4144 function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) { 4145 var cmp = mappingA.generatedLine - mappingB.generatedLine; 4146 if (cmp !== 0) { 4147 return cmp; 4148 } 4149 4150 cmp = mappingA.generatedColumn - mappingB.generatedColumn; 4151 if (cmp !== 0 || onlyCompareGenerated) { 4152 return cmp; 4153 } 4154 4155 cmp = strcmp(mappingA.source, mappingB.source); 4156 if (cmp !== 0) { 4157 return cmp; 4158 } 4159 4160 cmp = mappingA.originalLine - mappingB.originalLine; 4161 if (cmp !== 0) { 4162 return cmp; 4163 } 4164 4165 cmp = mappingA.originalColumn - mappingB.originalColumn; 4166 if (cmp !== 0) { 4167 return cmp; 4168 } 4169 4170 return strcmp(mappingA.name, mappingB.name); 4171 } 4172 exports$1.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated; 4173 4174 function strcmp(aStr1, aStr2) { 4175 if (aStr1 === aStr2) { 4176 return 0; 4177 } 4178 4179 if (aStr1 === null) { 4180 return 1; // aStr2 !== null 4181 } 4182 4183 if (aStr2 === null) { 4184 return -1; // aStr1 !== null 4185 } 4186 4187 if (aStr1 > aStr2) { 4188 return 1; 4189 } 4190 4191 return -1; 4192 } 4193 4194 /** 4195 * Comparator between two mappings with inflated source and name strings where 4196 * the generated positions are compared. 4197 */ 4198 function compareByGeneratedPositionsInflated(mappingA, mappingB) { 4199 var cmp = mappingA.generatedLine - mappingB.generatedLine; 4200 if (cmp !== 0) { 4201 return cmp; 4202 } 4203 4204 cmp = mappingA.generatedColumn - mappingB.generatedColumn; 4205 if (cmp !== 0) { 4206 return cmp; 4207 } 4208 4209 cmp = strcmp(mappingA.source, mappingB.source); 4210 if (cmp !== 0) { 4211 return cmp; 4212 } 4213 4214 cmp = mappingA.originalLine - mappingB.originalLine; 4215 if (cmp !== 0) { 4216 return cmp; 4217 } 4218 4219 cmp = mappingA.originalColumn - mappingB.originalColumn; 4220 if (cmp !== 0) { 4221 return cmp; 4222 } 4223 4224 return strcmp(mappingA.name, mappingB.name); 4225 } 4226 exports$1.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated; 4227 4228 /** 4229 * Strip any JSON XSSI avoidance prefix from the string (as documented 4230 * in the source maps specification), and then parse the string as 4231 * JSON. 4232 */ 4233 function parseSourceMapInput(str) { 4234 return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, '')); 4235 } 4236 exports$1.parseSourceMapInput = parseSourceMapInput; 4237 4238 /** 4239 * Compute the URL of a source given the the source root, the source's 4240 * URL, and the source map's URL. 4241 */ 4242 function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) { 4243 sourceURL = sourceURL || ''; 4244 4245 if (sourceRoot) { 4246 // This follows what Chrome does. 4247 if (sourceRoot[sourceRoot.length - 1] !== '/' && sourceURL[0] !== '/') { 4248 sourceRoot += '/'; 4249 } 4250 // The spec says: 4251 // Line 4: An optional source root, useful for relocating source 4252 // files on a server or removing repeated values in the 4253 // âsourcesâ entry. This value is prepended to the individual 4254 // entries in the âsourceâ field. 4255 sourceURL = sourceRoot + sourceURL; 4256 } 4257 4258 // Historically, SourceMapConsumer did not take the sourceMapURL as 4259 // a parameter. This mode is still somewhat supported, which is why 4260 // this code block is conditional. However, it's preferable to pass 4261 // the source map URL to SourceMapConsumer, so that this function 4262 // can implement the source URL resolution algorithm as outlined in 4263 // the spec. This block is basically the equivalent of: 4264 // new URL(sourceURL, sourceMapURL).toString() 4265 // ... except it avoids using URL, which wasn't available in the 4266 // older releases of node still supported by this library. 4267 // 4268 // The spec says: 4269 // If the sources are not absolute URLs after prepending of the 4270 // âsourceRootâ, the sources are resolved relative to the 4271 // SourceMap (like resolving script src in a html document). 4272 if (sourceMapURL) { 4273 var parsed = urlParse(sourceMapURL); 4274 if (!parsed) { 4275 throw new Error("sourceMapURL could not be parsed"); 4276 } 4277 if (parsed.path) { 4278 // Strip the last path component, but keep the "/". 4279 var index = parsed.path.lastIndexOf('/'); 4280 if (index >= 0) { 4281 parsed.path = parsed.path.substring(0, index + 1); 4282 } 4283 } 4284 sourceURL = join(urlGenerate(parsed), sourceURL); 4285 } 4286 4287 return normalize(sourceURL); 4288 } 4289 exports$1.computeSourceURL = computeSourceURL; 4290 } (util)); 4291 return util; 4292} 4293 4294var arraySet = {}; 4295 4296/* -*- Mode: js; js-indent-level: 2; -*- */ 4297 4298var hasRequiredArraySet; 4299 4300function requireArraySet () { 4301 if (hasRequiredArraySet) return arraySet; 4302 hasRequiredArraySet = 1; 4303 /* 4304 * Copyright 2011 Mozilla Foundation and contributors 4305 * Licensed under the New BSD license. See LICENSE or: 4306 * http://opensource.org/licenses/BSD-3-Clause 4307 */ 4308 4309 var util = requireUtil(); 4310 var has = Object.prototype.hasOwnProperty; 4311 var hasNativeMap = typeof Map !== "undefined"; 4312 4313 /** 4314 * A data structure which is a combination of an array and a set. Adding a new 4315 * member is O(1), testing for membership is O(1), and finding the index of an 4316 * element is O(1). Removing elements from the set is not supported. Only 4317 * strings are supported for membership. 4318 */ 4319 function ArraySet() { 4320 this._array = []; 4321 this._set = hasNativeMap ? new Map() : Object.create(null); 4322 } 4323 4324 /** 4325 * Static method for creating ArraySet instances from an existing array. 4326 */ 4327 ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) { 4328 var set = new ArraySet(); 4329 for (var i = 0, len = aArray.length; i < len; i++) { 4330 set.add(aArray[i], aAllowDuplicates); 4331 } 4332 return set; 4333 }; 4334 4335 /** 4336 * Return how many unique items are in this ArraySet. If duplicates have been 4337 * added, than those do not count towards the size. 4338 * 4339 * @returns Number 4340 */ 4341 ArraySet.prototype.size = function ArraySet_size() { 4342 return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length; 4343 }; 4344 4345 /** 4346 * Add the given string to this set. 4347 * 4348 * @param String aStr 4349 */ 4350 ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) { 4351 var sStr = hasNativeMap ? aStr : util.toSetString(aStr); 4352 var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr); 4353 var idx = this._array.length; 4354 if (!isDuplicate || aAllowDuplicates) { 4355 this._array.push(aStr); 4356 } 4357 if (!isDuplicate) { 4358 if (hasNativeMap) { 4359 this._set.set(aStr, idx); 4360 } else { 4361 this._set[sStr] = idx; 4362 } 4363 } 4364 }; 4365 4366 /** 4367 * Is the given string a member of this set? 4368 * 4369 * @param String aStr 4370 */ 4371 ArraySet.prototype.has = function ArraySet_has(aStr) { 4372 if (hasNativeMap) { 4373 return this._set.has(aStr); 4374 } else { 4375 var sStr = util.toSetString(aStr); 4376 return has.call(this._set, sStr); 4377 } 4378 }; 4379 4380 /** 4381 * What is the index of the given string in the array? 4382 * 4383 * @param String aStr 4384 */ 4385 ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) { 4386 if (hasNativeMap) { 4387 var idx = this._set.get(aStr); 4388 if (idx >= 0) { 4389 return idx; 4390 } 4391 } else { 4392 var sStr = util.toSetString(aStr); 4393 if (has.call(this._set, sStr)) { 4394 return this._set[sStr]; 4395 } 4396 } 4397 4398 throw new Error('"' + aStr + '" is not in the set.'); 4399 }; 4400 4401 /** 4402 * What is the element at the given index? 4403 * 4404 * @param Number aIdx 4405 */ 4406 ArraySet.prototype.at = function ArraySet_at(aIdx) { 4407 if (aIdx >= 0 && aIdx < this._array.length) { 4408 return this._array[aIdx]; 4409 } 4410 throw new Error('No element indexed by ' + aIdx); 4411 }; 4412 4413 /** 4414 * Returns the array representation of this set (which has the proper indices 4415 * indicated by indexOf). Note that this is a copy of the internal array used 4416 * for storing the members so that no one can mess with internal state. 4417 */ 4418 ArraySet.prototype.toArray = function ArraySet_toArray() { 4419 return this._array.slice(); 4420 }; 4421 4422 arraySet.ArraySet = ArraySet; 4423 return arraySet; 4424} 4425 4426var mappingList = {}; 4427 4428/* -*- Mode: js; js-indent-level: 2; -*- */ 4429 4430var hasRequiredMappingList; 4431 4432function requireMappingList () { 4433 if (hasRequiredMappingList) return mappingList; 4434 hasRequiredMappingList = 1; 4435 /* 4436 * Copyright 2014 Mozilla Foundation and contributors 4437 * Licensed under the New BSD license. See LICENSE or: 4438 * http://opensource.org/licenses/BSD-3-Clause 4439 */ 4440 4441 var util = requireUtil(); 4442 4443 /** 4444 * Determine whether mappingB is after mappingA with respect to generated 4445 * position. 4446 */ 4447 function generatedPositionAfter(mappingA, mappingB) { 4448 // Optimized for most common case 4449 var lineA = mappingA.generatedLine; 4450 var lineB = mappingB.generatedLine; 4451 var columnA = mappingA.generatedColumn; 4452 var columnB = mappingB.generatedColumn; 4453 return lineB > lineA || lineB == lineA && columnB >= columnA || 4454 util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0; 4455 } 4456 4457 /** 4458 * A data structure to provide a sorted view of accumulated mappings in a 4459 * performance conscious manner. It trades a neglibable overhead in general 4460 * case for a large speedup in case of mappings being added in order. 4461 */ 4462 function MappingList() { 4463 this._array = []; 4464 this._sorted = true; 4465 // Serves as infimum 4466 this._last = {generatedLine: -1, generatedColumn: 0}; 4467 } 4468 4469 /** 4470 * Iterate through internal items. This method takes the same arguments that 4471 * `Array.prototype.forEach` takes. 4472 * 4473 * NOTE: The order of the mappings is NOT guaranteed. 4474 */ 4475 MappingList.prototype.unsortedForEach = 4476 function MappingList_forEach(aCallback, aThisArg) { 4477 this._array.forEach(aCallback, aThisArg); 4478 }; 4479 4480 /** 4481 * Add the given source mapping. 4482 * 4483 * @param Object aMapping 4484 */ 4485 MappingList.prototype.add = function MappingList_add(aMapping) { 4486 if (generatedPositionAfter(this._last, aMapping)) { 4487 this._last = aMapping; 4488 this._array.push(aMapping); 4489 } else { 4490 this._sorted = false; 4491 this._array.push(aMapping); 4492 } 4493 }; 4494 4495 /** 4496 * Returns the flat, sorted array of mappings. The mappings are sorted by 4497 * generated position. 4498 * 4499 * WARNING: This method returns internal data without copying, for 4500 * performance. The return value must NOT be mutated, and should be treated as 4501 * an immutable borrow. If you want to take ownership, you must make your own 4502 * copy. 4503 */ 4504 MappingList.prototype.toArray = function MappingList_toArray() { 4505 if (!this._sorted) { 4506 this._array.sort(util.compareByGeneratedPositionsInflated); 4507 this._sorted = true; 4508 } 4509 return this._array; 4510 }; 4511 4512 mappingList.MappingList = MappingList; 4513 return mappingList; 4514} 4515 4516/* -*- Mode: js; js-indent-level: 2; -*- */ 4517 4518var hasRequiredSourceMapGenerator; 4519 4520function requireSourceMapGenerator () { 4521 if (hasRequiredSourceMapGenerator) return sourceMapGenerator; 4522 hasRequiredSourceMapGenerator = 1; 4523 /* 4524 * Copyright 2011 Mozilla Foundation and contributors 4525 * Licensed under the New BSD license. See LICENSE or: 4526 * http://opensource.org/licenses/BSD-3-Clause 4527 */ 4528 4529 var base64VLQ = requireBase64Vlq(); 4530 var util = requireUtil(); 4531 var ArraySet = requireArraySet().ArraySet; 4532 var MappingList =
vendor: 14,688 bytes, lines 4532-4961
4532 requireMappingList().MappingList; 4533 4534 /** 4535 * An instance of the SourceMapGenerator represents a source map which is 4536 * being built incrementally. You may pass an object with the following 4537 * properties: 4538 * 4539 * - file: The filename of the generated source. 4540 * - sourceRoot: A root for all relative URLs in this source map. 4541 */ 4542 function SourceMapGenerator(aArgs) { 4543 if (!aArgs) { 4544 aArgs = {}; 4545 } 4546 this._file = util.getArg(aArgs, 'file', null); 4547 this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null); 4548 this._skipValidation = util.getArg(aArgs, 'skipValidation', false); 4549 this._sources = new ArraySet(); 4550 this._names = new ArraySet(); 4551 this._mappings = new MappingList(); 4552 this._sourcesContents = null; 4553 } 4554 4555 SourceMapGenerator.prototype._version = 3; 4556 4557 /** 4558 * Creates a new SourceMapGenerator based on a SourceMapConsumer 4559 * 4560 * @param aSourceMapConsumer The SourceMap. 4561 */ 4562 SourceMapGenerator.fromSourceMap = 4563 function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) { 4564 var sourceRoot = aSourceMapConsumer.sourceRoot; 4565 var generator = new SourceMapGenerator({ 4566 file: aSourceMapConsumer.file, 4567 sourceRoot: sourceRoot 4568 }); 4569 aSourceMapConsumer.eachMapping(function (mapping) { 4570 var newMapping = { 4571 generated: { 4572 line: mapping.generatedLine, 4573 column: mapping.generatedColumn 4574 } 4575 }; 4576 4577 if (mapping.source != null) { 4578 newMapping.source = mapping.source; 4579 if (sourceRoot != null) { 4580 newMapping.source = util.relative(sourceRoot, newMapping.source); 4581 } 4582 4583 newMapping.original = { 4584 line: mapping.originalLine, 4585 column: mapping.originalColumn 4586 }; 4587 4588 if (mapping.name != null) { 4589 newMapping.name = mapping.name; 4590 } 4591 } 4592 4593 generator.addMapping(newMapping); 4594 }); 4595 aSourceMapConsumer.sources.forEach(function (sourceFile) { 4596 var sourceRelative = sourceFile; 4597 if (sourceRoot !== null) { 4598 sourceRelative = util.relative(sourceRoot, sourceFile); 4599 } 4600 4601 if (!generator._sources.has(sourceRelative)) { 4602 generator._sources.add(sourceRelative); 4603 } 4604 4605 var content = aSourceMapConsumer.sourceContentFor(sourceFile); 4606 if (content != null) { 4607 generator.setSourceContent(sourceFile, content); 4608 } 4609 }); 4610 return generator; 4611 }; 4612 4613 /** 4614 * Add a single mapping from original source line and column to the generated 4615 * source's line and column for this source map being created. The mapping 4616 * object should have the following properties: 4617 * 4618 * - generated: An object with the generated line and column positions. 4619 * - original: An object with the original line and column positions. 4620 * - source: The original source file (relative to the sourceRoot). 4621 * - name: An optional original token name for this mapping. 4622 */ 4623 SourceMapGenerator.prototype.addMapping = 4624 function SourceMapGenerator_addMapping(aArgs) { 4625 var generated = util.getArg(aArgs, 'generated'); 4626 var original = util.getArg(aArgs, 'original', null); 4627 var source = util.getArg(aArgs, 'source', null); 4628 var name = util.getArg(aArgs, 'name', null); 4629 4630 if (!this._skipValidation) { 4631 this._validateMapping(generated, original, source, name); 4632 } 4633 4634 if (source != null) { 4635 source = String(source); 4636 if (!this._sources.has(source)) { 4637 this._sources.add(source); 4638 } 4639 } 4640 4641 if (name != null) { 4642 name = String(name); 4643 if (!this._names.has(name)) { 4644 this._names.add(name); 4645 } 4646 } 4647 4648 this._mappings.add({ 4649 generatedLine: generated.line, 4650 generatedColumn: generated.column, 4651 originalLine: original != null && original.line, 4652 originalColumn: original != null && original.column, 4653 source: source, 4654 name: name 4655 }); 4656 }; 4657 4658 /** 4659 * Set the source content for a source file. 4660 */ 4661 SourceMapGenerator.prototype.setSourceContent = 4662 function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) { 4663 var source = aSourceFile; 4664 if (this._sourceRoot != null) { 4665 source = util.relative(this._sourceRoot, source); 4666 } 4667 4668 if (aSourceContent != null) { 4669 // Add the source content to the _sourcesContents map. 4670 // Create a new _sourcesContents map if the property is null. 4671 if (!this._sourcesContents) { 4672 this._sourcesContents = Object.create(null); 4673 } 4674 this._sourcesContents[util.toSetString(source)] = aSourceContent; 4675 } else if (this._sourcesContents) { 4676 // Remove the source file from the _sourcesContents map. 4677 // If the _sourcesContents map is empty, set the property to null. 4678 delete this._sourcesContents[util.toSetString(source)]; 4679 if (Object.keys(this._sourcesContents).length === 0) { 4680 this._sourcesContents = null; 4681 } 4682 } 4683 }; 4684 4685 /** 4686 * Applies the mappings of a sub-source-map for a specific source file to the 4687 * source map being generated. Each mapping to the supplied source file is 4688 * rewritten using the supplied source map. Note: The resolution for the 4689 * resulting mappings is the minimium of this map and the supplied map. 4690 * 4691 * @param aSourceMapConsumer The source map to be applied. 4692 * @param aSourceFile Optional. The filename of the source file. 4693 * If omitted, SourceMapConsumer's file property will be used. 4694 * @param aSourceMapPath Optional. The dirname of the path to the source map 4695 * to be applied. If relative, it is relative to the SourceMapConsumer. 4696 * This parameter is needed when the two source maps aren't in the same 4697 * directory, and the source map to be applied contains relative source 4698 * paths. If so, those relative source paths need to be rewritten 4699 * relative to the SourceMapGenerator. 4700 */ 4701 SourceMapGenerator.prototype.applySourceMap = 4702 function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) { 4703 var sourceFile = aSourceFile; 4704 // If aSourceFile is omitted, we will use the file property of the SourceMap 4705 if (aSourceFile == null) { 4706 if (aSourceMapConsumer.file == null) { 4707 throw new Error( 4708 'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' + 4709 'or the source map\'s "file" property. Both were omitted.' 4710 ); 4711 } 4712 sourceFile = aSourceMapConsumer.file; 4713 } 4714 var sourceRoot = this._sourceRoot; 4715 // Make "sourceFile" relative if an absolute Url is passed. 4716 if (sourceRoot != null) { 4717 sourceFile = util.relative(sourceRoot, sourceFile); 4718 } 4719 // Applying the SourceMap can add and remove items from the sources and 4720 // the names array. 4721 var newSources = new ArraySet(); 4722 var newNames = new ArraySet(); 4723 4724 // Find mappings for the "sourceFile" 4725 this._mappings.unsortedForEach(function (mapping) { 4726 if (mapping.source === sourceFile && mapping.originalLine != null) { 4727 // Check if it can be mapped by the source map, then update the mapping. 4728 var original = aSourceMapConsumer.originalPositionFor({ 4729 line: mapping.originalLine, 4730 column: mapping.originalColumn 4731 }); 4732 if (original.source != null) { 4733 // Copy mapping 4734 mapping.source = original.source; 4735 if (aSourceMapPath != null) { 4736 mapping.source = util.join(aSourceMapPath, mapping.source); 4737 } 4738 if (sourceRoot != null) { 4739 mapping.source = util.relative(sourceRoot, mapping.source); 4740 } 4741 mapping.originalLine = original.line; 4742 mapping.originalColumn = original.column; 4743 if (original.name != null) { 4744 mapping.name = original.name; 4745 } 4746 } 4747 } 4748 4749 var source = mapping.source; 4750 if (source != null && !newSources.has(source)) { 4751 newSources.add(source); 4752 } 4753 4754 var name = mapping.name; 4755 if (name != null && !newNames.has(name)) { 4756 newNames.add(name); 4757 } 4758 4759 }, this); 4760 this._sources = newSources; 4761 this._names = newNames; 4762 4763 // Copy sourcesContents of applied map. 4764 aSourceMapConsumer.sources.forEach(function (sourceFile) { 4765 var content = aSourceMapConsumer.sourceContentFor(sourceFile); 4766 if (content != null) { 4767 if (aSourceMapPath != null) { 4768 sourceFile = util.join(aSourceMapPath, sourceFile); 4769 } 4770 if (sourceRoot != null) { 4771 sourceFile = util.relative(sourceRoot, sourceFile); 4772 } 4773 this.setSourceContent(sourceFile, content); 4774 } 4775 }, this); 4776 }; 4777 4778 /** 4779 * A mapping can have one of the three levels of data: 4780 * 4781 * 1. Just the generated position. 4782 * 2. The Generated position, original position, and original source. 4783 * 3. Generated and original position, original source, as well as a name 4784 * token. 4785 * 4786 * To maintain consistency, we validate that any new mapping being added falls 4787 * in to one of these categories. 4788 */ 4789 SourceMapGenerator.prototype._validateMapping = 4790 function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource, 4791 aName) { 4792 // When aOriginal is truthy but has empty values for .line and .column, 4793 // it is most likely a programmer error. In this case we throw a very 4794 // specific error message to try to guide them the right way. 4795 // For example: https://github.com/Polymer/polymer-bundler/pull/519 4796 if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') { 4797 throw new Error( 4798 'original.line and original.column are not numbers -- you probably meant to omit ' + 4799 'the original mapping entirely and only map the generated position. If so, pass ' + 4800 'null for the original mapping instead of an object with empty or null values.' 4801 ); 4802 } 4803 4804 if (aGenerated && 'line' in aGenerated && 'column' in aGenerated 4805 && aGenerated.line > 0 && aGenerated.column >= 0 4806 && !aOriginal && !aSource && !aName) { 4807 // Case 1. 4808 return; 4809 } 4810 else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated 4811 && aOriginal && 'line' in aOriginal && 'column' in aOriginal 4812 && aGenerated.line > 0 && aGenerated.column >= 0 4813 && aOriginal.line > 0 && aOriginal.column >= 0 4814 && aSource) { 4815 // Cases 2 and 3. 4816 return; 4817 } 4818 else { 4819 throw new Error('Invalid mapping: ' + JSON.stringify({ 4820 generated: aGenerated, 4821 source: aSource, 4822 original: aOriginal, 4823 name: aName 4824 })); 4825 } 4826 }; 4827 4828 /** 4829 * Serialize the accumulated mappings in to the stream of base 64 VLQs 4830 * specified by the source map format. 4831 */ 4832 SourceMapGenerator.prototype._serializeMappings = 4833 function SourceMapGenerator_serializeMappings() { 4834 var previousGeneratedColumn = 0; 4835 var previousGeneratedLine = 1; 4836 var previousOriginalColumn = 0; 4837 var previousOriginalLine = 0; 4838 var previousName = 0; 4839 var previousSource = 0; 4840 var result = ''; 4841 var next; 4842 var mapping; 4843 var nameIdx; 4844 var sourceIdx; 4845 4846 var mappings = this._mappings.toArray(); 4847 for (var i = 0, len = mappings.length; i < len; i++) { 4848 mapping = mappings[i]; 4849 next = ''; 4850 4851 if (mapping.generatedLine !== previousGeneratedLine) { 4852 previousGeneratedColumn = 0; 4853 while (mapping.generatedLine !== previousGeneratedLine) { 4854 next += ';'; 4855 previousGeneratedLine++; 4856 } 4857 } 4858 else { 4859 if (i > 0) { 4860 if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) { 4861 continue; 4862 } 4863 next += ','; 4864 } 4865 } 4866 4867 next += base64VLQ.encode(mapping.generatedColumn 4868 - previousGeneratedColumn); 4869 previousGeneratedColumn = mapping.generatedColumn; 4870 4871 if (mapping.source != null) { 4872 sourceIdx = this._sources.indexOf(mapping.source); 4873 next += base64VLQ.encode(sourceIdx - previousSource); 4874 previousSource = sourceIdx; 4875 4876 // lines are stored 0-based in SourceMap spec version 3 4877 next += base64VLQ.encode(mapping.originalLine - 1 4878 - previousOriginalLine); 4879 previousOriginalLine = mapping.originalLine - 1; 4880 4881 next += base64VLQ.encode(mapping.originalColumn 4882 - previousOriginalColumn); 4883 previousOriginalColumn = mapping.originalColumn; 4884 4885 if (mapping.name != null) { 4886 nameIdx = this._names.indexOf(mapping.name); 4887 next += base64VLQ.encode(nameIdx - previousName); 4888 previousName = nameIdx; 4889 } 4890 } 4891 4892 result += next; 4893 } 4894 4895 return result; 4896 }; 4897 4898 SourceMapGenerator.prototype._generateSourcesContent = 4899 function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) { 4900 return aSources.map(function (source) { 4901 if (!this._sourcesContents) { 4902 return null; 4903 } 4904 if (aSourceRoot != null) { 4905 source = util.relative(aSourceRoot, source); 4906 } 4907 var key = util.toSetString(source); 4908 return Object.prototype.hasOwnProperty.call(this._sourcesContents, key) 4909 ? this._sourcesContents[key] 4910 : null; 4911 }, this); 4912 }; 4913 4914 /** 4915 * Externalize the source map. 4916 */ 4917 SourceMapGenerator.prototype.toJSON = 4918 function SourceMapGenerator_toJSON() { 4919 var map = { 4920 version: this._version, 4921 sources: this._sources.toArray(), 4922 names: this._names.toArray(), 4923 mappings: this._serializeMappings() 4924 }; 4925 if (this._file != null) { 4926 map.file = this._file; 4927 } 4928 if (this._sourceRoot != null) { 4929 map.sourceRoot = this._sourceRoot; 4930 } 4931 if (this._sourcesContents) { 4932 map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot); 4933 } 4934 4935 return map; 4936 }; 4937 4938 /** 4939 * Render the source map being generated to a string. 4940 */ 4941 SourceMapGenerator.prototype.toString = 4942 function SourceMapGenerator_toString() { 4943 return JSON.stringify(this.toJSON()); 4944 }; 4945 4946 sourceMapGenerator.SourceMapGenerator = SourceMapGenerator; 4947 return sourceMapGenerator; 4948} 4949 4950var sourceMapConsumer = {}; 4951 4952var binarySearch = {}; 4953 4954/* -*- Mode: js; js-indent-level: 2; -*- */ 4955 4956var hasRequiredBinarySearch; 4957 4958function requireBinarySearch () { 4959 if (hasRequiredBinarySearch) return binarySearch; 4960 hasRequiredBinarySearch = 1; 4961 (function (exports
vendor: 2,949 bytes, lines 4961-5035
4961$1) { 4962 /* 4963 * Copyright 2011 Mozilla Foundation and contributors 4964 * Licensed under the New BSD license. See LICENSE or: 4965 * http://opensource.org/licenses/BSD-3-Clause 4966 */ 4967 4968 exports$1.GREATEST_LOWER_BOUND = 1; 4969 exports$1.LEAST_UPPER_BOUND = 2; 4970 4971 /** 4972 * Recursive implementation of binary search. 4973 * 4974 * @param aLow Indices here and lower do not contain the needle. 4975 * @param aHigh Indices here and higher do not contain the needle. 4976 * @param aNeedle The element being searched for. 4977 * @param aHaystack The non-empty array being searched. 4978 * @param aCompare Function which takes two elements and returns -1, 0, or 1. 4979 * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or 4980 * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the 4981 * closest element that is smaller than or greater than the one we are 4982 * searching for, respectively, if the exact element cannot be found. 4983 */ 4984 function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) { 4985 // This function terminates when one of the following is true: 4986 // 4987 // 1. We find the exact element we are looking for. 4988 // 4989 // 2. We did not find the exact element, but we can return the index of 4990 // the next-closest element. 4991 // 4992 // 3. We did not find the exact element, and there is no next-closest 4993 // element than the one we are searching for, so we return -1. 4994 var mid = Math.floor((aHigh - aLow) / 2) + aLow; 4995 var cmp = aCompare(aNeedle, aHaystack[mid], true); 4996 if (cmp === 0) { 4997 // Found the element we are looking for. 4998 return mid; 4999 } 5000 else if (cmp > 0) { 5001 // Our needle is greater than aHaystack[mid]. 5002 if (aHigh - mid > 1) { 5003 // The element is in the upper half. 5004 return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias); 5005 } 5006 5007 // The exact needle element was not found in this haystack. Determine if 5008 // we are in termination case (3) or (2) and return the appropriate thing. 5009 if (aBias == exports$1.LEAST_UPPER_BOUND) { 5010 return aHigh < aHaystack.length ? aHigh : -1; 5011 } else { 5012 return mid; 5013 } 5014 } 5015 else { 5016 // Our needle is less than aHaystack[mid]. 5017 if (mid - aLow > 1) { 5018 // The element is in the lower half. 5019 return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias); 5020 } 5021 5022 // we are in termination case (3) or (2) and return the appropriate thing. 5023 if (aBias == exports$1.LEAST_UPPER_BOUND) { 5024 return mid; 5025 } else { 5026 return aLow < 0 ? -1 : aLow; 5027 } 5028 } 5029 } 5030 5031 /** 5032 * This is an implementation of binary search which will always try and return 5033 * the index of the closest element if there is no exact hit. This is because 5034 * mappings between original and generated line/col pairs are single points, 5035 * and there is an implicit region between each of them, so a miss just means
5036 * that you aren't on the very start of a region. 5037 * 5038 * @param aNeedle The element you are looking for. 5039 * @param aHaystack The array that is being searched. 5040 * @param aCompare A function which takes the needle and an element in the 5041 * array and returns -1, 0, or 1 depending on whether the needle is less 5042 * than, equal to, or greater than the element, respectively. 5043 * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or 5044 * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the 5045 * closest element that is smaller than or greater than the one we are 5046 * searching for, respectively, if the exact element cannot be found. 5047 * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'. 5048 */ 5049 exports$1.search = function search(aNeedle, aHaystack, aCompare, aBias) { 5050 if (aHaystack.length === 0) { 5051 return -1; 5052 } 5053 5054 var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack, 5055 aCompare, aBias || exports$1.GREATEST_LOWER_BOUND); 5056 if (index < 0) { 5057 return -1; 5058 } 5059 5060 // We have found either the exact element, or the next-closest element than 5061 // the one we are searching for. However, there may be more than one such 5062 // element. Make sure we always return the smallest of these. 5063 while (index - 1 >= 0) { 5064 if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) { 5065 break; 5066 } 5067 --index; 5068 } 5069 5070 return index; 5071 }; 5072 } (binarySearch)); 5073 return binarySearch; 5074} 5075 5076var quickSort = {}; 5077 5078/* -*- Mode: js; js-indent-level: 2; -*- */ 5079 5080var hasRequiredQuickSort; 5081 5082function requireQuickSort () { 5083 if (hasRequiredQuickSort) return quickSort; 5084 hasRequiredQuickSort = 1; 5085 /* 5086 * Copyright 2011 Mozilla Foundation and contributors 5087 * Licensed under the New BSD license. See LICENSE or: 5088 * http://opensource.org/licenses/BSD-3-Clause 5089 */ 5090 5091 // It turns out that some (most?) JavaScript engines don't self-host 5092 // `Array.prototype.sort`. This makes sense because C++ will likely remain 5093 // faster than JS when doing raw CPU-intensive sorting. However, when using a 5094 // custom comparator function, calling back and forth between the VM's C++ and 5095 // JIT'd JS is rather slow *and* loses JIT type information, resulting in 5096 // worse generated code for the comparator function than would be optimal. In 5097 // fact, when sorting with a comparator, these costs outweigh the benefits of 5098 // sorting in C++. By using our own JS-implemented Quick Sort (below), we get 5099 // a ~3500ms mean speed-up in `bench/bench.html`. 5100 5101 /** 5102 * Swap the elements indexed by `x` and `y` in the array `ary`. 5103 * 5104 * @param {Array} ary 5105 * The array. 5106 * @param {Number} x 5107 * The index of the first item. 5108 * @param {Number} y 5109 * The index of the second item. 5110 */ 5111 function swap(ary, x, y) { 5112 var temp = ary[x]; 5113 ary[x] = ary[y]; 5114 ary[y] = temp; 5115 } 5116 5117 /** 5118 * Returns a random integer within the range `low .. high` inclusive. 5119 * 5120 * @param {Number} low 5121 * The lower bound on the range. 5122 * @param {Number} high 5123 * The upper bound on the range. 5124 */ 5125 function randomIntInRange(low, high) { 5126 return Math.round(low + (Math.random() * (high - low))); 5127 } 5128 5129 /** 5130 * The Quick Sort algorithm. 5131 * 5132 * @param {Array} ary 5133 * An array to sort. 5134 * @param {function} comparator 5135 * Function to use to compare two items. 5136 * @param {Number} p 5137 * Start index of the array 5138 * @param {Number} r 5139 * End index of the array 5140 */ 5141 function doQuickSort(ary, comparator, p, r) { 5142 // If our lower bound is less than our upper bound, we (1) partition the 5143 // array into two pieces and (2) recurse on each half. If it is not, this is 5144 // the empty array and our base case. 5145 5146 if (p < r) { 5147 // (1) Partitioning. 5148 // 5149 // The partitioning chooses a pivot between `p` and `r` and moves all 5150 // elements that are less than or equal to the pivot to the before it, and 5151 // all the elements that are greater than it after it. The effect is that 5152 // once partition is done, the pivot is in the exact place it will be when 5153 // the array is put in sorted order, and it will not need to be moved 5154 // again. This runs in O(n) time. 5155 5156 // Always choose a random pivot so that an input array which is reverse 5157 // sorted does not cause O(n^2) running time. 5158 var pivotIndex = randomIntInRange(p, r); 5159 var i = p - 1; 5160 5161 swap(ary, pivotIndex, r); 5162 var pivot = ary[r]; 5163 5164 // Immediately after `j` is incremented in this loop, the following hold 5165 // true: 5166 // 5167 // * Every element in `ary[p .. i]` is less than or equal to the pivot. 5168 // 5169 // * Every element in `ary[i+1 .. j-1]` is greater than the pivot. 5170 for (var j = p; j < r; j++) { 5171 if (comparator(ary[j], pivot) <= 0) { 5172 i += 1; 5173 swap(ary, i, j); 5174 } 5175 } 5176 5177 swap(ary, i + 1, j); 5178 var q = i + 1; 5179 5180 // (2) Recurse on each half. 5181 5182 doQuickSort(ary, comparator, p, q - 1); 5183 doQuickSort(ary, comparator, q + 1, r); 5184 } 5185 } 5186
5187 /** 5188 * Sort the given array in-place with the given comparator function. 5189 * 5190 * @param {Array} ary 5191 * An array to sort. 5192 * @param {function} comparator 5193 * Function to use to compare two items. 5194 */ 5195 quickSort.quickSort = function (ary, comparator) { 5196 doQuickSort(ary, comparator, 0, ary.length - 1); 5197 }; 5198 return quickSort; 5199} 5200 5201/* -*- Mode: js; js-indent-level: 2; -*- */ 5202 5203var hasRequiredSourceMapConsumer; 5204 5205function requireSourceMapConsumer () { 5206 if (hasRequiredSourceMapConsumer) return sourceMapConsumer; 5207 hasRequiredSourceMapConsumer = 1; 5208 /* 5209 * Copyright 2011 Mozilla Foundation and contributors 5210 * Licensed under the New BSD license. See LICENSE or: 5211 * http://opensource.org/licenses/BSD-3-Clause 5212 */ 5213 5214 var util = requireUtil(); 5215 var binarySearch = requireBinarySearch(); 5216 var ArraySet = requireArraySet().ArraySet; 5217 var base64VLQ = requireBase64Vlq(); 5218 var quickSort =
vendor: 41,635 bytes, lines 5218-6370
5218 requireQuickSort().quickSort; 5219 5220 function SourceMapConsumer(aSourceMap, aSourceMapURL) { 5221 var sourceMap = aSourceMap; 5222 if (typeof aSourceMap === 'string') { 5223 sourceMap = util.parseSourceMapInput(aSourceMap); 5224 } 5225 5226 return sourceMap.sections != null 5227 ? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL) 5228 : new BasicSourceMapConsumer(sourceMap, aSourceMapURL); 5229 } 5230 5231 SourceMapConsumer.fromSourceMap = function(aSourceMap, aSourceMapURL) { 5232 return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL); 5233 }; 5234 5235 /** 5236 * The version of the source mapping spec that we are consuming. 5237 */ 5238 SourceMapConsumer.prototype._version = 3; 5239 5240 // `__generatedMappings` and `__originalMappings` are arrays that hold the 5241 // parsed mapping coordinates from the source map's "mappings" attribute. They 5242 // are lazily instantiated, accessed via the `_generatedMappings` and 5243 // `_originalMappings` getters respectively, and we only parse the mappings 5244 // and create these arrays once queried for a source location. We jump through 5245 // these hoops because there can be many thousands of mappings, and parsing 5246 // them is expensive, so we only want to do it if we must. 5247 // 5248 // Each object in the arrays is of the form: 5249 // 5250 // { 5251 // generatedLine: The line number in the generated code, 5252 // generatedColumn: The column number in the generated code, 5253 // source: The path to the original source file that generated this 5254 // chunk of code, 5255 // originalLine: The line number in the original source that 5256 // corresponds to this chunk of generated code, 5257 // originalColumn: The column number in the original source that 5258 // corresponds to this chunk of generated code, 5259 // name: The name of the original symbol which generated this chunk of 5260 // code. 5261 // } 5262 // 5263 // All properties except for `generatedLine` and `generatedColumn` can be 5264 // `null`. 5265 // 5266 // `_generatedMappings` is ordered by the generated positions. 5267 // 5268 // `_originalMappings` is ordered by the original positions. 5269 5270 SourceMapConsumer.prototype.__generatedMappings = null; 5271 Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', { 5272 configurable: true, 5273 enumerable: true, 5274 get: function () { 5275 if (!this.__generatedMappings) { 5276 this._parseMappings(this._mappings, this.sourceRoot); 5277 } 5278 5279 return this.__generatedMappings; 5280 } 5281 }); 5282 5283 SourceMapConsumer.prototype.__originalMappings = null; 5284 Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', { 5285 configurable: true, 5286 enumerable: true, 5287 get: function () { 5288 if (!this.__originalMappings) { 5289 this._parseMappings(this._mappings, this.sourceRoot); 5290 } 5291 5292 return this.__originalMappings; 5293 } 5294 }); 5295 5296 SourceMapConsumer.prototype._charIsMappingSeparator = 5297 function SourceMapConsumer_charIsMappingSeparator(aStr, index) { 5298 var c = aStr.charAt(index); 5299 return c === ";" || c === ","; 5300 }; 5301 5302 /** 5303 * Parse the mappings in a string in to a data structure which we can easily 5304 * query (the ordered arrays in the `this.__generatedMappings` and 5305 * `this.__originalMappings` properties). 5306 */ 5307 SourceMapConsumer.prototype._parseMappings = 5308 function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { 5309 throw new Error("Subclasses must implement _parseMappings"); 5310 }; 5311 5312 SourceMapConsumer.GENERATED_ORDER = 1; 5313 SourceMapConsumer.ORIGINAL_ORDER = 2; 5314 5315 SourceMapConsumer.GREATEST_LOWER_BOUND = 1; 5316 SourceMapConsumer.LEAST_UPPER_BOUND = 2; 5317 5318 /** 5319 * Iterate over each mapping between an original source/line/column and a 5320 * generated line/column in this source map. 5321 * 5322 * @param Function aCallback 5323 * The function that is called with each mapping. 5324 * @param Object aContext 5325 * Optional. If specified, this object will be the value of `this` every 5326 * time that `aCallback` is called. 5327 * @param aOrder 5328 * Either `SourceMapConsumer.GENERATED_ORDER` or 5329 * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to 5330 * iterate over the mappings sorted by the generated file's line/column 5331 * order or the original's source/line/column order, respectively. Defaults to 5332 * `SourceMapConsumer.GENERATED_ORDER`. 5333 */ 5334 SourceMapConsumer.prototype.eachMapping = 5335 function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) { 5336 var context = aContext || null; 5337 var order = aOrder || SourceMapConsumer.GENERATED_ORDER; 5338 5339 var mappings; 5340 switch (order) { 5341 case SourceMapConsumer.GENERATED_ORDER: 5342 mappings = this._generatedMappings; 5343 break; 5344 case SourceMapConsumer.ORIGINAL_ORDER: 5345 mappings = this._originalMappings; 5346 break; 5347 default: 5348 throw new Error("Unknown order of iteration."); 5349 } 5350 5351 var sourceRoot = this.sourceRoot; 5352 mappings.map(function (mapping) { 5353 var source = mapping.source === null ? null : this._sources.at(mapping.source); 5354 source = util.computeSourceURL(sourceRoot, source, this._sourceMapURL); 5355 return { 5356 source: source, 5357 generatedLine: mapping.generatedLine, 5358 generatedColumn: mapping.generatedColumn, 5359 originalLine: mapping.originalLine, 5360 originalColumn: mapping.originalColumn, 5361 name: mapping.name === null ? null : this._names.at(mapping.name) 5362 }; 5363 }, this).forEach(aCallback, context); 5364 }; 5365 5366 /** 5367 * Returns all generated line and column information for the original source, 5368 * line, and column provided. If no column is provided, returns all mappings 5369 * corresponding to a either the line we are searching for or the next 5370 * closest line that has any mappings. Otherwise, returns all mappings 5371 * corresponding to the given line and either the column we are searching for 5372 * or the next closest column that has any offsets. 5373 * 5374 * The only argument is an object with the following properties: 5375 * 5376 * - source: The filename of the original source. 5377 * - line: The line number in the original source. The line number is 1-based. 5378 * - column: Optional. the column number in the original source. 5379 * The column number is 0-based. 5380 * 5381 * and an array of objects is returned, each with the following properties: 5382 * 5383 * - line: The line number in the generated source, or null. The 5384 * line number is 1-based. 5385 * - column: The column number in the generated source, or null. 5386 * The column number is 0-based. 5387 */ 5388 SourceMapConsumer.prototype.allGeneratedPositionsFor = 5389 function SourceMapConsumer_allGeneratedPositionsFor(aArgs) { 5390 var line = util.getArg(aArgs, 'line'); 5391 5392 // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping 5393 // returns the index of the closest mapping less than the needle. By 5394 // setting needle.originalColumn to 0, we thus find the last mapping for 5395 // the given line, provided such a mapping exists. 5396 var needle = { 5397 source: util.getArg(aArgs, 'source'), 5398 originalLine: line, 5399 originalColumn: util.getArg(aArgs, 'column', 0) 5400 }; 5401 5402 needle.source = this._findSourceIndex(needle.source); 5403 if (needle.source < 0) { 5404 return []; 5405 } 5406 5407 var mappings = []; 5408 5409 var index = this._findMapping(needle, 5410 this._originalMappings, 5411 "originalLine", 5412 "originalColumn", 5413 util.compareByOriginalPositions, 5414 binarySearch.LEAST_UPPER_BOUND); 5415 if (index >= 0) { 5416 var mapping = this._originalMappings[index]; 5417 5418 if (aArgs.column === undefined) { 5419 var originalLine = mapping.originalLine; 5420 5421 // Iterate until either we run out of mappings, or we run into 5422 // a mapping for a different line than the one we found. Since 5423 // mappings are sorted, this is guaranteed to find all mappings for 5424 // the line we found. 5425 while (mapping && mapping.originalLine === originalLine) { 5426 mappings.push({ 5427 line: util.getArg(mapping, 'generatedLine', null), 5428 column: util.getArg(mapping, 'generatedColumn', null), 5429 lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) 5430 }); 5431 5432 mapping = this._originalMappings[++index]; 5433 } 5434 } else { 5435 var originalColumn = mapping.originalColumn; 5436 5437 // Iterate until either we run out of mappings, or we run into 5438 // a mapping for a different line than the one we were searching for. 5439 // Since mappings are sorted, this is guaranteed to find all mappings for 5440 // the line we are searching for. 5441 while (mapping && 5442 mapping.originalLine === line && 5443 mapping.originalColumn == originalColumn) { 5444 mappings.push({ 5445 line: util.getArg(mapping, 'generatedLine', null), 5446 column: util.getArg(mapping, 'generatedColumn', null), 5447 lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) 5448 }); 5449 5450 mapping = this._originalMappings[++index]; 5451 } 5452 } 5453 } 5454 5455 return mappings; 5456 }; 5457 5458 sourceMapConsumer.SourceMapConsumer = SourceMapConsumer; 5459 5460 /** 5461 * A BasicSourceMapConsumer instance represents a parsed source map which we can 5462 * query for information about the original file positions by giving it a file 5463 * position in the generated source. 5464 * 5465 * The first parameter is the raw source map (either as a JSON string, or 5466 * already parsed to an object). According to the spec, source maps have the 5467 * following attributes: 5468 * 5469 * - version: Which version of the source map spec this map is following. 5470 * - sources: An array of URLs to the original source files. 5471 * - names: An array of identifiers which can be referrenced by individual mappings. 5472 * - sourceRoot: Optional. The URL root from which all sources are relative. 5473 * - sourcesContent: Optional. An array of contents of the original source files. 5474 * - mappings: A string of base64 VLQs which contain the actual mappings. 5475 * - file: Optional. The generated file this source map is associated with. 5476 * 5477 * Here is an example source map, taken from the source map spec[0]: 5478 * 5479 * { 5480 * version : 3, 5481 * file: "out.js", 5482 * sourceRoot : "", 5483 * sources: ["foo.js", "bar.js"], 5484 * names: ["src", "maps", "are", "fun"], 5485 * mappings: "AA,AB;;ABCDE;" 5486 * } 5487 * 5488 * The second parameter, if given, is a string whose value is the URL 5489 * at which the source map was found. This URL is used to compute the 5490 * sources array. 5491 * 5492 * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1# 5493 */ 5494 function BasicSourceMapConsumer(aSourceMap, aSourceMapURL) { 5495 var sourceMap = aSourceMap; 5496 if (typeof aSourceMap === 'string') { 5497 sourceMap = util.parseSourceMapInput(aSourceMap); 5498 } 5499 5500 var version = util.getArg(sourceMap, 'version'); 5501 var sources = util.getArg(sourceMap, 'sources'); 5502 // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which 5503 // requires the array) to play nice here. 5504 var names = util.getArg(sourceMap, 'names', []); 5505 var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null); 5506 var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null); 5507 var mappings = util.getArg(sourceMap, 'mappings'); 5508 var file = util.getArg(sourceMap, 'file', null); 5509 5510 // Once again, Sass deviates from the spec and supplies the version as a 5511 // string rather than a number, so we use loose equality checking here. 5512 if (version != this._version) { 5513 throw new Error('Unsupported version: ' + version); 5514 } 5515 5516 if (sourceRoot) { 5517 sourceRoot = util.normalize(sourceRoot); 5518 } 5519 5520 sources = sources 5521 .map(String) 5522 // Some source maps produce relative source paths like "./foo.js" instead of 5523 // "foo.js". Normalize these first so that future comparisons will succeed. 5524 // See bugzil.la/1090768. 5525 .map(util.normalize) 5526 // Always ensure that absolute sources are internally stored relative to 5527 // the source root, if the source root is absolute. Not doing this would 5528 // be particularly problematic when the source root is a prefix of the 5529 // source (valid, but why??). See github issue #199 and bugzil.la/1188982. 5530 .map(function (source) { 5531 return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source) 5532 ? util.relative(sourceRoot, source) 5533 : source; 5534 }); 5535 5536 // Pass `true` below to allow duplicate names and sources. While source maps 5537 // are intended to be compressed and deduplicated, the TypeScript compiler 5538 // sometimes generates source maps with duplicates in them. See Github issue 5539 // #72 and bugzil.la/889492. 5540 this._names = ArraySet.fromArray(names.map(String), true); 5541 this._sources = ArraySet.fromArray(sources, true); 5542 5543 this._absoluteSources = this._sources.toArray().map(function (s) { 5544 return util.computeSourceURL(sourceRoot, s, aSourceMapURL); 5545 }); 5546 5547 this.sourceRoot = sourceRoot; 5548 this.sourcesContent = sourcesContent; 5549 this._mappings = mappings; 5550 this._sourceMapURL = aSourceMapURL; 5551 this.file = file; 5552 } 5553 5554 BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); 5555 BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer; 5556 5557 /** 5558 * Utility function to find the index of a source. Returns -1 if not 5559 * found. 5560 */ 5561 BasicSourceMapConsumer.prototype._findSourceIndex = function(aSource) { 5562 var relativeSource = aSource; 5563 if (this.sourceRoot != null) { 5564 relativeSource = util.relative(this.sourceRoot, relativeSource); 5565 } 5566 5567 if (this._sources.has(relativeSource)) { 5568 return this._sources.indexOf(relativeSource); 5569 } 5570 5571 // Maybe aSource is an absolute URL as returned by |sources|. In 5572 // this case we can't simply undo the transform. 5573 var i; 5574 for (i = 0; i < this._absoluteSources.length; ++i) { 5575 if (this._absoluteSources[i] == aSource) { 5576 return i; 5577 } 5578 } 5579 5580 return -1; 5581 }; 5582 5583 /** 5584 * Create a BasicSourceMapConsumer from a SourceMapGenerator. 5585 * 5586 * @param SourceMapGenerator aSourceMap 5587 * The source map that will be consumed. 5588 * @param String aSourceMapURL 5589 * The URL at which the source map can be found (optional) 5590 * @returns BasicSourceMapConsumer 5591 */ 5592 BasicSourceMapConsumer.fromSourceMap = 5593 function SourceMapConsumer_fromSourceMap(aSourceMap, aSourceMapURL) { 5594 var smc = Object.create(BasicSourceMapConsumer.prototype); 5595 5596 var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true); 5597 var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true); 5598 smc.sourceRoot = aSourceMap._sourceRoot; 5599 smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(), 5600 smc.sourceRoot); 5601 smc.file = aSourceMap._file; 5602 smc._sourceMapURL = aSourceMapURL; 5603 smc._absoluteSources = smc._sources.toArray().map(function (s) { 5604 return util.computeSourceURL(smc.sourceRoot, s, aSourceMapURL); 5605 }); 5606 5607 // Because we are modifying the entries (by converting string sources and 5608 // names to indices into the sources and names ArraySets), we have to make 5609 // a copy of the entry or else bad things happen. Shared mutable state 5610 // strikes again! See github issue #191. 5611 5612 var generatedMappings = aSourceMap._mappings.toArray().slice(); 5613 var destGeneratedMappings = smc.__generatedMappings = []; 5614 var destOriginalMappings = smc.__originalMappings = []; 5615 5616 for (var i = 0, length = generatedMappings.length; i < length; i++) { 5617 var srcMapping = generatedMappings[i]; 5618 var destMapping = new Mapping; 5619 destMapping.generatedLine = srcMapping.generatedLine; 5620 destMapping.generatedColumn = srcMapping.generatedColumn; 5621 5622 if (srcMapping.source) { 5623 destMapping.source = sources.indexOf(srcMapping.source); 5624 destMapping.originalLine = srcMapping.originalLine; 5625 destMapping.originalColumn = srcMapping.originalColumn; 5626 5627 if (srcMapping.name) { 5628 destMapping.name = names.indexOf(srcMapping.name); 5629 } 5630 5631 destOriginalMappings.push(destMapping); 5632 } 5633 5634 destGeneratedMappings.push(destMapping); 5635 } 5636 5637 quickSort(smc.__originalMappings, util.compareByOriginalPositions); 5638 5639 return smc; 5640 }; 5641 5642 /** 5643 * The version of the source mapping spec that we are consuming. 5644 */ 5645 BasicSourceMapConsumer.prototype._version = 3; 5646 5647 /** 5648 * The list of original sources. 5649 */ 5650 Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', { 5651 get: function () { 5652 return this._absoluteSources.slice(); 5653 } 5654 }); 5655 5656 /** 5657 * Provide the JIT with a nice shape / hidden class. 5658 */ 5659 function Mapping() { 5660 this.generatedLine = 0; 5661 this.generatedColumn = 0; 5662 this.source = null; 5663 this.originalLine = null; 5664 this.originalColumn = null; 5665 this.name = null; 5666 } 5667 5668 /** 5669 * Parse the mappings in a string in to a data structure which we can easily 5670 * query (the ordered arrays in the `this.__generatedMappings` and 5671 * `this.__originalMappings` properties). 5672 */ 5673 BasicSourceMapConsumer.prototype._parseMappings = 5674 function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { 5675 var generatedLine = 1; 5676 var previousGeneratedColumn = 0; 5677 var previousOriginalLine = 0; 5678 var previousOriginalColumn = 0; 5679 var previousSource = 0; 5680 var previousName = 0; 5681 var length = aStr.length; 5682 var index = 0; 5683 var cachedSegments = {}; 5684 var temp = {}; 5685 var originalMappings = []; 5686 var generatedMappings = []; 5687 var mapping, str, segment, end, value; 5688 5689 while (index < length) { 5690 if (aStr.charAt(index) === ';') { 5691 generatedLine++; 5692 index++; 5693 previousGeneratedColumn = 0; 5694 } 5695 else if (aStr.charAt(index) === ',') { 5696 index++; 5697 } 5698 else { 5699 mapping = new Mapping(); 5700 mapping.generatedLine = generatedLine; 5701 5702 // Because each offset is encoded relative to the previous one, 5703 // many segments often have the same encoding. We can exploit this 5704 // fact by caching the parsed variable length fields of each segment, 5705 // allowing us to avoid a second parse if we encounter the same 5706 // segment again. 5707 for (end = index; end < length; end++) { 5708 if (this._charIsMappingSeparator(aStr, end)) { 5709 break; 5710 } 5711 } 5712 str = aStr.slice(index, end); 5713 5714 segment = cachedSegments[str]; 5715 if (segment) { 5716 index += str.length; 5717 } else { 5718 segment = []; 5719 while (index < end) { 5720 base64VLQ.decode(aStr, index, temp); 5721 value = temp.value; 5722 index = temp.rest; 5723 segment.push(value); 5724 } 5725 5726 if (segment.length === 2) { 5727 throw new Error('Found a source, but no line and column'); 5728 } 5729 5730 if (segment.length === 3) { 5731 throw new Error('Found a source and line, but no column'); 5732 } 5733 5734 cachedSegments[str] = segment; 5735 } 5736 5737 // Generated column. 5738 mapping.generatedColumn = previousGeneratedColumn + segment[0]; 5739 previousGeneratedColumn = mapping.generatedColumn; 5740 5741 if (segment.length > 1) { 5742 // Original source. 5743 mapping.source = previousSource + segment[1]; 5744 previousSource += segment[1]; 5745 5746 // Original line. 5747 mapping.originalLine = previousOriginalLine + segment[2]; 5748 previousOriginalLine = mapping.originalLine; 5749 // Lines are stored 0-based 5750 mapping.originalLine += 1; 5751 5752 // Original column. 5753 mapping.originalColumn = previousOriginalColumn + segment[3]; 5754 previousOriginalColumn = mapping.originalColumn; 5755 5756 if (segment.length > 4) { 5757 // Original name. 5758 mapping.name = previousName + segment[4]; 5759 previousName += segment[4]; 5760 } 5761 } 5762 5763 generatedMappings.push(mapping); 5764 if (typeof mapping.originalLine === 'number') { 5765 originalMappings.push(mapping); 5766 } 5767 } 5768 } 5769 5770 quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated); 5771 this.__generatedMappings = generatedMappings; 5772 5773 quickSort(originalMappings, util.compareByOriginalPositions); 5774 this.__originalMappings = originalMappings; 5775 }; 5776 5777 /** 5778 * Find the mapping that best matches the hypothetical "needle" mapping that 5779 * we are searching for in the given "haystack" of mappings. 5780 */ 5781 BasicSourceMapConsumer.prototype._findMapping = 5782 function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName, 5783 aColumnName, aComparator, aBias) { 5784 // To return the position we are searching for, we must first find the 5785 // mapping for the given position and then return the opposite position it 5786 // points to. Because the mappings are sorted, we can use binary search to 5787 // find the best mapping. 5788 5789 if (aNeedle[aLineName] <= 0) { 5790 throw new TypeError('Line must be greater than or equal to 1, got ' 5791 + aNeedle[aLineName]); 5792 } 5793 if (aNeedle[aColumnName] < 0) { 5794 throw new TypeError('Column must be greater than or equal to 0, got ' 5795 + aNeedle[aColumnName]); 5796 } 5797 5798 return binarySearch.search(aNeedle, aMappings, aComparator, aBias); 5799 }; 5800 5801 /** 5802 * Compute the last column for each generated mapping. The last column is 5803 * inclusive. 5804 */ 5805 BasicSourceMapConsumer.prototype.computeColumnSpans = 5806 function SourceMapConsumer_computeColumnSpans() { 5807 for (var index = 0; index < this._generatedMappings.length; ++index) { 5808 var mapping = this._generatedMappings[index]; 5809 5810 // Mappings do not contain a field for the last generated columnt. We 5811 // can come up with an optimistic estimate, however, by assuming that 5812 // mappings are contiguous (i.e. given two consecutive mappings, the 5813 // first mapping ends where the second one starts). 5814 if (index + 1 < this._generatedMappings.length) { 5815 var nextMapping = this._generatedMappings[index + 1]; 5816 5817 if (mapping.generatedLine === nextMapping.generatedLine) { 5818 mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1; 5819 continue; 5820 } 5821 } 5822 5823 // The last mapping for each line spans the entire line. 5824 mapping.lastGeneratedColumn = Infinity; 5825 } 5826 }; 5827 5828 /** 5829 * Returns the original source, line, and column information for the generated 5830 * source's line and column positions provided. The only argument is an object 5831 * with the following properties: 5832 * 5833 * - line: The line number in the generated source. The line number 5834 * is 1-based. 5835 * - column: The column number in the generated source. The column 5836 * number is 0-based. 5837 * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or 5838 * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the 5839 * closest element that is smaller than or greater than the one we are 5840 * searching for, respectively, if the exact element cannot be found. 5841 * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. 5842 * 5843 * and an object is returned with the following properties: 5844 * 5845 * - source: The original source file, or null. 5846 * - line: The line number in the original source, or null. The 5847 * line number is 1-based. 5848 * - column: The column number in the original source, or null. The 5849 * column number is 0-based. 5850 * - name: The original identifier, or null. 5851 */ 5852 BasicSourceMapConsumer.prototype.originalPositionFor = 5853 function SourceMapConsumer_originalPositionFor(aArgs) { 5854 var needle = { 5855 generatedLine: util.getArg(aArgs, 'line'), 5856 generatedColumn: util.getArg(aArgs, 'column') 5857 }; 5858 5859 var index = this._findMapping( 5860 needle, 5861 this._generatedMappings, 5862 "generatedLine", 5863 "generatedColumn", 5864 util.compareByGeneratedPositionsDeflated, 5865 util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) 5866 ); 5867 5868 if (index >= 0) { 5869 var mapping = this._generatedMappings[index]; 5870 5871 if (mapping.generatedLine === needle.generatedLine) { 5872 var source = util.getArg(mapping, 'source', null); 5873 if (source !== null) { 5874 source = this._sources.at(source); 5875 source = util.computeSourceURL(this.sourceRoot, source, this._sourceMapURL); 5876 } 5877 var name = util.getArg(mapping, 'name', null); 5878 if (name !== null) { 5879 name = this._names.at(name); 5880 } 5881 return { 5882 source: source, 5883 line: util.getArg(mapping, 'originalLine', null), 5884 column: util.getArg(mapping, 'originalColumn', null), 5885 name: name 5886 }; 5887 } 5888 } 5889 5890 return { 5891 source: null, 5892 line: null, 5893 column: null, 5894 name: null 5895 }; 5896 }; 5897 5898 /** 5899 * Return true if we have the source content for every source in the source 5900 * map, false otherwise. 5901 */ 5902 BasicSourceMapConsumer.prototype.hasContentsOfAllSources = 5903 function BasicSourceMapConsumer_hasContentsOfAllSources() { 5904 if (!this.sourcesContent) { 5905 return false; 5906 } 5907 return this.sourcesContent.length >= this._sources.size() && 5908 !this.sourcesContent.some(function (sc) { return sc == null; }); 5909 }; 5910 5911 /** 5912 * Returns the original source content. The only argument is the url of the 5913 * original source file. Returns null if no original source content is 5914 * available. 5915 */ 5916 BasicSourceMapConsumer.prototype.sourceContentFor = 5917 function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { 5918 if (!this.sourcesContent) { 5919 return null; 5920 } 5921 5922 var index = this._findSourceIndex(aSource); 5923 if (index >= 0) { 5924 return this.sourcesContent[index]; 5925 } 5926 5927 var relativeSource = aSource; 5928 if (this.sourceRoot != null) { 5929 relativeSource = util.relative(this.sourceRoot, relativeSource); 5930 } 5931 5932 var url; 5933 if (this.sourceRoot != null 5934 && (url = util.urlParse(this.sourceRoot))) { 5935 // XXX: file:// URIs and absolute paths lead to unexpected behavior for 5936 // many users. We can help them out when they expect file:// URIs to 5937 // behave like it would if they were running a local HTTP server. See 5938 // https://bugzilla.mozilla.org/show_bug.cgi?id=885597. 5939 var fileUriAbsPath = relativeSource.replace(/^file:\/\//, ""); 5940 if (url.scheme == "file" 5941 && this._sources.has(fileUriAbsPath)) { 5942 return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)] 5943 } 5944 5945 if ((!url.path || url.path == "/") 5946 && this._sources.has("/" + relativeSource)) { 5947 return this.sourcesContent[this._sources.indexOf("/" + relativeSource)]; 5948 } 5949 } 5950 5951 // This function is used recursively from 5952 // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we 5953 // don't want to throw if we can't find the source - we just want to 5954 // return null, so we provide a flag to exit gracefully. 5955 if (nullOnMissing) { 5956 return null; 5957 } 5958 else { 5959 throw new Error('"' + relativeSource + '" is not in the SourceMap.'); 5960 } 5961 }; 5962 5963 /** 5964 * Returns the generated line and column information for the original source, 5965 * line, and column positions provided. The only argument is an object with 5966 * the following properties: 5967 * 5968 * - source: The filename of the original source. 5969 * - line: The line number in the original source. The line number 5970 * is 1-based. 5971 * - column: The column number in the original source. The column 5972 * number is 0-based. 5973 * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or 5974 * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the 5975 * closest element that is smaller than or greater than the one we are 5976 * searching for, respectively, if the exact element cannot be found. 5977 * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. 5978 * 5979 * and an object is returned with the following properties: 5980 * 5981 * - line: The line number in the generated source, or null. The 5982 * line number is 1-based. 5983 * - column: The column number in the generated source, or null. 5984 * The column number is 0-based. 5985 */ 5986 BasicSourceMapConsumer.prototype.generatedPositionFor = 5987 function SourceMapConsumer_generatedPositionFor(aArgs) { 5988 var source = util.getArg(aArgs, 'source'); 5989 source = this._findSourceIndex(source); 5990 if (source < 0) { 5991 return { 5992 line: null, 5993 column: null, 5994 lastColumn: null 5995 }; 5996 } 5997 5998 var needle = { 5999 source: source, 6000 originalLine: util.getArg(aArgs, 'line'), 6001 originalColumn: util.getArg(aArgs, 'column') 6002 }; 6003 6004 var index = this._findMapping( 6005 needle, 6006 this._originalMappings, 6007 "originalLine", 6008 "originalColumn", 6009 util.compareByOriginalPositions, 6010 util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) 6011 ); 6012 6013 if (index >= 0) { 6014 var mapping = this._originalMappings[index]; 6015 6016 if (mapping.source === needle.source) { 6017 return { 6018 line: util.getArg(mapping, 'generatedLine', null), 6019 column: util.getArg(mapping, 'generatedColumn', null), 6020 lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) 6021 }; 6022 } 6023 } 6024 6025 return { 6026 line: null, 6027 column: null, 6028 lastColumn: null 6029 }; 6030 }; 6031 6032 sourceMapConsumer.BasicSourceMapConsumer = BasicSourceMapConsumer; 6033 6034 /** 6035 * An IndexedSourceMapConsumer instance represents a parsed source map which 6036 * we can query for information. It differs from BasicSourceMapConsumer in 6037 * that it takes "indexed" source maps (i.e. ones with a "sections" field) as 6038 * input. 6039 * 6040 * The first parameter is a raw source map (either as a JSON string, or already 6041 * parsed to an object). According to the spec for indexed source maps, they 6042 * have the following attributes: 6043 * 6044 * - version: Which version of the source map spec this map is following. 6045 * - file: Optional. The generated file this source map is associated with. 6046 * - sections: A list of section definitions. 6047 * 6048 * Each value under the "sections" field has two fields: 6049 * - offset: The offset into the original specified at which this section 6050 * begins to apply, defined as an object with a "line" and "column" 6051 * field. 6052 * - map: A source map definition. This source map could also be indexed, 6053 * but doesn't have to be. 6054 * 6055 * Instead of the "map" field, it's also possible to have a "url" field 6056 * specifying a URL to retrieve a source map from, but that's currently 6057 * unsupported. 6058 * 6059 * Here's an example source map, taken from the source map spec[0], but 6060 * modified to omit a section which uses the "url" field. 6061 * 6062 * { 6063 * version : 3, 6064 * file: "app.js", 6065 * sections: [{ 6066 * offset: {line:100, column:10}, 6067 * map: { 6068 * version : 3, 6069 * file: "section.js", 6070 * sources: ["foo.js", "bar.js"], 6071 * names: ["src", "maps", "are", "fun"], 6072 * mappings: "AAAA,E;;ABCDE;" 6073 * } 6074 * }], 6075 * } 6076 * 6077 * The second parameter, if given, is a string whose value is the URL 6078 * at which the source map was found. This URL is used to compute the 6079 * sources array. 6080 * 6081 * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt 6082 */ 6083 function IndexedSourceMapConsumer(aSourceMap, aSourceMapURL) { 6084 var sourceMap = aSourceMap; 6085 if (typeof aSourceMap === 'string') { 6086 sourceMap = util.parseSourceMapInput(aSourceMap); 6087 } 6088 6089 var version = util.getArg(sourceMap, 'version'); 6090 var sections = util.getArg(sourceMap, 'sections'); 6091 6092 if (version != this._version) { 6093 throw new Error('Unsupported version: ' + version); 6094 } 6095 6096 this._sources = new ArraySet(); 6097 this._names = new ArraySet(); 6098 6099 var lastOffset = { 6100 line: -1, 6101 column: 0 6102 }; 6103 this._sections = sections.map(function (s) { 6104 if (s.url) { 6105 // The url field will require support for asynchronicity. 6106 // See https://github.com/mozilla/source-map/issues/16 6107 throw new Error('Support for url field in sections not implemented.'); 6108 } 6109 var offset = util.getArg(s, 'offset'); 6110 var offsetLine = util.getArg(offset, 'line'); 6111 var offsetColumn = util.getArg(offset, 'column'); 6112 6113 if (offsetLine < lastOffset.line || 6114 (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) { 6115 throw new Error('Section offsets must be ordered and non-overlapping.'); 6116 } 6117 lastOffset = offset; 6118 6119 return { 6120 generatedOffset: { 6121 // The offset fields are 0-based, but we use 1-based indices when 6122 // encoding/decoding from VLQ. 6123 generatedLine: offsetLine + 1, 6124 generatedColumn: offsetColumn + 1 6125 }, 6126 consumer: new SourceMapConsumer(util.getArg(s, 'map'), aSourceMapURL) 6127 } 6128 }); 6129 } 6130 6131 IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); 6132 IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer; 6133 6134 /** 6135 * The version of the source mapping spec that we are consuming. 6136 */ 6137 IndexedSourceMapConsumer.prototype._version = 3; 6138 6139 /** 6140 * The list of original sources. 6141 */ 6142 Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', { 6143 get: function () { 6144 var sources = []; 6145 for (var i = 0; i < this._sections.length; i++) { 6146 for (var j = 0; j < this._sections[i].consumer.sources.length; j++) { 6147 sources.push(this._sections[i].consumer.sources[j]); 6148 } 6149 } 6150 return sources; 6151 } 6152 }); 6153 6154 /** 6155 * Returns the original source, line, and column information for the generated 6156 * source's line and column positions provided. The only argument is an object 6157 * with the following properties: 6158 * 6159 * - line: The line number in the generated source. The line number 6160 * is 1-based. 6161 * - column: The column number in the generated source. The column 6162 * number is 0-based. 6163 * 6164 * and an object is returned with the following properties: 6165 * 6166 * - source: The original source file, or null. 6167 * - line: The line number in the original source, or null. The 6168 * line number is 1-based. 6169 * - column: The column number in the original source, or null. The 6170 * column number is 0-based. 6171 * - name: The original identifier, or null. 6172 */ 6173 IndexedSourceMapConsumer.prototype.originalPositionFor = 6174 function IndexedSourceMapConsumer_originalPositionFor(aArgs) { 6175 var needle = { 6176 generatedLine: util.getArg(aArgs, 'line'), 6177 generatedColumn: util.getArg(aArgs, 'column') 6178 }; 6179 6180 // Find the section containing the generated position we're trying to map 6181 // to an original position. 6182 var sectionIndex = binarySearch.search(needle, this._sections, 6183 function(needle, section) { 6184 var cmp = needle.generatedLine - section.generatedOffset.generatedLine; 6185 if (cmp) { 6186 return cmp; 6187 } 6188 6189 return (needle.generatedColumn - 6190 section.generatedOffset.generatedColumn); 6191 }); 6192 var section = this._sections[sectionIndex]; 6193 6194 if (!section) { 6195 return { 6196 source: null, 6197 line: null, 6198 column: null, 6199 name: null 6200 }; 6201 } 6202 6203 return section.consumer.originalPositionFor({ 6204 line: needle.generatedLine - 6205 (section.generatedOffset.generatedLine - 1), 6206 column: needle.generatedColumn - 6207 (section.generatedOffset.generatedLine === needle.generatedLine 6208 ? section.generatedOffset.generatedColumn - 1 6209 : 0), 6210 bias: aArgs.bias 6211 }); 6212 }; 6213 6214 /** 6215 * Return true if we have the source content for every source in the source 6216 * map, false otherwise. 6217 */ 6218 IndexedSourceMapConsumer.prototype.hasContentsOfAllSources = 6219 function IndexedSourceMapConsumer_hasContentsOfAllSources() { 6220 return this._sections.every(function (s) { 6221 return s.consumer.hasContentsOfAllSources(); 6222 }); 6223 }; 6224 6225 /** 6226 * Returns the original source content. The only argument is the url of the 6227 * original source file. Returns null if no original source content is 6228 * available. 6229 */ 6230 IndexedSourceMapConsumer.prototype.sourceContentFor = 6231 function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { 6232 for (var i = 0; i < this._sections.length; i++) { 6233 var section = this._sections[i]; 6234 6235 var content = section.consumer.sourceContentFor(aSource, true); 6236 if (content) { 6237 return content; 6238 } 6239 } 6240 if (nullOnMissing) { 6241 return null; 6242 } 6243 else { 6244 throw new Error('"' + aSource + '" is not in the SourceMap.'); 6245 } 6246 }; 6247 6248 /** 6249 * Returns the generated line and column information for the original source, 6250 * line, and column positions provided. The only argument is an object with 6251 * the following properties: 6252 * 6253 * - source: The filename of the original source. 6254 * - line: The line number in the original source. The line number 6255 * is 1-based. 6256 * - column: The column number in the original source. The column 6257 * number is 0-based. 6258 * 6259 * and an object is returned with the following properties: 6260 * 6261 * - line: The line number in the generated source, or null. The 6262 * line number is 1-based. 6263 * - column: The column number in the generated source, or null. 6264 * The column number is 0-based. 6265 */ 6266 IndexedSourceMapConsumer.prototype.generatedPositionFor = 6267 function IndexedSourceMapConsumer_generatedPositionFor(aArgs) { 6268 for (var i = 0; i < this._sections.length; i++) { 6269 var section = this._sections[i]; 6270 6271 // Only consider this section if the requested source is in the list of 6272 // sources of the consumer. 6273 if (section.consumer._findSourceIndex(util.getArg(aArgs, 'source')) === -1) { 6274 continue; 6275 } 6276 var generatedPosition = section.consumer.generatedPositionFor(aArgs); 6277 if (generatedPosition) { 6278 var ret = { 6279 line: generatedPosition.line + 6280 (section.generatedOffset.generatedLine - 1), 6281 column: generatedPosition.column + 6282 (section.generatedOffset.generatedLine === generatedPosition.line 6283 ? section.generatedOffset.generatedColumn - 1 6284 : 0) 6285 }; 6286 return ret; 6287 } 6288 } 6289 6290 return { 6291 line: null, 6292 column: null 6293 }; 6294 }; 6295 6296 /** 6297 * Parse the mappings in a string in to a data structure which we can easily 6298 * query (the ordered arrays in the `this.__generatedMappings` and 6299 * `this.__originalMappings` properties). 6300 */ 6301 IndexedSourceMapConsumer.prototype._parseMappings = 6302 function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) { 6303 this.__generatedMappings = []; 6304 this.__originalMappings = []; 6305 for (var i = 0; i < this._sections.length; i++) { 6306 var section = this._sections[i]; 6307 var sectionMappings = section.consumer._generatedMappings; 6308 for (var j = 0; j < sectionMappings.length; j++) { 6309 var mapping = sectionMappings[j]; 6310 6311 var source = section.consumer._sources.at(mapping.source); 6312 source = util.computeSourceURL(section.consumer.sourceRoot, source, this._sourceMapURL); 6313 this._sources.add(source); 6314 source = this._sources.indexOf(source); 6315 6316 var name = null; 6317 if (mapping.name) { 6318 name = section.consumer._names.at(mapping.name); 6319 this._names.add(name); 6320 name = this._names.indexOf(name); 6321 } 6322 6323 // The mappings coming from the consumer for the section have 6324 // generated positions relative to the start of the section, so we 6325 // need to offset them to be relative to the start of the concatenated 6326 // generated file. 6327 var adjustedMapping = { 6328 source: source, 6329 generatedLine: mapping.generatedLine + 6330 (section.generatedOffset.generatedLine - 1), 6331 generatedColumn: mapping.generatedColumn + 6332 (section.generatedOffset.generatedLine === mapping.generatedLine 6333 ? section.generatedOffset.generatedColumn - 1 6334 : 0), 6335 originalLine: mapping.originalLine, 6336 originalColumn: mapping.originalColumn, 6337 name: name 6338 }; 6339 6340 this.__generatedMappings.push(adjustedMapping); 6341 if (typeof adjustedMapping.originalLine === 'number') { 6342 this.__originalMappings.push(adjustedMapping); 6343 } 6344 } 6345 } 6346 6347 quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated); 6348 quickSort(this.__originalMappings, util.compareByOriginalPositions); 6349 }; 6350 6351 sourceMapConsumer.IndexedSourceMapConsumer = IndexedSourceMapConsumer; 6352 return sourceMapConsumer; 6353} 6354 6355var sourceNode = {}; 6356 6357/* -*- Mode: js; js-indent-level: 2; -*- */ 6358 6359var hasRequiredSourceNode; 6360 6361function requireSourceNode () { 6362 if (hasRequiredSourceNode) return sourceNode; 6363 hasRequiredSourceNode = 1; 6364 /* 6365 * Copyright 2011 Mozilla Foundation and contributors 6366 * Licensed under the New BSD license. See LICENSE or: 6367 * http://opensource.org/licenses/BSD-3-Clause 6368 */ 6369 6370 var SourceMapGenerator =
6370requireSourceMapGenerator().SourceMapGenerator; 6371 var util = requireUtil
vendor: 14,235 bytes, lines 6371-6790
6371(); 6372 6373 // Matches a Windows-style `\r\n` newline or a `\n` newline used by all other 6374 // operating systems these days (capturing the result). 6375 var REGEX_NEWLINE = /(\r?\n)/; 6376 6377 // Newline character code for charCodeAt() comparisons 6378 var NEWLINE_CODE = 10; 6379 6380 // Private symbol for identifying `SourceNode`s when multiple versions of 6381 // the source-map library are loaded. This MUST NOT CHANGE across 6382 // versions! 6383 var isSourceNode = "$$$isSourceNode$$$"; 6384 6385 /** 6386 * SourceNodes provide a way to abstract over interpolating/concatenating 6387 * snippets of generated JavaScript source code while maintaining the line and 6388 * column information associated with the original source code. 6389 * 6390 * @param aLine The original line number. 6391 * @param aColumn The original column number. 6392 * @param aSource The original source's filename. 6393 * @param aChunks Optional. An array of strings which are snippets of 6394 * generated JS, or other SourceNodes. 6395 * @param aName The original identifier. 6396 */ 6397 function SourceNode(aLine, aColumn, aSource, aChunks, aName) { 6398 this.children = []; 6399 this.sourceContents = {}; 6400 this.line = aLine == null ? null : aLine; 6401 this.column = aColumn == null ? null : aColumn; 6402 this.source = aSource == null ? null : aSource; 6403 this.name = aName == null ? null : aName; 6404 this[isSourceNode] = true; 6405 if (aChunks != null) this.add(aChunks); 6406 } 6407 6408 /** 6409 * Creates a SourceNode from generated code and a SourceMapConsumer. 6410 * 6411 * @param aGeneratedCode The generated code 6412 * @param aSourceMapConsumer The SourceMap for the generated code 6413 * @param aRelativePath Optional. The path that relative sources in the 6414 * SourceMapConsumer should be relative to. 6415 */ 6416 SourceNode.fromStringWithSourceMap = 6417 function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) { 6418 // The SourceNode we want to fill with the generated code 6419 // and the SourceMap 6420 var node = new SourceNode(); 6421 6422 // All even indices of this array are one line of the generated code, 6423 // while all odd indices are the newlines between two adjacent lines 6424 // (since `REGEX_NEWLINE` captures its match). 6425 // Processed fragments are accessed by calling `shiftNextLine`. 6426 var remainingLines = aGeneratedCode.split(REGEX_NEWLINE); 6427 var remainingLinesIndex = 0; 6428 var shiftNextLine = function() { 6429 var lineContents = getNextLine(); 6430 // The last line of a file might not have a newline. 6431 var newLine = getNextLine() || ""; 6432 return lineContents + newLine; 6433 6434 function getNextLine() { 6435 return remainingLinesIndex < remainingLines.length ? 6436 remainingLines[remainingLinesIndex++] : undefined; 6437 } 6438 }; 6439 6440 // We need to remember the position of "remainingLines" 6441 var lastGeneratedLine = 1, lastGeneratedColumn = 0; 6442 6443 // The generate SourceNodes we need a code range. 6444 // To extract it current and last mapping is used. 6445 // Here we store the last mapping. 6446 var lastMapping = null; 6447 6448 aSourceMapConsumer.eachMapping(function (mapping) { 6449 if (lastMapping !== null) { 6450 // We add the code from "lastMapping" to "mapping": 6451 // First check if there is a new line in between. 6452 if (lastGeneratedLine < mapping.generatedLine) { 6453 // Associate first line with "lastMapping" 6454 addMappingWithCode(lastMapping, shiftNextLine()); 6455 lastGeneratedLine++; 6456 lastGeneratedColumn = 0; 6457 // The remaining code is added without mapping 6458 } else { 6459 // There is no new line in between. 6460 // Associate the code between "lastGeneratedColumn" and 6461 // "mapping.generatedColumn" with "lastMapping" 6462 var nextLine = remainingLines[remainingLinesIndex] || ''; 6463 var code = nextLine.substr(0, mapping.generatedColumn - 6464 lastGeneratedColumn); 6465 remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn - 6466 lastGeneratedColumn); 6467 lastGeneratedColumn = mapping.generatedColumn; 6468 addMappingWithCode(lastMapping, code); 6469 // No more remaining code, continue 6470 lastMapping = mapping; 6471 return; 6472 } 6473 } 6474 // We add the generated code until the first mapping 6475 // to the SourceNode without any mapping. 6476 // Each line is added as separate string. 6477 while (lastGeneratedLine < mapping.generatedLine) { 6478 node.add(shiftNextLine()); 6479 lastGeneratedLine++; 6480 } 6481 if (lastGeneratedColumn < mapping.generatedColumn) { 6482 var nextLine = remainingLines[remainingLinesIndex] || ''; 6483 node.add(nextLine.substr(0, mapping.generatedColumn)); 6484 remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn); 6485 lastGeneratedColumn = mapping.generatedColumn; 6486 } 6487 lastMapping = mapping; 6488 }, this); 6489 // We have processed all mappings. 6490 if (remainingLinesIndex < remainingLines.length) { 6491 if (lastMapping) { 6492 // Associate the remaining code in the current line with "lastMapping" 6493 addMappingWithCode(lastMapping, shiftNextLine()); 6494 } 6495 // and add the remaining lines without any mapping 6496 node.add(remainingLines.splice(remainingLinesIndex).join("")); 6497 } 6498 6499 // Copy sourcesContent into SourceNode 6500 aSourceMapConsumer.sources.forEach(function (sourceFile) { 6501 var content = aSourceMapConsumer.sourceContentFor(sourceFile); 6502 if (content != null) { 6503 if (aRelativePath != null) { 6504 sourceFile = util.join(aRelativePath, sourceFile); 6505 } 6506 node.setSourceContent(sourceFile, content); 6507 } 6508 }); 6509 6510 return node; 6511 6512 function addMappingWithCode(mapping, code) { 6513 if (mapping === null || mapping.source === undefined) { 6514 node.add(code); 6515 } else { 6516 var source = aRelativePath 6517 ? util.join(aRelativePath, mapping.source) 6518 : mapping.source; 6519 node.add(new SourceNode(mapping.originalLine, 6520 mapping.originalColumn, 6521 source, 6522 code, 6523 mapping.name)); 6524 } 6525 } 6526 }; 6527 6528 /** 6529 * Add a chunk of generated JS to this source node. 6530 * 6531 * @param aChunk A string snippet of generated JS code, another instance of 6532 * SourceNode, or an array where each member is one of those things. 6533 */ 6534 SourceNode.prototype.add = function SourceNode_add(aChunk) { 6535 if (Array.isArray(aChunk)) { 6536 aChunk.forEach(function (chunk) { 6537 this.add(chunk); 6538 }, this); 6539 } 6540 else if (aChunk[isSourceNode] || typeof aChunk === "string") { 6541 if (aChunk) { 6542 this.children.push(aChunk); 6543 } 6544 } 6545 else { 6546 throw new TypeError( 6547 "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk 6548 ); 6549 } 6550 return this; 6551 }; 6552 6553 /** 6554 * Add a chunk of generated JS to the beginning of this source node. 6555 * 6556 * @param aChunk A string snippet of generated JS code, another instance of 6557 * SourceNode, or an array where each member is one of those things. 6558 */ 6559 SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) { 6560 if (Array.isArray(aChunk)) { 6561 for (var i = aChunk.length-1; i >= 0; i--) { 6562 this.prepend(aChunk[i]); 6563 } 6564 } 6565 else if (aChunk[isSourceNode] || typeof aChunk === "string") { 6566 this.children.unshift(aChunk); 6567 } 6568 else { 6569 throw new TypeError( 6570 "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk 6571 ); 6572 } 6573 return this; 6574 }; 6575 6576 /** 6577 * Walk over the tree of JS snippets in this node and its children. The 6578 * walking function is called once for each snippet of JS and is passed that 6579 * snippet and the its original associated source's line/column location. 6580 * 6581 * @param aFn The traversal function. 6582 */ 6583 SourceNode.prototype.walk = function SourceNode_walk(aFn) { 6584 var chunk; 6585 for (var i = 0, len = this.children.length; i < len; i++) { 6586 chunk = this.children[i]; 6587 if (chunk[isSourceNode]) { 6588 chunk.walk(aFn); 6589 } 6590 else { 6591 if (chunk !== '') { 6592 aFn(chunk, { source: this.source, 6593 line: this.line, 6594 column: this.column, 6595 name: this.name }); 6596 } 6597 } 6598 } 6599 }; 6600 6601 /** 6602 * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between 6603 * each of `this.children`. 6604 * 6605 * @param aSep The separator. 6606 */ 6607 SourceNode.prototype.join = function SourceNode_join(aSep) { 6608 var newChildren; 6609 var i; 6610 var len = this.children.length; 6611 if (len > 0) { 6612 newChildren = []; 6613 for (i = 0; i < len-1; i++) { 6614 newChildren.push(this.children[i]); 6615 newChildren.push(aSep); 6616 } 6617 newChildren.push(this.children[i]); 6618 this.children = newChildren; 6619 } 6620 return this; 6621 }; 6622 6623 /** 6624 * Call String.prototype.replace on the very right-most source snippet. Useful 6625 * for trimming whitespace from the end of a source node, etc. 6626 * 6627 * @param aPattern The pattern to replace. 6628 * @param aReplacement The thing to replace the pattern with. 6629 */ 6630 SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) { 6631 var lastChild = this.children[this.children.length - 1]; 6632 if (lastChild[isSourceNode]) { 6633 lastChild.replaceRight(aPattern, aReplacement); 6634 } 6635 else if (typeof lastChild === 'string') { 6636 this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement); 6637 } 6638 else { 6639 this.children.push(''.replace(aPattern, aReplacement)); 6640 } 6641 return this; 6642 }; 6643 6644 /** 6645 * Set the source content for a source file. This will be added to the SourceMapGenerator 6646 * in the sourcesContent field. 6647 * 6648 * @param aSourceFile The filename of the source file 6649 * @param aSourceContent The content of the source file 6650 */ 6651 SourceNode.prototype.setSourceContent = 6652 function SourceNode_setSourceContent(aSourceFile, aSourceContent) { 6653 this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent; 6654 }; 6655 6656 /** 6657 * Walk over the tree of SourceNodes. The walking function is called for each 6658 * source file content and is passed the filename and source content. 6659 * 6660 * @param aFn The traversal function. 6661 */ 6662 SourceNode.prototype.walkSourceContents = 6663 function SourceNode_walkSourceContents(aFn) { 6664 for (var i = 0, len = this.children.length; i < len; i++) { 6665 if (this.children[i][isSourceNode]) { 6666 this.children[i].walkSourceContents(aFn); 6667 } 6668 } 6669 6670 var sources = Object.keys(this.sourceContents); 6671 for (var i = 0, len = sources.length; i < len; i++) { 6672 aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]); 6673 } 6674 }; 6675 6676 /** 6677 * Return the string representation of this source node. Walks over the tree 6678 * and concatenates all the various snippets together to one string. 6679 */ 6680 SourceNode.prototype.toString = function SourceNode_toString() { 6681 var str = ""; 6682 this.walk(function (chunk) { 6683 str += chunk; 6684 }); 6685 return str; 6686 }; 6687 6688 /** 6689 * Returns the string representation of this source node along with a source 6690 * map. 6691 */ 6692 SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) { 6693 var generated = { 6694 code: "", 6695 line: 1, 6696 column: 0 6697 }; 6698 var map = new SourceMapGenerator(aArgs); 6699 var sourceMappingActive = false; 6700 var lastOriginalSource = null; 6701 var lastOriginalLine = null; 6702 var lastOriginalColumn = null; 6703 var lastOriginalName = null; 6704 this.walk(function (chunk, original) { 6705 generated.code += chunk; 6706 if (original.source !== null 6707 && original.line !== null 6708 && original.column !== null) { 6709 if(lastOriginalSource !== original.source 6710 || lastOriginalLine !== original.line 6711 || lastOriginalColumn !== original.column 6712 || lastOriginalName !== original.name) { 6713 map.addMapping({ 6714 source: original.source, 6715 original: { 6716 line: original.line, 6717 column: original.column 6718 }, 6719 generated: { 6720 line: generated.line, 6721 column: generated.column 6722 }, 6723 name: original.name 6724 }); 6725 } 6726 lastOriginalSource = original.source; 6727 lastOriginalLine = original.line; 6728 lastOriginalColumn = original.column; 6729 lastOriginalName = original.name; 6730 sourceMappingActive = true; 6731 } else if (sourceMappingActive) { 6732 map.addMapping({ 6733 generated: { 6734 line: generated.line, 6735 column: generated.column 6736 } 6737 }); 6738 lastOriginalSource = null; 6739 sourceMappingActive = false; 6740 } 6741 for (var idx = 0, length = chunk.length; idx < length; idx++) { 6742 if (chunk.charCodeAt(idx) === NEWLINE_CODE) { 6743 generated.line++; 6744 generated.column = 0; 6745 // Mappings end at eol 6746 if (idx + 1 === length) { 6747 lastOriginalSource = null; 6748 sourceMappingActive = false; 6749 } else if (sourceMappingActive) { 6750 map.addMapping({ 6751 source: original.source, 6752 original: { 6753 line: original.line, 6754 column: original.column 6755 }, 6756 generated: { 6757 line: generated.line, 6758 column: generated.column 6759 }, 6760 name: original.name 6761 }); 6762 } 6763 } else { 6764 generated.column++; 6765 } 6766 } 6767 }); 6768 this.walkSourceContents(function (sourceFile, sourceContent) { 6769 map.setSourceContent(sourceFile, sourceContent); 6770 }); 6771 6772 return { code: generated.code, map: map }; 6773 }; 6774 6775 sourceNode.SourceNode = SourceNode; 6776 return sourceNode; 6777} 6778 6779/* 6780 * Copyright 2009-2011 Mozilla Foundation and contributors 6781 * Licensed under the New BSD license. See LICENSE.txt or: 6782 * http://opensource.org/licenses/BSD-3-Clause 6783 */ 6784 6785var hasRequiredSourceMap; 6786 6787function requireSourceMap () { 6788 if (hasRequiredSourceMap) return sourceMap; 6789 hasRequiredSourceMap = 1; 6790 sourceMap.SourceMapGenerator =
6790requireSourceMapGenerator().SourceMapGenerator; 6791 sourceMap.SourceMapConsumer = requireSourceMapConsumer().SourceMapConsumer; 6792 sourceMap.SourceNode = requireSourceNode().SourceNode;
vendor: 4,640 bytes, lines 6793-6970
6793 return sourceMap; 6794} 6795 6796/* global define, require */ 6797 6798var hasRequiredCodeGen; 6799 6800function requireCodeGen () { 6801 if (hasRequiredCodeGen) return codeGen.exports; 6802 hasRequiredCodeGen = 1; 6803 (function (module, exports$1) { 6804 6805 exports$1.__esModule = true; 6806 6807 var _utils = requireUtils(); 6808 6809 var SourceNode = undefined; 6810 6811 try { 6812 /* istanbul ignore next */ 6813 if (typeof undefined !== 'function' || !undefined.amd) { 6814 // We don't support this in AMD environments. For these environments, we assume that 6815 // they are running on the browser and thus have no need for the source-map library. 6816 var SourceMap = requireSourceMap(); 6817 SourceNode = SourceMap.SourceNode; 6818 } 6819 } catch (err) {} 6820 /* NOP */ 6821 6822 /* istanbul ignore if: tested but not covered in istanbul due to dist build */ 6823 if (!SourceNode) { 6824 SourceNode = function (line, column, srcFile, chunks) { 6825 this.src = ''; 6826 if (chunks) { 6827 this.add(chunks); 6828 } 6829 }; 6830 /* istanbul ignore next */ 6831 SourceNode.prototype = { 6832 add: function add(chunks) { 6833 if (_utils.isArray(chunks)) { 6834 chunks = chunks.join(''); 6835 } 6836 this.src += chunks; 6837 }, 6838 prepend: function prepend(chunks) { 6839 if (_utils.isArray(chunks)) { 6840 chunks = chunks.join(''); 6841 } 6842 this.src = chunks + this.src; 6843 }, 6844 toStringWithSourceMap: function toStringWithSourceMap() { 6845 return { code: this.toString() }; 6846 }, 6847 toString: function toString() { 6848 return this.src; 6849 } 6850 }; 6851 } 6852 6853 function castChunk(chunk, codeGen, loc) { 6854 if (_utils.isArray(chunk)) { 6855 var ret = []; 6856 6857 for (var i = 0, len = chunk.length; i < len; i++) { 6858 ret.push(codeGen.wrap(chunk[i], loc)); 6859 } 6860 return ret; 6861 } else if (typeof chunk === 'boolean' || typeof chunk === 'number') { 6862 // Handle primitives that the SourceNode will throw up on 6863 return chunk + ''; 6864 } 6865 return chunk; 6866 } 6867 6868 function CodeGen(srcFile) { 6869 this.srcFile = srcFile; 6870 this.source = []; 6871 } 6872 6873 CodeGen.prototype = { 6874 isEmpty: function isEmpty() { 6875 return !this.source.length; 6876 }, 6877 prepend: function prepend(source, loc) { 6878 this.source.unshift(this.wrap(source, loc)); 6879 }, 6880 push: function push(source, loc) { 6881 this.source.push(this.wrap(source, loc)); 6882 }, 6883 6884 merge: function merge() { 6885 var source = this.empty(); 6886 this.each(function (line) { 6887 source.add([' ', line, '\n']); 6888 }); 6889 return source; 6890 }, 6891 6892 each: function each(iter) { 6893 for (var i = 0, len = this.source.length; i < len; i++) { 6894 iter(this.source[i]); 6895 } 6896 }, 6897 6898 empty: function empty() { 6899 var loc = this.currentLocation || { start: {} }; 6900 return new SourceNode(loc.start.line, loc.start.column, this.srcFile); 6901 }, 6902 wrap: function wrap(chunk) { 6903 var loc = arguments.length <= 1 || arguments[1] === undefined ? this.currentLocation || { start: {} } : arguments[1]; 6904 6905 if (chunk instanceof SourceNode) { 6906 return chunk; 6907 } 6908 6909 chunk = castChunk(chunk, this, loc); 6910 6911 return new SourceNode(loc.start.line, loc.start.column, this.srcFile, chunk); 6912 }, 6913 6914 functionCall: function functionCall(fn, type, params) { 6915 params = this.generateList(params); 6916 return this.wrap([fn, type ? '.' + type + '(' : '(', params, ')']); 6917 }, 6918 6919 quotedString: function quotedString(str) { 6920 return '"' + (str + '').replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/\n/g, '\\n').replace(/\r/g, '\\r').replace(/\u2028/g, '\\u2028') // Per Ecma-262 7.3 + 7.8.4 6921 .replace(/\u2029/g, '\\u2029') + '"'; 6922 }, 6923 6924 objectLiteral: function objectLiteral(obj) { 6925 // istanbul ignore next 6926 6927 var _this = this; 6928 6929 var pairs = []; 6930 6931 Object.keys(obj).forEach(function (key) { 6932 var value = castChunk(obj[key], _this); 6933 if (value !== 'undefined') { 6934 pairs.push([_this.quotedString(key), ':', value]); 6935 } 6936 }); 6937 6938 var ret = this.generateList(pairs); 6939 ret.prepend('{'); 6940 ret.add('}'); 6941 return ret; 6942 }, 6943 6944 generateList: function generateList(entries) { 6945 var ret = this.empty(); 6946 6947 for (var i = 0, len = entries.length; i < len; i++) { 6948 if (i) { 6949 ret.add(','); 6950 } 6951 6952 ret.add(castChunk(entries[i], this)); 6953 } 6954 6955 return ret; 6956 }, 6957 6958 generateArray: function generateArray(entries) { 6959 var ret = this.generateList(entries); 6960 ret.prepend('['); 6961 ret.add(']'); 6962 6963 return ret; 6964 } 6965 }; 6966 6967 exports$1['default'] = CodeGen; 6968 module.exports = exports$1['default']; 6969 6970 }
vendor: 13,116 bytes, lines 6970-7374
6970 (codeGen, codeGen.exports)); 6971 return codeGen.exports; 6972} 6973 6974var hasRequiredJavascriptCompiler; 6975 6976function requireJavascriptCompiler () { 6977 if (hasRequiredJavascriptCompiler) return javascriptCompiler.exports; 6978 hasRequiredJavascriptCompiler = 1; 6979 (function (module, exports$1) { 6980 6981 exports$1.__esModule = true; 6982 // istanbul ignore next 6983 6984 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 6985 6986 var _base = requireBase$1(); 6987 6988 var _exception = requireException(); 6989 6990 var _exception2 = _interopRequireDefault(_exception); 6991 6992 var _utils = requireUtils(); 6993 6994 var _codeGen = requireCodeGen(); 6995 6996 var _codeGen2 = _interopRequireDefault(_codeGen); 6997 6998 function Literal(value) { 6999 this.value = value; 7000 } 7001 7002 function JavaScriptCompiler() {} 7003 7004 JavaScriptCompiler.prototype = { 7005 // PUBLIC API: You can override these methods in a subclass to provide 7006 // alternative compiled forms for name lookup and buffering semantics 7007 nameLookup: function nameLookup(parent, name /*, type */) { 7008 return this.internalNameLookup(parent, name); 7009 }, 7010 depthedLookup: function depthedLookup(name) { 7011 return [this.aliasable('container.lookup'), '(depths, ', JSON.stringify(name), ')']; 7012 }, 7013 7014 compilerInfo: function compilerInfo() { 7015 var revision = _base.COMPILER_REVISION, 7016 versions = _base.REVISION_CHANGES[revision]; 7017 return [revision, versions]; 7018 }, 7019 7020 appendToBuffer: function appendToBuffer(source, location, explicit) { 7021 // Force a source as this simplifies the merge logic. 7022 if (!_utils.isArray(source)) { 7023 source = [source]; 7024 } 7025 source = this.source.wrap(source, location); 7026 7027 if (this.environment.isSimple) { 7028 return ['return ', source, ';']; 7029 } else if (explicit) { 7030 // This is a case where the buffer operation occurs as a child of another 7031 // construct, generally braces. We have to explicitly output these buffer 7032 // operations to ensure that the emitted code goes in the correct location. 7033 return ['buffer += ', source, ';']; 7034 } else { 7035 source.appendToBuffer = true; 7036 return source; 7037 } 7038 }, 7039 7040 initializeBuffer: function initializeBuffer() { 7041 return this.quotedString(''); 7042 }, 7043 // END PUBLIC API 7044 internalNameLookup: function internalNameLookup(parent, name) { 7045 this.lookupPropertyFunctionIsUsed = true; 7046 return ['lookupProperty(', parent, ',', JSON.stringify(name), ')']; 7047 }, 7048 7049 lookupPropertyFunctionIsUsed: false, 7050 7051 compile: function compile(environment, options, context, asObject) { 7052 this.environment = environment; 7053 this.options = options; 7054 this.stringParams = this.options.stringParams; 7055 this.trackIds = this.options.trackIds; 7056 this.precompile = !asObject; 7057 7058 this.name = this.environment.name; 7059 this.isChild = !!context; 7060 this.context = context || { 7061 decorators: [], 7062 programs: [], 7063 environments: [] 7064 }; 7065 7066 this.preamble(); 7067 7068 this.stackSlot = 0; 7069 this.stackVars = []; 7070 this.aliases = {}; 7071 this.registers = { list: [] }; 7072 this.hashes = []; 7073 this.compileStack = []; 7074 this.inlineStack = []; 7075 this.blockParams = []; 7076 7077 this.compileChildren(environment, options); 7078 7079 this.useDepths = this.useDepths || environment.useDepths || environment.useDecorators || this.options.compat; 7080 this.useBlockParams = this.useBlockParams || environment.useBlockParams; 7081 7082 var opcodes = environment.opcodes, 7083 opcode = undefined, 7084 firstLoc = undefined, 7085 i = undefined, 7086 l = undefined; 7087 7088 for (i = 0, l = opcodes.length; i < l; i++) { 7089 opcode = opcodes[i]; 7090 7091 this.source.currentLocation = opcode.loc; 7092 firstLoc = firstLoc || opcode.loc; 7093 this[opcode.opcode].apply(this, opcode.args); 7094 } 7095 7096 // Flush any trailing content that might be pending. 7097 this.source.currentLocation = firstLoc; 7098 this.pushSource(''); 7099 7100 /* istanbul ignore next */ 7101 if (this.stackSlot || this.inlineStack.length || this.compileStack.length) { 7102 throw new _exception2['default']('Compile completed with content left on stack'); 7103 } 7104 7105 if (!this.decorators.isEmpty()) { 7106 this.useDecorators = true; 7107 7108 this.decorators.prepend(['var decorators = container.decorators, ', this.lookupPropertyFunctionVarDeclaration(), ';\n']); 7109 this.decorators.push('return fn;'); 7110 7111 if (asObject) { 7112 this.decorators = Function.apply(this, ['fn', 'props', 'container', 'depth0', 'data', 'blockParams', 'depths', this.decorators.merge()]); 7113 } else { 7114 this.decorators.prepend('function(fn, props, container, depth0, data, blockParams, depths) {\n'); 7115 this.decorators.push('}\n'); 7116 this.decorators = this.decorators.merge(); 7117 } 7118 } else { 7119 this.decorators = undefined; 7120 } 7121 7122 var fn = this.createFunctionContext(asObject); 7123 if (!this.isChild) { 7124 var ret = { 7125 compiler: this.compilerInfo(), 7126 main: fn 7127 }; 7128 7129 if (this.decorators) { 7130 ret.main_d = this.decorators; // eslint-disable-line camelcase 7131 ret.useDecorators = true; 7132 } 7133 7134 var _context = this.context; 7135 var programs = _context.programs; 7136 var decorators = _context.decorators; 7137 7138 for (i = 0, l = programs.length; i < l; i++) { 7139 if (programs[i]) { 7140 ret[i] = programs[i]; 7141 if (decorators[i]) { 7142 ret[i + '_d'] = decorators[i]; 7143 ret.useDecorators = true; 7144 } 7145 } 7146 } 7147 7148 if (this.environment.usePartial) { 7149 ret.usePartial = true; 7150 } 7151 if (this.options.data) { 7152 ret.useData = true; 7153 } 7154 if (this.useDepths) { 7155 ret.useDepths = true; 7156 } 7157 if (this.useBlockParams) { 7158 ret.useBlockParams = true; 7159 } 7160 if (this.options.compat) { 7161 ret.compat = true; 7162 } 7163 7164 if (!asObject) { 7165 ret.compiler = JSON.stringify(ret.compiler); 7166 7167 this.source.currentLocation = { start: { line: 1, column: 0 } }; 7168 ret = this.objectLiteral(ret); 7169 7170 if (options.srcName) { 7171 ret = ret.toStringWithSourceMap({ file: options.destName }); 7172 ret.map = ret.map && ret.map.toString(); 7173 } else { 7174 ret = ret.toString(); 7175 } 7176 } else { 7177 ret.compilerOptions = this.options; 7178 } 7179 7180 return ret; 7181 } else { 7182 return fn; 7183 } 7184 }, 7185 7186 preamble: function preamble() { 7187 // track the last context pushed into place to allow skipping the 7188 // getContext opcode when it would be a noop 7189 this.lastContext = 0; 7190 this.source = new _codeGen2['default'](this.options.srcName); 7191 this.decorators = new _codeGen2['default'](this.options.srcName); 7192 }, 7193 7194 createFunctionContext: function createFunctionContext(asObject) { 7195 // istanbul ignore next 7196 7197 var _this = this; 7198 7199 var varDeclarations = ''; 7200 7201 var locals = this.stackVars.concat(this.registers.list); 7202 if (locals.length > 0) { 7203 varDeclarations += ', ' + locals.join(', '); 7204 } 7205 7206 // Generate minimizer alias mappings 7207 // 7208 // When using true SourceNodes, this will update all references to the given alias 7209 // as the source nodes are reused in situ. For the non-source node compilation mode, 7210 // aliases will not be used, but this case is already being run on the client and 7211 // we aren't concern about minimizing the template size. 7212 var aliasCount = 0; 7213 Object.keys(this.aliases).forEach(function (alias) { 7214 var node = _this.aliases[alias]; 7215 if (node.children && node.referenceCount > 1) { 7216 varDeclarations += ', alias' + ++aliasCount + '=' + alias; 7217 node.children[0] = 'alias' + aliasCount; 7218 } 7219 }); 7220 7221 if (this.lookupPropertyFunctionIsUsed) { 7222 varDeclarations += ', ' + this.lookupPropertyFunctionVarDeclaration(); 7223 } 7224 7225 var params = ['container', 'depth0', 'helpers', 'partials', 'data']; 7226 7227 if (this.useBlockParams || this.useDepths) { 7228 params.push('blockParams'); 7229 } 7230 if (this.useDepths) { 7231 params.push('depths'); 7232 } 7233 7234 // Perform a second pass over the output to merge content when possible 7235 var source = this.mergeSource(varDeclarations); 7236 7237 if (asObject) { 7238 params.push(source); 7239 7240 return Function.apply(this, params); 7241 } else { 7242 return this.source.wrap(['function(', params.join(','), ') {\n ', source, '}']); 7243 } 7244 }, 7245 mergeSource: function mergeSource(varDeclarations) { 7246 var isSimple = this.environment.isSimple, 7247 appendOnly = !this.forceBuffer, 7248 appendFirst = undefined, 7249 sourceSeen = undefined, 7250 bufferStart = undefined, 7251 bufferEnd = undefined; 7252 this.source.each(function (line) { 7253 if (line.appendToBuffer) { 7254 if (bufferStart) { 7255 line.prepend(' + '); 7256 } else { 7257 bufferStart = line; 7258 } 7259 bufferEnd = line; 7260 } else { 7261 if (bufferStart) { 7262 if (!sourceSeen) { 7263 appendFirst = true; 7264 } else { 7265 bufferStart.prepend('buffer += '); 7266 } 7267 bufferEnd.add(';'); 7268 bufferStart = bufferEnd = undefined; 7269 } 7270 7271 sourceSeen = true; 7272 if (!isSimple) { 7273 appendOnly = false; 7274 } 7275 } 7276 }); 7277 7278 if (appendOnly) { 7279 if (bufferStart) { 7280 bufferStart.prepend('return '); 7281 bufferEnd.add(';'); 7282 } else if (!sourceSeen) { 7283 this.source.push('return "";'); 7284 } 7285 } else { 7286 varDeclarations += ', buffer = ' + (appendFirst ? '' : this.initializeBuffer()); 7287 7288 if (bufferStart) { 7289 bufferStart.prepend('return buffer + '); 7290 bufferEnd.add(';'); 7291 } else { 7292 this.source.push('return buffer;'); 7293 } 7294 } 7295 7296 if (varDeclarations) { 7297 this.source.prepend('var ' + varDeclarations.substring(2) + (appendFirst ? '' : ';\n')); 7298 } 7299 7300 return this.source.merge(); 7301 }, 7302 7303 lookupPropertyFunctionVarDeclaration: function lookupPropertyFunctionVarDeclaration() { 7304 return '\n lookupProperty = container.lookupProperty || function(parent, propertyName) {\n if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {\n return parent[propertyName];\n }\n return undefined\n }\n '.trim(); 7305 }, 7306 7307 // [blockValue] 7308 // 7309 // On stack, before: hash, inverse, program, value 7310 // On stack, after: return value of blockHelperMissing 7311 // 7312 // The purpose of this opcode is to take a block of the form 7313 // `{{#this.foo}}...{{/this.foo}}`, resolve the value of `foo`, and 7314 // replace it on the stack with the result of properly 7315 // invoking blockHelperMissing. 7316 blockValue: function blockValue(name) { 7317 var blockHelperMissing = this.aliasable('container.hooks.blockHelperMissing'), 7318 params = [this.contextName(0)]; 7319 this.setupHelperArgs(name, 0, params); 7320 7321 var blockName = this.popStack(); 7322 params.splice(1, 0, blockName); 7323 7324 this.push(this.source.functionCall(blockHelperMissing, 'call', params)); 7325 }, 7326 7327 // [ambiguousBlockValue] 7328 // 7329 // On stack, before: hash, inverse, program, value 7330 // Compiler value, before: lastHelper=value of last found helper, if any 7331 // On stack, after, if no lastHelper: same as [blockValue] 7332 // On stack, after, if lastHelper: value 7333 ambiguousBlockValue: function ambiguousBlockValue() { 7334 // We're being a bit cheeky and reusing the options value from the prior exec 7335 var blockHelperMissing = this.aliasable('container.hooks.blockHelperMissing'), 7336 params = [this.contextName(0)]; 7337 this.setupHelperArgs('', 0, params, true); 7338 7339 this.flushInline(); 7340 7341 var current = this.topStack(); 7342 params.splice(1, 0, current); 7343 7344 this.pushSource(['if (!', this.lastHelper, ') { ', current, ' = ', this.source.functionCall(blockHelperMissing, 'call', params), '}']); 7345 }, 7346 7347 // [appendContent] 7348 // 7349 // On stack, before: ... 7350 // On stack, after: ... 7351 // 7352 // Appends the string value of `content` to the current buffer 7353 appendContent: function appendContent(content) { 7354 if (this.pendingContent) { 7355 content = this.pendingContent + content; 7356 } else { 7357 this.pendingLocation = this.source.currentLocation; 7358 } 7359 7360 this.pendingContent = content; 7361 }, 7362 7363 // [append] 7364 // 7365 // On stack, before: value, ... 7366 // On stack, after: ... 7367 // 7368 // Coerces `value` to a String and appends it to the current buffer. 7369 // 7370 // If `value` is truthy, or 0, it is coerced into a string and appended 7371 // Otherwise, the empty string is appended 7372 append: function append() { 7373 if (this.isInline()) { 7374 this.replaceStack(function (current) {
vendor: 13,784 bytes, lines 7375-7799
7375 return [' != null ? ', current, ' : ""']; 7376 }); 7377 7378 this.pushSource(this.appendToBuffer(this.popStack())); 7379 } else { 7380 var local = this.popStack(); 7381 this.pushSource(['if (', local, ' != null) { ', this.appendToBuffer(local, undefined, true), ' }']); 7382 if (this.environment.isSimple) { 7383 this.pushSource(['else { ', this.appendToBuffer("''", undefined, true), ' }']); 7384 } 7385 } 7386 }, 7387 7388 // [appendEscaped] 7389 // 7390 // On stack, before: value, ... 7391 // On stack, after: ... 7392 // 7393 // Escape `value` and append it to the buffer 7394 appendEscaped: function appendEscaped() { 7395 this.pushSource(this.appendToBuffer([this.aliasable('container.escapeExpression'), '(', this.popStack(), ')'])); 7396 }, 7397 7398 // [getContext] 7399 // 7400 // On stack, before: ... 7401 // On stack, after: ... 7402 // Compiler value, after: lastContext=depth 7403 // 7404 // Set the value of the `lastContext` compiler value to the depth 7405 getContext: function getContext(depth) { 7406 this.lastContext = depth; 7407 }, 7408 7409 // [pushContext] 7410 // 7411 // On stack, before: ... 7412 // On stack, after: currentContext, ... 7413 // 7414 // Pushes the value of the current context onto the stack. 7415 pushContext: function pushContext() { 7416 this.pushStackLiteral(this.contextName(this.lastContext)); 7417 }, 7418 7419 // [lookupOnContext] 7420 // 7421 // On stack, before: ... 7422 // On stack, after: currentContext[name], ... 7423 // 7424 // Looks up the value of `name` on the current context and pushes 7425 // it onto the stack. 7426 lookupOnContext: function lookupOnContext(parts, falsy, strict, scoped) { 7427 var i = 0; 7428 7429 if (!scoped && this.options.compat && !this.lastContext) { 7430 // The depthed query is expected to handle the undefined logic for the root level that 7431 // is implemented below, so we evaluate that directly in compat mode 7432 this.push(this.depthedLookup(parts[i++])); 7433 } else { 7434 this.pushContext(); 7435 } 7436 7437 this.resolvePath('context', parts, i, falsy, strict); 7438 }, 7439 7440 // [lookupBlockParam] 7441 // 7442 // On stack, before: ... 7443 // On stack, after: blockParam[name], ... 7444 // 7445 // Looks up the value of `parts` on the given block param and pushes 7446 // it onto the stack. 7447 lookupBlockParam: function lookupBlockParam(blockParamId, parts) { 7448 this.useBlockParams = true; 7449 7450 this.push(['blockParams[', blockParamId[0], '][', blockParamId[1], ']']); 7451 this.resolvePath('context', parts, 1); 7452 }, 7453 7454 // [lookupData] 7455 // 7456 // On stack, before: ... 7457 // On stack, after: data, ... 7458 // 7459 // Push the data lookup operator 7460 lookupData: function lookupData(depth, parts, strict) { 7461 if (!depth) { 7462 this.pushStackLiteral('data'); 7463 } else { 7464 this.pushStackLiteral('container.data(data, ' + depth + ')'); 7465 } 7466 7467 this.resolvePath('data', parts, 0, true, strict); 7468 }, 7469 7470 resolvePath: function resolvePath(type, parts, i, falsy, strict) { 7471 // istanbul ignore next 7472 7473 var _this2 = this; 7474 7475 if (this.options.strict || this.options.assumeObjects) { 7476 this.push(strictLookup(this.options.strict && strict, this, parts, i, type)); 7477 return; 7478 } 7479 7480 var len = parts.length; 7481 for (; i < len; i++) { 7482 /* eslint-disable no-loop-func */ 7483 this.replaceStack(function (current) { 7484 var lookup = _this2.nameLookup(current, parts[i], type); 7485 // We want to ensure that zero and false are handled properly if the context (falsy flag) 7486 // needs to have the special handling for these values. 7487 if (!falsy) { 7488 return [' != null ? ', lookup, ' : ', current]; 7489 } else { 7490 // Otherwise we can use generic falsy handling 7491 return [' && ', lookup]; 7492 } 7493 }); 7494 /* eslint-enable no-loop-func */ 7495 } 7496 }, 7497 7498 // [resolvePossibleLambda] 7499 // 7500 // On stack, before: value, ... 7501 // On stack, after: resolved value, ... 7502 // 7503 // If the `value` is a lambda, replace it on the stack by 7504 // the return value of the lambda 7505 resolvePossibleLambda: function resolvePossibleLambda() { 7506 this.push([this.aliasable('container.lambda'), '(', this.popStack(), ', ', this.contextName(0), ')']); 7507 }, 7508 7509 // [pushStringParam] 7510 // 7511 // On stack, before: ... 7512 // On stack, after: string, currentContext, ... 7513 // 7514 // This opcode is designed for use in string mode, which 7515 // provides the string value of a parameter along with its 7516 // depth rather than resolving it immediately. 7517 pushStringParam: function pushStringParam(string, type) { 7518 this.pushContext(); 7519 this.pushString(type); 7520 7521 // If it's a subexpression, the string result 7522 // will be pushed after this opcode. 7523 if (type !== 'SubExpression') { 7524 if (typeof string === 'string') { 7525 this.pushString(string); 7526 } else { 7527 this.pushStackLiteral(string); 7528 } 7529 } 7530 }, 7531 7532 emptyHash: function emptyHash(omitEmpty) { 7533 if (this.trackIds) { 7534 this.push('{}'); // hashIds 7535 } 7536 if (this.stringParams) { 7537 this.push('{}'); // hashContexts 7538 this.push('{}'); // hashTypes 7539 } 7540 this.pushStackLiteral(omitEmpty ? 'undefined' : '{}'); 7541 }, 7542 pushHash: function pushHash() { 7543 if (this.hash) { 7544 this.hashes.push(this.hash); 7545 } 7546 this.hash = { values: {}, types: [], contexts: [], ids: [] }; 7547 }, 7548 popHash: function popHash() { 7549 var hash = this.hash; 7550 this.hash = this.hashes.pop(); 7551 7552 if (this.trackIds) { 7553 this.push(this.objectLiteral(hash.ids)); 7554 } 7555 if (this.stringParams) { 7556 this.push(this.objectLiteral(hash.contexts)); 7557 this.push(this.objectLiteral(hash.types)); 7558 } 7559 7560 this.push(this.objectLiteral(hash.values)); 7561 }, 7562 7563 // [pushString] 7564 // 7565 // On stack, before: ... 7566 // On stack, after: quotedString(string), ... 7567 // 7568 // Push a quoted version of `string` onto the stack 7569 pushString: function pushString(string) { 7570 this.pushStackLiteral(this.quotedString(string)); 7571 }, 7572 7573 // [pushLiteral] 7574 // 7575 // On stack, before: ... 7576 // On stack, after: value, ... 7577 // 7578 // Pushes a value onto the stack. This operation prevents 7579 // the compiler from creating a temporary variable to hold 7580 // it. 7581 pushLiteral: function pushLiteral(value) { 7582 this.pushStackLiteral(value); 7583 }, 7584 7585 // [pushProgram] 7586 // 7587 // On stack, before: ... 7588 // On stack, after: program(guid), ... 7589 // 7590 // Push a program expression onto the stack. This takes 7591 // a compile-time guid and converts it into a runtime-accessible 7592 // expression. 7593 pushProgram: function pushProgram(guid) { 7594 if (guid != null) { 7595 this.pushStackLiteral(this.programExpression(guid)); 7596 } else { 7597 this.pushStackLiteral(null); 7598 } 7599 }, 7600 7601 // [registerDecorator] 7602 // 7603 // On stack, before: hash, program, params..., ... 7604 // On stack, after: ... 7605 // 7606 // Pops off the decorator's parameters, invokes the decorator, 7607 // and inserts the decorator into the decorators list. 7608 registerDecorator: function registerDecorator(paramSize, name) { 7609 var foundDecorator = this.nameLookup('decorators', name, 'decorator'), 7610 options = this.setupHelperArgs(name, paramSize); 7611 7612 this.decorators.push(['fn = ', this.decorators.functionCall(foundDecorator, '', ['fn', 'props', 'container', options]), ' || fn;']); 7613 }, 7614 7615 // [invokeHelper] 7616 // 7617 // On stack, before: hash, inverse, program, params..., ... 7618 // On stack, after: result of helper invocation 7619 // 7620 // Pops off the helper's parameters, invokes the helper, 7621 // and pushes the helper's return value onto the stack. 7622 // 7623 // If the helper is not found, `helperMissing` is called. 7624 invokeHelper: function invokeHelper(paramSize, name, isSimple) { 7625 var nonHelper = this.popStack(), 7626 helper = this.setupHelper(paramSize, name); 7627 7628 var possibleFunctionCalls = []; 7629 7630 if (isSimple) { 7631 // direct call to helper 7632 possibleFunctionCalls.push(helper.name); 7633 } 7634 // call a function from the input object 7635 possibleFunctionCalls.push(nonHelper); 7636 if (!this.options.strict) { 7637 possibleFunctionCalls.push(this.aliasable('container.hooks.helperMissing')); 7638 } 7639 7640 var functionLookupCode = ['(', this.itemsSeparatedBy(possibleFunctionCalls, '||'), ')']; 7641 var functionCall = this.source.functionCall(functionLookupCode, 'call', helper.callParams); 7642 this.push(functionCall); 7643 }, 7644 7645 itemsSeparatedBy: function itemsSeparatedBy(items, separator) { 7646 var result = []; 7647 result.push(items[0]); 7648 for (var i = 1; i < items.length; i++) { 7649 result.push(separator, items[i]); 7650 } 7651 return result; 7652 }, 7653 // [invokeKnownHelper] 7654 // 7655 // On stack, before: hash, inverse, program, params..., ... 7656 // On stack, after: result of helper invocation 7657 // 7658 // This operation is used when the helper is known to exist, 7659 // so a `helperMissing` fallback is not required. 7660 invokeKnownHelper: function invokeKnownHelper(paramSize, name) { 7661 var helper = this.setupHelper(paramSize, name); 7662 this.push(this.source.functionCall(helper.name, 'call', helper.callParams)); 7663 }, 7664 7665 // [invokeAmbiguous] 7666 // 7667 // On stack, before: hash, inverse, program, params..., ... 7668 // On stack, after: result of disambiguation 7669 // 7670 // This operation is used when an expression like `{{foo}}` 7671 // is provided, but we don't know at compile-time whether it 7672 // is a helper or a path. 7673 // 7674 // This operation emits more code than the other options, 7675 // and can be avoided by passing the `knownHelpers` and 7676 // `knownHelpersOnly` flags at compile-time. 7677 invokeAmbiguous: function invokeAmbiguous(name, helperCall) { 7678 this.useRegister('helper'); 7679 7680 var nonHelper = this.popStack(); 7681 7682 this.emptyHash(); 7683 var helper = this.setupHelper(0, name, helperCall); 7684 7685 var helperName = this.lastHelper = this.nameLookup('helpers', name, 'helper'); 7686 7687 var lookup = ['(', '(helper = ', helperName, ' || ', nonHelper, ')']; 7688 if (!this.options.strict) { 7689 lookup[0] = '(helper = '; 7690 lookup.push(' != null ? helper : ', this.aliasable('container.hooks.helperMissing')); 7691 } 7692 7693 this.push(['(', lookup, helper.paramsInit ? ['),(', helper.paramsInit] : [], '),', '(typeof helper === ', this.aliasable('"function"'), ' ? ', this.source.functionCall('helper', 'call', helper.callParams), ' : helper))']); 7694 }, 7695 7696 // [invokePartial] 7697 // 7698 // On stack, before: context, ... 7699 // On stack after: result of partial invocation 7700 // 7701 // This operation pops off a context, invokes a partial with that context, 7702 // and pushes the result of the invocation back. 7703 invokePartial: function invokePartial(isDynamic, name, indent) { 7704 var params = [], 7705 options = this.setupParams(name, 1, params); 7706 7707 if (isDynamic) { 7708 name = this.popStack(); 7709 delete options.name; 7710 } 7711 7712 if (indent) { 7713 options.indent = JSON.stringify(indent); 7714 } 7715 options.helpers = 'helpers'; 7716 options.partials = 'partials'; 7717 options.decorators = 'container.decorators'; 7718 7719 if (!isDynamic) { 7720 params.unshift(this.nameLookup('partials', name, 'partial')); 7721 } else { 7722 params.unshift(name); 7723 } 7724 7725 if (this.options.compat) { 7726 options.depths = 'depths'; 7727 } 7728 options = this.objectLiteral(options); 7729 params.push(options); 7730 7731 this.push(this.source.functionCall('container.invokePartial', '', params)); 7732 }, 7733 7734 // [assignToHash] 7735 // 7736 // On stack, before: value, ..., hash, ... 7737 // On stack, after: ..., hash, ... 7738 // 7739 // Pops a value off the stack and assigns it to the current hash 7740 assignToHash: function assignToHash(key) { 7741 var value = this.popStack(), 7742 context = undefined, 7743 type = undefined, 7744 id = undefined; 7745 7746 if (this.trackIds) { 7747 id = this.popStack(); 7748 } 7749 if (this.stringParams) { 7750 type = this.popStack(); 7751 context = this.popStack(); 7752 } 7753 7754 var hash = this.hash; 7755 if (context) { 7756 hash.contexts[key] = context; 7757 } 7758 if (type) { 7759 hash.types[key] = type; 7760 } 7761 if (id) { 7762 hash.ids[key] = id; 7763 } 7764 hash.values[key] = value; 7765 }, 7766 7767 pushId: function pushId(type, name, child) { 7768 if (type === 'BlockParam') { 7769 this.pushStackLiteral('blockParams[' + name[0] + '].path[' + name[1] + ']' + (child ? ' + ' + JSON.stringify('.' + child) : '')); 7770 } else if (type === 'PathExpression') { 7771 this.pushString(name); 7772 } else if (type === 'SubExpression') { 7773 this.pushStackLiteral('true'); 7774 } else { 7775 this.pushStackLiteral('null'); 7776 } 7777 }, 7778 7779 // HELPERS 7780 7781 compiler: JavaScriptCompiler, 7782 7783 compileChildren: function compileChildren(environment, options) { 7784 var children = environment.children, 7785 child = undefined, 7786 compiler = undefined; 7787 7788 for (var i = 0, l = children.length; i < l; i++) { 7789 child = children[i]; 7790 compiler = new this.compiler(); // eslint-disable-line new-cap 7791 7792 var existing = this.matchExistingProgram(child); 7793 7794 if (existing == null) { 7795 this.context.programs.push(''); // Placeholder to prevent name conflicts for nested children 7796 var index = this.context.programs.length; 7797 child.index = index; 7798 child.name = 'program' + index; 7799 this.context.programs[index] = compiler.compile(child, options, this.context, !this.prec
vendor: 9,414 bytes, lines 7799-8111
7799ompile); 7800 this.context.decorators[index] = compiler.decorators; 7801 this.context.environments[index] = child; 7802 7803 this.useDepths = this.useDepths || compiler.useDepths; 7804 this.useBlockParams = this.useBlockParams || compiler.useBlockParams; 7805 child.useDepths = this.useDepths; 7806 child.useBlockParams = this.useBlockParams; 7807 } else { 7808 child.index = existing.index; 7809 child.name = 'program' + existing.index; 7810 7811 this.useDepths = this.useDepths || existing.useDepths; 7812 this.useBlockParams = this.useBlockParams || existing.useBlockParams; 7813 } 7814 } 7815 }, 7816 matchExistingProgram: function matchExistingProgram(child) { 7817 for (var i = 0, len = this.context.environments.length; i < len; i++) { 7818 var environment = this.context.environments[i]; 7819 if (environment && environment.equals(child)) { 7820 return environment; 7821 } 7822 } 7823 }, 7824 7825 programExpression: function programExpression(guid) { 7826 var child = this.environment.children[guid], 7827 programParams = [child.index, 'data', child.blockParams]; 7828 7829 if (this.useBlockParams || this.useDepths) { 7830 programParams.push('blockParams'); 7831 } 7832 if (this.useDepths) { 7833 programParams.push('depths'); 7834 } 7835 7836 return 'container.program(' + programParams.join(', ') + ')'; 7837 }, 7838 7839 useRegister: function useRegister(name) { 7840 if (!this.registers[name]) { 7841 this.registers[name] = true; 7842 this.registers.list.push(name); 7843 } 7844 }, 7845 7846 push: function push(expr) { 7847 if (!(expr instanceof Literal)) { 7848 expr = this.source.wrap(expr); 7849 } 7850 7851 this.inlineStack.push(expr); 7852 return expr; 7853 }, 7854 7855 pushStackLiteral: function pushStackLiteral(item) { 7856 this.push(new Literal(item)); 7857 }, 7858 7859 pushSource: function pushSource(source) { 7860 if (this.pendingContent) { 7861 this.source.push(this.appendToBuffer(this.source.quotedString(this.pendingContent), this.pendingLocation)); 7862 this.pendingContent = undefined; 7863 } 7864 7865 if (source) { 7866 this.source.push(source); 7867 } 7868 }, 7869 7870 replaceStack: function replaceStack(callback) { 7871 var prefix = ['('], 7872 stack = undefined, 7873 createdStack = undefined, 7874 usedLiteral = undefined; 7875 7876 /* istanbul ignore next */ 7877 if (!this.isInline()) { 7878 throw new _exception2['default']('replaceStack on non-inline'); 7879 } 7880 7881 // We want to merge the inline statement into the replacement statement via ',' 7882 var top = this.popStack(true); 7883 7884 if (top instanceof Literal) { 7885 // Literals do not need to be inlined 7886 stack = [top.value]; 7887 prefix = ['(', stack]; 7888 usedLiteral = true; 7889 } else { 7890 // Get or create the current stack name for use by the inline 7891 createdStack = true; 7892 var _name = this.incrStack(); 7893 7894 prefix = ['((', this.push(_name), ' = ', top, ')']; 7895 stack = this.topStack(); 7896 } 7897 7898 var item = callback.call(this, stack); 7899 7900 if (!usedLiteral) { 7901 this.popStack(); 7902 } 7903 if (createdStack) { 7904 this.stackSlot--; 7905 } 7906 this.push(prefix.concat(item, ')')); 7907 }, 7908 7909 incrStack: function incrStack() { 7910 this.stackSlot++; 7911 if (this.stackSlot > this.stackVars.length) { 7912 this.stackVars.push('stack' + this.stackSlot); 7913 } 7914 return this.topStackName(); 7915 }, 7916 topStackName: function topStackName() { 7917 return 'stack' + this.stackSlot; 7918 }, 7919 flushInline: function flushInline() { 7920 var inlineStack = this.inlineStack; 7921 this.inlineStack = []; 7922 for (var i = 0, len = inlineStack.length; i < len; i++) { 7923 var entry = inlineStack[i]; 7924 /* istanbul ignore if */ 7925 if (entry instanceof Literal) { 7926 this.compileStack.push(entry); 7927 } else { 7928 var stack = this.incrStack(); 7929 this.pushSource([stack, ' = ', entry, ';']); 7930 this.compileStack.push(stack); 7931 } 7932 } 7933 }, 7934 isInline: function isInline() { 7935 return this.inlineStack.length; 7936 }, 7937 7938 popStack: function popStack(wrapped) { 7939 var inline = this.isInline(), 7940 item = (inline ? this.inlineStack : this.compileStack).pop(); 7941 7942 if (!wrapped && item instanceof Literal) { 7943 return item.value; 7944 } else { 7945 if (!inline) { 7946 /* istanbul ignore next */ 7947 if (!this.stackSlot) { 7948 throw new _exception2['default']('Invalid stack pop'); 7949 } 7950 this.stackSlot--; 7951 } 7952 return item; 7953 } 7954 }, 7955 7956 topStack: function topStack() { 7957 var stack = this.isInline() ? this.inlineStack : this.compileStack, 7958 item = stack[stack.length - 1]; 7959 7960 /* istanbul ignore if */ 7961 if (item instanceof Literal) { 7962 return item.value; 7963 } else { 7964 return item; 7965 } 7966 }, 7967 7968 contextName: function contextName(context) { 7969 if (this.useDepths && context) { 7970 return 'depths[' + context + ']'; 7971 } else { 7972 return 'depth' + context; 7973 } 7974 }, 7975 7976 quotedString: function quotedString(str) { 7977 return this.source.quotedString(str); 7978 }, 7979 7980 objectLiteral: function objectLiteral(obj) { 7981 return this.source.objectLiteral(obj); 7982 }, 7983 7984 aliasable: function aliasable(name) { 7985 var ret = this.aliases[name]; 7986 if (ret) { 7987 ret.referenceCount++; 7988 return ret; 7989 } 7990 7991 ret = this.aliases[name] = this.source.wrap(name); 7992 ret.aliasable = true; 7993 ret.referenceCount = 1; 7994 7995 return ret; 7996 }, 7997 7998 setupHelper: function setupHelper(paramSize, name, blockHelper) { 7999 var params = [], 8000 paramsInit = this.setupHelperArgs(name, paramSize, params, blockHelper); 8001 var foundHelper = this.nameLookup('helpers', name, 'helper'), 8002 callContext = this.aliasable(this.contextName(0) + ' != null ? ' + this.contextName(0) + ' : (container.nullContext || {})'); 8003 8004 return { 8005 params: params, 8006 paramsInit: paramsInit, 8007 name: foundHelper, 8008 callParams: [callContext].concat(params) 8009 }; 8010 }, 8011 8012 setupParams: function setupParams(helper, paramSize, params) { 8013 var options = {}, 8014 contexts = [], 8015 types = [], 8016 ids = [], 8017 objectArgs = !params, 8018 param = undefined; 8019 8020 if (objectArgs) { 8021 params = []; 8022 } 8023 8024 options.name = this.quotedString(helper); 8025 options.hash = this.popStack(); 8026 8027 if (this.trackIds) { 8028 options.hashIds = this.popStack(); 8029 } 8030 if (this.stringParams) { 8031 options.hashTypes = this.popStack(); 8032 options.hashContexts = this.popStack(); 8033 } 8034 8035 var inverse = this.popStack(), 8036 program = this.popStack(); 8037 8038 // Avoid setting fn and inverse if neither are set. This allows 8039 // helpers to do a check for `if (options.fn)` 8040 if (program || inverse) { 8041 options.fn = program || 'container.noop'; 8042 options.inverse = inverse || 'container.noop'; 8043 } 8044 8045 // The parameters go on to the stack in order (making sure that they are evaluated in order) 8046 // so we need to pop them off the stack in reverse order 8047 var i = paramSize; 8048 while (i--) { 8049 param = this.popStack(); 8050 params[i] = param; 8051 8052 if (this.trackIds) { 8053 ids[i] = this.popStack(); 8054 } 8055 if (this.stringParams) { 8056 types[i] = this.popStack(); 8057 contexts[i] = this.popStack(); 8058 } 8059 } 8060 8061 if (objectArgs) { 8062 options.args = this.source.generateArray(params); 8063 } 8064 8065 if (this.trackIds) { 8066 options.ids = this.source.generateArray(ids); 8067 } 8068 if (this.stringParams) { 8069 options.types = this.source.generateArray(types); 8070 options.contexts = this.source.generateArray(contexts); 8071 } 8072 8073 if (this.options.data) { 8074 options.data = 'data'; 8075 } 8076 if (this.useBlockParams) { 8077 options.blockParams = 'blockParams'; 8078 } 8079 return options; 8080 }, 8081 8082 setupHelperArgs: function setupHelperArgs(helper, paramSize, params, useRegister) { 8083 var options = this.setupParams(helper, paramSize, params); 8084 options.loc = JSON.stringify(this.source.currentLocation); 8085 options = this.objectLiteral(options); 8086 if (useRegister) { 8087 this.useRegister('options'); 8088 params.push('options'); 8089 return ['options=', options]; 8090 } else if (params) { 8091 params.push(options); 8092 return ''; 8093 } else { 8094 return options; 8095 } 8096 } 8097 }; 8098 8099 (function () { 8100 var reservedWords = ('break else new var' + ' case finally return void' + ' catch for switch while' + ' continue function this with' + ' default if throw' + ' delete in try' + ' do instanceof typeof' + ' abstract enum int short' + ' boolean export interface static' + ' byte extends long super' + ' char final native synchronized' + ' class float package throws' + ' const goto private transient' + ' debugger implements protected volatile' + ' double import public let yield await' + ' null true false').split(' '); 8101 8102 var compilerWords = JavaScriptCompiler.RESERVED_WORDS = {}; 8103 8104 for (var i = 0, l = reservedWords.length; i < l; i++) { 8105 compilerWords[reservedWords[i]] = true; 8106 } 8107 })(); 8108 8109 /** 8110 * @deprecated May be removed in the next major version 8111 */
8112 JavaScriptCompiler.isValidJavaScriptVariableName = function (name) { 8113 return !JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(name); 8114 }; 8115 8116 function strictLookup(requireTerminal, compiler, parts, i, type) { 8117 var stack = compiler.popStack(), 8118 len = parts.length; 8119 if (requireTerminal) { 8120 len--; 8121 } 8122 8123 for (; i < len; i++) { 8124 stack = compiler.nameLookup(stack, parts[i], type); 8125 } 8126 8127 if (requireTerminal) { 8128 return [compiler.aliasable('container.strict'), '(', stack, ', ', compiler.quotedString(parts[i]), ', ', JSON.stringify(compiler.source.currentLocation), ' )']; 8129 } else { 8130 return stack; 8131 } 8132 } 8133 8134 exports$1['default'] = JavaScriptCompiler; 8135 module.exports = exports$1['default']; 8136 8137 } (javascriptCompiler, javascriptCompiler.exports)); 8138 return javascriptCompiler.exports; 8139} 8140 8141var hasRequiredHandlebars; 8142 8143function requireHandlebars () { 8144 if (hasRequiredHandlebars) return handlebars.exports; 8145 hasRequiredHandlebars = 1; 8146 (function (module, exports$1) { 8147 8148 exports$1.__esModule = true; 8149 // istanbul ignore next 8150 8151 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 8152 8153 var _handlebarsRuntime = requireHandlebars_runtime(); 8154 8155 var _handlebarsRuntime2 = _interopRequireDefault(_handlebarsRuntime); 8156 8157 // Compiler imports 8158 8159 var _handlebarsCompilerAst = requireAst(); 8160 8161 var _handlebarsCompilerAst2 = _interopRequireDefault(_handlebarsCompilerAst); 8162 8163 var _handlebarsCompilerBase = requireBase(); 8164 8165 var _handlebarsCompilerCompiler = requireCompiler(); 8166 8167 var _handlebarsCompilerJavascriptCompiler = requireJavascriptCompiler(); 8168 8169 var _handlebarsCompilerJavascriptCompiler2 = _interopRequireDefault(_handlebarsCompilerJavascriptCompiler); 8170 8171 var _handlebarsCompilerVisitor = requireVisitor(); 8172 8173 var _handlebarsCompilerVisitor2 = _interopRequireDefault(_handlebarsCompilerVisitor); 8174 8175 var _handlebarsNoConflict = requireNoConflict(); 8176 8177 var _handlebarsNoConflict2 = _interopRequireDefault(_handlebarsNoConflict); 8178 8179 var _create = _handlebarsRuntime2['default'].create; 8180 function create() { 8181 var hb = _create(); 8182 8183 hb.compile = function (input, options) { 8184 return _handlebarsCompilerCompiler.compile(input, options, hb); 8185 }; 8186 hb.precompile = function (input, options) { 8187 return _handlebarsCompilerCompiler.precompile(input, options, hb); 8188 }; 8189 8190 hb.AST = _handlebarsCompilerAst2['default']; 8191 hb.Compiler = _handlebarsCompilerCompiler.Compiler; 8192 hb.JavaScriptCompiler = _handlebarsCompilerJavascriptCompiler2['default']; 8193 hb.Parser = _handlebarsCompilerBase.parser; 8194 hb.parse = _handlebarsCompilerBase.parse; 8195 hb.parseWithoutProcessing = _handlebarsCompilerBase.parseWithoutProcessing; 8196 8197 return hb; 8198 } 8199 8200 var inst = create(); 8201 inst.create = create; 8202 8203 _handlebarsNoConflict2['default'](inst); 8204 8205 inst.Visitor = _handlebarsCompilerVisitor2['default']; 8206 8207 inst['default'] = inst; 8208 8209 exports$1['default'] = inst; 8210 module.exports = exports$1['default']; 8211 8212 } (handlebars, handlebars.exports)); 8213 return handlebars.exports; 8214} 8215 8216var handlebarsExports = requireHandlebars(); 8217const Handlebars = /*@__PURE__*/getDefaultExportFromCjs(handlebarsExports); 8218 8219var root_1 = from_html(`<div class="error-container svelte-26mp0t"><strong class="error-title svelte-26mp0t">Error rendering <code class="error-component-name svelte-26mp0t"> </code>:</strong> <code class="error-message svelte-26mp0t"> </code></div>`); 8220var root_3 = from_html(`<div></div> <!> <div></div>`, 1); 8221var root_2 = from_html(`<div><!></div>`); 8222 8223function HTML($$anchor, $$props) { 8224 push($$props, true); 8225 8226 let elem_classes = prop($$props, 'elem_classes', 19, () => []), 8227 props = prop($$props, 'props', 23, () => ({})), 8228 html_template = prop($$props, 'html_template', 3, "${value}"), 8229 css_template = prop($$props, 'css_template', 3, ""), 8230 js_on_load = prop($$props, 'js_on_load', 3, null), 8231 head = prop($$props, 'head', 3, null), 8232 visible = prop($$props, 'visible', 3, true), 8233 autoscroll = prop($$props, 'autoscroll', 3, false), 8234 apply_default_css = prop($$props, 'apply_default_css', 3, true), 8235 component_class_name = prop($$props, 'component_class_name', 3, "HTML"), 8236 upload = prop($$props, 'upload', 3, null), 8237 server = prop($$props, 'server', 19, () => ({})), 8238 watch_fn = prop($$props, 'watch_fn', 3, (_propOrProps, _callback) => {}), 8239 fire_watchers = prop($$props, 'fire_watchers', 3, (_changedKeys) => {}); 8240 8241 let $$d = user_derived(() => { 8242 if (html_template().includes("@children") && $$props.children) { 8243 const parts = html_template().split("@children"); 8244 8245 return [true, parts[0] || "", parts.slice(1).join("@children") || ""]; 8246 } 8247 8248 return [false, html_template(), ""]; 8249 }), 8250 $$array = user_derived(() => to_array(get($$d), 3)), 8251 has_children = user_derived(() => get($$array)[0]), 8252 pre_html_template = user_derived(() => get($$array)[1]), 8253 post_html_template = user_derived(() => get($$array)[2]); 8254 8255 let old_props = state(proxy(snapshot(props()))); 8256 const dispatch = createEventDispatcher(); 8257 8258 const trigger = (event_type, event_data = {}) => { 8259 dispatch("event", { type: event_type, data: event_data }); 8260 }; 8261 8262 let element; 8263 let pre_element; 8264 let post_element; 8265 let scrollable_parent = null; 8266 let random_id = `html-${Math.random().toString(36).substring(2, 11)}`; 8267 let style_element = null; 8268 let reactiveProps = {}; 8269 let currentHtml = state(""); 8270 let currentPreHtml = state(""); 8271 let currentPostHtml = state(""); 8272 let currentCss = state(""); 8273 let renderScheduled = state(false); 8274 let mounted = state(false); 8275 let html_error_message = state(null); 8276 let css_error_message = state(null); 8277 8278 function get_scrollable_parent(element) { 8279 let parent = element.parentElement; 8280 8281 while (parent) { 8282 const style = window.getComputedStyle(parent); 8283 8284 if (style.overflow === "auto" || style.overflow === "scroll" || style.overflowY === "auto" || style.overflowY === "scroll") { 8285 return parent; 8286 } 8287 8288 parent = parent.parentElement; 8289 } 8290 8291 return null; 8292 } 8293 8294 function is_at_bottom() { 8295 if (!element) return true; 8296 8297 if (!scrollable_parent) { 8298 return window.innerHeight + window.scrollY >= document.documentElement.scrollHeight - 100; 8299 } 8300 8301 return scrollable_parent.offsetHeight + scrollable_parent.scrollTop >= scrollable_parent.scrollHeight - 100; 8302 } 8303 8304 function scroll_to_bottom() { 8305 if (!element) return; 8306 8307 if (scrollable_parent) { 8308 scrollable_parent.scrollTo(0, scrollable_parent.scrollHeight); 8309 } else { 8310 window.scrollTo(0, document.documentElement.scrollHeight); 8311 } 8312 } 8313 8314 async function scroll_on_html_update() { 8315 if (!autoscroll() || !element) return; 8316 8317 if (!scrollable_parent) { 8318 scrollable_parent = get_scrollable_parent(element); 8319 } 8320 8321 if (is_at_bottom()) { 8322 await new Promise((resolve) => setTimeout(resolve, 300)); 8323 scroll_to_bottom(); 8324 } 8325 } 8326 8327 function render_template(template, props, language = "html") { 8328 try { 8329 const handlebarsTemplate = Handlebars.compile(template); 8330 const handlebarsRendered = handlebarsTemplate(props); 8331 const propKeys = Object.keys(props); 8332 const propValues = Object.values(props); 8333 const templateFunc = new Function(...propKeys, `return \`${handlebarsRendered}\`;`); 8334 8335 if (language === "html") { 8336 set(html_error_message, null); 8337 } else if (language === "css") { 8338 set(css_error_message, null); 8339 } 8340 8341 return templateFunc(...propValues); 8342 } catch(e) { 8343 console.error("Error evaluating template:", e); 8344 8345 if (language === "html") {
8346 set(html_error_message, e instanceof Error ? e.message : String(e), true); 8347 } else if (language === "css") { 8348 set(css_error_message, e instanceof Error ? e.message : String(e), true); 8349 } 8350 8351 return ""; 8352 } 8353 } 8354 8355 function update_css() { 8356 if (typeof document === "undefined") return; 8357 8358 if (!style_element) { 8359 style_element = document.createElement("style"); 8360 document.head.appendChild(style_element); 8361 } 8362 8363 set(currentCss, render_template(css_template(), reactiveProps, "css"), true); 8364 8365 if (get(currentCss)) { 8366 style_element.textContent = `#${random_id} { ${get(currentCss)} }`; 8367 } else { 8368 style_element.textContent = ""; 8369 } 8370 } 8371 8372 function updateDOM(_element, oldHtml, newHtml) { 8373 if (!_element || oldHtml === newHtml) return; 8374 8375 const tempContainer = document.createElement("div"); 8376 8377 tempContainer.innerHTML = newHtml; 8378 8379 const oldNodes = Array.from(_element.childNodes); 8380 const newNodes = Array.from(tempContainer.childNodes); 8381 const maxLength = Math.max(oldNodes.length, newNodes.length); 8382 8383 for (let i = 0; i < maxLength; i++) { 8384 const oldNode = oldNodes[i]; 8385 const newNode = newNodes[i]; 8386 8387 if (!oldNode && newNode) { 8388 _element.appendChild(newNode.cloneNode(true)); 8389 } else if (oldNode && !newNode) { 8390 _element.removeChild(oldNode); 8391 } else if (oldNode && newNode) { 8392 updateNode(oldNode, newNode); 8393 } 8394 } 8395 } 8396 8397 // eslint-disable-next-line complexity 8398 function updateNode(oldNode, newNode) { 8399 if (oldNode.nodeType === Node.TEXT_NODE && newNode.nodeType === Node.TEXT_NODE) { 8400 if (oldNode.textContent !== newNode.textContent) { 8401 oldNode.textContent = newNode.textContent; 8402 } 8403 8404 return; 8405 } 8406 8407 if (oldNode.nodeType === Node.ELEMENT_NODE && newNode.nodeType === Node.ELEMENT_NODE) { 8408 const oldElement = oldNode; 8409 const newElement = newNode; 8410 8411 if (oldElement.tagName !== newElement.tagName) { 8412 oldNode.parentNode?.replaceChild(newNode.cloneNode(true), oldNode); 8413 8414 return; 8415 } 8416 8417 const oldAttrs = Array.from(oldElement.attributes); 8418 const newAttrs = Array.from(newElement.attributes); 8419 8420 for (const attr of oldAttrs) { 8421 if (!newElement.hasAttribute(attr.name)) { 8422 oldElement.removeAttribute(attr.name); 8423 } 8424 } 8425 8426 for (const attr of newAttrs) { 8427 if (oldElement.getAttribute(attr.name) !== attr.value) { 8428 oldElement.setAttribute(attr.name, attr.value); 8429 8430 if (attr.name === "value" && (oldElement.tagName === "INPUT" || oldElement.tagName === "TEXTAREA" || oldElement.tagName === "SELECT")) { 8431 oldElement.value = attr.value; 8432 } 8433 } 8434 } 8435 8436 const oldChildren = Array.from(oldElement.childNodes); 8437 const newChildren = Array.from(newElement.childNodes); 8438 const maxChildren = Math.max(oldChildren.length, newChildren.length); 8439 8440 for (let i = 0; i < maxChildren; i++) { 8441 const oldChild = oldChildren[i]; 8442 const newChild = newChildren[i]; 8443 8444 if (!oldChild && newChild) { 8445 oldElement.appendChild(newChild.cloneNode(true)); 8446 } else if (oldChild && !newChild) { 8447 oldElement.removeChild(oldChild); 8448 } else if (oldChild && newChild) { 8449 updateNode(oldChild, newChild); 8450 } 8451 } 8452 } else { 8453 oldNode.parentNode?.replaceChild(newNode.cloneNode(true), oldNode); 8454 } 8455 } 8456 8457 function renderHTML() { 8458 if (get(has_children)) { 8459 const newPreHtml = render_template(get(pre_html_template), reactiveProps, "html"); 8460 8461 updateDOM(pre_element, get(currentPreHtml), newPreHtml); 8462 set(currentPreHtml, newPreHtml, true); 8463 8464 const newPostHtml = render_template(get(post_html_template), reactiveProps, "html"); 8465 8466 updateDOM(post_element, get(currentPostHtml), newPostHtml); 8467 set(currentPostHtml, newPostHtml, true); 8468 } else { 8469 const newHtml = render_template(html_template(), reactiveProps, "html"); 8470 8471 updateDOM(element, get(currentHtml), newHtml); 8472 set(currentHtml, newHtml, true); 8473 } 8474 8475 if (autoscroll()) { 8476 scroll_on_html_update(); 8477 } 8478 } 8479 8480 function scheduleRender() { 8481 if (!get(renderScheduled)) { 8482 set(renderScheduled, true); 8483 8484 queueMicrotask(() => { 8485 set(renderScheduled, false); 8486 renderHTML(); 8487 update_css(); 8488 }); 8489 } 8490 } 8491 8492 async function loadHead(headHtml) { 8493 if (!headHtml) return; 8494 8495 const parser = new DOMParser(); 8496 const doc = parser.parseFromString(`<head>${headHtml}</head>`, "text/html");
8497 const promises = []; 8498 8499 for (const el of Array.from(doc.head.children)) { 8500 if (el.tagName === "SCRIPT") { 8501 const src = el.src; 8502 8503 if (src) { 8504 if (document.querySelector(`script[src="${src}"]`)) continue; 8505 8506 const script = document.createElement("script"); 8507 8508 script.src = src; 8509 8510 promises.push(new Promise((resolve, reject) => { 8511 script.onload = () => resolve(); 8512 script.onerror = () => reject(new Error(`Failed to load script: ${src}`)); 8513 })); 8514 8515 document.head.appendChild(script); 8516 } else { 8517 const script = document.createElement("script"); 8518 8519 script.textContent = el.textContent; 8520 document.head.appendChild(script); 8521 } 8522 } else { 8523 const existing = el.tagName === "LINK" && el.href 8524 ? document.querySelector(`link[href="${el.href}"]`) 8525 : null; 8526 8527 if (!existing) { 8528 document.head.appendChild(el.cloneNode(true)); 8529 } 8530 } 8531 } 8532 8533 await Promise.all(promises); 8534 } 8535 8536 // Mount effect 8537 user_effect(() => { 8538 if (!element || get(mounted)) return; 8539 8540 set(mounted, true); 8541 8542 reactiveProps = new Proxy(snapshot(props()), { 8543 set(target, property, value) { 8544 const oldValue = target[property]; 8545 8546 target[property] = value; 8547 8548 if (oldValue !== value) { 8549 scheduleRender(); 8550 8551 if (property === "value" || property === "label" || property === "visible") { 8552 props()[property] = value; 8553 get(old_props)[property] = value; 8554 dispatch("update_value", { data: value, property }); 8555 } 8556 } 8557 8558 return true; 8559 } 8560 }); 8561 8562 if (get(has_children)) { 8563 set(currentPreHtml, render_template(get(pre_html_template), reactiveProps, "html"), true); 8564 pre_element.innerHTML = get(currentPreHtml); 8565 set(currentPostHtml, render_template(get(post_html_template), reactiveProps, "html"), true); 8566 post_element.innerHTML = get(currentPostHtml); 8567 } else { 8568 set(currentHtml, render_template(html_template(), reactiveProps, "html"), true); 8569 element.innerHTML = get(currentHtml); 8570 } 8571 8572 update_css(); 8573 8574 if (autoscroll()) { 8575 scroll_to_bottom(); 8576 } 8577 8578 scroll_on_html_update(); 8579 8580 (async () => { 8581 if (head()) { 8582 await loadHead(head()); 8583 } 8584 8585 if (js_on_load() && element) { 8586 try { 8587 const upload_func = upload() ?? (async (_file) => { 8588 throw new Error("upload is not available in this context"); 8589 }); 8590 8591 const func = new Function("element", "trigger", "props", "server", "upload", "watch", js_on_load()); 8592 8593 func(element, trigger, reactiveProps, server(), upload_func, watch_fn()); 8594 } catch(error) { 8595 console.error("Error executing js_on_load:", error); 8596 } 8597 } 8598 })(); 8599 }); 8600 8601 user_effect(() => { 8602 if (reactiveProps && props() && JSON.stringify(get(old_props)) !== JSON.stringify(props())) { 8603 const changedKeys = []; 8604 8605 for (const key in props()) { 8606 if (JSON.stringify(reactiveProps[key]) !== JSON.stringify(props()[key])) { 8607 changedKeys.push(key); 8608 } 8609 8610 reactiveProps[key] = snapshot(props()[key]); 8611 } 8612 8613 set(old_props, props(), true); 8614 8615 if (changedKeys.length > 0) { 8616 queueMicrotask(() => fire_watchers()(changedKeys)); 8617 } 8618 } 8619 }); 8620 8621 var fragment = comment(); 8622 var node = first_child(fragment); 8623 8624 { 8625 var consequent = ($$anchor) => { 8626 var div = root_1(); 8627 var strong = child(div); 8628 var code = sibling(child(strong)); 8629 var text = child(code, true); 8630 8631 reset(code); 8632 next(); 8633 reset(strong); 8634 8635 var code_1 = sibling(strong, 2); 8636 var text_1 = child(code_1, true); 8637 8638 reset(code_1); 8639 reset(div); 8640 8641 template_effect(() => { 8642 set_text(text, component_class_name()); 8643 set_text(text_1, get(html_error_message) || get(css_error_message)); 8644 }); 8645 8646 append($$anchor, div); 8647 }; 8648 8649 var alternate = ($$anchor) => { 8650 var div_1 = root_2(); 8651 let classes; 8652 var node_1 = child(div_1); 8653 8654 { 8655 var consequent_1 = ($$anchor) => { 8656 var fragment_1 = root_3(); 8657 var div_2 = first_child(fragment_1); 8658 8659 bind_this(div_2, ($$value) => pre_element = $$value, () => pre_element); 8660 8661 var node_2 = sibling(div_2, 2); 8662 8663 snippet(node_2, () => $$props.children ?? noop); 8664 8665 var div_3 = sibling(node_2, 2); 8666 8667 bind_this(div_3, ($$value) => post_element = $$value, () => post_element); 8668 8669 template_effect(() => { 8670 set_class(div_2, 1, clsx(apply_default_css() ? "prose gradio-style" : "")); 8671 set_class(div_3, 1, clsx(apply_default_css() ? "prose gradio-style" : "")); 8672 }); 8673 8674 append($$anchor, fragment_1); 8675 }; 8676 8677 if_block(node_1, ($$render) => { 8678 if (get(has_children)) $$render(consequent_1); 8679 }); 8680 } 8681 8682 reset(div_1); 8683 bind_this(div_1, ($$value) => element = $$value, () => element); 8684 8685 template_effect( 8686 ($0) => {
8687 set_attribute(div_1, 'id', random_id); 8688 classes = set_class(div_1, 1, `${apply_default_css() && !get(has_children) ? 'prose gradio-style' : ''} ${$0 ?? ''}`, 'svelte-26mp0t', classes, { hide: !visible(), has_children: get(has_children) }); 8689 }, 8690 [() => elem_classes().join(' ')] 8691 ); 8692 8693 append($$anchor, div_1); 8694 }; 8695 8696 if_block(node, ($$render) => { 8697 if (get(html_error_message) || get(css_error_message)) $$render(consequent); else $$render(alternate, false); 8698 }); 8699 } 8700 8701 append($$anchor, fragment); 8702 pop(); 8703} 8704 8705export { HTML as default }; 8706//# sourceMappingURL=HTML-B2dUNNxJ.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.