Commit bff477be5abc3a9a2acc9ccc8b5e09d3941147d7
0 parents
Exists in
master
and in
12 other branches
initial commit
Showing
4 changed files
with
3799 additions
and
0 deletions
Show diff stats
| 1 | +++ a/index.html | |
| ... | ... | @@ -0,0 +1,21 @@ |
| 1 | +<html> | |
| 2 | + <head> | |
| 3 | + <script src='js/handlebars-v3.0.1.js'></script> | |
| 4 | + </head> | |
| 5 | + <body> | |
| 6 | + | |
| 7 | + <script id='proposal-template' type='text/x-handlebars-template'> | |
| 8 | + <ul class="proposal-group"> | |
| 9 | + <li class="proposal-item"> | |
| 10 | + <h1>{{proposal.title}}</h1> | |
| 11 | + {{proposal.description}} | |
| 12 | + </li> | |
| 13 | + </ul> | |
| 14 | + </script> | |
| 15 | + | |
| 16 | + <div id='proposal-result'></div> | |
| 17 | + | |
| 18 | + <script src='js/main.js'></script> | |
| 19 | + </body> | |
| 20 | + | |
| 21 | +</html> | ... | ... |
| 1 | +++ a/js/handlebars-v3.0.1.js | |
| ... | ... | @@ -0,0 +1,3748 @@ |
| 1 | +/*! | |
| 2 | + | |
| 3 | + handlebars v3.0.1 | |
| 4 | + | |
| 5 | +Copyright (C) 2011-2014 by Yehuda Katz | |
| 6 | + | |
| 7 | +Permission is hereby granted, free of charge, to any person obtaining a copy | |
| 8 | +of this software and associated documentation files (the "Software"), to deal | |
| 9 | +in the Software without restriction, including without limitation the rights | |
| 10 | +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| 11 | +copies of the Software, and to permit persons to whom the Software is | |
| 12 | +furnished to do so, subject to the following conditions: | |
| 13 | + | |
| 14 | +The above copyright notice and this permission notice shall be included in | |
| 15 | +all copies or substantial portions of the Software. | |
| 16 | + | |
| 17 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
| 18 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
| 19 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
| 20 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
| 21 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
| 22 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | |
| 23 | +THE SOFTWARE. | |
| 24 | + | |
| 25 | +@license | |
| 26 | +*/ | |
| 27 | +/* exported Handlebars */ | |
| 28 | +(function (root, factory) { | |
| 29 | + if (typeof define === 'function' && define.amd) { | |
| 30 | + define([], factory); | |
| 31 | + } else if (typeof exports === 'object') { | |
| 32 | + module.exports = factory(); | |
| 33 | + } else { | |
| 34 | + root.Handlebars = factory(); | |
| 35 | + } | |
| 36 | +}(this, function () { | |
| 37 | +// handlebars/utils.js | |
| 38 | +var __module3__ = (function() { | |
| 39 | + "use strict"; | |
| 40 | + var __exports__ = {}; | |
| 41 | + /*jshint -W004 */ | |
| 42 | + var escape = { | |
| 43 | + "&": "&", | |
| 44 | + "<": "<", | |
| 45 | + ">": ">", | |
| 46 | + '"': """, | |
| 47 | + "'": "'", | |
| 48 | + "`": "`" | |
| 49 | + }; | |
| 50 | + | |
| 51 | + var badChars = /[&<>"'`]/g; | |
| 52 | + var possible = /[&<>"'`]/; | |
| 53 | + | |
| 54 | + function escapeChar(chr) { | |
| 55 | + return escape[chr]; | |
| 56 | + } | |
| 57 | + | |
| 58 | + function extend(obj /* , ...source */) { | |
| 59 | + for (var i = 1; i < arguments.length; i++) { | |
| 60 | + for (var key in arguments[i]) { | |
| 61 | + if (Object.prototype.hasOwnProperty.call(arguments[i], key)) { | |
| 62 | + obj[key] = arguments[i][key]; | |
| 63 | + } | |
| 64 | + } | |
| 65 | + } | |
| 66 | + | |
| 67 | + return obj; | |
| 68 | + } | |
| 69 | + | |
| 70 | + __exports__.extend = extend;var toString = Object.prototype.toString; | |
| 71 | + __exports__.toString = toString; | |
| 72 | + // Sourced from lodash | |
| 73 | + // https://github.com/bestiejs/lodash/blob/master/LICENSE.txt | |
| 74 | + var isFunction = function(value) { | |
| 75 | + return typeof value === 'function'; | |
| 76 | + }; | |
| 77 | + // fallback for older versions of Chrome and Safari | |
| 78 | + /* istanbul ignore next */ | |
| 79 | + if (isFunction(/x/)) { | |
| 80 | + isFunction = function(value) { | |
| 81 | + return typeof value === 'function' && toString.call(value) === '[object Function]'; | |
| 82 | + }; | |
| 83 | + } | |
| 84 | + var isFunction; | |
| 85 | + __exports__.isFunction = isFunction; | |
| 86 | + /* istanbul ignore next */ | |
| 87 | + var isArray = Array.isArray || function(value) { | |
| 88 | + return (value && typeof value === 'object') ? toString.call(value) === '[object Array]' : false; | |
| 89 | + }; | |
| 90 | + __exports__.isArray = isArray; | |
| 91 | + // Older IE versions do not directly support indexOf so we must implement our own, sadly. | |
| 92 | + function indexOf(array, value) { | |
| 93 | + for (var i = 0, len = array.length; i < len; i++) { | |
| 94 | + if (array[i] === value) { | |
| 95 | + return i; | |
| 96 | + } | |
| 97 | + } | |
| 98 | + return -1; | |
| 99 | + } | |
| 100 | + | |
| 101 | + __exports__.indexOf = indexOf; | |
| 102 | + function escapeExpression(string) { | |
| 103 | + if (typeof string !== 'string') { | |
| 104 | + // don't escape SafeStrings, since they're already safe | |
| 105 | + if (string && string.toHTML) { | |
| 106 | + return string.toHTML(); | |
| 107 | + } else if (string == null) { | |
| 108 | + return ''; | |
| 109 | + } else if (!string) { | |
| 110 | + return string + ''; | |
| 111 | + } | |
| 112 | + | |
| 113 | + // Force a string conversion as this will be done by the append regardless and | |
| 114 | + // the regex test will do this transparently behind the scenes, causing issues if | |
| 115 | + // an object's to string has escaped characters in it. | |
| 116 | + string = '' + string; | |
| 117 | + } | |
| 118 | + | |
| 119 | + if (!possible.test(string)) { return string; } | |
| 120 | + return string.replace(badChars, escapeChar); | |
| 121 | + } | |
| 122 | + | |
| 123 | + __exports__.escapeExpression = escapeExpression;function isEmpty(value) { | |
| 124 | + if (!value && value !== 0) { | |
| 125 | + return true; | |
| 126 | + } else if (isArray(value) && value.length === 0) { | |
| 127 | + return true; | |
| 128 | + } else { | |
| 129 | + return false; | |
| 130 | + } | |
| 131 | + } | |
| 132 | + | |
| 133 | + __exports__.isEmpty = isEmpty;function blockParams(params, ids) { | |
| 134 | + params.path = ids; | |
| 135 | + return params; | |
| 136 | + } | |
| 137 | + | |
| 138 | + __exports__.blockParams = blockParams;function appendContextPath(contextPath, id) { | |
| 139 | + return (contextPath ? contextPath + '.' : '') + id; | |
| 140 | + } | |
| 141 | + | |
| 142 | + __exports__.appendContextPath = appendContextPath; | |
| 143 | + return __exports__; | |
| 144 | +})(); | |
| 145 | + | |
| 146 | +// handlebars/exception.js | |
| 147 | +var __module4__ = (function() { | |
| 148 | + "use strict"; | |
| 149 | + var __exports__; | |
| 150 | + | |
| 151 | + var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack']; | |
| 152 | + | |
| 153 | + function Exception(message, node) { | |
| 154 | + var loc = node && node.loc, | |
| 155 | + line, | |
| 156 | + column; | |
| 157 | + if (loc) { | |
| 158 | + line = loc.start.line; | |
| 159 | + column = loc.start.column; | |
| 160 | + | |
| 161 | + message += ' - ' + line + ':' + column; | |
| 162 | + } | |
| 163 | + | |
| 164 | + var tmp = Error.prototype.constructor.call(this, message); | |
| 165 | + | |
| 166 | + // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work. | |
| 167 | + for (var idx = 0; idx < errorProps.length; idx++) { | |
| 168 | + this[errorProps[idx]] = tmp[errorProps[idx]]; | |
| 169 | + } | |
| 170 | + | |
| 171 | + if (loc) { | |
| 172 | + this.lineNumber = line; | |
| 173 | + this.column = column; | |
| 174 | + } | |
| 175 | + } | |
| 176 | + | |
| 177 | + Exception.prototype = new Error(); | |
| 178 | + | |
| 179 | + __exports__ = Exception; | |
| 180 | + return __exports__; | |
| 181 | +})(); | |
| 182 | + | |
| 183 | +// handlebars/base.js | |
| 184 | +var __module2__ = (function(__dependency1__, __dependency2__) { | |
| 185 | + "use strict"; | |
| 186 | + var __exports__ = {}; | |
| 187 | + var Utils = __dependency1__; | |
| 188 | + var Exception = __dependency2__; | |
| 189 | + | |
| 190 | + var VERSION = "3.0.1"; | |
| 191 | + __exports__.VERSION = VERSION;var COMPILER_REVISION = 6; | |
| 192 | + __exports__.COMPILER_REVISION = COMPILER_REVISION; | |
| 193 | + var REVISION_CHANGES = { | |
| 194 | + 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it | |
| 195 | + 2: '== 1.0.0-rc.3', | |
| 196 | + 3: '== 1.0.0-rc.4', | |
| 197 | + 4: '== 1.x.x', | |
| 198 | + 5: '== 2.0.0-alpha.x', | |
| 199 | + 6: '>= 2.0.0-beta.1' | |
| 200 | + }; | |
| 201 | + __exports__.REVISION_CHANGES = REVISION_CHANGES; | |
| 202 | + var isArray = Utils.isArray, | |
| 203 | + isFunction = Utils.isFunction, | |
| 204 | + toString = Utils.toString, | |
| 205 | + objectType = '[object Object]'; | |
| 206 | + | |
| 207 | + function HandlebarsEnvironment(helpers, partials) { | |
| 208 | + this.helpers = helpers || {}; | |
| 209 | + this.partials = partials || {}; | |
| 210 | + | |
| 211 | + registerDefaultHelpers(this); | |
| 212 | + } | |
| 213 | + | |
| 214 | + __exports__.HandlebarsEnvironment = HandlebarsEnvironment;HandlebarsEnvironment.prototype = { | |
| 215 | + constructor: HandlebarsEnvironment, | |
| 216 | + | |
| 217 | + logger: logger, | |
| 218 | + log: log, | |
| 219 | + | |
| 220 | + registerHelper: function(name, fn) { | |
| 221 | + if (toString.call(name) === objectType) { | |
| 222 | + if (fn) { throw new Exception('Arg not supported with multiple helpers'); } | |
| 223 | + Utils.extend(this.helpers, name); | |
| 224 | + } else { | |
| 225 | + this.helpers[name] = fn; | |
| 226 | + } | |
| 227 | + }, | |
| 228 | + unregisterHelper: function(name) { | |
| 229 | + delete this.helpers[name]; | |
| 230 | + }, | |
| 231 | + | |
| 232 | + registerPartial: function(name, partial) { | |
| 233 | + if (toString.call(name) === objectType) { | |
| 234 | + Utils.extend(this.partials, name); | |
| 235 | + } else { | |
| 236 | + if (typeof partial === 'undefined') { | |
| 237 | + throw new Exception('Attempting to register a partial as undefined'); | |
| 238 | + } | |
| 239 | + this.partials[name] = partial; | |
| 240 | + } | |
| 241 | + }, | |
| 242 | + unregisterPartial: function(name) { | |
| 243 | + delete this.partials[name]; | |
| 244 | + } | |
| 245 | + }; | |
| 246 | + | |
| 247 | + function registerDefaultHelpers(instance) { | |
| 248 | + instance.registerHelper('helperMissing', function(/* [args, ]options */) { | |
| 249 | + if(arguments.length === 1) { | |
| 250 | + // A missing field in a {{foo}} constuct. | |
| 251 | + return undefined; | |
| 252 | + } else { | |
| 253 | + // Someone is actually trying to call something, blow up. | |
| 254 | + throw new Exception("Missing helper: '" + arguments[arguments.length-1].name + "'"); | |
| 255 | + } | |
| 256 | + }); | |
| 257 | + | |
| 258 | + instance.registerHelper('blockHelperMissing', function(context, options) { | |
| 259 | + var inverse = options.inverse, | |
| 260 | + fn = options.fn; | |
| 261 | + | |
| 262 | + if(context === true) { | |
| 263 | + return fn(this); | |
| 264 | + } else if(context === false || context == null) { | |
| 265 | + return inverse(this); | |
| 266 | + } else if (isArray(context)) { | |
| 267 | + if(context.length > 0) { | |
| 268 | + if (options.ids) { | |
| 269 | + options.ids = [options.name]; | |
| 270 | + } | |
| 271 | + | |
| 272 | + return instance.helpers.each(context, options); | |
| 273 | + } else { | |
| 274 | + return inverse(this); | |
| 275 | + } | |
| 276 | + } else { | |
| 277 | + if (options.data && options.ids) { | |
| 278 | + var data = createFrame(options.data); | |
| 279 | + data.contextPath = Utils.appendContextPath(options.data.contextPath, options.name); | |
| 280 | + options = {data: data}; | |
| 281 | + } | |
| 282 | + | |
| 283 | + return fn(context, options); | |
| 284 | + } | |
| 285 | + }); | |
| 286 | + | |
| 287 | + instance.registerHelper('each', function(context, options) { | |
| 288 | + if (!options) { | |
| 289 | + throw new Exception('Must pass iterator to #each'); | |
| 290 | + } | |
| 291 | + | |
| 292 | + var fn = options.fn, inverse = options.inverse; | |
| 293 | + var i = 0, ret = "", data; | |
| 294 | + | |
| 295 | + var contextPath; | |
| 296 | + if (options.data && options.ids) { | |
| 297 | + contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.'; | |
| 298 | + } | |
| 299 | + | |
| 300 | + if (isFunction(context)) { context = context.call(this); } | |
| 301 | + | |
| 302 | + if (options.data) { | |
| 303 | + data = createFrame(options.data); | |
| 304 | + } | |
| 305 | + | |
| 306 | + function execIteration(key, i, last) { | |
| 307 | + if (data) { | |
| 308 | + data.key = key; | |
| 309 | + data.index = i; | |
| 310 | + data.first = i === 0; | |
| 311 | + data.last = !!last; | |
| 312 | + | |
| 313 | + if (contextPath) { | |
| 314 | + data.contextPath = contextPath + key; | |
| 315 | + } | |
| 316 | + } | |
| 317 | + | |
| 318 | + ret = ret + fn(context[key], { | |
| 319 | + data: data, | |
| 320 | + blockParams: Utils.blockParams([context[key], key], [contextPath + key, null]) | |
| 321 | + }); | |
| 322 | + } | |
| 323 | + | |
| 324 | + if(context && typeof context === 'object') { | |
| 325 | + if (isArray(context)) { | |
| 326 | + for(var j = context.length; i<j; i++) { | |
| 327 | + execIteration(i, i, i === context.length-1); | |
| 328 | + } | |
| 329 | + } else { | |
| 330 | + var priorKey; | |
| 331 | + | |
| 332 | + for(var key in context) { | |
| 333 | + if(context.hasOwnProperty(key)) { | |
| 334 | + // We're running the iterations one step out of sync so we can detect | |
| 335 | + // the last iteration without have to scan the object twice and create | |
| 336 | + // an itermediate keys array. | |
| 337 | + if (priorKey) { | |
| 338 | + execIteration(priorKey, i-1); | |
| 339 | + } | |
| 340 | + priorKey = key; | |
| 341 | + i++; | |
| 342 | + } | |
| 343 | + } | |
| 344 | + if (priorKey) { | |
| 345 | + execIteration(priorKey, i-1, true); | |
| 346 | + } | |
| 347 | + } | |
| 348 | + } | |
| 349 | + | |
| 350 | + if(i === 0){ | |
| 351 | + ret = inverse(this); | |
| 352 | + } | |
| 353 | + | |
| 354 | + return ret; | |
| 355 | + }); | |
| 356 | + | |
| 357 | + instance.registerHelper('if', function(conditional, options) { | |
| 358 | + if (isFunction(conditional)) { conditional = conditional.call(this); } | |
| 359 | + | |
| 360 | + // Default behavior is to render the positive path if the value is truthy and not empty. | |
| 361 | + // The `includeZero` option may be set to treat the condtional as purely not empty based on the | |
| 362 | + // behavior of isEmpty. Effectively this determines if 0 is handled by the positive path or negative. | |
| 363 | + if ((!options.hash.includeZero && !conditional) || Utils.isEmpty(conditional)) { | |
| 364 | + return options.inverse(this); | |
| 365 | + } else { | |
| 366 | + return options.fn(this); | |
| 367 | + } | |
| 368 | + }); | |
| 369 | + | |
| 370 | + instance.registerHelper('unless', function(conditional, options) { | |
| 371 | + return instance.helpers['if'].call(this, conditional, {fn: options.inverse, inverse: options.fn, hash: options.hash}); | |
| 372 | + }); | |
| 373 | + | |
| 374 | + instance.registerHelper('with', function(context, options) { | |
| 375 | + if (isFunction(context)) { context = context.call(this); } | |
| 376 | + | |
| 377 | + var fn = options.fn; | |
| 378 | + | |
| 379 | + if (!Utils.isEmpty(context)) { | |
| 380 | + if (options.data && options.ids) { | |
| 381 | + var data = createFrame(options.data); | |
| 382 | + data.contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]); | |
| 383 | + options = {data:data}; | |
| 384 | + } | |
| 385 | + | |
| 386 | + return fn(context, options); | |
| 387 | + } else { | |
| 388 | + return options.inverse(this); | |
| 389 | + } | |
| 390 | + }); | |
| 391 | + | |
| 392 | + instance.registerHelper('log', function(message, options) { | |
| 393 | + var level = options.data && options.data.level != null ? parseInt(options.data.level, 10) : 1; | |
| 394 | + instance.log(level, message); | |
| 395 | + }); | |
| 396 | + | |
| 397 | + instance.registerHelper('lookup', function(obj, field) { | |
| 398 | + return obj && obj[field]; | |
| 399 | + }); | |
| 400 | + } | |
| 401 | + | |
| 402 | + var logger = { | |
| 403 | + methodMap: { 0: 'debug', 1: 'info', 2: 'warn', 3: 'error' }, | |
| 404 | + | |
| 405 | + // State enum | |
| 406 | + DEBUG: 0, | |
| 407 | + INFO: 1, | |
| 408 | + WARN: 2, | |
| 409 | + ERROR: 3, | |
| 410 | + level: 1, | |
| 411 | + | |
| 412 | + // Can be overridden in the host environment | |
| 413 | + log: function(level, message) { | |
| 414 | + if (typeof console !== 'undefined' && logger.level <= level) { | |
| 415 | + var method = logger.methodMap[level]; | |
| 416 | + (console[method] || console.log).call(console, message); | |
| 417 | + } | |
| 418 | + } | |
| 419 | + }; | |
| 420 | + __exports__.logger = logger; | |
| 421 | + var log = logger.log; | |
| 422 | + __exports__.log = log; | |
| 423 | + var createFrame = function(object) { | |
| 424 | + var frame = Utils.extend({}, object); | |
| 425 | + frame._parent = object; | |
| 426 | + return frame; | |
| 427 | + }; | |
| 428 | + __exports__.createFrame = createFrame; | |
| 429 | + return __exports__; | |
| 430 | +})(__module3__, __module4__); | |
| 431 | + | |
| 432 | +// handlebars/safe-string.js | |
| 433 | +var __module5__ = (function() { | |
| 434 | + "use strict"; | |
| 435 | + var __exports__; | |
| 436 | + // Build out our basic SafeString type | |
| 437 | + function SafeString(string) { | |
| 438 | + this.string = string; | |
| 439 | + } | |
| 440 | + | |
| 441 | + SafeString.prototype.toString = SafeString.prototype.toHTML = function() { | |
| 442 | + return "" + this.string; | |
| 443 | + }; | |
| 444 | + | |
| 445 | + __exports__ = SafeString; | |
| 446 | + return __exports__; | |
| 447 | +})(); | |
| 448 | + | |
| 449 | +// handlebars/runtime.js | |
| 450 | +var __module6__ = (function(__dependency1__, __dependency2__, __dependency3__) { | |
| 451 | + "use strict"; | |
| 452 | + var __exports__ = {}; | |
| 453 | + var Utils = __dependency1__; | |
| 454 | + var Exception = __dependency2__; | |
| 455 | + var COMPILER_REVISION = __dependency3__.COMPILER_REVISION; | |
| 456 | + var REVISION_CHANGES = __dependency3__.REVISION_CHANGES; | |
| 457 | + var createFrame = __dependency3__.createFrame; | |
| 458 | + | |
| 459 | + function checkRevision(compilerInfo) { | |
| 460 | + var compilerRevision = compilerInfo && compilerInfo[0] || 1, | |
| 461 | + currentRevision = COMPILER_REVISION; | |
| 462 | + | |
| 463 | + if (compilerRevision !== currentRevision) { | |
| 464 | + if (compilerRevision < currentRevision) { | |
| 465 | + var runtimeVersions = REVISION_CHANGES[currentRevision], | |
| 466 | + compilerVersions = REVISION_CHANGES[compilerRevision]; | |
| 467 | + throw new Exception("Template was precompiled with an older version of Handlebars than the current runtime. "+ | |
| 468 | + "Please update your precompiler to a newer version ("+runtimeVersions+") or downgrade your runtime to an older version ("+compilerVersions+")."); | |
| 469 | + } else { | |
| 470 | + // Use the embedded version info since the runtime doesn't know about this revision yet | |
| 471 | + throw new Exception("Template was precompiled with a newer version of Handlebars than the current runtime. "+ | |
| 472 | + "Please update your runtime to a newer version ("+compilerInfo[1]+")."); | |
| 473 | + } | |
| 474 | + } | |
| 475 | + } | |
| 476 | + | |
| 477 | + __exports__.checkRevision = checkRevision;// TODO: Remove this line and break up compilePartial | |
| 478 | + | |
| 479 | + function template(templateSpec, env) { | |
| 480 | + /* istanbul ignore next */ | |
| 481 | + if (!env) { | |
| 482 | + throw new Exception("No environment passed to template"); | |
| 483 | + } | |
| 484 | + if (!templateSpec || !templateSpec.main) { | |
| 485 | + throw new Exception('Unknown template object: ' + typeof templateSpec); | |
| 486 | + } | |
| 487 | + | |
| 488 | + // Note: Using env.VM references rather than local var references throughout this section to allow | |
| 489 | + // for external users to override these as psuedo-supported APIs. | |
| 490 | + env.VM.checkRevision(templateSpec.compiler); | |
| 491 | + | |
| 492 | + var invokePartialWrapper = function(partial, context, options) { | |
| 493 | + if (options.hash) { | |
| 494 | + context = Utils.extend({}, context, options.hash); | |
| 495 | + } | |
| 496 | + | |
| 497 | + partial = env.VM.resolvePartial.call(this, partial, context, options); | |
| 498 | + var result = env.VM.invokePartial.call(this, partial, context, options); | |
| 499 | + | |
| 500 | + if (result == null && env.compile) { | |
| 501 | + options.partials[options.name] = env.compile(partial, templateSpec.compilerOptions, env); | |
| 502 | + result = options.partials[options.name](context, options); | |
| 503 | + } | |
| 504 | + if (result != null) { | |
| 505 | + if (options.indent) { | |
| 506 | + var lines = result.split('\n'); | |
| 507 | + for (var i = 0, l = lines.length; i < l; i++) { | |
| 508 | + if (!lines[i] && i + 1 === l) { | |
| 509 | + break; | |
| 510 | + } | |
| 511 | + | |
| 512 | + lines[i] = options.indent + lines[i]; | |
| 513 | + } | |
| 514 | + result = lines.join('\n'); | |
| 515 | + } | |
| 516 | + return result; | |
| 517 | + } else { | |
| 518 | + throw new Exception("The partial " + options.name + " could not be compiled when running in runtime-only mode"); | |
| 519 | + } | |
| 520 | + }; | |
| 521 | + | |
| 522 | + // Just add water | |
| 523 | + var container = { | |
| 524 | + strict: function(obj, name) { | |
| 525 | + if (!(name in obj)) { | |
| 526 | + throw new Exception('"' + name + '" not defined in ' + obj); | |
| 527 | + } | |
| 528 | + return obj[name]; | |
| 529 | + }, | |
| 530 | + lookup: function(depths, name) { | |
| 531 | + var len = depths.length; | |
| 532 | + for (var i = 0; i < len; i++) { | |
| 533 | + if (depths[i] && depths[i][name] != null) { | |
| 534 | + return depths[i][name]; | |
| 535 | + } | |
| 536 | + } | |
| 537 | + }, | |
| 538 | + lambda: function(current, context) { | |
| 539 | + return typeof current === 'function' ? current.call(context) : current; | |
| 540 | + }, | |
| 541 | + | |
| 542 | + escapeExpression: Utils.escapeExpression, | |
| 543 | + invokePartial: invokePartialWrapper, | |
| 544 | + | |
| 545 | + fn: function(i) { | |
| 546 | + return templateSpec[i]; | |
| 547 | + }, | |
| 548 | + | |
| 549 | + programs: [], | |
| 550 | + program: function(i, data, declaredBlockParams, blockParams, depths) { | |
| 551 | + var programWrapper = this.programs[i], | |
| 552 | + fn = this.fn(i); | |
| 553 | + if (data || depths || blockParams || declaredBlockParams) { | |
| 554 | + programWrapper = program(this, i, fn, data, declaredBlockParams, blockParams, depths); | |
| 555 | + } else if (!programWrapper) { | |
| 556 | + programWrapper = this.programs[i] = program(this, i, fn); | |
| 557 | + } | |
| 558 | + return programWrapper; | |
| 559 | + }, | |
| 560 | + | |
| 561 | + data: function(data, depth) { | |
| 562 | + while (data && depth--) { | |
| 563 | + data = data._parent; | |
| 564 | + } | |
| 565 | + return data; | |
| 566 | + }, | |
| 567 | + merge: function(param, common) { | |
| 568 | + var ret = param || common; | |
| 569 | + | |
| 570 | + if (param && common && (param !== common)) { | |
| 571 | + ret = Utils.extend({}, common, param); | |
| 572 | + } | |
| 573 | + | |
| 574 | + return ret; | |
| 575 | + }, | |
| 576 | + | |
| 577 | + noop: env.VM.noop, | |
| 578 | + compilerInfo: templateSpec.compiler | |
| 579 | + }; | |
| 580 | + | |
| 581 | + var ret = function(context, options) { | |
| 582 | + options = options || {}; | |
| 583 | + var data = options.data; | |
| 584 | + | |
| 585 | + ret._setup(options); | |
| 586 | + if (!options.partial && templateSpec.useData) { | |
| 587 | + data = initData(context, data); | |
| 588 | + } | |
| 589 | + var depths, | |
| 590 | + blockParams = templateSpec.useBlockParams ? [] : undefined; | |
| 591 | + if (templateSpec.useDepths) { | |
| 592 | + depths = options.depths ? [context].concat(options.depths) : [context]; | |
| 593 | + } | |
| 594 | + | |
| 595 | + return templateSpec.main.call(container, context, container.helpers, container.partials, data, blockParams, depths); | |
| 596 | + }; | |
| 597 | + ret.isTop = true; | |
| 598 | + | |
| 599 | + ret._setup = function(options) { | |
| 600 | + if (!options.partial) { | |
| 601 | + container.helpers = container.merge(options.helpers, env.helpers); | |
| 602 | + | |
| 603 | + if (templateSpec.usePartial) { | |
| 604 | + container.partials = container.merge(options.partials, env.partials); | |
| 605 | + } | |
| 606 | + } else { | |
| 607 | + container.helpers = options.helpers; | |
| 608 | + container.partials = options.partials; | |
| 609 | + } | |
| 610 | + }; | |
| 611 | + | |
| 612 | + ret._child = function(i, data, blockParams, depths) { | |
| 613 | + if (templateSpec.useBlockParams && !blockParams) { | |
| 614 | + throw new Exception('must pass block params'); | |
| 615 | + } | |
| 616 | + if (templateSpec.useDepths && !depths) { | |
| 617 | + throw new Exception('must pass parent depths'); | |
| 618 | + } | |
| 619 | + | |
| 620 | + return program(container, i, templateSpec[i], data, 0, blockParams, depths); | |
| 621 | + }; | |
| 622 | + return ret; | |
| 623 | + } | |
| 624 | + | |
| 625 | + __exports__.template = template;function program(container, i, fn, data, declaredBlockParams, blockParams, depths) { | |
| 626 | + var prog = function(context, options) { | |
| 627 | + options = options || {}; | |
| 628 | + | |
| 629 | + return fn.call(container, | |
| 630 | + context, | |
| 631 | + container.helpers, container.partials, | |
| 632 | + options.data || data, | |
| 633 | + blockParams && [options.blockParams].concat(blockParams), | |
| 634 | + depths && [context].concat(depths)); | |
| 635 | + }; | |
| 636 | + prog.program = i; | |
| 637 | + prog.depth = depths ? depths.length : 0; | |
| 638 | + prog.blockParams = declaredBlockParams || 0; | |
| 639 | + return prog; | |
| 640 | + } | |
| 641 | + | |
| 642 | + __exports__.program = program;function resolvePartial(partial, context, options) { | |
| 643 | + if (!partial) { | |
| 644 | + partial = options.partials[options.name]; | |
| 645 | + } else if (!partial.call && !options.name) { | |
| 646 | + // This is a dynamic partial that returned a string | |
| 647 | + options.name = partial; | |
| 648 | + partial = options.partials[partial]; | |
| 649 | + } | |
| 650 | + return partial; | |
| 651 | + } | |
| 652 | + | |
| 653 | + __exports__.resolvePartial = resolvePartial;function invokePartial(partial, context, options) { | |
| 654 | + options.partial = true; | |
| 655 | + | |
| 656 | + if(partial === undefined) { | |
| 657 | + throw new Exception("The partial " + options.name + " could not be found"); | |
| 658 | + } else if(partial instanceof Function) { | |
| 659 | + return partial(context, options); | |
| 660 | + } | |
| 661 | + } | |
| 662 | + | |
| 663 | + __exports__.invokePartial = invokePartial;function noop() { return ""; } | |
| 664 | + | |
| 665 | + __exports__.noop = noop;function initData(context, data) { | |
| 666 | + if (!data || !('root' in data)) { | |
| 667 | + data = data ? createFrame(data) : {}; | |
| 668 | + data.root = context; | |
| 669 | + } | |
| 670 | + return data; | |
| 671 | + } | |
| 672 | + return __exports__; | |
| 673 | +})(__module3__, __module4__, __module2__); | |
| 674 | + | |
| 675 | +// handlebars.runtime.js | |
| 676 | +var __module1__ = (function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__) { | |
| 677 | + "use strict"; | |
| 678 | + var __exports__; | |
| 679 | + /*globals Handlebars: true */ | |
| 680 | + var base = __dependency1__; | |
| 681 | + | |
| 682 | + // Each of these augment the Handlebars object. No need to setup here. | |
| 683 | + // (This is done to easily share code between commonjs and browse envs) | |
| 684 | + var SafeString = __dependency2__; | |
| 685 | + var Exception = __dependency3__; | |
| 686 | + var Utils = __dependency4__; | |
| 687 | + var runtime = __dependency5__; | |
| 688 | + | |
| 689 | + // For compatibility and usage outside of module systems, make the Handlebars object a namespace | |
| 690 | + var create = function() { | |
| 691 | + var hb = new base.HandlebarsEnvironment(); | |
| 692 | + | |
| 693 | + Utils.extend(hb, base); | |
| 694 | + hb.SafeString = SafeString; | |
| 695 | + hb.Exception = Exception; | |
| 696 | + hb.Utils = Utils; | |
| 697 | + hb.escapeExpression = Utils.escapeExpression; | |
| 698 | + | |
| 699 | + hb.VM = runtime; | |
| 700 | + hb.template = function(spec) { | |
| 701 | + return runtime.template(spec, hb); | |
| 702 | + }; | |
| 703 | + | |
| 704 | + return hb; | |
| 705 | + }; | |
| 706 | + | |
| 707 | + var Handlebars = create(); | |
| 708 | + Handlebars.create = create; | |
| 709 | + | |
| 710 | + /*jshint -W040 */ | |
| 711 | + /* istanbul ignore next */ | |
| 712 | + var root = typeof global !== 'undefined' ? global : window, | |
| 713 | + $Handlebars = root.Handlebars; | |
| 714 | + /* istanbul ignore next */ | |
| 715 | + Handlebars.noConflict = function() { | |
| 716 | + if (root.Handlebars === Handlebars) { | |
| 717 | + root.Handlebars = $Handlebars; | |
| 718 | + } | |
| 719 | + }; | |
| 720 | + | |
| 721 | + Handlebars['default'] = Handlebars; | |
| 722 | + | |
| 723 | + __exports__ = Handlebars; | |
| 724 | + return __exports__; | |
| 725 | +})(__module2__, __module5__, __module4__, __module3__, __module6__); | |
| 726 | + | |
| 727 | +// handlebars/compiler/ast.js | |
| 728 | +var __module7__ = (function() { | |
| 729 | + "use strict"; | |
| 730 | + var __exports__; | |
| 731 | + var AST = { | |
| 732 | + Program: function(statements, blockParams, strip, locInfo) { | |
| 733 | + this.loc = locInfo; | |
| 734 | + this.type = 'Program'; | |
| 735 | + this.body = statements; | |
| 736 | + | |
| 737 | + this.blockParams = blockParams; | |
| 738 | + this.strip = strip; | |
| 739 | + }, | |
| 740 | + | |
| 741 | + MustacheStatement: function(path, params, hash, escaped, strip, locInfo) { | |
| 742 | + this.loc = locInfo; | |
| 743 | + this.type = 'MustacheStatement'; | |
| 744 | + | |
| 745 | + this.path = path; | |
| 746 | + this.params = params || []; | |
| 747 | + this.hash = hash; | |
| 748 | + this.escaped = escaped; | |
| 749 | + | |
| 750 | + this.strip = strip; | |
| 751 | + }, | |
| 752 | + | |
| 753 | + BlockStatement: function(path, params, hash, program, inverse, openStrip, inverseStrip, closeStrip, locInfo) { | |
| 754 | + this.loc = locInfo; | |
| 755 | + this.type = 'BlockStatement'; | |
| 756 | + | |
| 757 | + this.path = path; | |
| 758 | + this.params = params || []; | |
| 759 | + this.hash = hash; | |
| 760 | + this.program = program; | |
| 761 | + this.inverse = inverse; | |
| 762 | + | |
| 763 | + this.openStrip = openStrip; | |
| 764 | + this.inverseStrip = inverseStrip; | |
| 765 | + this.closeStrip = closeStrip; | |
| 766 | + }, | |
| 767 | + | |
| 768 | + PartialStatement: function(name, params, hash, strip, locInfo) { | |
| 769 | + this.loc = locInfo; | |
| 770 | + this.type = 'PartialStatement'; | |
| 771 | + | |
| 772 | + this.name = name; | |
| 773 | + this.params = params || []; | |
| 774 | + this.hash = hash; | |
| 775 | + | |
| 776 | + this.indent = ''; | |
| 777 | + this.strip = strip; | |
| 778 | + }, | |
| 779 | + | |
| 780 | + ContentStatement: function(string, locInfo) { | |
| 781 | + this.loc = locInfo; | |
| 782 | + this.type = 'ContentStatement'; | |
| 783 | + this.original = this.value = string; | |
| 784 | + }, | |
| 785 | + | |
| 786 | + CommentStatement: function(comment, strip, locInfo) { | |
| 787 | + this.loc = locInfo; | |
| 788 | + this.type = 'CommentStatement'; | |
| 789 | + this.value = comment; | |
| 790 | + | |
| 791 | + this.strip = strip; | |
| 792 | + }, | |
| 793 | + | |
| 794 | + SubExpression: function(path, params, hash, locInfo) { | |
| 795 | + this.loc = locInfo; | |
| 796 | + | |
| 797 | + this.type = 'SubExpression'; | |
| 798 | + this.path = path; | |
| 799 | + this.params = params || []; | |
| 800 | + this.hash = hash; | |
| 801 | + }, | |
| 802 | + | |
| 803 | + PathExpression: function(data, depth, parts, original, locInfo) { | |
| 804 | + this.loc = locInfo; | |
| 805 | + this.type = 'PathExpression'; | |
| 806 | + | |
| 807 | + this.data = data; | |
| 808 | + this.original = original; | |
| 809 | + this.parts = parts; | |
| 810 | + this.depth = depth; | |
| 811 | + }, | |
| 812 | + | |
| 813 | + StringLiteral: function(string, locInfo) { | |
| 814 | + this.loc = locInfo; | |
| 815 | + this.type = 'StringLiteral'; | |
| 816 | + this.original = | |
| 817 | + this.value = string; | |
| 818 | + }, | |
| 819 | + | |
| 820 | + NumberLiteral: function(number, locInfo) { | |
| 821 | + this.loc = locInfo; | |
| 822 | + this.type = 'NumberLiteral'; | |
| 823 | + this.original = | |
| 824 | + this.value = Number(number); | |
| 825 | + }, | |
| 826 | + | |
| 827 | + BooleanLiteral: function(bool, locInfo) { | |
| 828 | + this.loc = locInfo; | |
| 829 | + this.type = 'BooleanLiteral'; | |
| 830 | + this.original = | |
| 831 | + this.value = bool === 'true'; | |
| 832 | + }, | |
| 833 | + | |
| 834 | + Hash: function(pairs, locInfo) { | |
| 835 | + this.loc = locInfo; | |
| 836 | + this.type = 'Hash'; | |
| 837 | + this.pairs = pairs; | |
| 838 | + }, | |
| 839 | + HashPair: function(key, value, locInfo) { | |
| 840 | + this.loc = locInfo; | |
| 841 | + this.type = 'HashPair'; | |
| 842 | + this.key = key; | |
| 843 | + this.value = value; | |
| 844 | + }, | |
| 845 | + | |
| 846 | + // Public API used to evaluate derived attributes regarding AST nodes | |
| 847 | + helpers: { | |
| 848 | + // a mustache is definitely a helper if: | |
| 849 | + // * it is an eligible helper, and | |
| 850 | + // * it has at least one parameter or hash segment | |
| 851 | + // TODO: Make these public utility methods | |
| 852 | + helperExpression: function(node) { | |
| 853 | + return !!(node.type === 'SubExpression' || node.params.length || node.hash); | |
| 854 | + }, | |
| 855 | + | |
| 856 | + scopedId: function(path) { | |
| 857 | + return (/^\.|this\b/).test(path.original); | |
| 858 | + }, | |
| 859 | + | |
| 860 | + // an ID is simple if it only has one part, and that part is not | |
| 861 | + // `..` or `this`. | |
| 862 | + simpleId: function(path) { | |
| 863 | + return path.parts.length === 1 && !AST.helpers.scopedId(path) && !path.depth; | |
| 864 | + } | |
| 865 | + } | |
| 866 | + }; | |
| 867 | + | |
| 868 | + | |
| 869 | + // Must be exported as an object rather than the root of the module as the jison lexer | |
| 870 | + // must modify the object to operate properly. | |
| 871 | + __exports__ = AST; | |
| 872 | + return __exports__; | |
| 873 | +})(); | |
| 874 | + | |
| 875 | +// handlebars/compiler/parser.js | |
| 876 | +var __module9__ = (function() { | |
| 877 | + "use strict"; | |
| 878 | + var __exports__; | |
| 879 | + /* jshint ignore:start */ | |
| 880 | + /* istanbul ignore next */ | |
| 881 | + /* Jison generated parser */ | |
| 882 | + var handlebars = (function(){ | |
| 883 | + var parser = {trace: function trace() { }, | |
| 884 | + yy: {}, | |
| 885 | + symbols_: {"error":2,"root":3,"program":4,"EOF":5,"program_repetition0":6,"statement":7,"mustache":8,"block":9,"rawBlock":10,"partial":11,"content":12,"COMMENT":13,"CONTENT":14,"openRawBlock":15,"END_RAW_BLOCK":16,"OPEN_RAW_BLOCK":17,"helperName":18,"openRawBlock_repetition0":19,"openRawBlock_option0":20,"CLOSE_RAW_BLOCK":21,"openBlock":22,"block_option0":23,"closeBlock":24,"openInverse":25,"block_option1":26,"OPEN_BLOCK":27,"openBlock_repetition0":28,"openBlock_option0":29,"openBlock_option1":30,"CLOSE":31,"OPEN_INVERSE":32,"openInverse_repetition0":33,"openInverse_option0":34,"openInverse_option1":35,"openInverseChain":36,"OPEN_INVERSE_CHAIN":37,"openInverseChain_repetition0":38,"openInverseChain_option0":39,"openInverseChain_option1":40,"inverseAndProgram":41,"INVERSE":42,"inverseChain":43,"inverseChain_option0":44,"OPEN_ENDBLOCK":45,"OPEN":46,"mustache_repetition0":47,"mustache_option0":48,"OPEN_UNESCAPED":49,"mustache_repetition1":50,"mustache_option1":51,"CLOSE_UNESCAPED":52,"OPEN_PARTIAL":53,"partialName":54,"partial_repetition0":55,"partial_option0":56,"param":57,"sexpr":58,"OPEN_SEXPR":59,"sexpr_repetition0":60,"sexpr_option0":61,"CLOSE_SEXPR":62,"hash":63,"hash_repetition_plus0":64,"hashSegment":65,"ID":66,"EQUALS":67,"blockParams":68,"OPEN_BLOCK_PARAMS":69,"blockParams_repetition_plus0":70,"CLOSE_BLOCK_PARAMS":71,"path":72,"dataName":73,"STRING":74,"NUMBER":75,"BOOLEAN":76,"DATA":77,"pathSegments":78,"SEP":79,"$accept":0,"$end":1}, | |
| 886 | + terminals_: {2:"error",5:"EOF",13:"COMMENT",14:"CONTENT",16:"END_RAW_BLOCK",17:"OPEN_RAW_BLOCK",21:"CLOSE_RAW_BLOCK",27:"OPEN_BLOCK",31:"CLOSE",32:"OPEN_INVERSE",37:"OPEN_INVERSE_CHAIN",42:"INVERSE",45:"OPEN_ENDBLOCK",46:"OPEN",49:"OPEN_UNESCAPED",52:"CLOSE_UNESCAPED",53:"OPEN_PARTIAL",59:"OPEN_SEXPR",62:"CLOSE_SEXPR",66:"ID",67:"EQUALS",69:"OPEN_BLOCK_PARAMS",71:"CLOSE_BLOCK_PARAMS",74:"STRING",75:"NUMBER",76:"BOOLEAN",77:"DATA",79:"SEP"}, | |
| 887 | + productions_: [0,[3,2],[4,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[12,1],[10,3],[15,5],[9,4],[9,4],[22,6],[25,6],[36,6],[41,2],[43,3],[43,1],[24,3],[8,5],[8,5],[11,5],[57,1],[57,1],[58,5],[63,1],[65,3],[68,3],[18,1],[18,1],[18,1],[18,1],[18,1],[54,1],[54,1],[73,2],[72,1],[78,3],[78,1],[6,0],[6,2],[19,0],[19,2],[20,0],[20,1],[23,0],[23,1],[26,0],[26,1],[28,0],[28,2],[29,0],[29,1],[30,0],[30,1],[33,0],[33,2],[34,0],[34,1],[35,0],[35,1],[38,0],[38,2],[39,0],[39,1],[40,0],[40,1],[44,0],[44,1],[47,0],[47,2],[48,0],[48,1],[50,0],[50,2],[51,0],[51,1],[55,0],[55,2],[56,0],[56,1],[60,0],[60,2],[61,0],[61,1],[64,1],[64,2],[70,1],[70,2]], | |
| 888 | + performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) { | |
| 889 | + | |
| 890 | + var $0 = $$.length - 1; | |
| 891 | + switch (yystate) { | |
| 892 | + case 1: return $$[$0-1]; | |
| 893 | + break; | |
| 894 | + case 2:this.$ = new yy.Program($$[$0], null, {}, yy.locInfo(this._$)); | |
| 895 | + break; | |
| 896 | + case 3:this.$ = $$[$0]; | |
| 897 | + break; | |
| 898 | + case 4:this.$ = $$[$0]; | |
| 899 | + break; | |
| 900 | + case 5:this.$ = $$[$0]; | |
| 901 | + break; | |
| 902 | + case 6:this.$ = $$[$0]; | |
| 903 | + break; | |
| 904 | + case 7:this.$ = $$[$0]; | |
| 905 | + break; | |
| 906 | + case 8:this.$ = new yy.CommentStatement(yy.stripComment($$[$0]), yy.stripFlags($$[$0], $$[$0]), yy.locInfo(this._$)); | |
| 907 | + break; | |
| 908 | + case 9:this.$ = new yy.ContentStatement($$[$0], yy.locInfo(this._$)); | |
| 909 | + break; | |
| 910 | + case 10:this.$ = yy.prepareRawBlock($$[$0-2], $$[$0-1], $$[$0], this._$); | |
| 911 | + break; | |
| 912 | + case 11:this.$ = { path: $$[$0-3], params: $$[$0-2], hash: $$[$0-1] }; | |
| 913 | + break; | |
| 914 | + case 12:this.$ = yy.prepareBlock($$[$0-3], $$[$0-2], $$[$0-1], $$[$0], false, this._$); | |
| 915 | + break; | |
| 916 | + case 13:this.$ = yy.prepareBlock($$[$0-3], $$[$0-2], $$[$0-1], $$[$0], true, this._$); | |
| 917 | + break; | |
| 918 | + case 14:this.$ = { path: $$[$0-4], params: $$[$0-3], hash: $$[$0-2], blockParams: $$[$0-1], strip: yy.stripFlags($$[$0-5], $$[$0]) }; | |
| 919 | + break; | |
| 920 | + case 15:this.$ = { path: $$[$0-4], params: $$[$0-3], hash: $$[$0-2], blockParams: $$[$0-1], strip: yy.stripFlags($$[$0-5], $$[$0]) }; | |
| 921 | + break; | |
| 922 | + case 16:this.$ = { path: $$[$0-4], params: $$[$0-3], hash: $$[$0-2], blockParams: $$[$0-1], strip: yy.stripFlags($$[$0-5], $$[$0]) }; | |
| 923 | + break; | |
| 924 | + case 17:this.$ = { strip: yy.stripFlags($$[$0-1], $$[$0-1]), program: $$[$0] }; | |
| 925 | + break; | |
| 926 | + case 18: | |
| 927 | + var inverse = yy.prepareBlock($$[$0-2], $$[$0-1], $$[$0], $$[$0], false, this._$), | |
| 928 | + program = new yy.Program([inverse], null, {}, yy.locInfo(this._$)); | |
| 929 | + program.chained = true; | |
| 930 | + | |
| 931 | + this.$ = { strip: $$[$0-2].strip, program: program, chain: true }; | |
| 932 | + | |
| 933 | + break; | |
| 934 | + case 19:this.$ = $$[$0]; | |
| 935 | + break; | |
| 936 | + case 20:this.$ = {path: $$[$0-1], strip: yy.stripFlags($$[$0-2], $$[$0])}; | |
| 937 | + break; | |
| 938 | + case 21:this.$ = yy.prepareMustache($$[$0-3], $$[$0-2], $$[$0-1], $$[$0-4], yy.stripFlags($$[$0-4], $$[$0]), this._$); | |
| 939 | + break; | |
| 940 | + case 22:this.$ = yy.prepareMustache($$[$0-3], $$[$0-2], $$[$0-1], $$[$0-4], yy.stripFlags($$[$0-4], $$[$0]), this._$); | |
| 941 | + break; | |
| 942 | + case 23:this.$ = new yy.PartialStatement($$[$0-3], $$[$0-2], $$[$0-1], yy.stripFlags($$[$0-4], $$[$0]), yy.locInfo(this._$)); | |
| 943 | + break; | |
| 944 | + case 24:this.$ = $$[$0]; | |
| 945 | + break; | |
| 946 | + case 25:this.$ = $$[$0]; | |
| 947 | + break; | |
| 948 | + case 26:this.$ = new yy.SubExpression($$[$0-3], $$[$0-2], $$[$0-1], yy.locInfo(this._$)); | |
| 949 | + break; | |
| 950 | + case 27:this.$ = new yy.Hash($$[$0], yy.locInfo(this._$)); | |
| 951 | + break; | |
| 952 | + case 28:this.$ = new yy.HashPair($$[$0-2], $$[$0], yy.locInfo(this._$)); | |
| 953 | + break; | |
| 954 | + case 29:this.$ = $$[$0-1]; | |
| 955 | + break; | |
| 956 | + case 30:this.$ = $$[$0]; | |
| 957 | + break; | |
| 958 | + case 31:this.$ = $$[$0]; | |
| 959 | + break; | |
| 960 | + case 32:this.$ = new yy.StringLiteral($$[$0], yy.locInfo(this._$)); | |
| 961 | + break; | |
| 962 | + case 33:this.$ = new yy.NumberLiteral($$[$0], yy.locInfo(this._$)); | |
| 963 | + break; | |
| 964 | + case 34:this.$ = new yy.BooleanLiteral($$[$0], yy.locInfo(this._$)); | |
| 965 | + break; | |
| 966 | + case 35:this.$ = $$[$0]; | |
| 967 | + break; | |
| 968 | + case 36:this.$ = $$[$0]; | |
| 969 | + break; | |
| 970 | + case 37:this.$ = yy.preparePath(true, $$[$0], this._$); | |
| 971 | + break; | |
| 972 | + case 38:this.$ = yy.preparePath(false, $$[$0], this._$); | |
| 973 | + break; | |
| 974 | + case 39: $$[$0-2].push({part: $$[$0], separator: $$[$0-1]}); this.$ = $$[$0-2]; | |
| 975 | + break; | |
| 976 | + case 40:this.$ = [{part: $$[$0]}]; | |
| 977 | + break; | |
| 978 | + case 41:this.$ = []; | |
| 979 | + break; | |
| 980 | + case 42:$$[$0-1].push($$[$0]); | |
| 981 | + break; | |
| 982 | + case 43:this.$ = []; | |
| 983 | + break; | |
| 984 | + case 44:$$[$0-1].push($$[$0]); | |
| 985 | + break; | |
| 986 | + case 51:this.$ = []; | |
| 987 | + break; | |
| 988 | + case 52:$$[$0-1].push($$[$0]); | |
| 989 | + break; | |
| 990 | + case 57:this.$ = []; | |
| 991 | + break; | |
| 992 | + case 58:$$[$0-1].push($$[$0]); | |
| 993 | + break; | |
| 994 | + case 63:this.$ = []; | |
| 995 | + break; | |
| 996 | + case 64:$$[$0-1].push($$[$0]); | |
| 997 | + break; | |
| 998 | + case 71:this.$ = []; | |
| 999 | + break; | |
| 1000 | + case 72:$$[$0-1].push($$[$0]); | |
| 1001 | + break; | |
| 1002 | + case 75:this.$ = []; | |
| 1003 | + break; | |
| 1004 | + case 76:$$[$0-1].push($$[$0]); | |
| 1005 | + break; | |
| 1006 | + case 79:this.$ = []; | |
| 1007 | + break; | |
| 1008 | + case 80:$$[$0-1].push($$[$0]); | |
| 1009 | + break; | |
| 1010 | + case 83:this.$ = []; | |
| 1011 | + break; | |
| 1012 | + case 84:$$[$0-1].push($$[$0]); | |
| 1013 | + break; | |
| 1014 | + case 87:this.$ = [$$[$0]]; | |
| 1015 | + break; | |
| 1016 | + case 88:$$[$0-1].push($$[$0]); | |
| 1017 | + break; | |
| 1018 | + case 89:this.$ = [$$[$0]]; | |
| 1019 | + break; | |
| 1020 | + case 90:$$[$0-1].push($$[$0]); | |
| 1021 | + break; | |
| 1022 | + } | |
| 1023 | + }, | |
| 1024 | + table: [{3:1,4:2,5:[2,41],6:3,13:[2,41],14:[2,41],17:[2,41],27:[2,41],32:[2,41],46:[2,41],49:[2,41],53:[2,41]},{1:[3]},{5:[1,4]},{5:[2,2],7:5,8:6,9:7,10:8,11:9,12:10,13:[1,11],14:[1,18],15:16,17:[1,21],22:14,25:15,27:[1,19],32:[1,20],37:[2,2],42:[2,2],45:[2,2],46:[1,12],49:[1,13],53:[1,17]},{1:[2,1]},{5:[2,42],13:[2,42],14:[2,42],17:[2,42],27:[2,42],32:[2,42],37:[2,42],42:[2,42],45:[2,42],46:[2,42],49:[2,42],53:[2,42]},{5:[2,3],13:[2,3],14:[2,3],17:[2,3],27:[2,3],32:[2,3],37:[2,3],42:[2,3],45:[2,3],46:[2,3],49:[2,3],53:[2,3]},{5:[2,4],13:[2,4],14:[2,4],17:[2,4],27:[2,4],32:[2,4],37:[2,4],42:[2,4],45:[2,4],46:[2,4],49:[2,4],53:[2,4]},{5:[2,5],13:[2,5],14:[2,5],17:[2,5],27:[2,5],32:[2,5],37:[2,5],42:[2,5],45:[2,5],46:[2,5],49:[2,5],53:[2,5]},{5:[2,6],13:[2,6],14:[2,6],17:[2,6],27:[2,6],32:[2,6],37:[2,6],42:[2,6],45:[2,6],46:[2,6],49:[2,6],53:[2,6]},{5:[2,7],13:[2,7],14:[2,7],17:[2,7],27:[2,7],32:[2,7],37:[2,7],42:[2,7],45:[2,7],46:[2,7],49:[2,7],53:[2,7]},{5:[2,8],13:[2,8],14:[2,8],17:[2,8],27:[2,8],32:[2,8],37:[2,8],42:[2,8],45:[2,8],46:[2,8],49:[2,8],53:[2,8]},{18:22,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{18:31,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{4:32,6:3,13:[2,41],14:[2,41],17:[2,41],27:[2,41],32:[2,41],37:[2,41],42:[2,41],45:[2,41],46:[2,41],49:[2,41],53:[2,41]},{4:33,6:3,13:[2,41],14:[2,41],17:[2,41],27:[2,41],32:[2,41],42:[2,41],45:[2,41],46:[2,41],49:[2,41],53:[2,41]},{12:34,14:[1,18]},{18:36,54:35,58:37,59:[1,38],66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{5:[2,9],13:[2,9],14:[2,9],16:[2,9],17:[2,9],27:[2,9],32:[2,9],37:[2,9],42:[2,9],45:[2,9],46:[2,9],49:[2,9],53:[2,9]},{18:39,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{18:40,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{18:41,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{31:[2,71],47:42,59:[2,71],66:[2,71],74:[2,71],75:[2,71],76:[2,71],77:[2,71]},{21:[2,30],31:[2,30],52:[2,30],59:[2,30],62:[2,30],66:[2,30],69:[2,30],74:[2,30],75:[2,30],76:[2,30],77:[2,30]},{21:[2,31],31:[2,31],52:[2,31],59:[2,31],62:[2,31],66:[2,31],69:[2,31],74:[2,31],75:[2,31],76:[2,31],77:[2,31]},{21:[2,32],31:[2,32],52:[2,32],59:[2,32],62:[2,32],66:[2,32],69:[2,32],74:[2,32],75:[2,32],76:[2,32],77:[2,32]},{21:[2,33],31:[2,33],52:[2,33],59:[2,33],62:[2,33],66:[2,33],69:[2,33],74:[2,33],75:[2,33],76:[2,33],77:[2,33]},{21:[2,34],31:[2,34],52:[2,34],59:[2,34],62:[2,34],66:[2,34],69:[2,34],74:[2,34],75:[2,34],76:[2,34],77:[2,34]},{21:[2,38],31:[2,38],52:[2,38],59:[2,38],62:[2,38],66:[2,38],69:[2,38],74:[2,38],75:[2,38],76:[2,38],77:[2,38],79:[1,43]},{66:[1,30],78:44},{21:[2,40],31:[2,40],52:[2,40],59:[2,40],62:[2,40],66:[2,40],69:[2,40],74:[2,40],75:[2,40],76:[2,40],77:[2,40],79:[2,40]},{50:45,52:[2,75],59:[2,75],66:[2,75],74:[2,75],75:[2,75],76:[2,75],77:[2,75]},{23:46,36:48,37:[1,50],41:49,42:[1,51],43:47,45:[2,47]},{26:52,41:53,42:[1,51],45:[2,49]},{16:[1,54]},{31:[2,79],55:55,59:[2,79],66:[2,79],74:[2,79],75:[2,79],76:[2,79],77:[2,79]},{31:[2,35],59:[2,35],66:[2,35],74:[2,35],75:[2,35],76:[2,35],77:[2,35]},{31:[2,36],59:[2,36],66:[2,36],74:[2,36],75:[2,36],76:[2,36],77:[2,36]},{18:56,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{28:57,31:[2,51],59:[2,51],66:[2,51],69:[2,51],74:[2,51],75:[2,51],76:[2,51],77:[2,51]},{31:[2,57],33:58,59:[2,57],66:[2,57],69:[2,57],74:[2,57],75:[2,57],76:[2,57],77:[2,57]},{19:59,21:[2,43],59:[2,43],66:[2,43],74:[2,43],75:[2,43],76:[2,43],77:[2,43]},{18:63,31:[2,73],48:60,57:61,58:64,59:[1,38],63:62,64:65,65:66,66:[1,67],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{66:[1,68]},{21:[2,37],31:[2,37],52:[2,37],59:[2,37],62:[2,37],66:[2,37],69:[2,37],74:[2,37],75:[2,37],76:[2,37],77:[2,37],79:[1,43]},{18:63,51:69,52:[2,77],57:70,58:64,59:[1,38],63:71,64:65,65:66,66:[1,67],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{24:72,45:[1,73]},{45:[2,48]},{4:74,6:3,13:[2,41],14:[2,41],17:[2,41],27:[2,41],32:[2,41],37:[2,41],42:[2,41],45:[2,41],46:[2,41],49:[2,41],53:[2,41]},{45:[2,19]},{18:75,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{4:76,6:3,13:[2,41],14:[2,41],17:[2,41],27:[2,41],32:[2,41],45:[2,41],46:[2,41],49:[2,41],53:[2,41]},{24:77,45:[1,73]},{45:[2,50]},{5:[2,10],13:[2,10],14:[2,10],17:[2,10],27:[2,10],32:[2,10],37:[2,10],42:[2,10],45:[2,10],46:[2,10],49:[2,10],53:[2,10]},{18:63,31:[2,81],56:78,57:79,58:64,59:[1,38],63:80,64:65,65:66,66:[1,67],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{59:[2,83],60:81,62:[2,83],66:[2,83],74:[2,83],75:[2,83],76:[2,83],77:[2,83]},{18:63,29:82,31:[2,53],57:83,58:64,59:[1,38],63:84,64:65,65:66,66:[1,67],69:[2,53],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{18:63,31:[2,59],34:85,57:86,58:64,59:[1,38],63:87,64:65,65:66,66:[1,67],69:[2,59],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{18:63,20:88,21:[2,45],57:89,58:64,59:[1,38],63:90,64:65,65:66,66:[1,67],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{31:[1,91]},{31:[2,72],59:[2,72],66:[2,72],74:[2,72],75:[2,72],76:[2,72],77:[2,72]},{31:[2,74]},{21:[2,24],31:[2,24],52:[2,24],59:[2,24],62:[2,24],66:[2,24],69:[2,24],74:[2,24],75:[2,24],76:[2,24],77:[2,24]},{21:[2,25],31:[2,25],52:[2,25],59:[2,25],62:[2,25],66:[2,25],69:[2,25],74:[2,25],75:[2,25],76:[2,25],77:[2,25]},{21:[2,27],31:[2,27],52:[2,27],62:[2,27],65:92,66:[1,93],69:[2,27]},{21:[2,87],31:[2,87],52:[2,87],62:[2,87],66:[2,87],69:[2,87]},{21:[2,40],31:[2,40],52:[2,40],59:[2,40],62:[2,40],66:[2,40],67:[1,94],69:[2,40],74:[2,40],75:[2,40],76:[2,40],77:[2,40],79:[2,40]},{21:[2,39],31:[2,39],52:[2,39],59:[2,39],62:[2,39],66:[2,39],69:[2,39],74:[2,39],75:[2,39],76:[2,39],77:[2,39],79:[2,39]},{52:[1,95]},{52:[2,76],59:[2,76],66:[2,76],74:[2,76],75:[2,76],76:[2,76],77:[2,76]},{52:[2,78]},{5:[2,12],13:[2,12],14:[2,12],17:[2,12],27:[2,12],32:[2,12],37:[2,12],42:[2,12],45:[2,12],46:[2,12],49:[2,12],53:[2,12]},{18:96,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{36:48,37:[1,50],41:49,42:[1,51],43:98,44:97,45:[2,69]},{31:[2,63],38:99,59:[2,63],66:[2,63],69:[2,63],74:[2,63],75:[2,63],76:[2,63],77:[2,63]},{45:[2,17]},{5:[2,13],13:[2,13],14:[2,13],17:[2,13],27:[2,13],32:[2,13],37:[2,13],42:[2,13],45:[2,13],46:[2,13],49:[2,13],53:[2,13]},{31:[1,100]},{31:[2,80],59:[2,80],66:[2,80],74:[2,80],75:[2,80],76:[2,80],77:[2,80]},{31:[2,82]},{18:63,57:102,58:64,59:[1,38],61:101,62:[2,85],63:103,64:65,65:66,66:[1,67],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{30:104,31:[2,55],68:105,69:[1,106]},{31:[2,52],59:[2,52],66:[2,52],69:[2,52],74:[2,52],75:[2,52],76:[2,52],77:[2,52]},{31:[2,54],69:[2,54]},{31:[2,61],35:107,68:108,69:[1,106]},{31:[2,58],59:[2,58],66:[2,58],69:[2,58],74:[2,58],75:[2,58],76:[2,58],77:[2,58]},{31:[2,60],69:[2,60]},{21:[1,109]},{21:[2,44],59:[2,44],66:[2,44],74:[2,44],75:[2,44],76:[2,44],77:[2,44]},{21:[2,46]},{5:[2,21],13:[2,21],14:[2,21],17:[2,21],27:[2,21],32:[2,21],37:[2,21],42:[2,21],45:[2,21],46:[2,21],49:[2,21],53:[2,21]},{21:[2,88],31:[2,88],52:[2,88],62:[2,88],66:[2,88],69:[2,88]},{67:[1,94]},{18:63,57:110,58:64,59:[1,38],66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{5:[2,22],13:[2,22],14:[2,22],17:[2,22],27:[2,22],32:[2,22],37:[2,22],42:[2,22],45:[2,22],46:[2,22],49:[2,22],53:[2,22]},{31:[1,111]},{45:[2,18]},{45:[2,70]},{18:63,31:[2,65],39:112,57:113,58:64,59:[1,38],63:114,64:65,65:66,66:[1,67],69:[2,65],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{5:[2,23],13:[2,23],14:[2,23],17:[2,23],27:[2,23],32:[2,23],37:[2,23],42:[2,23],45:[2,23],46:[2,23],49:[2,23],53:[2,23]},{62:[1,115]},{59:[2,84],62:[2,84],66:[2,84],74:[2,84],75:[2,84],76:[2,84],77:[2,84]},{62:[2,86]},{31:[1,116]},{31:[2,56]},{66:[1,118],70:117},{31:[1,119]},{31:[2,62]},{14:[2,11]},{21:[2,28],31:[2,28],52:[2,28],62:[2,28],66:[2,28],69:[2,28]},{5:[2,20],13:[2,20],14:[2,20],17:[2,20],27:[2,20],32:[2,20],37:[2,20],42:[2,20],45:[2,20],46:[2,20],49:[2,20],53:[2,20]},{31:[2,67],40:120,68:121,69:[1,106]},{31:[2,64],59:[2,64],66:[2,64],69:[2,64],74:[2,64],75:[2,64],76:[2,64],77:[2,64]},{31:[2,66],69:[2,66]},{21:[2,26],31:[2,26],52:[2,26],59:[2,26],62:[2,26],66:[2,26],69:[2,26],74:[2,26],75:[2,26],76:[2,26],77:[2,26]},{13:[2,14],14:[2,14],17:[2,14],27:[2,14],32:[2,14],37:[2,14],42:[2,14],45:[2,14],46:[2,14],49:[2,14],53:[2,14]},{66:[1,123],71:[1,122]},{66:[2,89],71:[2,89]},{13:[2,15],14:[2,15],17:[2,15],27:[2,15],32:[2,15],42:[2,15],45:[2,15],46:[2,15],49:[2,15],53:[2,15]},{31:[1,124]},{31:[2,68]},{31:[2,29]},{66:[2,90],71:[2,90]},{13:[2,16],14:[2,16],17:[2,16],27:[2,16],32:[2,16],37:[2,16],42:[2,16],45:[2,16],46:[2,16],49:[2,16],53:[2,16]}], | |
| 1025 | + defaultActions: {4:[2,1],47:[2,48],49:[2,19],53:[2,50],62:[2,74],71:[2,78],76:[2,17],80:[2,82],90:[2,46],97:[2,18],98:[2,70],103:[2,86],105:[2,56],108:[2,62],109:[2,11],121:[2,68],122:[2,29]}, | |
| 1026 | + parseError: function parseError(str, hash) { | |
| 1027 | + throw new Error(str); | |
| 1028 | + }, | |
| 1029 | + parse: function parse(input) { | |
| 1030 | + var self = this, stack = [0], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1; | |
| 1031 | + this.lexer.setInput(input); | |
| 1032 | + this.lexer.yy = this.yy; | |
| 1033 | + this.yy.lexer = this.lexer; | |
| 1034 | + this.yy.parser = this; | |
| 1035 | + if (typeof this.lexer.yylloc == "undefined") | |
| 1036 | + this.lexer.yylloc = {}; | |
| 1037 | + var yyloc = this.lexer.yylloc; | |
| 1038 | + lstack.push(yyloc); | |
| 1039 | + var ranges = this.lexer.options && this.lexer.options.ranges; | |
| 1040 | + if (typeof this.yy.parseError === "function") | |
| 1041 | + this.parseError = this.yy.parseError; | |
| 1042 | + function popStack(n) { | |
| 1043 | + stack.length = stack.length - 2 * n; | |
| 1044 | + vstack.length = vstack.length - n; | |
| 1045 | + lstack.length = lstack.length - n; | |
| 1046 | + } | |
| 1047 | + function lex() { | |
| 1048 | + var token; | |
| 1049 | + token = self.lexer.lex() || 1; | |
| 1050 | + if (typeof token !== "number") { | |
| 1051 | + token = self.symbols_[token] || token; | |
| 1052 | + } | |
| 1053 | + return token; | |
| 1054 | + } | |
| 1055 | + var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected; | |
| 1056 | + while (true) { | |
| 1057 | + state = stack[stack.length - 1]; | |
| 1058 | + if (this.defaultActions[state]) { | |
| 1059 | + action = this.defaultActions[state]; | |
| 1060 | + } else { | |
| 1061 | + if (symbol === null || typeof symbol == "undefined") { | |
| 1062 | + symbol = lex(); | |
| 1063 | + } | |
| 1064 | + action = table[state] && table[state][symbol]; | |
| 1065 | + } | |
| 1066 | + if (typeof action === "undefined" || !action.length || !action[0]) { | |
| 1067 | + var errStr = ""; | |
| 1068 | + if (!recovering) { | |
| 1069 | + expected = []; | |
| 1070 | + for (p in table[state]) | |
| 1071 | + if (this.terminals_[p] && p > 2) { | |
| 1072 | + expected.push("'" + this.terminals_[p] + "'"); | |
| 1073 | + } | |
| 1074 | + if (this.lexer.showPosition) { | |
| 1075 | + errStr = "Parse error on line " + (yylineno + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; | |
| 1076 | + } else { | |
| 1077 | + errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == 1?"end of input":"'" + (this.terminals_[symbol] || symbol) + "'"); | |
| 1078 | + } | |
| 1079 | + this.parseError(errStr, {text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected}); | |
| 1080 | + } | |
| 1081 | + } | |
| 1082 | + if (action[0] instanceof Array && action.length > 1) { | |
| 1083 | + throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol); | |
| 1084 | + } | |
| 1085 | + switch (action[0]) { | |
| 1086 | + case 1: | |
| 1087 | + stack.push(symbol); | |
| 1088 | + vstack.push(this.lexer.yytext); | |
| 1089 | + lstack.push(this.lexer.yylloc); | |
| 1090 | + stack.push(action[1]); | |
| 1091 | + symbol = null; | |
| 1092 | + if (!preErrorSymbol) { | |
| 1093 | + yyleng = this.lexer.yyleng; | |
| 1094 | + yytext = this.lexer.yytext; | |
| 1095 | + yylineno = this.lexer.yylineno; | |
| 1096 | + yyloc = this.lexer.yylloc; | |
| 1097 | + if (recovering > 0) | |
| 1098 | + recovering--; | |
| 1099 | + } else { | |
| 1100 | + symbol = preErrorSymbol; | |
| 1101 | + preErrorSymbol = null; | |
| 1102 | + } | |
| 1103 | + break; | |
| 1104 | + case 2: | |
| 1105 | + len = this.productions_[action[1]][1]; | |
| 1106 | + yyval.$ = vstack[vstack.length - len]; | |
| 1107 | + 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}; | |
| 1108 | + if (ranges) { | |
| 1109 | + yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]]; | |
| 1110 | + } | |
| 1111 | + r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack); | |
| 1112 | + if (typeof r !== "undefined") { | |
| 1113 | + return r; | |
| 1114 | + } | |
| 1115 | + if (len) { | |
| 1116 | + stack = stack.slice(0, -1 * len * 2); | |
| 1117 | + vstack = vstack.slice(0, -1 * len); | |
| 1118 | + lstack = lstack.slice(0, -1 * len); | |
| 1119 | + } | |
| 1120 | + stack.push(this.productions_[action[1]][0]); | |
| 1121 | + vstack.push(yyval.$); | |
| 1122 | + lstack.push(yyval._$); | |
| 1123 | + newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; | |
| 1124 | + stack.push(newState); | |
| 1125 | + break; | |
| 1126 | + case 3: | |
| 1127 | + return true; | |
| 1128 | + } | |
| 1129 | + } | |
| 1130 | + return true; | |
| 1131 | + } | |
| 1132 | + }; | |
| 1133 | + /* Jison generated lexer */ | |
| 1134 | + var lexer = (function(){ | |
| 1135 | + var lexer = ({EOF:1, | |
| 1136 | + parseError:function parseError(str, hash) { | |
| 1137 | + if (this.yy.parser) { | |
| 1138 | + this.yy.parser.parseError(str, hash); | |
| 1139 | + } else { | |
| 1140 | + throw new Error(str); | |
| 1141 | + } | |
| 1142 | + }, | |
| 1143 | + setInput:function (input) { | |
| 1144 | + this._input = input; | |
| 1145 | + this._more = this._less = this.done = false; | |
| 1146 | + this.yylineno = this.yyleng = 0; | |
| 1147 | + this.yytext = this.matched = this.match = ''; | |
| 1148 | + this.conditionStack = ['INITIAL']; | |
| 1149 | + this.yylloc = {first_line:1,first_column:0,last_line:1,last_column:0}; | |
| 1150 | + if (this.options.ranges) this.yylloc.range = [0,0]; | |
| 1151 | + this.offset = 0; | |
| 1152 | + return this; | |
| 1153 | + }, | |
| 1154 | + input:function () { | |
| 1155 | + var ch = this._input[0]; | |
| 1156 | + this.yytext += ch; | |
| 1157 | + this.yyleng++; | |
| 1158 | + this.offset++; | |
| 1159 | + this.match += ch; | |
| 1160 | + this.matched += ch; | |
| 1161 | + var lines = ch.match(/(?:\r\n?|\n).*/g); | |
| 1162 | + if (lines) { | |
| 1163 | + this.yylineno++; | |
| 1164 | + this.yylloc.last_line++; | |
| 1165 | + } else { | |
| 1166 | + this.yylloc.last_column++; | |
| 1167 | + } | |
| 1168 | + if (this.options.ranges) this.yylloc.range[1]++; | |
| 1169 | + | |
| 1170 | + this._input = this._input.slice(1); | |
| 1171 | + return ch; | |
| 1172 | + }, | |
| 1173 | + unput:function (ch) { | |
| 1174 | + var len = ch.length; | |
| 1175 | + var lines = ch.split(/(?:\r\n?|\n)/g); | |
| 1176 | + | |
| 1177 | + this._input = ch + this._input; | |
| 1178 | + this.yytext = this.yytext.substr(0, this.yytext.length-len-1); | |
| 1179 | + //this.yyleng -= len; | |
| 1180 | + this.offset -= len; | |
| 1181 | + var oldLines = this.match.split(/(?:\r\n?|\n)/g); | |
| 1182 | + this.match = this.match.substr(0, this.match.length-1); | |
| 1183 | + this.matched = this.matched.substr(0, this.matched.length-1); | |
| 1184 | + | |
| 1185 | + if (lines.length-1) this.yylineno -= lines.length-1; | |
| 1186 | + var r = this.yylloc.range; | |
| 1187 | + | |
| 1188 | + this.yylloc = {first_line: this.yylloc.first_line, | |
| 1189 | + last_line: this.yylineno+1, | |
| 1190 | + first_column: this.yylloc.first_column, | |
| 1191 | + last_column: lines ? | |
| 1192 | + (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length: | |
| 1193 | + this.yylloc.first_column - len | |
| 1194 | + }; | |
| 1195 | + | |
| 1196 | + if (this.options.ranges) { | |
| 1197 | + this.yylloc.range = [r[0], r[0] + this.yyleng - len]; | |
| 1198 | + } | |
| 1199 | + return this; | |
| 1200 | + }, | |
| 1201 | + more:function () { | |
| 1202 | + this._more = true; | |
| 1203 | + return this; | |
| 1204 | + }, | |
| 1205 | + less:function (n) { | |
| 1206 | + this.unput(this.match.slice(n)); | |
| 1207 | + }, | |
| 1208 | + pastInput:function () { | |
| 1209 | + var past = this.matched.substr(0, this.matched.length - this.match.length); | |
| 1210 | + return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, ""); | |
| 1211 | + }, | |
| 1212 | + upcomingInput:function () { | |
| 1213 | + var next = this.match; | |
| 1214 | + if (next.length < 20) { | |
| 1215 | + next += this._input.substr(0, 20-next.length); | |
| 1216 | + } | |
| 1217 | + return (next.substr(0,20)+(next.length > 20 ? '...':'')).replace(/\n/g, ""); | |
| 1218 | + }, | |
| 1219 | + showPosition:function () { | |
| 1220 | + var pre = this.pastInput(); | |
| 1221 | + var c = new Array(pre.length + 1).join("-"); | |
| 1222 | + return pre + this.upcomingInput() + "\n" + c+"^"; | |
| 1223 | + }, | |
| 1224 | + next:function () { | |
| 1225 | + if (this.done) { | |
| 1226 | + return this.EOF; | |
| 1227 | + } | |
| 1228 | + if (!this._input) this.done = true; | |
| 1229 | + | |
| 1230 | + var token, | |
| 1231 | + match, | |
| 1232 | + tempMatch, | |
| 1233 | + index, | |
| 1234 | + col, | |
| 1235 | + lines; | |
| 1236 | + if (!this._more) { | |
| 1237 | + this.yytext = ''; | |
| 1238 | + this.match = ''; | |
| 1239 | + } | |
| 1240 | + var rules = this._currentRules(); | |
| 1241 | + for (var i=0;i < rules.length; i++) { | |
| 1242 | + tempMatch = this._input.match(this.rules[rules[i]]); | |
| 1243 | + if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { | |
| 1244 | + match = tempMatch; | |
| 1245 | + index = i; | |
| 1246 | + if (!this.options.flex) break; | |
| 1247 | + } | |
| 1248 | + } | |
| 1249 | + if (match) { | |
| 1250 | + lines = match[0].match(/(?:\r\n?|\n).*/g); | |
| 1251 | + if (lines) this.yylineno += lines.length; | |
| 1252 | + this.yylloc = {first_line: this.yylloc.last_line, | |
| 1253 | + last_line: this.yylineno+1, | |
| 1254 | + first_column: this.yylloc.last_column, | |
| 1255 | + last_column: lines ? lines[lines.length-1].length-lines[lines.length-1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length}; | |
| 1256 | + this.yytext += match[0]; | |
| 1257 | + this.match += match[0]; | |
| 1258 | + this.matches = match; | |
| 1259 | + this.yyleng = this.yytext.length; | |
| 1260 | + if (this.options.ranges) { | |
| 1261 | + this.yylloc.range = [this.offset, this.offset += this.yyleng]; | |
| 1262 | + } | |
| 1263 | + this._more = false; | |
| 1264 | + this._input = this._input.slice(match[0].length); | |
| 1265 | + this.matched += match[0]; | |
| 1266 | + token = this.performAction.call(this, this.yy, this, rules[index],this.conditionStack[this.conditionStack.length-1]); | |
| 1267 | + if (this.done && this._input) this.done = false; | |
| 1268 | + if (token) return token; | |
| 1269 | + else return; | |
| 1270 | + } | |
| 1271 | + if (this._input === "") { | |
| 1272 | + return this.EOF; | |
| 1273 | + } else { | |
| 1274 | + return this.parseError('Lexical error on line '+(this.yylineno+1)+'. Unrecognized text.\n'+this.showPosition(), | |
| 1275 | + {text: "", token: null, line: this.yylineno}); | |
| 1276 | + } | |
| 1277 | + }, | |
| 1278 | + lex:function lex() { | |
| 1279 | + var r = this.next(); | |
| 1280 | + if (typeof r !== 'undefined') { | |
| 1281 | + return r; | |
| 1282 | + } else { | |
| 1283 | + return this.lex(); | |
| 1284 | + } | |
| 1285 | + }, | |
| 1286 | + begin:function begin(condition) { | |
| 1287 | + this.conditionStack.push(condition); | |
| 1288 | + }, | |
| 1289 | + popState:function popState() { | |
| 1290 | + return this.conditionStack.pop(); | |
| 1291 | + }, | |
| 1292 | + _currentRules:function _currentRules() { | |
| 1293 | + return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules; | |
| 1294 | + }, | |
| 1295 | + topState:function () { | |
| 1296 | + return this.conditionStack[this.conditionStack.length-2]; | |
| 1297 | + }, | |
| 1298 | + pushState:function begin(condition) { | |
| 1299 | + this.begin(condition); | |
| 1300 | + }}); | |
| 1301 | + lexer.options = {}; | |
| 1302 | + lexer.performAction = function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) { | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + function strip(start, end) { | |
| 1306 | + return yy_.yytext = yy_.yytext.substr(start, yy_.yyleng-end); | |
| 1307 | + } | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + var YYSTATE=YY_START | |
| 1311 | + switch($avoiding_name_collisions) { | |
| 1312 | + case 0: | |
| 1313 | + if(yy_.yytext.slice(-2) === "\\\\") { | |
| 1314 | + strip(0,1); | |
| 1315 | + this.begin("mu"); | |
| 1316 | + } else if(yy_.yytext.slice(-1) === "\\") { | |
| 1317 | + strip(0,1); | |
| 1318 | + this.begin("emu"); | |
| 1319 | + } else { | |
| 1320 | + this.begin("mu"); | |
| 1321 | + } | |
| 1322 | + if(yy_.yytext) return 14; | |
| 1323 | + | |
| 1324 | + break; | |
| 1325 | + case 1:return 14; | |
| 1326 | + break; | |
| 1327 | + case 2: | |
| 1328 | + this.popState(); | |
| 1329 | + return 14; | |
| 1330 | + | |
| 1331 | + break; | |
| 1332 | + case 3: | |
| 1333 | + yy_.yytext = yy_.yytext.substr(5, yy_.yyleng-9); | |
| 1334 | + this.popState(); | |
| 1335 | + return 16; | |
| 1336 | + | |
| 1337 | + break; | |
| 1338 | + case 4: return 14; | |
| 1339 | + break; | |
| 1340 | + case 5: | |
| 1341 | + this.popState(); | |
| 1342 | + return 13; | |
| 1343 | + | |
| 1344 | + break; | |
| 1345 | + case 6:return 59; | |
| 1346 | + break; | |
| 1347 | + case 7:return 62; | |
| 1348 | + break; | |
| 1349 | + case 8: return 17; | |
| 1350 | + break; | |
| 1351 | + case 9: | |
| 1352 | + this.popState(); | |
| 1353 | + this.begin('raw'); | |
| 1354 | + return 21; | |
| 1355 | + | |
| 1356 | + break; | |
| 1357 | + case 10:return 53; | |
| 1358 | + break; | |
| 1359 | + case 11:return 27; | |
| 1360 | + break; | |
| 1361 | + case 12:return 45; | |
| 1362 | + break; | |
| 1363 | + case 13:this.popState(); return 42; | |
| 1364 | + break; | |
| 1365 | + case 14:this.popState(); return 42; | |
| 1366 | + break; | |
| 1367 | + case 15:return 32; | |
| 1368 | + break; | |
| 1369 | + case 16:return 37; | |
| 1370 | + break; | |
| 1371 | + case 17:return 49; | |
| 1372 | + break; | |
| 1373 | + case 18:return 46; | |
| 1374 | + break; | |
| 1375 | + case 19: | |
| 1376 | + this.unput(yy_.yytext); | |
| 1377 | + this.popState(); | |
| 1378 | + this.begin('com'); | |
| 1379 | + | |
| 1380 | + break; | |
| 1381 | + case 20: | |
| 1382 | + this.popState(); | |
| 1383 | + return 13; | |
| 1384 | + | |
| 1385 | + break; | |
| 1386 | + case 21:return 46; | |
| 1387 | + break; | |
| 1388 | + case 22:return 67; | |
| 1389 | + break; | |
| 1390 | + case 23:return 66; | |
| 1391 | + break; | |
| 1392 | + case 24:return 66; | |
| 1393 | + break; | |
| 1394 | + case 25:return 79; | |
| 1395 | + break; | |
| 1396 | + case 26:// ignore whitespace | |
| 1397 | + break; | |
| 1398 | + case 27:this.popState(); return 52; | |
| 1399 | + break; | |
| 1400 | + case 28:this.popState(); return 31; | |
| 1401 | + break; | |
| 1402 | + case 29:yy_.yytext = strip(1,2).replace(/\\"/g,'"'); return 74; | |
| 1403 | + break; | |
| 1404 | + case 30:yy_.yytext = strip(1,2).replace(/\\'/g,"'"); return 74; | |
| 1405 | + break; | |
| 1406 | + case 31:return 77; | |
| 1407 | + break; | |
| 1408 | + case 32:return 76; | |
| 1409 | + break; | |
| 1410 | + case 33:return 76; | |
| 1411 | + break; | |
| 1412 | + case 34:return 75; | |
| 1413 | + break; | |
| 1414 | + case 35:return 69; | |
| 1415 | + break; | |
| 1416 | + case 36:return 71; | |
| 1417 | + break; | |
| 1418 | + case 37:return 66; | |
| 1419 | + break; | |
| 1420 | + case 38:yy_.yytext = strip(1,2); return 66; | |
| 1421 | + break; | |
| 1422 | + case 39:return 'INVALID'; | |
| 1423 | + break; | |
| 1424 | + case 40:return 5; | |
| 1425 | + break; | |
| 1426 | + } | |
| 1427 | + }; | |
| 1428 | + 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)])))/,/^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/,/^(?:as\s+\|)/,/^(?:\|)/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/]; | |
| 1429 | + lexer.conditions = {"mu":{"rules":[6,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],"inclusive":false},"emu":{"rules":[2],"inclusive":false},"com":{"rules":[5],"inclusive":false},"raw":{"rules":[3,4],"inclusive":false},"INITIAL":{"rules":[0,1,40],"inclusive":true}}; | |
| 1430 | + return lexer;})() | |
| 1431 | + parser.lexer = lexer; | |
| 1432 | + function Parser () { this.yy = {}; }Parser.prototype = parser;parser.Parser = Parser; | |
| 1433 | + return new Parser; | |
| 1434 | + })();__exports__ = handlebars; | |
| 1435 | + /* jshint ignore:end */ | |
| 1436 | + return __exports__; | |
| 1437 | +})(); | |
| 1438 | + | |
| 1439 | +// handlebars/compiler/visitor.js | |
| 1440 | +var __module11__ = (function(__dependency1__, __dependency2__) { | |
| 1441 | + "use strict"; | |
| 1442 | + var __exports__; | |
| 1443 | + var Exception = __dependency1__; | |
| 1444 | + var AST = __dependency2__; | |
| 1445 | + | |
| 1446 | + function Visitor() { | |
| 1447 | + this.parents = []; | |
| 1448 | + } | |
| 1449 | + | |
| 1450 | + Visitor.prototype = { | |
| 1451 | + constructor: Visitor, | |
| 1452 | + mutating: false, | |
| 1453 | + | |
| 1454 | + // Visits a given value. If mutating, will replace the value if necessary. | |
| 1455 | + acceptKey: function(node, name) { | |
| 1456 | + var value = this.accept(node[name]); | |
| 1457 | + if (this.mutating) { | |
| 1458 | + // Hacky sanity check: | |
| 1459 | + if (value && (!value.type || !AST[value.type])) { | |
| 1460 | + throw new Exception('Unexpected node type "' + value.type + '" found when accepting ' + name + ' on ' + node.type); | |
| 1461 | + } | |
| 1462 | + node[name] = value; | |
| 1463 | + } | |
| 1464 | + }, | |
| 1465 | + | |
| 1466 | + // Performs an accept operation with added sanity check to ensure | |
| 1467 | + // required keys are not removed. | |
| 1468 | + acceptRequired: function(node, name) { | |
| 1469 | + this.acceptKey(node, name); | |
| 1470 | + | |
| 1471 | + if (!node[name]) { | |
| 1472 | + throw new Exception(node.type + ' requires ' + name); | |
| 1473 | + } | |
| 1474 | + }, | |
| 1475 | + | |
| 1476 | + // Traverses a given array. If mutating, empty respnses will be removed | |
| 1477 | + // for child elements. | |
| 1478 | + acceptArray: function(array) { | |
| 1479 | + for (var i = 0, l = array.length; i < l; i++) { | |
| 1480 | + this.acceptKey(array, i); | |
| 1481 | + | |
| 1482 | + if (!array[i]) { | |
| 1483 | + array.splice(i, 1); | |
| 1484 | + i--; | |
| 1485 | + l--; | |
| 1486 | + } | |
| 1487 | + } | |
| 1488 | + }, | |
| 1489 | + | |
| 1490 | + accept: function(object) { | |
| 1491 | + if (!object) { | |
| 1492 | + return; | |
| 1493 | + } | |
| 1494 | + | |
| 1495 | + if (this.current) { | |
| 1496 | + this.parents.unshift(this.current); | |
| 1497 | + } | |
| 1498 | + this.current = object; | |
| 1499 | + | |
| 1500 | + var ret = this[object.type](object); | |
| 1501 | + | |
| 1502 | + this.current = this.parents.shift(); | |
| 1503 | + | |
| 1504 | + if (!this.mutating || ret) { | |
| 1505 | + return ret; | |
| 1506 | + } else if (ret !== false) { | |
| 1507 | + return object; | |
| 1508 | + } | |
| 1509 | + }, | |
| 1510 | + | |
| 1511 | + Program: function(program) { | |
| 1512 | + this.acceptArray(program.body); | |
| 1513 | + }, | |
| 1514 | + | |
| 1515 | + MustacheStatement: function(mustache) { | |
| 1516 | + this.acceptRequired(mustache, 'path'); | |
| 1517 | + this.acceptArray(mustache.params); | |
| 1518 | + this.acceptKey(mustache, 'hash'); | |
| 1519 | + }, | |
| 1520 | + | |
| 1521 | + BlockStatement: function(block) { | |
| 1522 | + this.acceptRequired(block, 'path'); | |
| 1523 | + this.acceptArray(block.params); | |
| 1524 | + this.acceptKey(block, 'hash'); | |
| 1525 | + | |
| 1526 | + this.acceptKey(block, 'program'); | |
| 1527 | + this.acceptKey(block, 'inverse'); | |
| 1528 | + }, | |
| 1529 | + | |
| 1530 | + PartialStatement: function(partial) { | |
| 1531 | + this.acceptRequired(partial, 'name'); | |
| 1532 | + this.acceptArray(partial.params); | |
| 1533 | + this.acceptKey(partial, 'hash'); | |
| 1534 | + }, | |
| 1535 | + | |
| 1536 | + ContentStatement: function(/* content */) {}, | |
| 1537 | + CommentStatement: function(/* comment */) {}, | |
| 1538 | + | |
| 1539 | + SubExpression: function(sexpr) { | |
| 1540 | + this.acceptRequired(sexpr, 'path'); | |
| 1541 | + this.acceptArray(sexpr.params); | |
| 1542 | + this.acceptKey(sexpr, 'hash'); | |
| 1543 | + }, | |
| 1544 | + PartialExpression: function(partial) { | |
| 1545 | + this.acceptRequired(partial, 'name'); | |
| 1546 | + this.acceptArray(partial.params); | |
| 1547 | + this.acceptKey(partial, 'hash'); | |
| 1548 | + }, | |
| 1549 | + | |
| 1550 | + PathExpression: function(/* path */) {}, | |
| 1551 | + | |
| 1552 | + StringLiteral: function(/* string */) {}, | |
| 1553 | + NumberLiteral: function(/* number */) {}, | |
| 1554 | + BooleanLiteral: function(/* bool */) {}, | |
| 1555 | + | |
| 1556 | + Hash: function(hash) { | |
| 1557 | + this.acceptArray(hash.pairs); | |
| 1558 | + }, | |
| 1559 | + HashPair: function(pair) { | |
| 1560 | + this.acceptRequired(pair, 'value'); | |
| 1561 | + } | |
| 1562 | + }; | |
| 1563 | + | |
| 1564 | + __exports__ = Visitor; | |
| 1565 | + return __exports__; | |
| 1566 | +})(__module4__, __module7__); | |
| 1567 | + | |
| 1568 | +// handlebars/compiler/whitespace-control.js | |
| 1569 | +var __module10__ = (function(__dependency1__) { | |
| 1570 | + "use strict"; | |
| 1571 | + var __exports__; | |
| 1572 | + var Visitor = __dependency1__; | |
| 1573 | + | |
| 1574 | + function WhitespaceControl() { | |
| 1575 | + } | |
| 1576 | + WhitespaceControl.prototype = new Visitor(); | |
| 1577 | + | |
| 1578 | + WhitespaceControl.prototype.Program = function(program) { | |
| 1579 | + var isRoot = !this.isRootSeen; | |
| 1580 | + this.isRootSeen = true; | |
| 1581 | + | |
| 1582 | + var body = program.body; | |
| 1583 | + for (var i = 0, l = body.length; i < l; i++) { | |
| 1584 | + var current = body[i], | |
| 1585 | + strip = this.accept(current); | |
| 1586 | + | |
| 1587 | + if (!strip) { | |
| 1588 | + continue; | |
| 1589 | + } | |
| 1590 | + | |
| 1591 | + var _isPrevWhitespace = isPrevWhitespace(body, i, isRoot), | |
| 1592 | + _isNextWhitespace = isNextWhitespace(body, i, isRoot), | |
| 1593 | + | |
| 1594 | + openStandalone = strip.openStandalone && _isPrevWhitespace, | |
| 1595 | + closeStandalone = strip.closeStandalone && _isNextWhitespace, | |
| 1596 | + inlineStandalone = strip.inlineStandalone && _isPrevWhitespace && _isNextWhitespace; | |
| 1597 | + | |
| 1598 | + if (strip.close) { | |
| 1599 | + omitRight(body, i, true); | |
| 1600 | + } | |
| 1601 | + if (strip.open) { | |
| 1602 | + omitLeft(body, i, true); | |
| 1603 | + } | |
| 1604 | + | |
| 1605 | + if (inlineStandalone) { | |
| 1606 | + omitRight(body, i); | |
| 1607 | + | |
| 1608 | + if (omitLeft(body, i)) { | |
| 1609 | + // If we are on a standalone node, save the indent info for partials | |
| 1610 | + if (current.type === 'PartialStatement') { | |
| 1611 | + // Pull out the whitespace from the final line | |
| 1612 | + current.indent = (/([ \t]+$)/).exec(body[i-1].original)[1]; | |
| 1613 | + } | |
| 1614 | + } | |
| 1615 | + } | |
| 1616 | + if (openStandalone) { | |
| 1617 | + omitRight((current.program || current.inverse).body); | |
| 1618 | + | |
| 1619 | + // Strip out the previous content node if it's whitespace only | |
| 1620 | + omitLeft(body, i); | |
| 1621 | + } | |
| 1622 | + if (closeStandalone) { | |
| 1623 | + // Always strip the next node | |
| 1624 | + omitRight(body, i); | |
| 1625 | + | |
| 1626 | + omitLeft((current.inverse || current.program).body); | |
| 1627 | + } | |
| 1628 | + } | |
| 1629 | + | |
| 1630 | + return program; | |
| 1631 | + }; | |
| 1632 | + WhitespaceControl.prototype.BlockStatement = function(block) { | |
| 1633 | + this.accept(block.program); | |
| 1634 | + this.accept(block.inverse); | |
| 1635 | + | |
| 1636 | + // Find the inverse program that is involed with whitespace stripping. | |
| 1637 | + var program = block.program || block.inverse, | |
| 1638 | + inverse = block.program && block.inverse, | |
| 1639 | + firstInverse = inverse, | |
| 1640 | + lastInverse = inverse; | |
| 1641 | + | |
| 1642 | + if (inverse && inverse.chained) { | |
| 1643 | + firstInverse = inverse.body[0].program; | |
| 1644 | + | |
| 1645 | + // Walk the inverse chain to find the last inverse that is actually in the chain. | |
| 1646 | + while (lastInverse.chained) { | |
| 1647 | + lastInverse = lastInverse.body[lastInverse.body.length-1].program; | |
| 1648 | + } | |
| 1649 | + } | |
| 1650 | + | |
| 1651 | + var strip = { | |
| 1652 | + open: block.openStrip.open, | |
| 1653 | + close: block.closeStrip.close, | |
| 1654 | + | |
| 1655 | + // Determine the standalone candiacy. Basically flag our content as being possibly standalone | |
| 1656 | + // so our parent can determine if we actually are standalone | |
| 1657 | + openStandalone: isNextWhitespace(program.body), | |
| 1658 | + closeStandalone: isPrevWhitespace((firstInverse || program).body) | |
| 1659 | + }; | |
| 1660 | + | |
| 1661 | + if (block.openStrip.close) { | |
| 1662 | + omitRight(program.body, null, true); | |
| 1663 | + } | |
| 1664 | + | |
| 1665 | + if (inverse) { | |
| 1666 | + var inverseStrip = block.inverseStrip; | |
| 1667 | + | |
| 1668 | + if (inverseStrip.open) { | |
| 1669 | + omitLeft(program.body, null, true); | |
| 1670 | + } | |
| 1671 | + | |
| 1672 | + if (inverseStrip.close) { | |
| 1673 | + omitRight(firstInverse.body, null, true); | |
| 1674 | + } | |
| 1675 | + if (block.closeStrip.open) { | |
| 1676 | + omitLeft(lastInverse.body, null, true); | |
| 1677 | + } | |
| 1678 | + | |
| 1679 | + // Find standalone else statments | |
| 1680 | + if (isPrevWhitespace(program.body) | |
| 1681 | + && isNextWhitespace(firstInverse.body)) { | |
| 1682 | + | |
| 1683 | + omitLeft(program.body); | |
| 1684 | + omitRight(firstInverse.body); | |
| 1685 | + } | |
| 1686 | + } else { | |
| 1687 | + if (block.closeStrip.open) { | |
| 1688 | + omitLeft(program.body, null, true); | |
| 1689 | + } | |
| 1690 | + } | |
| 1691 | + | |
| 1692 | + return strip; | |
| 1693 | + }; | |
| 1694 | + | |
| 1695 | + WhitespaceControl.prototype.MustacheStatement = function(mustache) { | |
| 1696 | + return mustache.strip; | |
| 1697 | + }; | |
| 1698 | + | |
| 1699 | + WhitespaceControl.prototype.PartialStatement = | |
| 1700 | + WhitespaceControl.prototype.CommentStatement = function(node) { | |
| 1701 | + /* istanbul ignore next */ | |
| 1702 | + var strip = node.strip || {}; | |
| 1703 | + return { | |
| 1704 | + inlineStandalone: true, | |
| 1705 | + open: strip.open, | |
| 1706 | + close: strip.close | |
| 1707 | + }; | |
| 1708 | + }; | |
| 1709 | + | |
| 1710 | + | |
| 1711 | + function isPrevWhitespace(body, i, isRoot) { | |
| 1712 | + if (i === undefined) { | |
| 1713 | + i = body.length; | |
| 1714 | + } | |
| 1715 | + | |
| 1716 | + // Nodes that end with newlines are considered whitespace (but are special | |
| 1717 | + // cased for strip operations) | |
| 1718 | + var prev = body[i-1], | |
| 1719 | + sibling = body[i-2]; | |
| 1720 | + if (!prev) { | |
| 1721 | + return isRoot; | |
| 1722 | + } | |
| 1723 | + | |
| 1724 | + if (prev.type === 'ContentStatement') { | |
| 1725 | + return (sibling || !isRoot ? (/\r?\n\s*?$/) : (/(^|\r?\n)\s*?$/)).test(prev.original); | |
| 1726 | + } | |
| 1727 | + } | |
| 1728 | + function isNextWhitespace(body, i, isRoot) { | |
| 1729 | + if (i === undefined) { | |
| 1730 | + i = -1; | |
| 1731 | + } | |
| 1732 | + | |
| 1733 | + var next = body[i+1], | |
| 1734 | + sibling = body[i+2]; | |
| 1735 | + if (!next) { | |
| 1736 | + return isRoot; | |
| 1737 | + } | |
| 1738 | + | |
| 1739 | + if (next.type === 'ContentStatement') { | |
| 1740 | + return (sibling || !isRoot ? (/^\s*?\r?\n/) : (/^\s*?(\r?\n|$)/)).test(next.original); | |
| 1741 | + } | |
| 1742 | + } | |
| 1743 | + | |
| 1744 | + // Marks the node to the right of the position as omitted. | |
| 1745 | + // I.e. {{foo}}' ' will mark the ' ' node as omitted. | |
| 1746 | + // | |
| 1747 | + // If i is undefined, then the first child will be marked as such. | |
| 1748 | + // | |
| 1749 | + // If mulitple is truthy then all whitespace will be stripped out until non-whitespace | |
| 1750 | + // content is met. | |
| 1751 | + function omitRight(body, i, multiple) { | |
| 1752 | + var current = body[i == null ? 0 : i + 1]; | |
| 1753 | + if (!current || current.type !== 'ContentStatement' || (!multiple && current.rightStripped)) { | |
| 1754 | + return; | |
| 1755 | + } | |
| 1756 | + | |
| 1757 | + var original = current.value; | |
| 1758 | + current.value = current.value.replace(multiple ? (/^\s+/) : (/^[ \t]*\r?\n?/), ''); | |
| 1759 | + current.rightStripped = current.value !== original; | |
| 1760 | + } | |
| 1761 | + | |
| 1762 | + // Marks the node to the left of the position as omitted. | |
| 1763 | + // I.e. ' '{{foo}} will mark the ' ' node as omitted. | |
| 1764 | + // | |
| 1765 | + // If i is undefined then the last child will be marked as such. | |
| 1766 | + // | |
| 1767 | + // If mulitple is truthy then all whitespace will be stripped out until non-whitespace | |
| 1768 | + // content is met. | |
| 1769 | + function omitLeft(body, i, multiple) { | |
| 1770 | + var current = body[i == null ? body.length - 1 : i - 1]; | |
| 1771 | + if (!current || current.type !== 'ContentStatement' || (!multiple && current.leftStripped)) { | |
| 1772 | + return; | |
| 1773 | + } | |
| 1774 | + | |
| 1775 | + // We omit the last node if it's whitespace only and not preceeded by a non-content node. | |
| 1776 | + var original = current.value; | |
| 1777 | + current.value = current.value.replace(multiple ? (/\s+$/) : (/[ \t]+$/), ''); | |
| 1778 | + current.leftStripped = current.value !== original; | |
| 1779 | + return current.leftStripped; | |
| 1780 | + } | |
| 1781 | + | |
| 1782 | + __exports__ = WhitespaceControl; | |
| 1783 | + return __exports__; | |
| 1784 | +})(__module11__); | |
| 1785 | + | |
| 1786 | +// handlebars/compiler/helpers.js | |
| 1787 | +var __module12__ = (function(__dependency1__) { | |
| 1788 | + "use strict"; | |
| 1789 | + var __exports__ = {}; | |
| 1790 | + var Exception = __dependency1__; | |
| 1791 | + | |
| 1792 | + function SourceLocation(source, locInfo) { | |
| 1793 | + this.source = source; | |
| 1794 | + this.start = { | |
| 1795 | + line: locInfo.first_line, | |
| 1796 | + column: locInfo.first_column | |
| 1797 | + }; | |
| 1798 | + this.end = { | |
| 1799 | + line: locInfo.last_line, | |
| 1800 | + column: locInfo.last_column | |
| 1801 | + }; | |
| 1802 | + } | |
| 1803 | + | |
| 1804 | + __exports__.SourceLocation = SourceLocation;function stripFlags(open, close) { | |
| 1805 | + return { | |
| 1806 | + open: open.charAt(2) === '~', | |
| 1807 | + close: close.charAt(close.length-3) === '~' | |
| 1808 | + }; | |
| 1809 | + } | |
| 1810 | + | |
| 1811 | + __exports__.stripFlags = stripFlags;function stripComment(comment) { | |
| 1812 | + return comment.replace(/^\{\{~?\!-?-?/, '') | |
| 1813 | + .replace(/-?-?~?\}\}$/, ''); | |
| 1814 | + } | |
| 1815 | + | |
| 1816 | + __exports__.stripComment = stripComment;function preparePath(data, parts, locInfo) { | |
| 1817 | + /*jshint -W040 */ | |
| 1818 | + locInfo = this.locInfo(locInfo); | |
| 1819 | + | |
| 1820 | + var original = data ? '@' : '', | |
| 1821 | + dig = [], | |
| 1822 | + depth = 0, | |
| 1823 | + depthString = ''; | |
| 1824 | + | |
| 1825 | + for(var i=0,l=parts.length; i<l; i++) { | |
| 1826 | + var part = parts[i].part; | |
| 1827 | + original += (parts[i].separator || '') + part; | |
| 1828 | + | |
| 1829 | + if (part === '..' || part === '.' || part === 'this') { | |
| 1830 | + if (dig.length > 0) { | |
| 1831 | + throw new Exception('Invalid path: ' + original, {loc: locInfo}); | |
| 1832 | + } else if (part === '..') { | |
| 1833 | + depth++; | |
| 1834 | + depthString += '../'; | |
| 1835 | + } | |
| 1836 | + } else { | |
| 1837 | + dig.push(part); | |
| 1838 | + } | |
| 1839 | + } | |
| 1840 | + | |
| 1841 | + return new this.PathExpression(data, depth, dig, original, locInfo); | |
| 1842 | + } | |
| 1843 | + | |
| 1844 | + __exports__.preparePath = preparePath;function prepareMustache(path, params, hash, open, strip, locInfo) { | |
| 1845 | + /*jshint -W040 */ | |
| 1846 | + // Must use charAt to support IE pre-10 | |
| 1847 | + var escapeFlag = open.charAt(3) || open.charAt(2), | |
| 1848 | + escaped = escapeFlag !== '{' && escapeFlag !== '&'; | |
| 1849 | + | |
| 1850 | + return new this.MustacheStatement(path, params, hash, escaped, strip, this.locInfo(locInfo)); | |
| 1851 | + } | |
| 1852 | + | |
| 1853 | + __exports__.prepareMustache = prepareMustache;function prepareRawBlock(openRawBlock, content, close, locInfo) { | |
| 1854 | + /*jshint -W040 */ | |
| 1855 | + if (openRawBlock.path.original !== close) { | |
| 1856 | + var errorNode = {loc: openRawBlock.path.loc}; | |
| 1857 | + | |
| 1858 | + throw new Exception(openRawBlock.path.original + " doesn't match " + close, errorNode); | |
| 1859 | + } | |
| 1860 | + | |
| 1861 | + locInfo = this.locInfo(locInfo); | |
| 1862 | + var program = new this.Program([content], null, {}, locInfo); | |
| 1863 | + | |
| 1864 | + return new this.BlockStatement( | |
| 1865 | + openRawBlock.path, openRawBlock.params, openRawBlock.hash, | |
| 1866 | + program, undefined, | |
| 1867 | + {}, {}, {}, | |
| 1868 | + locInfo); | |
| 1869 | + } | |
| 1870 | + | |
| 1871 | + __exports__.prepareRawBlock = prepareRawBlock;function prepareBlock(openBlock, program, inverseAndProgram, close, inverted, locInfo) { | |
| 1872 | + /*jshint -W040 */ | |
| 1873 | + // When we are chaining inverse calls, we will not have a close path | |
| 1874 | + if (close && close.path && openBlock.path.original !== close.path.original) { | |
| 1875 | + var errorNode = {loc: openBlock.path.loc}; | |
| 1876 | + | |
| 1877 | + throw new Exception(openBlock.path.original + ' doesn\'t match ' + close.path.original, errorNode); | |
| 1878 | + } | |
| 1879 | + | |
| 1880 | + program.blockParams = openBlock.blockParams; | |
| 1881 | + | |
| 1882 | + var inverse, | |
| 1883 | + inverseStrip; | |
| 1884 | + | |
| 1885 | + if (inverseAndProgram) { | |
| 1886 | + if (inverseAndProgram.chain) { | |
| 1887 | + inverseAndProgram.program.body[0].closeStrip = close.strip; | |
| 1888 | + } | |
| 1889 | + | |
| 1890 | + inverseStrip = inverseAndProgram.strip; | |
| 1891 | + inverse = inverseAndProgram.program; | |
| 1892 | + } | |
| 1893 | + | |
| 1894 | + if (inverted) { | |
| 1895 | + inverted = inverse; | |
| 1896 | + inverse = program; | |
| 1897 | + program = inverted; | |
| 1898 | + } | |
| 1899 | + | |
| 1900 | + return new this.BlockStatement( | |
| 1901 | + openBlock.path, openBlock.params, openBlock.hash, | |
| 1902 | + program, inverse, | |
| 1903 | + openBlock.strip, inverseStrip, close && close.strip, | |
| 1904 | + this.locInfo(locInfo)); | |
| 1905 | + } | |
| 1906 | + | |
| 1907 | + __exports__.prepareBlock = prepareBlock; | |
| 1908 | + return __exports__; | |
| 1909 | +})(__module4__); | |
| 1910 | + | |
| 1911 | +// handlebars/compiler/base.js | |
| 1912 | +var __module8__ = (function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__) { | |
| 1913 | + "use strict"; | |
| 1914 | + var __exports__ = {}; | |
| 1915 | + var parser = __dependency1__; | |
| 1916 | + var AST = __dependency2__; | |
| 1917 | + var WhitespaceControl = __dependency3__; | |
| 1918 | + var Helpers = __dependency4__; | |
| 1919 | + var extend = __dependency5__.extend; | |
| 1920 | + | |
| 1921 | + __exports__.parser = parser; | |
| 1922 | + | |
| 1923 | + var yy = {}; | |
| 1924 | + extend(yy, Helpers, AST); | |
| 1925 | + | |
| 1926 | + function parse(input, options) { | |
| 1927 | + // Just return if an already-compiled AST was passed in. | |
| 1928 | + if (input.type === 'Program') { return input; } | |
| 1929 | + | |
| 1930 | + parser.yy = yy; | |
| 1931 | + | |
| 1932 | + // Altering the shared object here, but this is ok as parser is a sync operation | |
| 1933 | + yy.locInfo = function(locInfo) { | |
| 1934 | + return new yy.SourceLocation(options && options.srcName, locInfo); | |
| 1935 | + }; | |
| 1936 | + | |
| 1937 | + var strip = new WhitespaceControl(); | |
| 1938 | + return strip.accept(parser.parse(input)); | |
| 1939 | + } | |
| 1940 | + | |
| 1941 | + __exports__.parse = parse; | |
| 1942 | + return __exports__; | |
| 1943 | +})(__module9__, __module7__, __module10__, __module12__, __module3__); | |
| 1944 | + | |
| 1945 | +// handlebars/compiler/compiler.js | |
| 1946 | +var __module13__ = (function(__dependency1__, __dependency2__, __dependency3__) { | |
| 1947 | + "use strict"; | |
| 1948 | + var __exports__ = {}; | |
| 1949 | + var Exception = __dependency1__; | |
| 1950 | + var isArray = __dependency2__.isArray; | |
| 1951 | + var indexOf = __dependency2__.indexOf; | |
| 1952 | + var AST = __dependency3__; | |
| 1953 | + | |
| 1954 | + var slice = [].slice; | |
| 1955 | + | |
| 1956 | + | |
| 1957 | + function Compiler() {} | |
| 1958 | + | |
| 1959 | + __exports__.Compiler = Compiler;// the foundHelper register will disambiguate helper lookup from finding a | |
| 1960 | + // function in a context. This is necessary for mustache compatibility, which | |
| 1961 | + // requires that context functions in blocks are evaluated by blockHelperMissing, | |
| 1962 | + // and then proceed as if the resulting value was provided to blockHelperMissing. | |
| 1963 | + | |
| 1964 | + Compiler.prototype = { | |
| 1965 | + compiler: Compiler, | |
| 1966 | + | |
| 1967 | + equals: function(other) { | |
| 1968 | + var len = this.opcodes.length; | |
| 1969 | + if (other.opcodes.length !== len) { | |
| 1970 | + return false; | |
| 1971 | + } | |
| 1972 | + | |
| 1973 | + for (var i = 0; i < len; i++) { | |
| 1974 | + var opcode = this.opcodes[i], | |
| 1975 | + otherOpcode = other.opcodes[i]; | |
| 1976 | + if (opcode.opcode !== otherOpcode.opcode || !argEquals(opcode.args, otherOpcode.args)) { | |
| 1977 | + return false; | |
| 1978 | + } | |
| 1979 | + } | |
| 1980 | + | |
| 1981 | + // We know that length is the same between the two arrays because they are directly tied | |
| 1982 | + // to the opcode behavior above. | |
| 1983 | + len = this.children.length; | |
| 1984 | + for (i = 0; i < len; i++) { | |
| 1985 | + if (!this.children[i].equals(other.children[i])) { | |
| 1986 | + return false; | |
| 1987 | + } | |
| 1988 | + } | |
| 1989 | + | |
| 1990 | + return true; | |
| 1991 | + }, | |
| 1992 | + | |
| 1993 | + guid: 0, | |
| 1994 | + | |
| 1995 | + compile: function(program, options) { | |
| 1996 | + this.sourceNode = []; | |
| 1997 | + this.opcodes = []; | |
| 1998 | + this.children = []; | |
| 1999 | + this.options = options; | |
| 2000 | + this.stringParams = options.stringParams; | |
| 2001 | + this.trackIds = options.trackIds; | |
| 2002 | + | |
| 2003 | + options.blockParams = options.blockParams || []; | |
| 2004 | + | |
| 2005 | + // These changes will propagate to the other compiler components | |
| 2006 | + var knownHelpers = options.knownHelpers; | |
| 2007 | + options.knownHelpers = { | |
| 2008 | + 'helperMissing': true, | |
| 2009 | + 'blockHelperMissing': true, | |
| 2010 | + 'each': true, | |
| 2011 | + 'if': true, | |
| 2012 | + 'unless': true, | |
| 2013 | + 'with': true, | |
| 2014 | + 'log': true, | |
| 2015 | + 'lookup': true | |
| 2016 | + }; | |
| 2017 | + if (knownHelpers) { | |
| 2018 | + for (var name in knownHelpers) { | |
| 2019 | + options.knownHelpers[name] = knownHelpers[name]; | |
| 2020 | + } | |
| 2021 | + } | |
| 2022 | + | |
| 2023 | + return this.accept(program); | |
| 2024 | + }, | |
| 2025 | + | |
| 2026 | + compileProgram: function(program) { | |
| 2027 | + var result = new this.compiler().compile(program, this.options); | |
| 2028 | + var guid = this.guid++; | |
| 2029 | + | |
| 2030 | + this.usePartial = this.usePartial || result.usePartial; | |
| 2031 | + | |
| 2032 | + this.children[guid] = result; | |
| 2033 | + this.useDepths = this.useDepths || result.useDepths; | |
| 2034 | + | |
| 2035 | + return guid; | |
| 2036 | + }, | |
| 2037 | + | |
| 2038 | + accept: function(node) { | |
| 2039 | + this.sourceNode.unshift(node); | |
| 2040 | + var ret = this[node.type](node); | |
| 2041 | + this.sourceNode.shift(); | |
| 2042 | + return ret; | |
| 2043 | + }, | |
| 2044 | + | |
| 2045 | + Program: function(program) { | |
| 2046 | + this.options.blockParams.unshift(program.blockParams); | |
| 2047 | + | |
| 2048 | + var body = program.body; | |
| 2049 | + for(var i=0, l=body.length; i<l; i++) { | |
| 2050 | + this.accept(body[i]); | |
| 2051 | + } | |
| 2052 | + | |
| 2053 | + this.options.blockParams.shift(); | |
| 2054 | + | |
| 2055 | + this.isSimple = l === 1; | |
| 2056 | + this.blockParams = program.blockParams ? program.blockParams.length : 0; | |
| 2057 | + | |
| 2058 | + return this; | |
| 2059 | + }, | |
| 2060 | + | |
| 2061 | + BlockStatement: function(block) { | |
| 2062 | + transformLiteralToPath(block); | |
| 2063 | + | |
| 2064 | + var program = block.program, | |
| 2065 | + inverse = block.inverse; | |
| 2066 | + | |
| 2067 | + program = program && this.compileProgram(program); | |
| 2068 | + inverse = inverse && this.compileProgram(inverse); | |
| 2069 | + | |
| 2070 | + var type = this.classifySexpr(block); | |
| 2071 | + | |
| 2072 | + if (type === 'helper') { | |
| 2073 | + this.helperSexpr(block, program, inverse); | |
| 2074 | + } else if (type === 'simple') { | |
| 2075 | + this.simpleSexpr(block); | |
| 2076 | + | |
| 2077 | + // now that the simple mustache is resolved, we need to | |
| 2078 | + // evaluate it by executing `blockHelperMissing` | |
| 2079 | + this.opcode('pushProgram', program); | |
| 2080 | + this.opcode('pushProgram', inverse); | |
| 2081 | + this.opcode('emptyHash'); | |
| 2082 | + this.opcode('blockValue', block.path.original); | |
| 2083 | + } else { | |
| 2084 | + this.ambiguousSexpr(block, program, inverse); | |
| 2085 | + | |
| 2086 | + // now that the simple mustache is resolved, we need to | |
| 2087 | + // evaluate it by executing `blockHelperMissing` | |
| 2088 | + this.opcode('pushProgram', program); | |
| 2089 | + this.opcode('pushProgram', inverse); | |
| 2090 | + this.opcode('emptyHash'); | |
| 2091 | + this.opcode('ambiguousBlockValue'); | |
| 2092 | + } | |
| 2093 | + | |
| 2094 | + this.opcode('append'); | |
| 2095 | + }, | |
| 2096 | + | |
| 2097 | + PartialStatement: function(partial) { | |
| 2098 | + this.usePartial = true; | |
| 2099 | + | |
| 2100 | + var params = partial.params; | |
| 2101 | + if (params.length > 1) { | |
| 2102 | + throw new Exception('Unsupported number of partial arguments: ' + params.length, partial); | |
| 2103 | + } else if (!params.length) { | |
| 2104 | + params.push({type: 'PathExpression', parts: [], depth: 0}); | |
| 2105 | + } | |
| 2106 | + | |
| 2107 | + var partialName = partial.name.original, | |
| 2108 | + isDynamic = partial.name.type === 'SubExpression'; | |
| 2109 | + if (isDynamic) { | |
| 2110 | + this.accept(partial.name); | |
| 2111 | + } | |
| 2112 | + | |
| 2113 | + this.setupFullMustacheParams(partial, undefined, undefined, true); | |
| 2114 | + | |
| 2115 | + var indent = partial.indent || ''; | |
| 2116 | + if (this.options.preventIndent && indent) { | |
| 2117 | + this.opcode('appendContent', indent); | |
| 2118 | + indent = ''; | |
| 2119 | + } | |
| 2120 | + | |
| 2121 | + this.opcode('invokePartial', isDynamic, partialName, indent); | |
| 2122 | + this.opcode('append'); | |
| 2123 | + }, | |
| 2124 | + | |
| 2125 | + MustacheStatement: function(mustache) { | |
| 2126 | + this.SubExpression(mustache); | |
| 2127 | + | |
| 2128 | + if(mustache.escaped && !this.options.noEscape) { | |
| 2129 | + this.opcode('appendEscaped'); | |
| 2130 | + } else { | |
| 2131 | + this.opcode('append'); | |
| 2132 | + } | |
| 2133 | + }, | |
| 2134 | + | |
| 2135 | + ContentStatement: function(content) { | |
| 2136 | + if (content.value) { | |
| 2137 | + this.opcode('appendContent', content.value); | |
| 2138 | + } | |
| 2139 | + }, | |
| 2140 | + | |
| 2141 | + CommentStatement: function() {}, | |
| 2142 | + | |
| 2143 | + SubExpression: function(sexpr) { | |
| 2144 | + transformLiteralToPath(sexpr); | |
| 2145 | + var type = this.classifySexpr(sexpr); | |
| 2146 | + | |
| 2147 | + if (type === 'simple') { | |
| 2148 | + this.simpleSexpr(sexpr); | |
| 2149 | + } else if (type === 'helper') { | |
| 2150 | + this.helperSexpr(sexpr); | |
| 2151 | + } else { | |
| 2152 | + this.ambiguousSexpr(sexpr); | |
| 2153 | + } | |
| 2154 | + }, | |
| 2155 | + ambiguousSexpr: function(sexpr, program, inverse) { | |
| 2156 | + var path = sexpr.path, | |
| 2157 | + name = path.parts[0], | |
| 2158 | + isBlock = program != null || inverse != null; | |
| 2159 | + | |
| 2160 | + this.opcode('getContext', path.depth); | |
| 2161 | + | |
| 2162 | + this.opcode('pushProgram', program); | |
| 2163 | + this.opcode('pushProgram', inverse); | |
| 2164 | + | |
| 2165 | + this.accept(path); | |
| 2166 | + | |
| 2167 | + this.opcode('invokeAmbiguous', name, isBlock); | |
| 2168 | + }, | |
| 2169 | + | |
| 2170 | + simpleSexpr: function(sexpr) { | |
| 2171 | + this.accept(sexpr.path); | |
| 2172 | + this.opcode('resolvePossibleLambda'); | |
| 2173 | + }, | |
| 2174 | + | |
| 2175 | + helperSexpr: function(sexpr, program, inverse) { | |
| 2176 | + var params = this.setupFullMustacheParams(sexpr, program, inverse), | |
| 2177 | + path = sexpr.path, | |
| 2178 | + name = path.parts[0]; | |
| 2179 | + | |
| 2180 | + if (this.options.knownHelpers[name]) { | |
| 2181 | + this.opcode('invokeKnownHelper', params.length, name); | |
| 2182 | + } else if (this.options.knownHelpersOnly) { | |
| 2183 | + throw new Exception("You specified knownHelpersOnly, but used the unknown helper " + name, sexpr); | |
| 2184 | + } else { | |
| 2185 | + path.falsy = true; | |
| 2186 | + | |
| 2187 | + this.accept(path); | |
| 2188 | + this.opcode('invokeHelper', params.length, path.original, AST.helpers.simpleId(path)); | |
| 2189 | + } | |
| 2190 | + }, | |
| 2191 | + | |
| 2192 | + PathExpression: function(path) { | |
| 2193 | + this.addDepth(path.depth); | |
| 2194 | + this.opcode('getContext', path.depth); | |
| 2195 | + | |
| 2196 | + var name = path.parts[0], | |
| 2197 | + scoped = AST.helpers.scopedId(path), | |
| 2198 | + blockParamId = !path.depth && !scoped && this.blockParamIndex(name); | |
| 2199 | + | |
| 2200 | + if (blockParamId) { | |
| 2201 | + this.opcode('lookupBlockParam', blockParamId, path.parts); | |
| 2202 | + } else if (!name) { | |
| 2203 | + // Context reference, i.e. `{{foo .}}` or `{{foo ..}}` | |
| 2204 | + this.opcode('pushContext'); | |
| 2205 | + } else if (path.data) { | |
| 2206 | + this.options.data = true; | |
| 2207 | + this.opcode('lookupData', path.depth, path.parts); | |
| 2208 | + } else { | |
| 2209 | + this.opcode('lookupOnContext', path.parts, path.falsy, scoped); | |
| 2210 | + } | |
| 2211 | + }, | |
| 2212 | + | |
| 2213 | + StringLiteral: function(string) { | |
| 2214 | + this.opcode('pushString', string.value); | |
| 2215 | + }, | |
| 2216 | + | |
| 2217 | + NumberLiteral: function(number) { | |
| 2218 | + this.opcode('pushLiteral', number.value); | |
| 2219 | + }, | |
| 2220 | + | |
| 2221 | + BooleanLiteral: function(bool) { | |
| 2222 | + this.opcode('pushLiteral', bool.value); | |
| 2223 | + }, | |
| 2224 | + | |
| 2225 | + Hash: function(hash) { | |
| 2226 | + var pairs = hash.pairs, i, l; | |
| 2227 | + | |
| 2228 | + this.opcode('pushHash'); | |
| 2229 | + | |
| 2230 | + for (i=0, l=pairs.length; i<l; i++) { | |
| 2231 | + this.pushParam(pairs[i].value); | |
| 2232 | + } | |
| 2233 | + while (i--) { | |
| 2234 | + this.opcode('assignToHash', pairs[i].key); | |
| 2235 | + } | |
| 2236 | + this.opcode('popHash'); | |
| 2237 | + }, | |
| 2238 | + | |
| 2239 | + // HELPERS | |
| 2240 | + opcode: function(name) { | |
| 2241 | + this.opcodes.push({ opcode: name, args: slice.call(arguments, 1), loc: this.sourceNode[0].loc }); | |
| 2242 | + }, | |
| 2243 | + | |
| 2244 | + addDepth: function(depth) { | |
| 2245 | + if (!depth) { | |
| 2246 | + return; | |
| 2247 | + } | |
| 2248 | + | |
| 2249 | + this.useDepths = true; | |
| 2250 | + }, | |
| 2251 | + | |
| 2252 | + classifySexpr: function(sexpr) { | |
| 2253 | + var isSimple = AST.helpers.simpleId(sexpr.path); | |
| 2254 | + | |
| 2255 | + var isBlockParam = isSimple && !!this.blockParamIndex(sexpr.path.parts[0]); | |
| 2256 | + | |
| 2257 | + // a mustache is an eligible helper if: | |
| 2258 | + // * its id is simple (a single part, not `this` or `..`) | |
| 2259 | + var isHelper = !isBlockParam && AST.helpers.helperExpression(sexpr); | |
| 2260 | + | |
| 2261 | + // if a mustache is an eligible helper but not a definite | |
| 2262 | + // helper, it is ambiguous, and will be resolved in a later | |
| 2263 | + // pass or at runtime. | |
| 2264 | + var isEligible = !isBlockParam && (isHelper || isSimple); | |
| 2265 | + | |
| 2266 | + var options = this.options; | |
| 2267 | + | |
| 2268 | + // if ambiguous, we can possibly resolve the ambiguity now | |
| 2269 | + // An eligible helper is one that does not have a complex path, i.e. `this.foo`, `../foo` etc. | |
| 2270 | + if (isEligible && !isHelper) { | |
| 2271 | + var name = sexpr.path.parts[0]; | |
| 2272 | + | |
| 2273 | + if (options.knownHelpers[name]) { | |
| 2274 | + isHelper = true; | |
| 2275 | + } else if (options.knownHelpersOnly) { | |
| 2276 | + isEligible = false; | |
| 2277 | + } | |
| 2278 | + } | |
| 2279 | + | |
| 2280 | + if (isHelper) { return 'helper'; } | |
| 2281 | + else if (isEligible) { return 'ambiguous'; } | |
| 2282 | + else { return 'simple'; } | |
| 2283 | + }, | |
| 2284 | + | |
| 2285 | + pushParams: function(params) { | |
| 2286 | + for(var i=0, l=params.length; i<l; i++) { | |
| 2287 | + this.pushParam(params[i]); | |
| 2288 | + } | |
| 2289 | + }, | |
| 2290 | + | |
| 2291 | + pushParam: function(val) { | |
| 2292 | + var value = val.value != null ? val.value : val.original || ''; | |
| 2293 | + | |
| 2294 | + if (this.stringParams) { | |
| 2295 | + if (value.replace) { | |
| 2296 | + value = value | |
| 2297 | + .replace(/^(\.?\.\/)*/g, '') | |
| 2298 | + .replace(/\//g, '.'); | |
| 2299 | + } | |
| 2300 | + | |
| 2301 | + if(val.depth) { | |
| 2302 | + this.addDepth(val.depth); | |
| 2303 | + } | |
| 2304 | + this.opcode('getContext', val.depth || 0); | |
| 2305 | + this.opcode('pushStringParam', value, val.type); | |
| 2306 | + | |
| 2307 | + if (val.type === 'SubExpression') { | |
| 2308 | + // SubExpressions get evaluated and passed in | |
| 2309 | + // in string params mode. | |
| 2310 | + this.accept(val); | |
| 2311 | + } | |
| 2312 | + } else { | |
| 2313 | + if (this.trackIds) { | |
| 2314 | + var blockParamIndex; | |
| 2315 | + if (val.parts && !AST.helpers.scopedId(val) && !val.depth) { | |
| 2316 | + blockParamIndex = this.blockParamIndex(val.parts[0]); | |
| 2317 | + } | |
| 2318 | + if (blockParamIndex) { | |
| 2319 | + var blockParamChild = val.parts.slice(1).join('.'); | |
| 2320 | + this.opcode('pushId', 'BlockParam', blockParamIndex, blockParamChild); | |
| 2321 | + } else { | |
| 2322 | + value = val.original || value; | |
| 2323 | + if (value.replace) { | |
| 2324 | + value = value | |
| 2325 | + .replace(/^\.\//g, '') | |
| 2326 | + .replace(/^\.$/g, ''); | |
| 2327 | + } | |
| 2328 | + | |
| 2329 | + this.opcode('pushId', val.type, value); | |
| 2330 | + } | |
| 2331 | + } | |
| 2332 | + this.accept(val); | |
| 2333 | + } | |
| 2334 | + }, | |
| 2335 | + | |
| 2336 | + setupFullMustacheParams: function(sexpr, program, inverse, omitEmpty) { | |
| 2337 | + var params = sexpr.params; | |
| 2338 | + this.pushParams(params); | |
| 2339 | + | |
| 2340 | + this.opcode('pushProgram', program); | |
| 2341 | + this.opcode('pushProgram', inverse); | |
| 2342 | + | |
| 2343 | + if (sexpr.hash) { | |
| 2344 | + this.accept(sexpr.hash); | |
| 2345 | + } else { | |
| 2346 | + this.opcode('emptyHash', omitEmpty); | |
| 2347 | + } | |
| 2348 | + | |
| 2349 | + return params; | |
| 2350 | + }, | |
| 2351 | + | |
| 2352 | + blockParamIndex: function(name) { | |
| 2353 | + for (var depth = 0, len = this.options.blockParams.length; depth < len; depth++) { | |
| 2354 | + var blockParams = this.options.blockParams[depth], | |
| 2355 | + param = blockParams && indexOf(blockParams, name); | |
| 2356 | + if (blockParams && param >= 0) { | |
| 2357 | + return [depth, param]; | |
| 2358 | + } | |
| 2359 | + } | |
| 2360 | + } | |
| 2361 | + }; | |
| 2362 | + | |
| 2363 | + function precompile(input, options, env) { | |
| 2364 | + if (input == null || (typeof input !== 'string' && input.type !== 'Program')) { | |
| 2365 | + throw new Exception("You must pass a string or Handlebars AST to Handlebars.precompile. You passed " + input); | |
| 2366 | + } | |
| 2367 | + | |
| 2368 | + options = options || {}; | |
| 2369 | + if (!('data' in options)) { | |
| 2370 | + options.data = true; | |
| 2371 | + } | |
| 2372 | + if (options.compat) { | |
| 2373 | + options.useDepths = true; | |
| 2374 | + } | |
| 2375 | + | |
| 2376 | + var ast = env.parse(input, options); | |
| 2377 | + var environment = new env.Compiler().compile(ast, options); | |
| 2378 | + return new env.JavaScriptCompiler().compile(environment, options); | |
| 2379 | + } | |
| 2380 | + | |
| 2381 | + __exports__.precompile = precompile;function compile(input, options, env) { | |
| 2382 | + if (input == null || (typeof input !== 'string' && input.type !== 'Program')) { | |
| 2383 | + throw new Exception("You must pass a string or Handlebars AST to Handlebars.compile. You passed " + input); | |
| 2384 | + } | |
| 2385 | + | |
| 2386 | + options = options || {}; | |
| 2387 | + | |
| 2388 | + if (!('data' in options)) { | |
| 2389 | + options.data = true; | |
| 2390 | + } | |
| 2391 | + if (options.compat) { | |
| 2392 | + options.useDepths = true; | |
| 2393 | + } | |
| 2394 | + | |
| 2395 | + var compiled; | |
| 2396 | + | |
| 2397 | + function compileInput() { | |
| 2398 | + var ast = env.parse(input, options); | |
| 2399 | + var environment = new env.Compiler().compile(ast, options); | |
| 2400 | + var templateSpec = new env.JavaScriptCompiler().compile(environment, options, undefined, true); | |
| 2401 | + return env.template(templateSpec); | |
| 2402 | + } | |
| 2403 | + | |
| 2404 | + // Template is only compiled on first use and cached after that point. | |
| 2405 | + var ret = function(context, options) { | |
| 2406 | + if (!compiled) { | |
| 2407 | + compiled = compileInput(); | |
| 2408 | + } | |
| 2409 | + return compiled.call(this, context, options); | |
| 2410 | + }; | |
| 2411 | + ret._setup = function(options) { | |
| 2412 | + if (!compiled) { | |
| 2413 | + compiled = compileInput(); | |
| 2414 | + } | |
| 2415 | + return compiled._setup(options); | |
| 2416 | + }; | |
| 2417 | + ret._child = function(i, data, blockParams, depths) { | |
| 2418 | + if (!compiled) { | |
| 2419 | + compiled = compileInput(); | |
| 2420 | + } | |
| 2421 | + return compiled._child(i, data, blockParams, depths); | |
| 2422 | + }; | |
| 2423 | + return ret; | |
| 2424 | + } | |
| 2425 | + | |
| 2426 | + __exports__.compile = compile;function argEquals(a, b) { | |
| 2427 | + if (a === b) { | |
| 2428 | + return true; | |
| 2429 | + } | |
| 2430 | + | |
| 2431 | + if (isArray(a) && isArray(b) && a.length === b.length) { | |
| 2432 | + for (var i = 0; i < a.length; i++) { | |
| 2433 | + if (!argEquals(a[i], b[i])) { | |
| 2434 | + return false; | |
| 2435 | + } | |
| 2436 | + } | |
| 2437 | + return true; | |
| 2438 | + } | |
| 2439 | + } | |
| 2440 | + | |
| 2441 | + function transformLiteralToPath(sexpr) { | |
| 2442 | + if (!sexpr.path.parts) { | |
| 2443 | + var literal = sexpr.path; | |
| 2444 | + // Casting to string here to make false and 0 literal values play nicely with the rest | |
| 2445 | + // of the system. | |
| 2446 | + sexpr.path = new AST.PathExpression(false, 0, [literal.original+''], literal.original+'', literal.loc); | |
| 2447 | + } | |
| 2448 | + } | |
| 2449 | + return __exports__; | |
| 2450 | +})(__module4__, __module3__, __module7__); | |
| 2451 | + | |
| 2452 | +// handlebars/compiler/code-gen.js | |
| 2453 | +var __module15__ = (function(__dependency1__) { | |
| 2454 | + "use strict"; | |
| 2455 | + var __exports__; | |
| 2456 | + var isArray = __dependency1__.isArray; | |
| 2457 | + | |
| 2458 | + try { | |
| 2459 | + var SourceMap = require('source-map'), | |
| 2460 | + SourceNode = SourceMap.SourceNode; | |
| 2461 | + } catch (err) { | |
| 2462 | + /* istanbul ignore next: tested but not covered in istanbul due to dist build */ | |
| 2463 | + SourceNode = function(line, column, srcFile, chunks) { | |
| 2464 | + this.src = ''; | |
| 2465 | + if (chunks) { | |
| 2466 | + this.add(chunks); | |
| 2467 | + } | |
| 2468 | + }; | |
| 2469 | + /* istanbul ignore next */ | |
| 2470 | + SourceNode.prototype = { | |
| 2471 | + add: function(chunks) { | |
| 2472 | + if (isArray(chunks)) { | |
| 2473 | + chunks = chunks.join(''); | |
| 2474 | + } | |
| 2475 | + this.src += chunks; | |
| 2476 | + }, | |
| 2477 | + prepend: function(chunks) { | |
| 2478 | + if (isArray(chunks)) { | |
| 2479 | + chunks = chunks.join(''); | |
| 2480 | + } | |
| 2481 | + this.src = chunks + this.src; | |
| 2482 | + }, | |
| 2483 | + toStringWithSourceMap: function() { | |
| 2484 | + return {code: this.toString()}; | |
| 2485 | + }, | |
| 2486 | + toString: function() { | |
| 2487 | + return this.src; | |
| 2488 | + } | |
| 2489 | + }; | |
| 2490 | + } | |
| 2491 | + | |
| 2492 | + | |
| 2493 | + function castChunk(chunk, codeGen, loc) { | |
| 2494 | + if (isArray(chunk)) { | |
| 2495 | + var ret = []; | |
| 2496 | + | |
| 2497 | + for (var i = 0, len = chunk.length; i < len; i++) { | |
| 2498 | + ret.push(codeGen.wrap(chunk[i], loc)); | |
| 2499 | + } | |
| 2500 | + return ret; | |
| 2501 | + } else if (typeof chunk === 'boolean' || typeof chunk === 'number') { | |
| 2502 | + // Handle primitives that the SourceNode will throw up on | |
| 2503 | + return chunk+''; | |
| 2504 | + } | |
| 2505 | + return chunk; | |
| 2506 | + } | |
| 2507 | + | |
| 2508 | + | |
| 2509 | + function CodeGen(srcFile) { | |
| 2510 | + this.srcFile = srcFile; | |
| 2511 | + this.source = []; | |
| 2512 | + } | |
| 2513 | + | |
| 2514 | + CodeGen.prototype = { | |
| 2515 | + prepend: function(source, loc) { | |
| 2516 | + this.source.unshift(this.wrap(source, loc)); | |
| 2517 | + }, | |
| 2518 | + push: function(source, loc) { | |
| 2519 | + this.source.push(this.wrap(source, loc)); | |
| 2520 | + }, | |
| 2521 | + | |
| 2522 | + merge: function() { | |
| 2523 | + var source = this.empty(); | |
| 2524 | + this.each(function(line) { | |
| 2525 | + source.add([' ', line, '\n']); | |
| 2526 | + }); | |
| 2527 | + return source; | |
| 2528 | + }, | |
| 2529 | + | |
| 2530 | + each: function(iter) { | |
| 2531 | + for (var i = 0, len = this.source.length; i < len; i++) { | |
| 2532 | + iter(this.source[i]); | |
| 2533 | + } | |
| 2534 | + }, | |
| 2535 | + | |
| 2536 | + empty: function(loc) { | |
| 2537 | + loc = loc || this.currentLocation || {start:{}}; | |
| 2538 | + return new SourceNode(loc.start.line, loc.start.column, this.srcFile); | |
| 2539 | + }, | |
| 2540 | + wrap: function(chunk, loc) { | |
| 2541 | + if (chunk instanceof SourceNode) { | |
| 2542 | + return chunk; | |
| 2543 | + } | |
| 2544 | + | |
| 2545 | + loc = loc || this.currentLocation || {start:{}}; | |
| 2546 | + chunk = castChunk(chunk, this, loc); | |
| 2547 | + | |
| 2548 | + return new SourceNode(loc.start.line, loc.start.column, this.srcFile, chunk); | |
| 2549 | + }, | |
| 2550 | + | |
| 2551 | + functionCall: function(fn, type, params) { | |
| 2552 | + params = this.generateList(params); | |
| 2553 | + return this.wrap([fn, type ? '.' + type + '(' : '(', params, ')']); | |
| 2554 | + }, | |
| 2555 | + | |
| 2556 | + quotedString: function(str) { | |
| 2557 | + return '"' + (str + '') | |
| 2558 | + .replace(/\\/g, '\\\\') | |
| 2559 | + .replace(/"/g, '\\"') | |
| 2560 | + .replace(/\n/g, '\\n') | |
| 2561 | + .replace(/\r/g, '\\r') | |
| 2562 | + .replace(/\u2028/g, '\\u2028') // Per Ecma-262 7.3 + 7.8.4 | |
| 2563 | + .replace(/\u2029/g, '\\u2029') + '"'; | |
| 2564 | + }, | |
| 2565 | + | |
| 2566 | + objectLiteral: function(obj) { | |
| 2567 | + var pairs = []; | |
| 2568 | + | |
| 2569 | + for (var key in obj) { | |
| 2570 | + if (obj.hasOwnProperty(key)) { | |
| 2571 | + var value = castChunk(obj[key], this); | |
| 2572 | + if (value !== 'undefined') { | |
| 2573 | + pairs.push([this.quotedString(key), ':', value]); | |
| 2574 | + } | |
| 2575 | + } | |
| 2576 | + } | |
| 2577 | + | |
| 2578 | + var ret = this.generateList(pairs); | |
| 2579 | + ret.prepend('{'); | |
| 2580 | + ret.add('}'); | |
| 2581 | + return ret; | |
| 2582 | + }, | |
| 2583 | + | |
| 2584 | + | |
| 2585 | + generateList: function(entries, loc) { | |
| 2586 | + var ret = this.empty(loc); | |
| 2587 | + | |
| 2588 | + for (var i = 0, len = entries.length; i < len; i++) { | |
| 2589 | + if (i) { | |
| 2590 | + ret.add(','); | |
| 2591 | + } | |
| 2592 | + | |
| 2593 | + ret.add(castChunk(entries[i], this, loc)); | |
| 2594 | + } | |
| 2595 | + | |
| 2596 | + return ret; | |
| 2597 | + }, | |
| 2598 | + | |
| 2599 | + generateArray: function(entries, loc) { | |
| 2600 | + var ret = this.generateList(entries, loc); | |
| 2601 | + ret.prepend('['); | |
| 2602 | + ret.add(']'); | |
| 2603 | + | |
| 2604 | + return ret; | |
| 2605 | + } | |
| 2606 | + }; | |
| 2607 | + | |
| 2608 | + __exports__ = CodeGen; | |
| 2609 | + return __exports__; | |
| 2610 | +})(__module3__); | |
| 2611 | + | |
| 2612 | +// handlebars/compiler/javascript-compiler.js | |
| 2613 | +var __module14__ = (function(__dependency1__, __dependency2__, __dependency3__, __dependency4__) { | |
| 2614 | + "use strict"; | |
| 2615 | + var __exports__; | |
| 2616 | + var COMPILER_REVISION = __dependency1__.COMPILER_REVISION; | |
| 2617 | + var REVISION_CHANGES = __dependency1__.REVISION_CHANGES; | |
| 2618 | + var Exception = __dependency2__; | |
| 2619 | + var isArray = __dependency3__.isArray; | |
| 2620 | + var CodeGen = __dependency4__; | |
| 2621 | + | |
| 2622 | + function Literal(value) { | |
| 2623 | + this.value = value; | |
| 2624 | + } | |
| 2625 | + | |
| 2626 | + function JavaScriptCompiler() {} | |
| 2627 | + | |
| 2628 | + JavaScriptCompiler.prototype = { | |
| 2629 | + // PUBLIC API: You can override these methods in a subclass to provide | |
| 2630 | + // alternative compiled forms for name lookup and buffering semantics | |
| 2631 | + nameLookup: function(parent, name /* , type*/) { | |
| 2632 | + if (JavaScriptCompiler.isValidJavaScriptVariableName(name)) { | |
| 2633 | + return [parent, ".", name]; | |
| 2634 | + } else { | |
| 2635 | + return [parent, "['", name, "']"]; | |
| 2636 | + } | |
| 2637 | + }, | |
| 2638 | + depthedLookup: function(name) { | |
| 2639 | + return [this.aliasable('this.lookup'), '(depths, "', name, '")']; | |
| 2640 | + }, | |
| 2641 | + | |
| 2642 | + compilerInfo: function() { | |
| 2643 | + var revision = COMPILER_REVISION, | |
| 2644 | + versions = REVISION_CHANGES[revision]; | |
| 2645 | + return [revision, versions]; | |
| 2646 | + }, | |
| 2647 | + | |
| 2648 | + appendToBuffer: function(source, location, explicit) { | |
| 2649 | + // Force a source as this simplifies the merge logic. | |
| 2650 | + if (!isArray(source)) { | |
| 2651 | + source = [source]; | |
| 2652 | + } | |
| 2653 | + source = this.source.wrap(source, location); | |
| 2654 | + | |
| 2655 | + if (this.environment.isSimple) { | |
| 2656 | + return ['return ', source, ';']; | |
| 2657 | + } else if (explicit) { | |
| 2658 | + // This is a case where the buffer operation occurs as a child of another | |
| 2659 | + // construct, generally braces. We have to explicitly output these buffer | |
| 2660 | + // operations to ensure that the emitted code goes in the correct location. | |
| 2661 | + return ['buffer += ', source, ';']; | |
| 2662 | + } else { | |
| 2663 | + source.appendToBuffer = true; | |
| 2664 | + return source; | |
| 2665 | + } | |
| 2666 | + }, | |
| 2667 | + | |
| 2668 | + initializeBuffer: function() { | |
| 2669 | + return this.quotedString(""); | |
| 2670 | + }, | |
| 2671 | + // END PUBLIC API | |
| 2672 | + | |
| 2673 | + compile: function(environment, options, context, asObject) { | |
| 2674 | + this.environment = environment; | |
| 2675 | + this.options = options; | |
| 2676 | + this.stringParams = this.options.stringParams; | |
| 2677 | + this.trackIds = this.options.trackIds; | |
| 2678 | + this.precompile = !asObject; | |
| 2679 | + | |
| 2680 | + this.name = this.environment.name; | |
| 2681 | + this.isChild = !!context; | |
| 2682 | + this.context = context || { | |
| 2683 | + programs: [], | |
| 2684 | + environments: [] | |
| 2685 | + }; | |
| 2686 | + | |
| 2687 | + this.preamble(); | |
| 2688 | + | |
| 2689 | + this.stackSlot = 0; | |
| 2690 | + this.stackVars = []; | |
| 2691 | + this.aliases = {}; | |
| 2692 | + this.registers = { list: [] }; | |
| 2693 | + this.hashes = []; | |
| 2694 | + this.compileStack = []; | |
| 2695 | + this.inlineStack = []; | |
| 2696 | + this.blockParams = []; | |
| 2697 | + | |
| 2698 | + this.compileChildren(environment, options); | |
| 2699 | + | |
| 2700 | + this.useDepths = this.useDepths || environment.useDepths || this.options.compat; | |
| 2701 | + this.useBlockParams = this.useBlockParams || environment.useBlockParams; | |
| 2702 | + | |
| 2703 | + var opcodes = environment.opcodes, | |
| 2704 | + opcode, | |
| 2705 | + firstLoc, | |
| 2706 | + i, | |
| 2707 | + l; | |
| 2708 | + | |
| 2709 | + for (i = 0, l = opcodes.length; i < l; i++) { | |
| 2710 | + opcode = opcodes[i]; | |
| 2711 | + | |
| 2712 | + this.source.currentLocation = opcode.loc; | |
| 2713 | + firstLoc = firstLoc || opcode.loc; | |
| 2714 | + this[opcode.opcode].apply(this, opcode.args); | |
| 2715 | + } | |
| 2716 | + | |
| 2717 | + // Flush any trailing content that might be pending. | |
| 2718 | + this.source.currentLocation = firstLoc; | |
| 2719 | + this.pushSource(''); | |
| 2720 | + | |
| 2721 | + /* istanbul ignore next */ | |
| 2722 | + if (this.stackSlot || this.inlineStack.length || this.compileStack.length) { | |
| 2723 | + throw new Exception('Compile completed with content left on stack'); | |
| 2724 | + } | |
| 2725 | + | |
| 2726 | + var fn = this.createFunctionContext(asObject); | |
| 2727 | + if (!this.isChild) { | |
| 2728 | + var ret = { | |
| 2729 | + compiler: this.compilerInfo(), | |
| 2730 | + main: fn | |
| 2731 | + }; | |
| 2732 | + var programs = this.context.programs; | |
| 2733 | + for (i = 0, l = programs.length; i < l; i++) { | |
| 2734 | + if (programs[i]) { | |
| 2735 | + ret[i] = programs[i]; | |
| 2736 | + } | |
| 2737 | + } | |
| 2738 | + | |
| 2739 | + if (this.environment.usePartial) { | |
| 2740 | + ret.usePartial = true; | |
| 2741 | + } | |
| 2742 | + if (this.options.data) { | |
| 2743 | + ret.useData = true; | |
| 2744 | + } | |
| 2745 | + if (this.useDepths) { | |
| 2746 | + ret.useDepths = true; | |
| 2747 | + } | |
| 2748 | + if (this.useBlockParams) { | |
| 2749 | + ret.useBlockParams = true; | |
| 2750 | + } | |
| 2751 | + if (this.options.compat) { | |
| 2752 | + ret.compat = true; | |
| 2753 | + } | |
| 2754 | + | |
| 2755 | + if (!asObject) { | |
| 2756 | + ret.compiler = JSON.stringify(ret.compiler); | |
| 2757 | + | |
| 2758 | + this.source.currentLocation = {start: {line: 1, column: 0}}; | |
| 2759 | + ret = this.objectLiteral(ret); | |
| 2760 | + | |
| 2761 | + if (options.srcName) { | |
| 2762 | + ret = ret.toStringWithSourceMap({file: options.destName}); | |
| 2763 | + ret.map = ret.map && ret.map.toString(); | |
| 2764 | + } else { | |
| 2765 | + ret = ret.toString(); | |
| 2766 | + } | |
| 2767 | + } else { | |
| 2768 | + ret.compilerOptions = this.options; | |
| 2769 | + } | |
| 2770 | + | |
| 2771 | + return ret; | |
| 2772 | + } else { | |
| 2773 | + return fn; | |
| 2774 | + } | |
| 2775 | + }, | |
| 2776 | + | |
| 2777 | + preamble: function() { | |
| 2778 | + // track the last context pushed into place to allow skipping the | |
| 2779 | + // getContext opcode when it would be a noop | |
| 2780 | + this.lastContext = 0; | |
| 2781 | + this.source = new CodeGen(this.options.srcName); | |
| 2782 | + }, | |
| 2783 | + | |
| 2784 | + createFunctionContext: function(asObject) { | |
| 2785 | + var varDeclarations = ''; | |
| 2786 | + | |
| 2787 | + var locals = this.stackVars.concat(this.registers.list); | |
| 2788 | + if(locals.length > 0) { | |
| 2789 | + varDeclarations += ", " + locals.join(", "); | |
| 2790 | + } | |
| 2791 | + | |
| 2792 | + // Generate minimizer alias mappings | |
| 2793 | + // | |
| 2794 | + // When using true SourceNodes, this will update all references to the given alias | |
| 2795 | + // as the source nodes are reused in situ. For the non-source node compilation mode, | |
| 2796 | + // aliases will not be used, but this case is already being run on the client and | |
| 2797 | + // we aren't concern about minimizing the template size. | |
| 2798 | + var aliasCount = 0; | |
| 2799 | + for (var alias in this.aliases) { | |
| 2800 | + var node = this.aliases[alias]; | |
| 2801 | + | |
| 2802 | + if (this.aliases.hasOwnProperty(alias) && node.children && node.referenceCount > 1) { | |
| 2803 | + varDeclarations += ', alias' + (++aliasCount) + '=' + alias; | |
| 2804 | + node.children[0] = 'alias' + aliasCount; | |
| 2805 | + } | |
| 2806 | + } | |
| 2807 | + | |
| 2808 | + var params = ["depth0", "helpers", "partials", "data"]; | |
| 2809 | + | |
| 2810 | + if (this.useBlockParams || this.useDepths) { | |
| 2811 | + params.push('blockParams'); | |
| 2812 | + } | |
| 2813 | + if (this.useDepths) { | |
| 2814 | + params.push('depths'); | |
| 2815 | + } | |
| 2816 | + | |
| 2817 | + // Perform a second pass over the output to merge content when possible | |
| 2818 | + var source = this.mergeSource(varDeclarations); | |
| 2819 | + | |
| 2820 | + if (asObject) { | |
| 2821 | + params.push(source); | |
| 2822 | + | |
| 2823 | + return Function.apply(this, params); | |
| 2824 | + } else { | |
| 2825 | + return this.source.wrap(['function(', params.join(','), ') {\n ', source, '}']); | |
| 2826 | + } | |
| 2827 | + }, | |
| 2828 | + mergeSource: function(varDeclarations) { | |
| 2829 | + var isSimple = this.environment.isSimple, | |
| 2830 | + appendOnly = !this.forceBuffer, | |
| 2831 | + appendFirst, | |
| 2832 | + | |
| 2833 | + sourceSeen, | |
| 2834 | + bufferStart, | |
| 2835 | + bufferEnd; | |
| 2836 | + this.source.each(function(line) { | |
| 2837 | + if (line.appendToBuffer) { | |
| 2838 | + if (bufferStart) { | |
| 2839 | + line.prepend(' + '); | |
| 2840 | + } else { | |
| 2841 | + bufferStart = line; | |
| 2842 | + } | |
| 2843 | + bufferEnd = line; | |
| 2844 | + } else { | |
| 2845 | + if (bufferStart) { | |
| 2846 | + if (!sourceSeen) { | |
| 2847 | + appendFirst = true; | |
| 2848 | + } else { | |
| 2849 | + bufferStart.prepend('buffer += '); | |
| 2850 | + } | |
| 2851 | + bufferEnd.add(';'); | |
| 2852 | + bufferStart = bufferEnd = undefined; | |
| 2853 | + } | |
| 2854 | + | |
| 2855 | + sourceSeen = true; | |
| 2856 | + if (!isSimple) { | |
| 2857 | + appendOnly = false; | |
| 2858 | + } | |
| 2859 | + } | |
| 2860 | + }); | |
| 2861 | + | |
| 2862 | + | |
| 2863 | + if (appendOnly) { | |
| 2864 | + if (bufferStart) { | |
| 2865 | + bufferStart.prepend('return '); | |
| 2866 | + bufferEnd.add(';'); | |
| 2867 | + } else if (!sourceSeen) { | |
| 2868 | + this.source.push('return "";'); | |
| 2869 | + } | |
| 2870 | + } else { | |
| 2871 | + varDeclarations += ", buffer = " + (appendFirst ? '' : this.initializeBuffer()); | |
| 2872 | + | |
| 2873 | + if (bufferStart) { | |
| 2874 | + bufferStart.prepend('return buffer + '); | |
| 2875 | + bufferEnd.add(';'); | |
| 2876 | + } else { | |
| 2877 | + this.source.push('return buffer;'); | |
| 2878 | + } | |
| 2879 | + } | |
| 2880 | + | |
| 2881 | + if (varDeclarations) { | |
| 2882 | + this.source.prepend('var ' + varDeclarations.substring(2) + (appendFirst ? '' : ';\n')); | |
| 2883 | + } | |
| 2884 | + | |
| 2885 | + return this.source.merge(); | |
| 2886 | + }, | |
| 2887 | + | |
| 2888 | + // [blockValue] | |
| 2889 | + // | |
| 2890 | + // On stack, before: hash, inverse, program, value | |
| 2891 | + // On stack, after: return value of blockHelperMissing | |
| 2892 | + // | |
| 2893 | + // The purpose of this opcode is to take a block of the form | |
| 2894 | + // `{{#this.foo}}...{{/this.foo}}`, resolve the value of `foo`, and | |
| 2895 | + // replace it on the stack with the result of properly | |
| 2896 | + // invoking blockHelperMissing. | |
| 2897 | + blockValue: function(name) { | |
| 2898 | + var blockHelperMissing = this.aliasable('helpers.blockHelperMissing'), | |
| 2899 | + params = [this.contextName(0)]; | |
| 2900 | + this.setupHelperArgs(name, 0, params); | |
| 2901 | + | |
| 2902 | + var blockName = this.popStack(); | |
| 2903 | + params.splice(1, 0, blockName); | |
| 2904 | + | |
| 2905 | + this.push(this.source.functionCall(blockHelperMissing, 'call', params)); | |
| 2906 | + }, | |
| 2907 | + | |
| 2908 | + // [ambiguousBlockValue] | |
| 2909 | + // | |
| 2910 | + // On stack, before: hash, inverse, program, value | |
| 2911 | + // Compiler value, before: lastHelper=value of last found helper, if any | |
| 2912 | + // On stack, after, if no lastHelper: same as [blockValue] | |
| 2913 | + // On stack, after, if lastHelper: value | |
| 2914 | + ambiguousBlockValue: function() { | |
| 2915 | + // We're being a bit cheeky and reusing the options value from the prior exec | |
| 2916 | + var blockHelperMissing = this.aliasable('helpers.blockHelperMissing'), | |
| 2917 | + params = [this.contextName(0)]; | |
| 2918 | + this.setupHelperArgs('', 0, params, true); | |
| 2919 | + | |
| 2920 | + this.flushInline(); | |
| 2921 | + | |
| 2922 | + var current = this.topStack(); | |
| 2923 | + params.splice(1, 0, current); | |
| 2924 | + | |
| 2925 | + this.pushSource([ | |
| 2926 | + 'if (!', this.lastHelper, ') { ', | |
| 2927 | + current, ' = ', this.source.functionCall(blockHelperMissing, 'call', params), | |
| 2928 | + '}']); | |
| 2929 | + }, | |
| 2930 | + | |
| 2931 | + // [appendContent] | |
| 2932 | + // | |
| 2933 | + // On stack, before: ... | |
| 2934 | + // On stack, after: ... | |
| 2935 | + // | |
| 2936 | + // Appends the string value of `content` to the current buffer | |
| 2937 | + appendContent: function(content) { | |
| 2938 | + if (this.pendingContent) { | |
| 2939 | + content = this.pendingContent + content; | |
| 2940 | + } else { | |
| 2941 | + this.pendingLocation = this.source.currentLocation; | |
| 2942 | + } | |
| 2943 | + | |
| 2944 | + this.pendingContent = content; | |
| 2945 | + }, | |
| 2946 | + | |
| 2947 | + // [append] | |
| 2948 | + // | |
| 2949 | + // On stack, before: value, ... | |
| 2950 | + // On stack, after: ... | |
| 2951 | + // | |
| 2952 | + // Coerces `value` to a String and appends it to the current buffer. | |
| 2953 | + // | |
| 2954 | + // If `value` is truthy, or 0, it is coerced into a string and appended | |
| 2955 | + // Otherwise, the empty string is appended | |
| 2956 | + append: function() { | |
| 2957 | + if (this.isInline()) { | |
| 2958 | + this.replaceStack(function(current) { | |
| 2959 | + return [' != null ? ', current, ' : ""']; | |
| 2960 | + }); | |
| 2961 | + | |
| 2962 | + this.pushSource(this.appendToBuffer(this.popStack())); | |
| 2963 | + } else { | |
| 2964 | + var local = this.popStack(); | |
| 2965 | + this.pushSource(['if (', local, ' != null) { ', this.appendToBuffer(local, undefined, true), ' }']); | |
| 2966 | + if (this.environment.isSimple) { | |
| 2967 | + this.pushSource(['else { ', this.appendToBuffer("''", undefined, true), ' }']); | |
| 2968 | + } | |
| 2969 | + } | |
| 2970 | + }, | |
| 2971 | + | |
| 2972 | + // [appendEscaped] | |
| 2973 | + // | |
| 2974 | + // On stack, before: value, ... | |
| 2975 | + // On stack, after: ... | |
| 2976 | + // | |
| 2977 | + // Escape `value` and append it to the buffer | |
| 2978 | + appendEscaped: function() { | |
| 2979 | + this.pushSource(this.appendToBuffer( | |
| 2980 | + [this.aliasable('this.escapeExpression'), '(', this.popStack(), ')'])); | |
| 2981 | + }, | |
| 2982 | + | |
| 2983 | + // [getContext] | |
| 2984 | + // | |
| 2985 | + // On stack, before: ... | |
| 2986 | + // On stack, after: ... | |
| 2987 | + // Compiler value, after: lastContext=depth | |
| 2988 | + // | |
| 2989 | + // Set the value of the `lastContext` compiler value to the depth | |
| 2990 | + getContext: function(depth) { | |
| 2991 | + this.lastContext = depth; | |
| 2992 | + }, | |
| 2993 | + | |
| 2994 | + // [pushContext] | |
| 2995 | + // | |
| 2996 | + // On stack, before: ... | |
| 2997 | + // On stack, after: currentContext, ... | |
| 2998 | + // | |
| 2999 | + // Pushes the value of the current context onto the stack. | |
| 3000 | + pushContext: function() { | |
| 3001 | + this.pushStackLiteral(this.contextName(this.lastContext)); | |
| 3002 | + }, | |
| 3003 | + | |
| 3004 | + // [lookupOnContext] | |
| 3005 | + // | |
| 3006 | + // On stack, before: ... | |
| 3007 | + // On stack, after: currentContext[name], ... | |
| 3008 | + // | |
| 3009 | + // Looks up the value of `name` on the current context and pushes | |
| 3010 | + // it onto the stack. | |
| 3011 | + lookupOnContext: function(parts, falsy, scoped) { | |
| 3012 | + var i = 0; | |
| 3013 | + | |
| 3014 | + if (!scoped && this.options.compat && !this.lastContext) { | |
| 3015 | + // The depthed query is expected to handle the undefined logic for the root level that | |
| 3016 | + // is implemented below, so we evaluate that directly in compat mode | |
| 3017 | + this.push(this.depthedLookup(parts[i++])); | |
| 3018 | + } else { | |
| 3019 | + this.pushContext(); | |
| 3020 | + } | |
| 3021 | + | |
| 3022 | + this.resolvePath('context', parts, i, falsy); | |
| 3023 | + }, | |
| 3024 | + | |
| 3025 | + // [lookupBlockParam] | |
| 3026 | + // | |
| 3027 | + // On stack, before: ... | |
| 3028 | + // On stack, after: blockParam[name], ... | |
| 3029 | + // | |
| 3030 | + // Looks up the value of `parts` on the given block param and pushes | |
| 3031 | + // it onto the stack. | |
| 3032 | + lookupBlockParam: function(blockParamId, parts) { | |
| 3033 | + this.useBlockParams = true; | |
| 3034 | + | |
| 3035 | + this.push(['blockParams[', blockParamId[0], '][', blockParamId[1], ']']); | |
| 3036 | + this.resolvePath('context', parts, 1); | |
| 3037 | + }, | |
| 3038 | + | |
| 3039 | + // [lookupData] | |
| 3040 | + // | |
| 3041 | + // On stack, before: ... | |
| 3042 | + // On stack, after: data, ... | |
| 3043 | + // | |
| 3044 | + // Push the data lookup operator | |
| 3045 | + lookupData: function(depth, parts) { | |
| 3046 | + /*jshint -W083 */ | |
| 3047 | + if (!depth) { | |
| 3048 | + this.pushStackLiteral('data'); | |
| 3049 | + } else { | |
| 3050 | + this.pushStackLiteral('this.data(data, ' + depth + ')'); | |
| 3051 | + } | |
| 3052 | + | |
| 3053 | + this.resolvePath('data', parts, 0, true); | |
| 3054 | + }, | |
| 3055 | + | |
| 3056 | + resolvePath: function(type, parts, i, falsy) { | |
| 3057 | + /*jshint -W083 */ | |
| 3058 | + if (this.options.strict || this.options.assumeObjects) { | |
| 3059 | + this.push(strictLookup(this.options.strict, this, parts, type)); | |
| 3060 | + return; | |
| 3061 | + } | |
| 3062 | + | |
| 3063 | + var len = parts.length; | |
| 3064 | + for (; i < len; i++) { | |
| 3065 | + this.replaceStack(function(current) { | |
| 3066 | + var lookup = this.nameLookup(current, parts[i], type); | |
| 3067 | + // We want to ensure that zero and false are handled properly if the context (falsy flag) | |
| 3068 | + // needs to have the special handling for these values. | |
| 3069 | + if (!falsy) { | |
| 3070 | + return [' != null ? ', lookup, ' : ', current]; | |
| 3071 | + } else { | |
| 3072 | + // Otherwise we can use generic falsy handling | |
| 3073 | + return [' && ', lookup]; | |
| 3074 | + } | |
| 3075 | + }); | |
| 3076 | + } | |
| 3077 | + }, | |
| 3078 | + | |
| 3079 | + // [resolvePossibleLambda] | |
| 3080 | + // | |
| 3081 | + // On stack, before: value, ... | |
| 3082 | + // On stack, after: resolved value, ... | |
| 3083 | + // | |
| 3084 | + // If the `value` is a lambda, replace it on the stack by | |
| 3085 | + // the return value of the lambda | |
| 3086 | + resolvePossibleLambda: function() { | |
| 3087 | + this.push([this.aliasable('this.lambda'), '(', this.popStack(), ', ', this.contextName(0), ')']); | |
| 3088 | + }, | |
| 3089 | + | |
| 3090 | + // [pushStringParam] | |
| 3091 | + // | |
| 3092 | + // On stack, before: ... | |
| 3093 | + // On stack, after: string, currentContext, ... | |
| 3094 | + // | |
| 3095 | + // This opcode is designed for use in string mode, which | |
| 3096 | + // provides the string value of a parameter along with its | |
| 3097 | + // depth rather than resolving it immediately. | |
| 3098 | + pushStringParam: function(string, type) { | |
| 3099 | + this.pushContext(); | |
| 3100 | + this.pushString(type); | |
| 3101 | + | |
| 3102 | + // If it's a subexpression, the string result | |
| 3103 | + // will be pushed after this opcode. | |
| 3104 | + if (type !== 'SubExpression') { | |
| 3105 | + if (typeof string === 'string') { | |
| 3106 | + this.pushString(string); | |
| 3107 | + } else { | |
| 3108 | + this.pushStackLiteral(string); | |
| 3109 | + } | |
| 3110 | + } | |
| 3111 | + }, | |
| 3112 | + | |
| 3113 | + emptyHash: function(omitEmpty) { | |
| 3114 | + if (this.trackIds) { | |
| 3115 | + this.push('{}'); // hashIds | |
| 3116 | + } | |
| 3117 | + if (this.stringParams) { | |
| 3118 | + this.push('{}'); // hashContexts | |
| 3119 | + this.push('{}'); // hashTypes | |
| 3120 | + } | |
| 3121 | + this.pushStackLiteral(omitEmpty ? 'undefined' : '{}'); | |
| 3122 | + }, | |
| 3123 | + pushHash: function() { | |
| 3124 | + if (this.hash) { | |
| 3125 | + this.hashes.push(this.hash); | |
| 3126 | + } | |
| 3127 | + this.hash = {values: [], types: [], contexts: [], ids: []}; | |
| 3128 | + }, | |
| 3129 | + popHash: function() { | |
| 3130 | + var hash = this.hash; | |
| 3131 | + this.hash = this.hashes.pop(); | |
| 3132 | + | |
| 3133 | + if (this.trackIds) { | |
| 3134 | + this.push(this.objectLiteral(hash.ids)); | |
| 3135 | + } | |
| 3136 | + if (this.stringParams) { | |
| 3137 | + this.push(this.objectLiteral(hash.contexts)); | |
| 3138 | + this.push(this.objectLiteral(hash.types)); | |
| 3139 | + } | |
| 3140 | + | |
| 3141 | + this.push(this.objectLiteral(hash.values)); | |
| 3142 | + }, | |
| 3143 | + | |
| 3144 | + // [pushString] | |
| 3145 | + // | |
| 3146 | + // On stack, before: ... | |
| 3147 | + // On stack, after: quotedString(string), ... | |
| 3148 | + // | |
| 3149 | + // Push a quoted version of `string` onto the stack | |
| 3150 | + pushString: function(string) { | |
| 3151 | + this.pushStackLiteral(this.quotedString(string)); | |
| 3152 | + }, | |
| 3153 | + | |
| 3154 | + // [pushLiteral] | |
| 3155 | + // | |
| 3156 | + // On stack, before: ... | |
| 3157 | + // On stack, after: value, ... | |
| 3158 | + // | |
| 3159 | + // Pushes a value onto the stack. This operation prevents | |
| 3160 | + // the compiler from creating a temporary variable to hold | |
| 3161 | + // it. | |
| 3162 | + pushLiteral: function(value) { | |
| 3163 | + this.pushStackLiteral(value); | |
| 3164 | + }, | |
| 3165 | + | |
| 3166 | + // [pushProgram] | |
| 3167 | + // | |
| 3168 | + // On stack, before: ... | |
| 3169 | + // On stack, after: program(guid), ... | |
| 3170 | + // | |
| 3171 | + // Push a program expression onto the stack. This takes | |
| 3172 | + // a compile-time guid and converts it into a runtime-accessible | |
| 3173 | + // expression. | |
| 3174 | + pushProgram: function(guid) { | |
| 3175 | + if (guid != null) { | |
| 3176 | + this.pushStackLiteral(this.programExpression(guid)); | |
| 3177 | + } else { | |
| 3178 | + this.pushStackLiteral(null); | |
| 3179 | + } | |
| 3180 | + }, | |
| 3181 | + | |
| 3182 | + // [invokeHelper] | |
| 3183 | + // | |
| 3184 | + // On stack, before: hash, inverse, program, params..., ... | |
| 3185 | + // On stack, after: result of helper invocation | |
| 3186 | + // | |
| 3187 | + // Pops off the helper's parameters, invokes the helper, | |
| 3188 | + // and pushes the helper's return value onto the stack. | |
| 3189 | + // | |
| 3190 | + // If the helper is not found, `helperMissing` is called. | |
| 3191 | + invokeHelper: function(paramSize, name, isSimple) { | |
| 3192 | + var nonHelper = this.popStack(); | |
| 3193 | + var helper = this.setupHelper(paramSize, name); | |
| 3194 | + var simple = isSimple ? [helper.name, ' || '] : ''; | |
| 3195 | + | |
| 3196 | + var lookup = ['('].concat(simple, nonHelper); | |
| 3197 | + if (!this.options.strict) { | |
| 3198 | + lookup.push(' || ', this.aliasable('helpers.helperMissing')); | |
| 3199 | + } | |
| 3200 | + lookup.push(')'); | |
| 3201 | + | |
| 3202 | + this.push(this.source.functionCall(lookup, 'call', helper.callParams)); | |
| 3203 | + }, | |
| 3204 | + | |
| 3205 | + // [invokeKnownHelper] | |
| 3206 | + // | |
| 3207 | + // On stack, before: hash, inverse, program, params..., ... | |
| 3208 | + // On stack, after: result of helper invocation | |
| 3209 | + // | |
| 3210 | + // This operation is used when the helper is known to exist, | |
| 3211 | + // so a `helperMissing` fallback is not required. | |
| 3212 | + invokeKnownHelper: function(paramSize, name) { | |
| 3213 | + var helper = this.setupHelper(paramSize, name); | |
| 3214 | + this.push(this.source.functionCall(helper.name, 'call', helper.callParams)); | |
| 3215 | + }, | |
| 3216 | + | |
| 3217 | + // [invokeAmbiguous] | |
| 3218 | + // | |
| 3219 | + // On stack, before: hash, inverse, program, params..., ... | |
| 3220 | + // On stack, after: result of disambiguation | |
| 3221 | + // | |
| 3222 | + // This operation is used when an expression like `{{foo}}` | |
| 3223 | + // is provided, but we don't know at compile-time whether it | |
| 3224 | + // is a helper or a path. | |
| 3225 | + // | |
| 3226 | + // This operation emits more code than the other options, | |
| 3227 | + // and can be avoided by passing the `knownHelpers` and | |
| 3228 | + // `knownHelpersOnly` flags at compile-time. | |
| 3229 | + invokeAmbiguous: function(name, helperCall) { | |
| 3230 | + this.useRegister('helper'); | |
| 3231 | + | |
| 3232 | + var nonHelper = this.popStack(); | |
| 3233 | + | |
| 3234 | + this.emptyHash(); | |
| 3235 | + var helper = this.setupHelper(0, name, helperCall); | |
| 3236 | + | |
| 3237 | + var helperName = this.lastHelper = this.nameLookup('helpers', name, 'helper'); | |
| 3238 | + | |
| 3239 | + var lookup = ['(', '(helper = ', helperName, ' || ', nonHelper, ')']; | |
| 3240 | + if (!this.options.strict) { | |
| 3241 | + lookup[0] = '(helper = '; | |
| 3242 | + lookup.push( | |
| 3243 | + ' != null ? helper : ', | |
| 3244 | + this.aliasable('helpers.helperMissing') | |
| 3245 | + ); | |
| 3246 | + } | |
| 3247 | + | |
| 3248 | + this.push([ | |
| 3249 | + '(', lookup, | |
| 3250 | + (helper.paramsInit ? ['),(', helper.paramsInit] : []), '),', | |
| 3251 | + '(typeof helper === ', this.aliasable('"function"'), ' ? ', | |
| 3252 | + this.source.functionCall('helper','call', helper.callParams), ' : helper))' | |
| 3253 | + ]); | |
| 3254 | + }, | |
| 3255 | + | |
| 3256 | + // [invokePartial] | |
| 3257 | + // | |
| 3258 | + // On stack, before: context, ... | |
| 3259 | + // On stack after: result of partial invocation | |
| 3260 | + // | |
| 3261 | + // This operation pops off a context, invokes a partial with that context, | |
| 3262 | + // and pushes the result of the invocation back. | |
| 3263 | + invokePartial: function(isDynamic, name, indent) { | |
| 3264 | + var params = [], | |
| 3265 | + options = this.setupParams(name, 1, params, false); | |
| 3266 | + | |
| 3267 | + if (isDynamic) { | |
| 3268 | + name = this.popStack(); | |
| 3269 | + delete options.name; | |
| 3270 | + } | |
| 3271 | + | |
| 3272 | + if (indent) { | |
| 3273 | + options.indent = JSON.stringify(indent); | |
| 3274 | + } | |
| 3275 | + options.helpers = 'helpers'; | |
| 3276 | + options.partials = 'partials'; | |
| 3277 | + | |
| 3278 | + if (!isDynamic) { | |
| 3279 | + params.unshift(this.nameLookup('partials', name, 'partial')); | |
| 3280 | + } else { | |
| 3281 | + params.unshift(name); | |
| 3282 | + } | |
| 3283 | + | |
| 3284 | + if (this.options.compat) { | |
| 3285 | + options.depths = 'depths'; | |
| 3286 | + } | |
| 3287 | + options = this.objectLiteral(options); | |
| 3288 | + params.push(options); | |
| 3289 | + | |
| 3290 | + this.push(this.source.functionCall('this.invokePartial', '', params)); | |
| 3291 | + }, | |
| 3292 | + | |
| 3293 | + // [assignToHash] | |
| 3294 | + // | |
| 3295 | + // On stack, before: value, ..., hash, ... | |
| 3296 | + // On stack, after: ..., hash, ... | |
| 3297 | + // | |
| 3298 | + // Pops a value off the stack and assigns it to the current hash | |
| 3299 | + assignToHash: function(key) { | |
| 3300 | + var value = this.popStack(), | |
| 3301 | + context, | |
| 3302 | + type, | |
| 3303 | + id; | |
| 3304 | + | |
| 3305 | + if (this.trackIds) { | |
| 3306 | + id = this.popStack(); | |
| 3307 | + } | |
| 3308 | + if (this.stringParams) { | |
| 3309 | + type = this.popStack(); | |
| 3310 | + context = this.popStack(); | |
| 3311 | + } | |
| 3312 | + | |
| 3313 | + var hash = this.hash; | |
| 3314 | + if (context) { | |
| 3315 | + hash.contexts[key] = context; | |
| 3316 | + } | |
| 3317 | + if (type) { | |
| 3318 | + hash.types[key] = type; | |
| 3319 | + } | |
| 3320 | + if (id) { | |
| 3321 | + hash.ids[key] = id; | |
| 3322 | + } | |
| 3323 | + hash.values[key] = value; | |
| 3324 | + }, | |
| 3325 | + | |
| 3326 | + pushId: function(type, name, child) { | |
| 3327 | + if (type === 'BlockParam') { | |
| 3328 | + this.pushStackLiteral( | |
| 3329 | + 'blockParams[' + name[0] + '].path[' + name[1] + ']' | |
| 3330 | + + (child ? ' + ' + JSON.stringify('.' + child) : '')); | |
| 3331 | + } else if (type === 'PathExpression') { | |
| 3332 | + this.pushString(name); | |
| 3333 | + } else if (type === 'SubExpression') { | |
| 3334 | + this.pushStackLiteral('true'); | |
| 3335 | + } else { | |
| 3336 | + this.pushStackLiteral('null'); | |
| 3337 | + } | |
| 3338 | + }, | |
| 3339 | + | |
| 3340 | + // HELPERS | |
| 3341 | + | |
| 3342 | + compiler: JavaScriptCompiler, | |
| 3343 | + | |
| 3344 | + compileChildren: function(environment, options) { | |
| 3345 | + var children = environment.children, child, compiler; | |
| 3346 | + | |
| 3347 | + for(var i=0, l=children.length; i<l; i++) { | |
| 3348 | + child = children[i]; | |
| 3349 | + compiler = new this.compiler(); | |
| 3350 | + | |
| 3351 | + var index = this.matchExistingProgram(child); | |
| 3352 | + | |
| 3353 | + if (index == null) { | |
| 3354 | + this.context.programs.push(''); // Placeholder to prevent name conflicts for nested children | |
| 3355 | + index = this.context.programs.length; | |
| 3356 | + child.index = index; | |
| 3357 | + child.name = 'program' + index; | |
| 3358 | + this.context.programs[index] = compiler.compile(child, options, this.context, !this.precompile); | |
| 3359 | + this.context.environments[index] = child; | |
| 3360 | + | |
| 3361 | + this.useDepths = this.useDepths || compiler.useDepths; | |
| 3362 | + this.useBlockParams = this.useBlockParams || compiler.useBlockParams; | |
| 3363 | + } else { | |
| 3364 | + child.index = index; | |
| 3365 | + child.name = 'program' + index; | |
| 3366 | + | |
| 3367 | + this.useDepths = this.useDepths || child.useDepths; | |
| 3368 | + this.useBlockParams = this.useBlockParams || child.useBlockParams; | |
| 3369 | + } | |
| 3370 | + } | |
| 3371 | + }, | |
| 3372 | + matchExistingProgram: function(child) { | |
| 3373 | + for (var i = 0, len = this.context.environments.length; i < len; i++) { | |
| 3374 | + var environment = this.context.environments[i]; | |
| 3375 | + if (environment && environment.equals(child)) { | |
| 3376 | + return i; | |
| 3377 | + } | |
| 3378 | + } | |
| 3379 | + }, | |
| 3380 | + | |
| 3381 | + programExpression: function(guid) { | |
| 3382 | + var child = this.environment.children[guid], | |
| 3383 | + programParams = [child.index, 'data', child.blockParams]; | |
| 3384 | + | |
| 3385 | + if (this.useBlockParams || this.useDepths) { | |
| 3386 | + programParams.push('blockParams'); | |
| 3387 | + } | |
| 3388 | + if (this.useDepths) { | |
| 3389 | + programParams.push('depths'); | |
| 3390 | + } | |
| 3391 | + | |
| 3392 | + return 'this.program(' + programParams.join(', ') + ')'; | |
| 3393 | + }, | |
| 3394 | + | |
| 3395 | + useRegister: function(name) { | |
| 3396 | + if(!this.registers[name]) { | |
| 3397 | + this.registers[name] = true; | |
| 3398 | + this.registers.list.push(name); | |
| 3399 | + } | |
| 3400 | + }, | |
| 3401 | + | |
| 3402 | + push: function(expr) { | |
| 3403 | + if (!(expr instanceof Literal)) { | |
| 3404 | + expr = this.source.wrap(expr); | |
| 3405 | + } | |
| 3406 | + | |
| 3407 | + this.inlineStack.push(expr); | |
| 3408 | + return expr; | |
| 3409 | + }, | |
| 3410 | + | |
| 3411 | + pushStackLiteral: function(item) { | |
| 3412 | + this.push(new Literal(item)); | |
| 3413 | + }, | |
| 3414 | + | |
| 3415 | + pushSource: function(source) { | |
| 3416 | + if (this.pendingContent) { | |
| 3417 | + this.source.push( | |
| 3418 | + this.appendToBuffer(this.source.quotedString(this.pendingContent), this.pendingLocation)); | |
| 3419 | + this.pendingContent = undefined; | |
| 3420 | + } | |
| 3421 | + | |
| 3422 | + if (source) { | |
| 3423 | + this.source.push(source); | |
| 3424 | + } | |
| 3425 | + }, | |
| 3426 | + | |
| 3427 | + replaceStack: function(callback) { | |
| 3428 | + var prefix = ['('], | |
| 3429 | + stack, | |
| 3430 | + createdStack, | |
| 3431 | + usedLiteral; | |
| 3432 | + | |
| 3433 | + /* istanbul ignore next */ | |
| 3434 | + if (!this.isInline()) { | |
| 3435 | + throw new Exception('replaceStack on non-inline'); | |
| 3436 | + } | |
| 3437 | + | |
| 3438 | + // We want to merge the inline statement into the replacement statement via ',' | |
| 3439 | + var top = this.popStack(true); | |
| 3440 | + | |
| 3441 | + if (top instanceof Literal) { | |
| 3442 | + // Literals do not need to be inlined | |
| 3443 | + stack = [top.value]; | |
| 3444 | + prefix = ['(', stack]; | |
| 3445 | + usedLiteral = true; | |
| 3446 | + } else { | |
| 3447 | + // Get or create the current stack name for use by the inline | |
| 3448 | + createdStack = true; | |
| 3449 | + var name = this.incrStack(); | |
| 3450 | + | |
| 3451 | + prefix = ['((', this.push(name), ' = ', top, ')']; | |
| 3452 | + stack = this.topStack(); | |
| 3453 | + } | |
| 3454 | + | |
| 3455 | + var item = callback.call(this, stack); | |
| 3456 | + | |
| 3457 | + if (!usedLiteral) { | |
| 3458 | + this.popStack(); | |
| 3459 | + } | |
| 3460 | + if (createdStack) { | |
| 3461 | + this.stackSlot--; | |
| 3462 | + } | |
| 3463 | + this.push(prefix.concat(item, ')')); | |
| 3464 | + }, | |
| 3465 | + | |
| 3466 | + incrStack: function() { | |
| 3467 | + this.stackSlot++; | |
| 3468 | + if(this.stackSlot > this.stackVars.length) { this.stackVars.push("stack" + this.stackSlot); } | |
| 3469 | + return this.topStackName(); | |
| 3470 | + }, | |
| 3471 | + topStackName: function() { | |
| 3472 | + return "stack" + this.stackSlot; | |
| 3473 | + }, | |
| 3474 | + flushInline: function() { | |
| 3475 | + var inlineStack = this.inlineStack; | |
| 3476 | + this.inlineStack = []; | |
| 3477 | + for (var i = 0, len = inlineStack.length; i < len; i++) { | |
| 3478 | + var entry = inlineStack[i]; | |
| 3479 | + /* istanbul ignore if */ | |
| 3480 | + if (entry instanceof Literal) { | |
| 3481 | + this.compileStack.push(entry); | |
| 3482 | + } else { | |
| 3483 | + var stack = this.incrStack(); | |
| 3484 | + this.pushSource([stack, ' = ', entry, ';']); | |
| 3485 | + this.compileStack.push(stack); | |
| 3486 | + } | |
| 3487 | + } | |
| 3488 | + }, | |
| 3489 | + isInline: function() { | |
| 3490 | + return this.inlineStack.length; | |
| 3491 | + }, | |
| 3492 | + | |
| 3493 | + popStack: function(wrapped) { | |
| 3494 | + var inline = this.isInline(), | |
| 3495 | + item = (inline ? this.inlineStack : this.compileStack).pop(); | |
| 3496 | + | |
| 3497 | + if (!wrapped && (item instanceof Literal)) { | |
| 3498 | + return item.value; | |
| 3499 | + } else { | |
| 3500 | + if (!inline) { | |
| 3501 | + /* istanbul ignore next */ | |
| 3502 | + if (!this.stackSlot) { | |
| 3503 | + throw new Exception('Invalid stack pop'); | |
| 3504 | + } | |
| 3505 | + this.stackSlot--; | |
| 3506 | + } | |
| 3507 | + return item; | |
| 3508 | + } | |
| 3509 | + }, | |
| 3510 | + | |
| 3511 | + topStack: function() { | |
| 3512 | + var stack = (this.isInline() ? this.inlineStack : this.compileStack), | |
| 3513 | + item = stack[stack.length - 1]; | |
| 3514 | + | |
| 3515 | + /* istanbul ignore if */ | |
| 3516 | + if (item instanceof Literal) { | |
| 3517 | + return item.value; | |
| 3518 | + } else { | |
| 3519 | + return item; | |
| 3520 | + } | |
| 3521 | + }, | |
| 3522 | + | |
| 3523 | + contextName: function(context) { | |
| 3524 | + if (this.useDepths && context) { | |
| 3525 | + return 'depths[' + context + ']'; | |
| 3526 | + } else { | |
| 3527 | + return 'depth' + context; | |
| 3528 | + } | |
| 3529 | + }, | |
| 3530 | + | |
| 3531 | + quotedString: function(str) { | |
| 3532 | + return this.source.quotedString(str); | |
| 3533 | + }, | |
| 3534 | + | |
| 3535 | + objectLiteral: function(obj) { | |
| 3536 | + return this.source.objectLiteral(obj); | |
| 3537 | + }, | |
| 3538 | + | |
| 3539 | + aliasable: function(name) { | |
| 3540 | + var ret = this.aliases[name]; | |
| 3541 | + if (ret) { | |
| 3542 | + ret.referenceCount++; | |
| 3543 | + return ret; | |
| 3544 | + } | |
| 3545 | + | |
| 3546 | + ret = this.aliases[name] = this.source.wrap(name); | |
| 3547 | + ret.aliasable = true; | |
| 3548 | + ret.referenceCount = 1; | |
| 3549 | + | |
| 3550 | + return ret; | |
| 3551 | + }, | |
| 3552 | + | |
| 3553 | + setupHelper: function(paramSize, name, blockHelper) { | |
| 3554 | + var params = [], | |
| 3555 | + paramsInit = this.setupHelperArgs(name, paramSize, params, blockHelper); | |
| 3556 | + var foundHelper = this.nameLookup('helpers', name, 'helper'); | |
| 3557 | + | |
| 3558 | + return { | |
| 3559 | + params: params, | |
| 3560 | + paramsInit: paramsInit, | |
| 3561 | + name: foundHelper, | |
| 3562 | + callParams: [this.contextName(0)].concat(params) | |
| 3563 | + }; | |
| 3564 | + }, | |
| 3565 | + | |
| 3566 | + setupParams: function(helper, paramSize, params) { | |
| 3567 | + var options = {}, contexts = [], types = [], ids = [], param; | |
| 3568 | + | |
| 3569 | + options.name = this.quotedString(helper); | |
| 3570 | + options.hash = this.popStack(); | |
| 3571 | + | |
| 3572 | + if (this.trackIds) { | |
| 3573 | + options.hashIds = this.popStack(); | |
| 3574 | + } | |
| 3575 | + if (this.stringParams) { | |
| 3576 | + options.hashTypes = this.popStack(); | |
| 3577 | + options.hashContexts = this.popStack(); | |
| 3578 | + } | |
| 3579 | + | |
| 3580 | + var inverse = this.popStack(), | |
| 3581 | + program = this.popStack(); | |
| 3582 | + | |
| 3583 | + // Avoid setting fn and inverse if neither are set. This allows | |
| 3584 | + // helpers to do a check for `if (options.fn)` | |
| 3585 | + if (program || inverse) { | |
| 3586 | + options.fn = program || 'this.noop'; | |
| 3587 | + options.inverse = inverse || 'this.noop'; | |
| 3588 | + } | |
| 3589 | + | |
| 3590 | + // The parameters go on to the stack in order (making sure that they are evaluated in order) | |
| 3591 | + // so we need to pop them off the stack in reverse order | |
| 3592 | + var i = paramSize; | |
| 3593 | + while (i--) { | |
| 3594 | + param = this.popStack(); | |
| 3595 | + params[i] = param; | |
| 3596 | + | |
| 3597 | + if (this.trackIds) { | |
| 3598 | + ids[i] = this.popStack(); | |
| 3599 | + } | |
| 3600 | + if (this.stringParams) { | |
| 3601 | + types[i] = this.popStack(); | |
| 3602 | + contexts[i] = this.popStack(); | |
| 3603 | + } | |
| 3604 | + } | |
| 3605 | + | |
| 3606 | + if (this.trackIds) { | |
| 3607 | + options.ids = this.source.generateArray(ids); | |
| 3608 | + } | |
| 3609 | + if (this.stringParams) { | |
| 3610 | + options.types = this.source.generateArray(types); | |
| 3611 | + options.contexts = this.source.generateArray(contexts); | |
| 3612 | + } | |
| 3613 | + | |
| 3614 | + if (this.options.data) { | |
| 3615 | + options.data = 'data'; | |
| 3616 | + } | |
| 3617 | + if (this.useBlockParams) { | |
| 3618 | + options.blockParams = 'blockParams'; | |
| 3619 | + } | |
| 3620 | + return options; | |
| 3621 | + }, | |
| 3622 | + | |
| 3623 | + setupHelperArgs: function(helper, paramSize, params, useRegister) { | |
| 3624 | + var options = this.setupParams(helper, paramSize, params, true); | |
| 3625 | + options = this.objectLiteral(options); | |
| 3626 | + if (useRegister) { | |
| 3627 | + this.useRegister('options'); | |
| 3628 | + params.push('options'); | |
| 3629 | + return ['options=', options]; | |
| 3630 | + } else { | |
| 3631 | + params.push(options); | |
| 3632 | + return ''; | |
| 3633 | + } | |
| 3634 | + } | |
| 3635 | + }; | |
| 3636 | + | |
| 3637 | + | |
| 3638 | + var reservedWords = ( | |
| 3639 | + "break else new var" + | |
| 3640 | + " case finally return void" + | |
| 3641 | + " catch for switch while" + | |
| 3642 | + " continue function this with" + | |
| 3643 | + " default if throw" + | |
| 3644 | + " delete in try" + | |
| 3645 | + " do instanceof typeof" + | |
| 3646 | + " abstract enum int short" + | |
| 3647 | + " boolean export interface static" + | |
| 3648 | + " byte extends long super" + | |
| 3649 | + " char final native synchronized" + | |
| 3650 | + " class float package throws" + | |
| 3651 | + " const goto private transient" + | |
| 3652 | + " debugger implements protected volatile" + | |
| 3653 | + " double import public let yield await" + | |
| 3654 | + " null true false" | |
| 3655 | + ).split(" "); | |
| 3656 | + | |
| 3657 | + var compilerWords = JavaScriptCompiler.RESERVED_WORDS = {}; | |
| 3658 | + | |
| 3659 | + for(var i=0, l=reservedWords.length; i<l; i++) { | |
| 3660 | + compilerWords[reservedWords[i]] = true; | |
| 3661 | + } | |
| 3662 | + | |
| 3663 | + JavaScriptCompiler.isValidJavaScriptVariableName = function(name) { | |
| 3664 | + return !JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(name); | |
| 3665 | + }; | |
| 3666 | + | |
| 3667 | + function strictLookup(requireTerminal, compiler, parts, type) { | |
| 3668 | + var stack = compiler.popStack(); | |
| 3669 | + | |
| 3670 | + var i = 0, | |
| 3671 | + len = parts.length; | |
| 3672 | + if (requireTerminal) { | |
| 3673 | + len--; | |
| 3674 | + } | |
| 3675 | + | |
| 3676 | + for (; i < len; i++) { | |
| 3677 | + stack = compiler.nameLookup(stack, parts[i], type); | |
| 3678 | + } | |
| 3679 | + | |
| 3680 | + if (requireTerminal) { | |
| 3681 | + return [compiler.aliasable('this.strict'), '(', stack, ', ', compiler.quotedString(parts[i]), ')']; | |
| 3682 | + } else { | |
| 3683 | + return stack; | |
| 3684 | + } | |
| 3685 | + } | |
| 3686 | + | |
| 3687 | + __exports__ = JavaScriptCompiler; | |
| 3688 | + return __exports__; | |
| 3689 | +})(__module2__, __module4__, __module3__, __module15__); | |
| 3690 | + | |
| 3691 | +// handlebars.js | |
| 3692 | +var __module0__ = (function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__) { | |
| 3693 | + "use strict"; | |
| 3694 | + var __exports__; | |
| 3695 | + /*globals Handlebars: true */ | |
| 3696 | + var Handlebars = __dependency1__; | |
| 3697 | + | |
| 3698 | + // Compiler imports | |
| 3699 | + var AST = __dependency2__; | |
| 3700 | + var Parser = __dependency3__.parser; | |
| 3701 | + var parse = __dependency3__.parse; | |
| 3702 | + var Compiler = __dependency4__.Compiler; | |
| 3703 | + var compile = __dependency4__.compile; | |
| 3704 | + var precompile = __dependency4__.precompile; | |
| 3705 | + var JavaScriptCompiler = __dependency5__; | |
| 3706 | + | |
| 3707 | + var _create = Handlebars.create; | |
| 3708 | + var create = function() { | |
| 3709 | + var hb = _create(); | |
| 3710 | + | |
| 3711 | + hb.compile = function(input, options) { | |
| 3712 | + return compile(input, options, hb); | |
| 3713 | + }; | |
| 3714 | + hb.precompile = function (input, options) { | |
| 3715 | + return precompile(input, options, hb); | |
| 3716 | + }; | |
| 3717 | + | |
| 3718 | + hb.AST = AST; | |
| 3719 | + hb.Compiler = Compiler; | |
| 3720 | + hb.JavaScriptCompiler = JavaScriptCompiler; | |
| 3721 | + hb.Parser = Parser; | |
| 3722 | + hb.parse = parse; | |
| 3723 | + | |
| 3724 | + return hb; | |
| 3725 | + }; | |
| 3726 | + | |
| 3727 | + Handlebars = create(); | |
| 3728 | + Handlebars.create = create; | |
| 3729 | + | |
| 3730 | + /*jshint -W040 */ | |
| 3731 | + /* istanbul ignore next */ | |
| 3732 | + var root = typeof global !== 'undefined' ? global : window, | |
| 3733 | + $Handlebars = root.Handlebars; | |
| 3734 | + /* istanbul ignore next */ | |
| 3735 | + Handlebars.noConflict = function() { | |
| 3736 | + if (root.Handlebars === Handlebars) { | |
| 3737 | + root.Handlebars = $Handlebars; | |
| 3738 | + } | |
| 3739 | + }; | |
| 3740 | + | |
| 3741 | + Handlebars['default'] = Handlebars; | |
| 3742 | + | |
| 3743 | + __exports__ = Handlebars; | |
| 3744 | + return __exports__; | |
| 3745 | +})(__module1__, __module7__, __module8__, __module13__, __module14__); | |
| 3746 | + | |
| 3747 | + return __module0__; | |
| 3748 | +})); | ... | ... |
| 1 | +++ a/js/jquery-1.11.2.min.js | |
| ... | ... | @@ -0,0 +1,4 @@ |
| 1 | +/*! jQuery v1.11.2 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */ | |
| 2 | +!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l="1.11.2",m=function(a,b){return new m.fn.init(a,b)},n=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,o=/^-ms-/,p=/-([\da-z])/gi,q=function(a,b){return b.toUpperCase()};m.fn=m.prototype={jquery:l,constructor:m,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=m.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return m.each(this,a,b)},map:function(a){return this.pushStack(m.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},m.extend=m.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||m.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(m.isPlainObject(c)||(b=m.isArray(c)))?(b?(b=!1,f=a&&m.isArray(a)?a:[]):f=a&&m.isPlainObject(a)?a:{},g[d]=m.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},m.extend({expando:"jQuery"+(l+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===m.type(a)},isArray:Array.isArray||function(a){return"array"===m.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return!m.isArray(a)&&a-parseFloat(a)+1>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==m.type(a)||a.nodeType||m.isWindow(a))return!1;try{if(a.constructor&&!j.call(a,"constructor")&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(k.ownLast)for(b in a)return j.call(a,b);for(b in a);return void 0===b||j.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(b){b&&m.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(o,"ms-").replace(p,q)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=r(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(n,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(r(Object(a))?m.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(g)return g.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=r(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(f=a[b],b=a,a=f),m.isFunction(a)?(c=d.call(arguments,2),e=function(){return a.apply(b||this,c.concat(d.call(arguments)))},e.guid=a.guid=a.guid||m.guid++,e):void 0},now:function(){return+new Date},support:k}),m.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function r(a){var b=a.length,c=m.type(a);return"function"===c||m.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var s=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=hb(),z=hb(),A=hb(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N=M.replace("w","w#"),O="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+N+"))|)"+L+"*\\]",P=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+O+")*)|.*)\\)|)",Q=new RegExp(L+"+","g"),R=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),S=new RegExp("^"+L+"*,"+L+"*"),T=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),U=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),V=new RegExp(P),W=new RegExp("^"+N+"$"),X={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+O),PSEUDO:new RegExp("^"+P),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ab=/[+~]/,bb=/'|\\/g,cb=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),db=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},eb=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(fb){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function gb(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],k=b.nodeType,"string"!=typeof a||!a||1!==k&&9!==k&&11!==k)return d;if(!e&&p){if(11!==k&&(f=_.exec(a)))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return H.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName)return H.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=1!==k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(bb,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+rb(o[l]);w=ab.test(a)&&pb(b.parentNode)||b,x=o.join(",")}if(x)try{return H.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function hb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ib(a){return a[u]=!0,a}function jb(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function kb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function lb(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function mb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function nb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function ob(a){return ib(function(b){return b=+b,ib(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function pb(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=gb.support={},f=gb.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=gb.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=g.documentElement,e=g.defaultView,e&&e!==e.top&&(e.addEventListener?e.addEventListener("unload",eb,!1):e.attachEvent&&e.attachEvent("onunload",eb)),p=!f(g),c.attributes=jb(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=jb(function(a){return a.appendChild(g.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(g.getElementsByClassName),c.getById=jb(function(a){return o.appendChild(a).id=u,!g.getElementsByName||!g.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(g.querySelectorAll))&&(jb(function(a){o.appendChild(a).innerHTML="<a id='"+u+"'></a><select id='"+u+"-\f]' msallowcapture=''><option selected=''></option></select>",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),jb(function(a){var b=g.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&jb(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",P)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===g||a.ownerDocument===v&&t(v,a)?-1:b===g||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,h=[a],i=[b];if(!e||!f)return a===g?-1:b===g?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return lb(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?lb(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},g):n},gb.matches=function(a,b){return gb(a,null,null,b)},gb.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return gb(b,n,null,[a]).length>0},gb.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},gb.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},gb.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},gb.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=gb.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=gb.selectors={cacheLength:50,createPseudo:ib,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(cb,db),a[3]=(a[3]||a[4]||a[5]||"").replace(cb,db),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||gb.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&gb.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(cb,db).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=gb.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(Q," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||gb.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ib(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ib(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?ib(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ib(function(a){return function(b){return gb(a,b).length>0}}),contains:ib(function(a){return a=a.replace(cb,db),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ib(function(a){return W.test(a||"")||gb.error("unsupported lang: "+a),a=a.replace(cb,db).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:ob(function(){return[0]}),last:ob(function(a,b){return[b-1]}),eq:ob(function(a,b,c){return[0>c?c+b:c]}),even:ob(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:ob(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:ob(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:ob(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=mb(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=nb(b);function qb(){}qb.prototype=d.filters=d.pseudos,d.setFilters=new qb,g=gb.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){(!c||(e=S.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=T.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(R," ")}),h=h.slice(c.length));for(g in d.filter)!(e=X[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?gb.error(a):z(a,i).slice(0)};function rb(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function sb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function tb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function ub(a,b,c){for(var d=0,e=b.length;e>d;d++)gb(a,b[d],c);return c}function vb(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function wb(a,b,c,d,e,f){return d&&!d[u]&&(d=wb(d)),e&&!e[u]&&(e=wb(e,f)),ib(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ub(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:vb(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=vb(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=vb(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function xb(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=sb(function(a){return a===b},h,!0),l=sb(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[sb(tb(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return wb(i>1&&tb(m),i>1&&rb(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&xb(a.slice(i,e)),f>e&&xb(a=a.slice(e)),f>e&&rb(a))}m.push(c)}return tb(m)}function yb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=F.call(i));s=vb(s)}H.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&gb.uniqueSort(i)}return k&&(w=v,j=t),r};return c?ib(f):f}return h=gb.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=xb(b[c]),f[u]?d.push(f):e.push(f);f=A(a,yb(e,d)),f.selector=a}return f},i=gb.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(cb,db),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(cb,db),ab.test(j[0].type)&&pb(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&rb(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,ab.test(a)&&pb(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=jb(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),jb(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||kb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&jb(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||kb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),jb(function(a){return null==a.getAttribute("disabled")})||kb(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),gb}(a);m.find=s,m.expr=s.selectors,m.expr[":"]=m.expr.pseudos,m.unique=s.uniqueSort,m.text=s.getText,m.isXMLDoc=s.isXML,m.contains=s.contains;var t=m.expr.match.needsContext,u=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,v=/^.[^:#\[\.,]*$/;function w(a,b,c){if(m.isFunction(b))return m.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return m.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(v.test(b))return m.filter(b,a,c);b=m.filter(b,a)}return m.grep(a,function(a){return m.inArray(a,b)>=0!==c})}m.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?m.find.matchesSelector(d,a)?[d]:[]:m.find.matches(a,m.grep(b,function(a){return 1===a.nodeType}))},m.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(m(a).filter(function(){for(b=0;e>b;b++)if(m.contains(d[b],this))return!0}));for(b=0;e>b;b++)m.find(a,d[b],c);return c=this.pushStack(e>1?m.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(w(this,a||[],!1))},not:function(a){return this.pushStack(w(this,a||[],!0))},is:function(a){return!!w(this,"string"==typeof a&&t.test(a)?m(a):a||[],!1).length}});var x,y=a.document,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=m.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||x).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof m?b[0]:b,m.merge(this,m.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:y,!0)),u.test(c[1])&&m.isPlainObject(b))for(c in b)m.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}if(d=y.getElementById(c[2]),d&&d.parentNode){if(d.id!==c[2])return x.find(a);this.length=1,this[0]=d}return this.context=y,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):m.isFunction(a)?"undefined"!=typeof x.ready?x.ready(a):a(m):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),m.makeArray(a,this))};A.prototype=m.fn,x=m(y);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};m.extend({dir:function(a,b,c){var d=[],e=a[b];while(e&&9!==e.nodeType&&(void 0===c||1!==e.nodeType||!m(e).is(c)))1===e.nodeType&&d.push(e),e=e[b];return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),m.fn.extend({has:function(a){var b,c=m(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(m.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=t.test(a)||"string"!=typeof a?m(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&m.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?m.unique(f):f)},index:function(a){return a?"string"==typeof a?m.inArray(this[0],m(a)):m.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(m.unique(m.merge(this.get(),m(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}m.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return m.dir(a,"parentNode")},parentsUntil:function(a,b,c){return m.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return m.dir(a,"nextSibling")},prevAll:function(a){return m.dir(a,"previousSibling")},nextUntil:function(a,b,c){return m.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return m.dir(a,"previousSibling",c)},siblings:function(a){return m.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return m.sibling(a.firstChild)},contents:function(a){return m.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:m.merge([],a.childNodes)}},function(a,b){m.fn[a]=function(c,d){var e=m.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=m.filter(d,e)),this.length>1&&(C[a]||(e=m.unique(e)),B.test(a)&&(e=e.reverse())),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return m.each(a.match(E)||[],function(a,c){b[c]=!0}),b}m.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):m.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(c=a.memory&&l,d=!0,f=g||0,g=0,e=h.length,b=!0;h&&e>f;f++)if(h[f].apply(l[0],l[1])===!1&&a.stopOnFalse){c=!1;break}b=!1,h&&(i?i.length&&j(i.shift()):c?h=[]:k.disable())},k={add:function(){if(h){var d=h.length;!function f(b){m.each(b,function(b,c){var d=m.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&f(c)})}(arguments),b?e=h.length:c&&(g=d,j(c))}return this},remove:function(){return h&&m.each(arguments,function(a,c){var d;while((d=m.inArray(c,h,d))>-1)h.splice(d,1),b&&(e>=d&&e--,f>=d&&f--)}),this},has:function(a){return a?m.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],e=0,this},disable:function(){return h=i=c=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,c||k.disable(),this},locked:function(){return!i},fireWith:function(a,c){return!h||d&&!i||(c=c||[],c=[a,c.slice?c.slice():c],b?i.push(c):j(c)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!d}};return k},m.extend({Deferred:function(a){var b=[["resolve","done",m.Callbacks("once memory"),"resolved"],["reject","fail",m.Callbacks("once memory"),"rejected"],["notify","progress",m.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return m.Deferred(function(c){m.each(b,function(b,f){var g=m.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&m.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?m.extend(a,d):d}},e={};return d.pipe=d.then,m.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&m.isFunction(a.promise)?e:0,g=1===f?a:m.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&m.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;m.fn.ready=function(a){return m.ready.promise().done(a),this},m.extend({isReady:!1,readyWait:1,holdReady:function(a){a?m.readyWait++:m.ready(!0)},ready:function(a){if(a===!0?!--m.readyWait:!m.isReady){if(!y.body)return setTimeout(m.ready);m.isReady=!0,a!==!0&&--m.readyWait>0||(H.resolveWith(y,[m]),m.fn.triggerHandler&&(m(y).triggerHandler("ready"),m(y).off("ready")))}}});function I(){y.addEventListener?(y.removeEventListener("DOMContentLoaded",J,!1),a.removeEventListener("load",J,!1)):(y.detachEvent("onreadystatechange",J),a.detachEvent("onload",J))}function J(){(y.addEventListener||"load"===event.type||"complete"===y.readyState)&&(I(),m.ready())}m.ready.promise=function(b){if(!H)if(H=m.Deferred(),"complete"===y.readyState)setTimeout(m.ready);else if(y.addEventListener)y.addEventListener("DOMContentLoaded",J,!1),a.addEventListener("load",J,!1);else{y.attachEvent("onreadystatechange",J),a.attachEvent("onload",J);var c=!1;try{c=null==a.frameElement&&y.documentElement}catch(d){}c&&c.doScroll&&!function e(){if(!m.isReady){try{c.doScroll("left")}catch(a){return setTimeout(e,50)}I(),m.ready()}}()}return H.promise(b)};var K="undefined",L;for(L in m(k))break;k.ownLast="0"!==L,k.inlineBlockNeedsLayout=!1,m(function(){var a,b,c,d;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",k.inlineBlockNeedsLayout=a=3===b.offsetWidth,a&&(c.style.zoom=1)),c.removeChild(d))}),function(){var a=y.createElement("div");if(null==k.deleteExpando){k.deleteExpando=!0;try{delete a.test}catch(b){k.deleteExpando=!1}}a=null}(),m.acceptData=function(a){var b=m.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b};var M=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,N=/([A-Z])/g;function O(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(N,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:M.test(c)?m.parseJSON(c):c}catch(e){}m.data(a,b,c)}else c=void 0}return c}function P(a){var b;for(b in a)if(("data"!==b||!m.isEmptyObject(a[b]))&&"toJSON"!==b)return!1; | |
| 3 | +return!0}function Q(a,b,d,e){if(m.acceptData(a)){var f,g,h=m.expando,i=a.nodeType,j=i?m.cache:a,k=i?a[h]:a[h]&&h;if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||m.guid++:h),j[k]||(j[k]=i?{}:{toJSON:m.noop}),("object"==typeof b||"function"==typeof b)&&(e?j[k]=m.extend(j[k],b):j[k].data=m.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[m.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[m.camelCase(b)])):f=g,f}}function R(a,b,c){if(m.acceptData(a)){var d,e,f=a.nodeType,g=f?m.cache:a,h=f?a[m.expando]:m.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){m.isArray(b)?b=b.concat(m.map(b,m.camelCase)):b in d?b=[b]:(b=m.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!P(d):!m.isEmptyObject(d))return}(c||(delete g[h].data,P(g[h])))&&(f?m.cleanData([a],!0):k.deleteExpando||g!=g.window?delete g[h]:g[h]=null)}}}m.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?m.cache[a[m.expando]]:a[m.expando],!!a&&!P(a)},data:function(a,b,c){return Q(a,b,c)},removeData:function(a,b){return R(a,b)},_data:function(a,b,c){return Q(a,b,c,!0)},_removeData:function(a,b){return R(a,b,!0)}}),m.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=m.data(f),1===f.nodeType&&!m._data(f,"parsedAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=m.camelCase(d.slice(5)),O(f,d,e[d])));m._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){m.data(this,a)}):arguments.length>1?this.each(function(){m.data(this,a,b)}):f?O(f,a,m.data(f,a)):void 0},removeData:function(a){return this.each(function(){m.removeData(this,a)})}}),m.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=m._data(a,b),c&&(!d||m.isArray(c)?d=m._data(a,b,m.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=m.queue(a,b),d=c.length,e=c.shift(),f=m._queueHooks(a,b),g=function(){m.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return m._data(a,c)||m._data(a,c,{empty:m.Callbacks("once memory").add(function(){m._removeData(a,b+"queue"),m._removeData(a,c)})})}}),m.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?m.queue(this[0],a):void 0===b?this:this.each(function(){var c=m.queue(this,a,b);m._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&m.dequeue(this,a)})},dequeue:function(a){return this.each(function(){m.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=m.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=m._data(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var S=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=["Top","Right","Bottom","Left"],U=function(a,b){return a=b||a,"none"===m.css(a,"display")||!m.contains(a.ownerDocument,a)},V=m.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===m.type(c)){e=!0;for(h in c)m.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,m.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(m(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},W=/^(?:checkbox|radio)$/i;!function(){var a=y.createElement("input"),b=y.createElement("div"),c=y.createDocumentFragment();if(b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",k.leadingWhitespace=3===b.firstChild.nodeType,k.tbody=!b.getElementsByTagName("tbody").length,k.htmlSerialize=!!b.getElementsByTagName("link").length,k.html5Clone="<:nav></:nav>"!==y.createElement("nav").cloneNode(!0).outerHTML,a.type="checkbox",a.checked=!0,c.appendChild(a),k.appendChecked=a.checked,b.innerHTML="<textarea>x</textarea>",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue,c.appendChild(b),b.innerHTML="<input type='radio' checked='checked' name='t'/>",k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,k.noCloneEvent=!0,b.attachEvent&&(b.attachEvent("onclick",function(){k.noCloneEvent=!1}),b.cloneNode(!0).click()),null==k.deleteExpando){k.deleteExpando=!0;try{delete b.test}catch(d){k.deleteExpando=!1}}}(),function(){var b,c,d=y.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(k[b+"Bubbles"]=c in a)||(d.setAttribute(c,"t"),k[b+"Bubbles"]=d.attributes[c].expando===!1);d=null}();var X=/^(?:input|select|textarea)$/i,Y=/^key/,Z=/^(?:mouse|pointer|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=/^([^.]*)(?:\.(.+)|)$/;function ab(){return!0}function bb(){return!1}function cb(){try{return y.activeElement}catch(a){}}m.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=m.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return typeof m===K||a&&m.event.triggered===a.type?void 0:m.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(E)||[""],h=b.length;while(h--)f=_.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=m.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=m.event.special[o]||{},l=m.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&m.expr.match.needsContext.test(e),namespace:p.join(".")},i),(n=g[o])||(n=g[o]=[],n.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent("on"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?n.splice(n.delegateCount++,0,l):n.push(l),m.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m.hasData(a)&&m._data(a);if(r&&(k=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=_.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=m.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,n=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=n.length;while(f--)g=n[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(n.splice(f,1),g.selector&&n.delegateCount--,l.remove&&l.remove.call(a,g));i&&!n.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||m.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)m.event.remove(a,o+b[j],c,d,!0);m.isEmptyObject(k)&&(delete r.handle,m._removeData(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,l,n,o=[d||y],p=j.call(b,"type")?b.type:b,q=j.call(b,"namespace")?b.namespace.split("."):[];if(h=l=d=d||y,3!==d.nodeType&&8!==d.nodeType&&!$.test(p+m.event.triggered)&&(p.indexOf(".")>=0&&(q=p.split("."),p=q.shift(),q.sort()),g=p.indexOf(":")<0&&"on"+p,b=b[m.expando]?b:new m.Event(p,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=q.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:m.makeArray(c,[b]),k=m.event.special[p]||{},e||!k.trigger||k.trigger.apply(d,c)!==!1)){if(!e&&!k.noBubble&&!m.isWindow(d)){for(i=k.delegateType||p,$.test(i+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),l=h;l===(d.ownerDocument||y)&&o.push(l.defaultView||l.parentWindow||a)}n=0;while((h=o[n++])&&!b.isPropagationStopped())b.type=n>1?i:k.bindType||p,f=(m._data(h,"events")||{})[b.type]&&m._data(h,"handle"),f&&f.apply(h,c),f=g&&h[g],f&&f.apply&&m.acceptData(h)&&(b.result=f.apply(h,c),b.result===!1&&b.preventDefault());if(b.type=p,!e&&!b.isDefaultPrevented()&&(!k._default||k._default.apply(o.pop(),c)===!1)&&m.acceptData(d)&&g&&d[p]&&!m.isWindow(d)){l=d[g],l&&(d[g]=null),m.event.triggered=p;try{d[p]()}catch(r){}m.event.triggered=void 0,l&&(d[g]=l)}return b.result}},dispatch:function(a){a=m.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(m._data(this,"events")||{})[a.type]||[],k=m.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=m.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,g=0;while((e=f.handlers[g++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(e.namespace))&&(a.handleObj=e,a.data=e.data,c=((m.event.special[e.origType]||{}).handle||e.handler).apply(f.elem,i),void 0!==c&&(a.result=c)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(e=[],f=0;h>f;f++)d=b[f],c=d.selector+" ",void 0===e[c]&&(e[c]=d.needsContext?m(c,this).index(i)>=0:m.find(c,this,null,[i]).length),e[c]&&e.push(d);e.length&&g.push({elem:i,handlers:e})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},fix:function(a){if(a[m.expando])return a;var b,c,d,e=a.type,f=a,g=this.fixHooks[e];g||(this.fixHooks[e]=g=Z.test(e)?this.mouseHooks:Y.test(e)?this.keyHooks:{}),d=g.props?this.props.concat(g.props):this.props,a=new m.Event(f),b=d.length;while(b--)c=d[b],a[c]=f[c];return a.target||(a.target=f.srcElement||y),3===a.target.nodeType&&(a.target=a.target.parentNode),a.metaKey=!!a.metaKey,g.filter?g.filter(a,f):a},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,d,e,f=b.button,g=b.fromElement;return null==a.pageX&&null!=b.clientX&&(d=a.target.ownerDocument||y,e=d.documentElement,c=d.body,a.pageX=b.clientX+(e&&e.scrollLeft||c&&c.scrollLeft||0)-(e&&e.clientLeft||c&&c.clientLeft||0),a.pageY=b.clientY+(e&&e.scrollTop||c&&c.scrollTop||0)-(e&&e.clientTop||c&&c.clientTop||0)),!a.relatedTarget&&g&&(a.relatedTarget=g===a.target?b.toElement:g),a.which||void 0===f||(a.which=1&f?1:2&f?3:4&f?2:0),a}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==cb()&&this.focus)try{return this.focus(),!1}catch(a){}},delegateType:"focusin"},blur:{trigger:function(){return this===cb()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return m.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):void 0},_default:function(a){return m.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,d){var e=m.extend(new m.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?m.event.trigger(e,null,b):m.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},m.removeEvent=y.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){var d="on"+b;a.detachEvent&&(typeof a[d]===K&&(a[d]=null),a.detachEvent(d,c))},m.Event=function(a,b){return this instanceof m.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?ab:bb):this.type=a,b&&m.extend(this,b),this.timeStamp=a&&a.timeStamp||m.now(),void(this[m.expando]=!0)):new m.Event(a,b)},m.Event.prototype={isDefaultPrevented:bb,isPropagationStopped:bb,isImmediatePropagationStopped:bb,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=ab,a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=ab,a&&(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=ab,a&&a.stopImmediatePropagation&&a.stopImmediatePropagation(),this.stopPropagation()}},m.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){m.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return(!e||e!==d&&!m.contains(d,e))&&(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),k.submitBubbles||(m.event.special.submit={setup:function(){return m.nodeName(this,"form")?!1:void m.event.add(this,"click._submit keypress._submit",function(a){var b=a.target,c=m.nodeName(b,"input")||m.nodeName(b,"button")?b.form:void 0;c&&!m._data(c,"submitBubbles")&&(m.event.add(c,"submit._submit",function(a){a._submit_bubble=!0}),m._data(c,"submitBubbles",!0))})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&m.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){return m.nodeName(this,"form")?!1:void m.event.remove(this,"._submit")}}),k.changeBubbles||(m.event.special.change={setup:function(){return X.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(m.event.add(this,"propertychange._change",function(a){"checked"===a.originalEvent.propertyName&&(this._just_changed=!0)}),m.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1),m.event.simulate("change",this,a,!0)})),!1):void m.event.add(this,"beforeactivate._change",function(a){var b=a.target;X.test(b.nodeName)&&!m._data(b,"changeBubbles")&&(m.event.add(b,"change._change",function(a){!this.parentNode||a.isSimulated||a.isTrigger||m.event.simulate("change",this.parentNode,a,!0)}),m._data(b,"changeBubbles",!0))})},handle:function(a){var b=a.target;return this!==b||a.isSimulated||a.isTrigger||"radio"!==b.type&&"checkbox"!==b.type?a.handleObj.handler.apply(this,arguments):void 0},teardown:function(){return m.event.remove(this,"._change"),!X.test(this.nodeName)}}),k.focusinBubbles||m.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){m.event.simulate(b,a.target,m.event.fix(a),!0)};m.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=m._data(d,b);e||d.addEventListener(a,c,!0),m._data(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=m._data(d,b)-1;e?m._data(d,b,e):(d.removeEventListener(a,c,!0),m._removeData(d,b))}}}),m.fn.extend({on:function(a,b,c,d,e){var f,g;if("object"==typeof a){"string"!=typeof b&&(c=c||b,b=void 0);for(f in a)this.on(f,b,c,a[f],e);return this}if(null==c&&null==d?(d=b,c=b=void 0):null==d&&("string"==typeof b?(d=c,c=void 0):(d=c,c=b,b=void 0)),d===!1)d=bb;else if(!d)return this;return 1===e&&(g=d,d=function(a){return m().off(a),g.apply(this,arguments)},d.guid=g.guid||(g.guid=m.guid++)),this.each(function(){m.event.add(this,a,d,c,b)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,m(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return(b===!1||"function"==typeof b)&&(c=b,b=void 0),c===!1&&(c=bb),this.each(function(){m.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){m.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?m.event.trigger(a,b,c,!0):void 0}});function db(a){var b=eb.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}var eb="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",fb=/ jQuery\d+="(?:null|\d+)"/g,gb=new RegExp("<(?:"+eb+")[\\s/>]","i"),hb=/^\s+/,ib=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,jb=/<([\w:]+)/,kb=/<tbody/i,lb=/<|&#?\w+;/,mb=/<(?:script|style|link)/i,nb=/checked\s*(?:[^=]|=\s*.checked.)/i,ob=/^$|\/(?:java|ecma)script/i,pb=/^true\/(.*)/,qb=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,rb={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:k.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},sb=db(y),tb=sb.appendChild(y.createElement("div"));rb.optgroup=rb.option,rb.tbody=rb.tfoot=rb.colgroup=rb.caption=rb.thead,rb.th=rb.td;function ub(a,b){var c,d,e=0,f=typeof a.getElementsByTagName!==K?a.getElementsByTagName(b||"*"):typeof a.querySelectorAll!==K?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||m.nodeName(d,b)?f.push(d):m.merge(f,ub(d,b));return void 0===b||b&&m.nodeName(a,b)?m.merge([a],f):f}function vb(a){W.test(a.type)&&(a.defaultChecked=a.checked)}function wb(a,b){return m.nodeName(a,"table")&&m.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function xb(a){return a.type=(null!==m.find.attr(a,"type"))+"/"+a.type,a}function yb(a){var b=pb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function zb(a,b){for(var c,d=0;null!=(c=a[d]);d++)m._data(c,"globalEval",!b||m._data(b[d],"globalEval"))}function Ab(a,b){if(1===b.nodeType&&m.hasData(a)){var c,d,e,f=m._data(a),g=m._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)m.event.add(b,c,h[c][d])}g.data&&(g.data=m.extend({},g.data))}}function Bb(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!k.noCloneEvent&&b[m.expando]){e=m._data(b);for(d in e.events)m.removeEvent(b,d,e.handle);b.removeAttribute(m.expando)}"script"===c&&b.text!==a.text?(xb(b).text=a.text,yb(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),k.html5Clone&&a.innerHTML&&!m.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&W.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}}m.extend({clone:function(a,b,c){var d,e,f,g,h,i=m.contains(a.ownerDocument,a);if(k.html5Clone||m.isXMLDoc(a)||!gb.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(tb.innerHTML=a.outerHTML,tb.removeChild(f=tb.firstChild)),!(k.noCloneEvent&&k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||m.isXMLDoc(a)))for(d=ub(f),h=ub(a),g=0;null!=(e=h[g]);++g)d[g]&&Bb(e,d[g]);if(b)if(c)for(h=h||ub(a),d=d||ub(f),g=0;null!=(e=h[g]);g++)Ab(e,d[g]);else Ab(a,f);return d=ub(f,"script"),d.length>0&&zb(d,!i&&ub(a,"script")),d=h=e=null,f},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,l,n=a.length,o=db(b),p=[],q=0;n>q;q++)if(f=a[q],f||0===f)if("object"===m.type(f))m.merge(p,f.nodeType?[f]:f);else if(lb.test(f)){h=h||o.appendChild(b.createElement("div")),i=(jb.exec(f)||["",""])[1].toLowerCase(),l=rb[i]||rb._default,h.innerHTML=l[1]+f.replace(ib,"<$1></$2>")+l[2],e=l[0];while(e--)h=h.lastChild;if(!k.leadingWhitespace&&hb.test(f)&&p.push(b.createTextNode(hb.exec(f)[0])),!k.tbody){f="table"!==i||kb.test(f)?"<table>"!==l[1]||kb.test(f)?0:h:h.firstChild,e=f&&f.childNodes.length;while(e--)m.nodeName(j=f.childNodes[e],"tbody")&&!j.childNodes.length&&f.removeChild(j)}m.merge(p,h.childNodes),h.textContent="";while(h.firstChild)h.removeChild(h.firstChild);h=o.lastChild}else p.push(b.createTextNode(f));h&&o.removeChild(h),k.appendChecked||m.grep(ub(p,"input"),vb),q=0;while(f=p[q++])if((!d||-1===m.inArray(f,d))&&(g=m.contains(f.ownerDocument,f),h=ub(o.appendChild(f),"script"),g&&zb(h),c)){e=0;while(f=h[e++])ob.test(f.type||"")&&c.push(f)}return h=null,o},cleanData:function(a,b){for(var d,e,f,g,h=0,i=m.expando,j=m.cache,l=k.deleteExpando,n=m.event.special;null!=(d=a[h]);h++)if((b||m.acceptData(d))&&(f=d[i],g=f&&j[f])){if(g.events)for(e in g.events)n[e]?m.event.remove(d,e):m.removeEvent(d,e,g.handle);j[f]&&(delete j[f],l?delete d[i]:typeof d.removeAttribute!==K?d.removeAttribute(i):d[i]=null,c.push(f))}}}),m.fn.extend({text:function(a){return V(this,function(a){return void 0===a?m.text(this):this.empty().append((this[0]&&this[0].ownerDocument||y).createTextNode(a))},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?m.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||m.cleanData(ub(c)),c.parentNode&&(b&&m.contains(c.ownerDocument,c)&&zb(ub(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&m.cleanData(ub(a,!1));while(a.firstChild)a.removeChild(a.firstChild);a.options&&m.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return m.clone(this,a,b)})},html:function(a){return V(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(fb,""):void 0;if(!("string"!=typeof a||mb.test(a)||!k.htmlSerialize&&gb.test(a)||!k.leadingWhitespace&&hb.test(a)||rb[(jb.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(ib,"<$1></$2>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(m.cleanData(ub(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,m.cleanData(ub(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,n=this,o=l-1,p=a[0],q=m.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&nb.test(p))return this.each(function(c){var d=n.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(i=m.buildFragment(a,this[0].ownerDocument,!1,this),c=i.firstChild,1===i.childNodes.length&&(i=c),c)){for(g=m.map(ub(i,"script"),xb),f=g.length;l>j;j++)d=i,j!==o&&(d=m.clone(d,!0,!0),f&&m.merge(g,ub(d,"script"))),b.call(this[j],d,j);if(f)for(h=g[g.length-1].ownerDocument,m.map(g,yb),j=0;f>j;j++)d=g[j],ob.test(d.type||"")&&!m._data(d,"globalEval")&&m.contains(h,d)&&(d.src?m._evalUrl&&m._evalUrl(d.src):m.globalEval((d.text||d.textContent||d.innerHTML||"").replace(qb,"")));i=c=null}return this}}),m.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){m.fn[a]=function(a){for(var c,d=0,e=[],g=m(a),h=g.length-1;h>=d;d++)c=d===h?this:this.clone(!0),m(g[d])[b](c),f.apply(e,c.get());return this.pushStack(e)}});var Cb,Db={};function Eb(b,c){var d,e=m(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:m.css(e[0],"display");return e.detach(),f}function Fb(a){var b=y,c=Db[a];return c||(c=Eb(a,b),"none"!==c&&c||(Cb=(Cb||m("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=(Cb[0].contentWindow||Cb[0].contentDocument).document,b.write(),b.close(),c=Eb(a,b),Cb.detach()),Db[a]=c),c}!function(){var a;k.shrinkWrapBlocks=function(){if(null!=a)return a;a=!1;var b,c,d;return c=y.getElementsByTagName("body")[0],c&&c.style?(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:1px;width:1px;zoom:1",b.appendChild(y.createElement("div")).style.width="5px",a=3!==b.offsetWidth),c.removeChild(d),a):void 0}}();var Gb=/^margin/,Hb=new RegExp("^("+S+")(?!px)[a-z%]+$","i"),Ib,Jb,Kb=/^(top|right|bottom|left)$/;a.getComputedStyle?(Ib=function(b){return b.ownerDocument.defaultView.opener?b.ownerDocument.defaultView.getComputedStyle(b,null):a.getComputedStyle(b,null)},Jb=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ib(a),g=c?c.getPropertyValue(b)||c[b]:void 0,c&&(""!==g||m.contains(a.ownerDocument,a)||(g=m.style(a,b)),Hb.test(g)&&Gb.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0===g?g:g+""}):y.documentElement.currentStyle&&(Ib=function(a){return a.currentStyle},Jb=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ib(a),g=c?c[b]:void 0,null==g&&h&&h[b]&&(g=h[b]),Hb.test(g)&&!Kb.test(b)&&(d=h.left,e=a.runtimeStyle,f=e&&e.left,f&&(e.left=a.currentStyle.left),h.left="fontSize"===b?"1em":g,g=h.pixelLeft+"px",h.left=d,f&&(e.left=f)),void 0===g?g:g+""||"auto"});function Lb(a,b){return{get:function(){var c=a();if(null!=c)return c?void delete this.get:(this.get=b).apply(this,arguments)}}}!function(){var b,c,d,e,f,g,h;if(b=y.createElement("div"),b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",d=b.getElementsByTagName("a")[0],c=d&&d.style){c.cssText="float:left;opacity:.5",k.opacity="0.5"===c.opacity,k.cssFloat=!!c.cssFloat,b.style.backgroundClip="content-box",b.cloneNode(!0).style.backgroundClip="",k.clearCloneStyle="content-box"===b.style.backgroundClip,k.boxSizing=""===c.boxSizing||""===c.MozBoxSizing||""===c.WebkitBoxSizing,m.extend(k,{reliableHiddenOffsets:function(){return null==g&&i(),g},boxSizingReliable:function(){return null==f&&i(),f},pixelPosition:function(){return null==e&&i(),e},reliableMarginRight:function(){return null==h&&i(),h}});function i(){var b,c,d,i;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),b.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute",e=f=!1,h=!0,a.getComputedStyle&&(e="1%"!==(a.getComputedStyle(b,null)||{}).top,f="4px"===(a.getComputedStyle(b,null)||{width:"4px"}).width,i=b.appendChild(y.createElement("div")),i.style.cssText=b.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",i.style.marginRight=i.style.width="0",b.style.width="1px",h=!parseFloat((a.getComputedStyle(i,null)||{}).marginRight),b.removeChild(i)),b.innerHTML="<table><tr><td></td><td>t</td></tr></table>",i=b.getElementsByTagName("td"),i[0].style.cssText="margin:0;border:0;padding:0;display:none",g=0===i[0].offsetHeight,g&&(i[0].style.display="",i[1].style.display="none",g=0===i[0].offsetHeight),c.removeChild(d))}}}(),m.swap=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};var Mb=/alpha\([^)]*\)/i,Nb=/opacity\s*=\s*([^)]*)/,Ob=/^(none|table(?!-c[ea]).+)/,Pb=new RegExp("^("+S+")(.*)$","i"),Qb=new RegExp("^([+-])=("+S+")","i"),Rb={position:"absolute",visibility:"hidden",display:"block"},Sb={letterSpacing:"0",fontWeight:"400"},Tb=["Webkit","O","Moz","ms"];function Ub(a,b){if(b in a)return b;var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=Tb.length;while(e--)if(b=Tb[e]+c,b in a)return b;return d}function Vb(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=m._data(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&U(d)&&(f[g]=m._data(d,"olddisplay",Fb(d.nodeName)))):(e=U(d),(c&&"none"!==c||!e)&&m._data(d,"olddisplay",e?c:m.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}function Wb(a,b,c){var d=Pb.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function Xb(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=m.css(a,c+T[f],!0,e)),d?("content"===c&&(g-=m.css(a,"padding"+T[f],!0,e)),"margin"!==c&&(g-=m.css(a,"border"+T[f]+"Width",!0,e))):(g+=m.css(a,"padding"+T[f],!0,e),"padding"!==c&&(g+=m.css(a,"border"+T[f]+"Width",!0,e)));return g}function Yb(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=Ib(a),g=k.boxSizing&&"border-box"===m.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=Jb(a,b,f),(0>e||null==e)&&(e=a.style[b]),Hb.test(e))return e;d=g&&(k.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Xb(a,b,c||(g?"border":"content"),d,f)+"px"}m.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Jb(a,"opacity");return""===c?"1":c}}}},cssNumber:{columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":k.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=m.camelCase(b),i=a.style;if(b=m.cssProps[h]||(m.cssProps[h]=Ub(i,h)),g=m.cssHooks[b]||m.cssHooks[h],void 0===c)return g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b];if(f=typeof c,"string"===f&&(e=Qb.exec(c))&&(c=(e[1]+1)*e[2]+parseFloat(m.css(a,b)),f="number"),null!=c&&c===c&&("number"!==f||m.cssNumber[h]||(c+="px"),k.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),!(g&&"set"in g&&void 0===(c=g.set(a,c,d)))))try{i[b]=c}catch(j){}}},css:function(a,b,c,d){var e,f,g,h=m.camelCase(b);return b=m.cssProps[h]||(m.cssProps[h]=Ub(a.style,h)),g=m.cssHooks[b]||m.cssHooks[h],g&&"get"in g&&(f=g.get(a,!0,c)),void 0===f&&(f=Jb(a,b,d)),"normal"===f&&b in Sb&&(f=Sb[b]),""===c||c?(e=parseFloat(f),c===!0||m.isNumeric(e)?e||0:f):f}}),m.each(["height","width"],function(a,b){m.cssHooks[b]={get:function(a,c,d){return c?Ob.test(m.css(a,"display"))&&0===a.offsetWidth?m.swap(a,Rb,function(){return Yb(a,b,d)}):Yb(a,b,d):void 0},set:function(a,c,d){var e=d&&Ib(a);return Wb(a,c,d?Xb(a,b,d,k.boxSizing&&"border-box"===m.css(a,"boxSizing",!1,e),e):0)}}}),k.opacity||(m.cssHooks.opacity={get:function(a,b){return Nb.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=m.isNumeric(b)?"alpha(opacity="+100*b+")":"",f=d&&d.filter||c.filter||"";c.zoom=1,(b>=1||""===b)&&""===m.trim(f.replace(Mb,""))&&c.removeAttribute&&(c.removeAttribute("filter"),""===b||d&&!d.filter)||(c.filter=Mb.test(f)?f.replace(Mb,e):f+" "+e)}}),m.cssHooks.marginRight=Lb(k.reliableMarginRight,function(a,b){return b?m.swap(a,{display:"inline-block"},Jb,[a,"marginRight"]):void 0}),m.each({margin:"",padding:"",border:"Width"},function(a,b){m.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+T[d]+b]=f[d]||f[d-2]||f[0];return e}},Gb.test(a)||(m.cssHooks[a+b].set=Wb)}),m.fn.extend({css:function(a,b){return V(this,function(a,b,c){var d,e,f={},g=0;if(m.isArray(b)){for(d=Ib(a),e=b.length;e>g;g++)f[b[g]]=m.css(a,b[g],!1,d);return f}return void 0!==c?m.style(a,b,c):m.css(a,b)},a,b,arguments.length>1)},show:function(){return Vb(this,!0)},hide:function(){return Vb(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){U(this)?m(this).show():m(this).hide()})}});function Zb(a,b,c,d,e){return new Zb.prototype.init(a,b,c,d,e) | |
| 4 | +}m.Tween=Zb,Zb.prototype={constructor:Zb,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(m.cssNumber[c]?"":"px")},cur:function(){var a=Zb.propHooks[this.prop];return a&&a.get?a.get(this):Zb.propHooks._default.get(this)},run:function(a){var b,c=Zb.propHooks[this.prop];return this.pos=b=this.options.duration?m.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Zb.propHooks._default.set(this),this}},Zb.prototype.init.prototype=Zb.prototype,Zb.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=m.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){m.fx.step[a.prop]?m.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[m.cssProps[a.prop]]||m.cssHooks[a.prop])?m.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},Zb.propHooks.scrollTop=Zb.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},m.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},m.fx=Zb.prototype.init,m.fx.step={};var $b,_b,ac=/^(?:toggle|show|hide)$/,bc=new RegExp("^(?:([+-])=|)("+S+")([a-z%]*)$","i"),cc=/queueHooks$/,dc=[ic],ec={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=bc.exec(b),f=e&&e[3]||(m.cssNumber[a]?"":"px"),g=(m.cssNumber[a]||"px"!==f&&+d)&&bc.exec(m.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,m.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};function fc(){return setTimeout(function(){$b=void 0}),$b=m.now()}function gc(a,b){var c,d={height:a},e=0;for(b=b?1:0;4>e;e+=2-b)c=T[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function hc(a,b,c){for(var d,e=(ec[b]||[]).concat(ec["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function ic(a,b,c){var d,e,f,g,h,i,j,l,n=this,o={},p=a.style,q=a.nodeType&&U(a),r=m._data(a,"fxshow");c.queue||(h=m._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,n.always(function(){n.always(function(){h.unqueued--,m.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[p.overflow,p.overflowX,p.overflowY],j=m.css(a,"display"),l="none"===j?m._data(a,"olddisplay")||Fb(a.nodeName):j,"inline"===l&&"none"===m.css(a,"float")&&(k.inlineBlockNeedsLayout&&"inline"!==Fb(a.nodeName)?p.zoom=1:p.display="inline-block")),c.overflow&&(p.overflow="hidden",k.shrinkWrapBlocks()||n.always(function(){p.overflow=c.overflow[0],p.overflowX=c.overflow[1],p.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],ac.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(q?"hide":"show")){if("show"!==e||!r||void 0===r[d])continue;q=!0}o[d]=r&&r[d]||m.style(a,d)}else j=void 0;if(m.isEmptyObject(o))"inline"===("none"===j?Fb(a.nodeName):j)&&(p.display=j);else{r?"hidden"in r&&(q=r.hidden):r=m._data(a,"fxshow",{}),f&&(r.hidden=!q),q?m(a).show():n.done(function(){m(a).hide()}),n.done(function(){var b;m._removeData(a,"fxshow");for(b in o)m.style(a,b,o[b])});for(d in o)g=hc(q?r[d]:0,d,n),d in r||(r[d]=g.start,q&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function jc(a,b){var c,d,e,f,g;for(c in a)if(d=m.camelCase(c),e=b[d],f=a[c],m.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=m.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function kc(a,b,c){var d,e,f=0,g=dc.length,h=m.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=$b||fc(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:m.extend({},b),opts:m.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:$b||fc(),duration:c.duration,tweens:[],createTween:function(b,c){var d=m.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(jc(k,j.opts.specialEasing);g>f;f++)if(d=dc[f].call(j,a,k,j.opts))return d;return m.map(k,hc,j),m.isFunction(j.opts.start)&&j.opts.start.call(a,j),m.fx.timer(m.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}m.Animation=m.extend(kc,{tweener:function(a,b){m.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;e>d;d++)c=a[d],ec[c]=ec[c]||[],ec[c].unshift(b)},prefilter:function(a,b){b?dc.unshift(a):dc.push(a)}}),m.speed=function(a,b,c){var d=a&&"object"==typeof a?m.extend({},a):{complete:c||!c&&b||m.isFunction(a)&&a,duration:a,easing:c&&b||b&&!m.isFunction(b)&&b};return d.duration=m.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in m.fx.speeds?m.fx.speeds[d.duration]:m.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){m.isFunction(d.old)&&d.old.call(this),d.queue&&m.dequeue(this,d.queue)},d},m.fn.extend({fadeTo:function(a,b,c,d){return this.filter(U).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=m.isEmptyObject(a),f=m.speed(b,c,d),g=function(){var b=kc(this,m.extend({},a),f);(e||m._data(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=m.timers,g=m._data(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&cc.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));(b||!c)&&m.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=m._data(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=m.timers,g=d?d.length:0;for(c.finish=!0,m.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),m.each(["toggle","show","hide"],function(a,b){var c=m.fn[b];m.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(gc(b,!0),a,d,e)}}),m.each({slideDown:gc("show"),slideUp:gc("hide"),slideToggle:gc("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){m.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),m.timers=[],m.fx.tick=function(){var a,b=m.timers,c=0;for($b=m.now();c<b.length;c++)a=b[c],a()||b[c]!==a||b.splice(c--,1);b.length||m.fx.stop(),$b=void 0},m.fx.timer=function(a){m.timers.push(a),a()?m.fx.start():m.timers.pop()},m.fx.interval=13,m.fx.start=function(){_b||(_b=setInterval(m.fx.tick,m.fx.interval))},m.fx.stop=function(){clearInterval(_b),_b=null},m.fx.speeds={slow:600,fast:200,_default:400},m.fn.delay=function(a,b){return a=m.fx?m.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},function(){var a,b,c,d,e;b=y.createElement("div"),b.setAttribute("className","t"),b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",d=b.getElementsByTagName("a")[0],c=y.createElement("select"),e=c.appendChild(y.createElement("option")),a=b.getElementsByTagName("input")[0],d.style.cssText="top:1px",k.getSetAttribute="t"!==b.className,k.style=/top/.test(d.getAttribute("style")),k.hrefNormalized="/a"===d.getAttribute("href"),k.checkOn=!!a.value,k.optSelected=e.selected,k.enctype=!!y.createElement("form").enctype,c.disabled=!0,k.optDisabled=!e.disabled,a=y.createElement("input"),a.setAttribute("value",""),k.input=""===a.getAttribute("value"),a.value="t",a.setAttribute("type","radio"),k.radioValue="t"===a.value}();var lc=/\r/g;m.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=m.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,m(this).val()):a,null==e?e="":"number"==typeof e?e+="":m.isArray(e)&&(e=m.map(e,function(a){return null==a?"":a+""})),b=m.valHooks[this.type]||m.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=m.valHooks[e.type]||m.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(lc,""):null==c?"":c)}}}),m.extend({valHooks:{option:{get:function(a){var b=m.find.attr(a,"value");return null!=b?b:m.trim(m.text(a))}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],!(!c.selected&&i!==e||(k.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&m.nodeName(c.parentNode,"optgroup"))){if(b=m(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=m.makeArray(b),g=e.length;while(g--)if(d=e[g],m.inArray(m.valHooks.option.get(d),f)>=0)try{d.selected=c=!0}catch(h){d.scrollHeight}else d.selected=!1;return c||(a.selectedIndex=-1),e}}}}),m.each(["radio","checkbox"],function(){m.valHooks[this]={set:function(a,b){return m.isArray(b)?a.checked=m.inArray(m(a).val(),b)>=0:void 0}},k.checkOn||(m.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var mc,nc,oc=m.expr.attrHandle,pc=/^(?:checked|selected)$/i,qc=k.getSetAttribute,rc=k.input;m.fn.extend({attr:function(a,b){return V(this,m.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){m.removeAttr(this,a)})}}),m.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(a&&3!==f&&8!==f&&2!==f)return typeof a.getAttribute===K?m.prop(a,b,c):(1===f&&m.isXMLDoc(a)||(b=b.toLowerCase(),d=m.attrHooks[b]||(m.expr.match.bool.test(b)?nc:mc)),void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=m.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void m.removeAttr(a,b))},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(E);if(f&&1===a.nodeType)while(c=f[e++])d=m.propFix[c]||c,m.expr.match.bool.test(c)?rc&&qc||!pc.test(c)?a[d]=!1:a[m.camelCase("default-"+c)]=a[d]=!1:m.attr(a,c,""),a.removeAttribute(qc?c:d)},attrHooks:{type:{set:function(a,b){if(!k.radioValue&&"radio"===b&&m.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),nc={set:function(a,b,c){return b===!1?m.removeAttr(a,c):rc&&qc||!pc.test(c)?a.setAttribute(!qc&&m.propFix[c]||c,c):a[m.camelCase("default-"+c)]=a[c]=!0,c}},m.each(m.expr.match.bool.source.match(/\w+/g),function(a,b){var c=oc[b]||m.find.attr;oc[b]=rc&&qc||!pc.test(b)?function(a,b,d){var e,f;return d||(f=oc[b],oc[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,oc[b]=f),e}:function(a,b,c){return c?void 0:a[m.camelCase("default-"+b)]?b.toLowerCase():null}}),rc&&qc||(m.attrHooks.value={set:function(a,b,c){return m.nodeName(a,"input")?void(a.defaultValue=b):mc&&mc.set(a,b,c)}}),qc||(mc={set:function(a,b,c){var d=a.getAttributeNode(c);return d||a.setAttributeNode(d=a.ownerDocument.createAttribute(c)),d.value=b+="","value"===c||b===a.getAttribute(c)?b:void 0}},oc.id=oc.name=oc.coords=function(a,b,c){var d;return c?void 0:(d=a.getAttributeNode(b))&&""!==d.value?d.value:null},m.valHooks.button={get:function(a,b){var c=a.getAttributeNode(b);return c&&c.specified?c.value:void 0},set:mc.set},m.attrHooks.contenteditable={set:function(a,b,c){mc.set(a,""===b?!1:b,c)}},m.each(["width","height"],function(a,b){m.attrHooks[b]={set:function(a,c){return""===c?(a.setAttribute(b,"auto"),c):void 0}}})),k.style||(m.attrHooks.style={get:function(a){return a.style.cssText||void 0},set:function(a,b){return a.style.cssText=b+""}});var sc=/^(?:input|select|textarea|button|object)$/i,tc=/^(?:a|area)$/i;m.fn.extend({prop:function(a,b){return V(this,m.prop,a,b,arguments.length>1)},removeProp:function(a){return a=m.propFix[a]||a,this.each(function(){try{this[a]=void 0,delete this[a]}catch(b){}})}}),m.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!m.isXMLDoc(a),f&&(b=m.propFix[b]||b,e=m.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=m.find.attr(a,"tabindex");return b?parseInt(b,10):sc.test(a.nodeName)||tc.test(a.nodeName)&&a.href?0:-1}}}}),k.hrefNormalized||m.each(["href","src"],function(a,b){m.propHooks[b]={get:function(a){return a.getAttribute(b,4)}}}),k.optSelected||(m.propHooks.selected={get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),null}}),m.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){m.propFix[this.toLowerCase()]=this}),k.enctype||(m.propFix.enctype="encoding");var uc=/[\t\r\n\f]/g;m.fn.extend({addClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j="string"==typeof a&&a;if(m.isFunction(a))return this.each(function(b){m(this).addClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(E)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(uc," "):" ")){f=0;while(e=b[f++])d.indexOf(" "+e+" ")<0&&(d+=e+" ");g=m.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j=0===arguments.length||"string"==typeof a&&a;if(m.isFunction(a))return this.each(function(b){m(this).removeClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(E)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(uc," "):"")){f=0;while(e=b[f++])while(d.indexOf(" "+e+" ")>=0)d=d.replace(" "+e+" "," ");g=a?m.trim(d):"",c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):this.each(m.isFunction(a)?function(c){m(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c){var b,d=0,e=m(this),f=a.match(E)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else(c===K||"boolean"===c)&&(this.className&&m._data(this,"__className__",this.className),this.className=this.className||a===!1?"":m._data(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(uc," ").indexOf(b)>=0)return!0;return!1}}),m.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){m.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),m.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}});var vc=m.now(),wc=/\?/,xc=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;m.parseJSON=function(b){if(a.JSON&&a.JSON.parse)return a.JSON.parse(b+"");var c,d=null,e=m.trim(b+"");return e&&!m.trim(e.replace(xc,function(a,b,e,f){return c&&b&&(d=0),0===d?a:(c=e||b,d+=!f-!e,"")}))?Function("return "+e)():m.error("Invalid JSON: "+b)},m.parseXML=function(b){var c,d;if(!b||"string"!=typeof b)return null;try{a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b))}catch(e){c=void 0}return c&&c.documentElement&&!c.getElementsByTagName("parsererror").length||m.error("Invalid XML: "+b),c};var yc,zc,Ac=/#.*$/,Bc=/([?&])_=[^&]*/,Cc=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Dc=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Ec=/^(?:GET|HEAD)$/,Fc=/^\/\//,Gc=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Hc={},Ic={},Jc="*/".concat("*");try{zc=location.href}catch(Kc){zc=y.createElement("a"),zc.href="",zc=zc.href}yc=Gc.exec(zc.toLowerCase())||[];function Lc(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(E)||[];if(m.isFunction(c))while(d=f[e++])"+"===d.charAt(0)?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Mc(a,b,c,d){var e={},f=a===Ic;function g(h){var i;return e[h]=!0,m.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Nc(a,b){var c,d,e=m.ajaxSettings.flatOptions||{};for(d in b)void 0!==b[d]&&((e[d]?a:c||(c={}))[d]=b[d]);return c&&m.extend(!0,a,c),a}function Oc(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===e&&(e=a.mimeType||b.getResponseHeader("Content-Type"));if(e)for(g in h)if(h[g]&&h[g].test(e)){i.unshift(g);break}if(i[0]in c)f=i[0];else{for(g in c){if(!i[0]||a.converters[g+" "+i[0]]){f=g;break}d||(d=g)}f=f||d}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function Pc(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}m.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:zc,type:"GET",isLocal:Dc.test(yc[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Jc,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":m.parseJSON,"text xml":m.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Nc(Nc(a,m.ajaxSettings),b):Nc(m.ajaxSettings,a)},ajaxPrefilter:Lc(Hc),ajaxTransport:Lc(Ic),ajax:function(a,b){"object"==typeof a&&(b=a,a=void 0),b=b||{};var c,d,e,f,g,h,i,j,k=m.ajaxSetup({},b),l=k.context||k,n=k.context&&(l.nodeType||l.jquery)?m(l):m.event,o=m.Deferred(),p=m.Callbacks("once memory"),q=k.statusCode||{},r={},s={},t=0,u="canceled",v={readyState:0,getResponseHeader:function(a){var b;if(2===t){if(!j){j={};while(b=Cc.exec(f))j[b[1].toLowerCase()]=b[2]}b=j[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===t?f:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return t||(a=s[c]=s[c]||a,r[a]=b),this},overrideMimeType:function(a){return t||(k.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>t)for(b in a)q[b]=[q[b],a[b]];else v.always(a[v.status]);return this},abort:function(a){var b=a||u;return i&&i.abort(b),x(0,b),this}};if(o.promise(v).complete=p.add,v.success=v.done,v.error=v.fail,k.url=((a||k.url||zc)+"").replace(Ac,"").replace(Fc,yc[1]+"//"),k.type=b.method||b.type||k.method||k.type,k.dataTypes=m.trim(k.dataType||"*").toLowerCase().match(E)||[""],null==k.crossDomain&&(c=Gc.exec(k.url.toLowerCase()),k.crossDomain=!(!c||c[1]===yc[1]&&c[2]===yc[2]&&(c[3]||("http:"===c[1]?"80":"443"))===(yc[3]||("http:"===yc[1]?"80":"443")))),k.data&&k.processData&&"string"!=typeof k.data&&(k.data=m.param(k.data,k.traditional)),Mc(Hc,k,b,v),2===t)return v;h=m.event&&k.global,h&&0===m.active++&&m.event.trigger("ajaxStart"),k.type=k.type.toUpperCase(),k.hasContent=!Ec.test(k.type),e=k.url,k.hasContent||(k.data&&(e=k.url+=(wc.test(e)?"&":"?")+k.data,delete k.data),k.cache===!1&&(k.url=Bc.test(e)?e.replace(Bc,"$1_="+vc++):e+(wc.test(e)?"&":"?")+"_="+vc++)),k.ifModified&&(m.lastModified[e]&&v.setRequestHeader("If-Modified-Since",m.lastModified[e]),m.etag[e]&&v.setRequestHeader("If-None-Match",m.etag[e])),(k.data&&k.hasContent&&k.contentType!==!1||b.contentType)&&v.setRequestHeader("Content-Type",k.contentType),v.setRequestHeader("Accept",k.dataTypes[0]&&k.accepts[k.dataTypes[0]]?k.accepts[k.dataTypes[0]]+("*"!==k.dataTypes[0]?", "+Jc+"; q=0.01":""):k.accepts["*"]);for(d in k.headers)v.setRequestHeader(d,k.headers[d]);if(k.beforeSend&&(k.beforeSend.call(l,v,k)===!1||2===t))return v.abort();u="abort";for(d in{success:1,error:1,complete:1})v[d](k[d]);if(i=Mc(Ic,k,b,v)){v.readyState=1,h&&n.trigger("ajaxSend",[v,k]),k.async&&k.timeout>0&&(g=setTimeout(function(){v.abort("timeout")},k.timeout));try{t=1,i.send(r,x)}catch(w){if(!(2>t))throw w;x(-1,w)}}else x(-1,"No Transport");function x(a,b,c,d){var j,r,s,u,w,x=b;2!==t&&(t=2,g&&clearTimeout(g),i=void 0,f=d||"",v.readyState=a>0?4:0,j=a>=200&&300>a||304===a,c&&(u=Oc(k,v,c)),u=Pc(k,u,v,j),j?(k.ifModified&&(w=v.getResponseHeader("Last-Modified"),w&&(m.lastModified[e]=w),w=v.getResponseHeader("etag"),w&&(m.etag[e]=w)),204===a||"HEAD"===k.type?x="nocontent":304===a?x="notmodified":(x=u.state,r=u.data,s=u.error,j=!s)):(s=x,(a||!x)&&(x="error",0>a&&(a=0))),v.status=a,v.statusText=(b||x)+"",j?o.resolveWith(l,[r,x,v]):o.rejectWith(l,[v,x,s]),v.statusCode(q),q=void 0,h&&n.trigger(j?"ajaxSuccess":"ajaxError",[v,k,j?r:s]),p.fireWith(l,[v,x]),h&&(n.trigger("ajaxComplete",[v,k]),--m.active||m.event.trigger("ajaxStop")))}return v},getJSON:function(a,b,c){return m.get(a,b,c,"json")},getScript:function(a,b){return m.get(a,void 0,b,"script")}}),m.each(["get","post"],function(a,b){m[b]=function(a,c,d,e){return m.isFunction(c)&&(e=e||d,d=c,c=void 0),m.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),m._evalUrl=function(a){return m.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},m.fn.extend({wrapAll:function(a){if(m.isFunction(a))return this.each(function(b){m(this).wrapAll(a.call(this,b))});if(this[0]){var b=m(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&1===a.firstChild.nodeType)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return this.each(m.isFunction(a)?function(b){m(this).wrapInner(a.call(this,b))}:function(){var b=m(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=m.isFunction(a);return this.each(function(c){m(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){m.nodeName(this,"body")||m(this).replaceWith(this.childNodes)}).end()}}),m.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0||!k.reliableHiddenOffsets()&&"none"===(a.style&&a.style.display||m.css(a,"display"))},m.expr.filters.visible=function(a){return!m.expr.filters.hidden(a)};var Qc=/%20/g,Rc=/\[\]$/,Sc=/\r?\n/g,Tc=/^(?:submit|button|image|reset|file)$/i,Uc=/^(?:input|select|textarea|keygen)/i;function Vc(a,b,c,d){var e;if(m.isArray(b))m.each(b,function(b,e){c||Rc.test(a)?d(a,e):Vc(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==m.type(b))d(a,b);else for(e in b)Vc(a+"["+e+"]",b[e],c,d)}m.param=function(a,b){var c,d=[],e=function(a,b){b=m.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=m.ajaxSettings&&m.ajaxSettings.traditional),m.isArray(a)||a.jquery&&!m.isPlainObject(a))m.each(a,function(){e(this.name,this.value)});else for(c in a)Vc(c,a[c],b,e);return d.join("&").replace(Qc,"+")},m.fn.extend({serialize:function(){return m.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=m.prop(this,"elements");return a?m.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!m(this).is(":disabled")&&Uc.test(this.nodeName)&&!Tc.test(a)&&(this.checked||!W.test(a))}).map(function(a,b){var c=m(this).val();return null==c?null:m.isArray(c)?m.map(c,function(a){return{name:b.name,value:a.replace(Sc,"\r\n")}}):{name:b.name,value:c.replace(Sc,"\r\n")}}).get()}}),m.ajaxSettings.xhr=void 0!==a.ActiveXObject?function(){return!this.isLocal&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&Zc()||$c()}:Zc;var Wc=0,Xc={},Yc=m.ajaxSettings.xhr();a.attachEvent&&a.attachEvent("onunload",function(){for(var a in Xc)Xc[a](void 0,!0)}),k.cors=!!Yc&&"withCredentials"in Yc,Yc=k.ajax=!!Yc,Yc&&m.ajaxTransport(function(a){if(!a.crossDomain||k.cors){var b;return{send:function(c,d){var e,f=a.xhr(),g=++Wc;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(e in a.xhrFields)f[e]=a.xhrFields[e];a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");for(e in c)void 0!==c[e]&&f.setRequestHeader(e,c[e]+"");f.send(a.hasContent&&a.data||null),b=function(c,e){var h,i,j;if(b&&(e||4===f.readyState))if(delete Xc[g],b=void 0,f.onreadystatechange=m.noop,e)4!==f.readyState&&f.abort();else{j={},h=f.status,"string"==typeof f.responseText&&(j.text=f.responseText);try{i=f.statusText}catch(k){i=""}h||!a.isLocal||a.crossDomain?1223===h&&(h=204):h=j.text?200:404}j&&d(h,i,j,f.getAllResponseHeaders())},a.async?4===f.readyState?setTimeout(b):f.onreadystatechange=Xc[g]=b:b()},abort:function(){b&&b(void 0,!0)}}}});function Zc(){try{return new a.XMLHttpRequest}catch(b){}}function $c(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}m.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return m.globalEval(a),a}}}),m.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),m.ajaxTransport("script",function(a){if(a.crossDomain){var b,c=y.head||m("head")[0]||y.documentElement;return{send:function(d,e){b=y.createElement("script"),b.async=!0,a.scriptCharset&&(b.charset=a.scriptCharset),b.src=a.url,b.onload=b.onreadystatechange=function(a,c){(c||!b.readyState||/loaded|complete/.test(b.readyState))&&(b.onload=b.onreadystatechange=null,b.parentNode&&b.parentNode.removeChild(b),b=null,c||e(200,"success"))},c.insertBefore(b,c.firstChild)},abort:function(){b&&b.onload(void 0,!0)}}}});var _c=[],ad=/(=)\?(?=&|$)|\?\?/;m.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=_c.pop()||m.expando+"_"+vc++;return this[a]=!0,a}}),m.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(ad.test(b.url)?"url":"string"==typeof b.data&&!(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&ad.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=m.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(ad,"$1"+e):b.jsonp!==!1&&(b.url+=(wc.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||m.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,_c.push(e)),g&&m.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),m.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||y;var d=u.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=m.buildFragment([a],b,e),e&&e.length&&m(e).remove(),m.merge([],d.childNodes))};var bd=m.fn.load;m.fn.load=function(a,b,c){if("string"!=typeof a&&bd)return bd.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>=0&&(d=m.trim(a.slice(h,a.length)),a=a.slice(0,h)),m.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(f="POST"),g.length>0&&m.ajax({url:a,type:f,dataType:"html",data:b}).done(function(a){e=arguments,g.html(d?m("<div>").append(m.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,e||[a.responseText,b,a])}),this},m.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){m.fn[b]=function(a){return this.on(b,a)}}),m.expr.filters.animated=function(a){return m.grep(m.timers,function(b){return a===b.elem}).length};var cd=a.document.documentElement;function dd(a){return m.isWindow(a)?a:9===a.nodeType?a.defaultView||a.parentWindow:!1}m.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=m.css(a,"position"),l=m(a),n={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=m.css(a,"top"),i=m.css(a,"left"),j=("absolute"===k||"fixed"===k)&&m.inArray("auto",[f,i])>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),m.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(n.top=b.top-h.top+g),null!=b.left&&(n.left=b.left-h.left+e),"using"in b?b.using.call(a,n):l.css(n)}},m.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){m.offset.setOffset(this,a,b)});var b,c,d={top:0,left:0},e=this[0],f=e&&e.ownerDocument;if(f)return b=f.documentElement,m.contains(b,e)?(typeof e.getBoundingClientRect!==K&&(d=e.getBoundingClientRect()),c=dd(f),{top:d.top+(c.pageYOffset||b.scrollTop)-(b.clientTop||0),left:d.left+(c.pageXOffset||b.scrollLeft)-(b.clientLeft||0)}):d},position:function(){if(this[0]){var a,b,c={top:0,left:0},d=this[0];return"fixed"===m.css(d,"position")?b=d.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),m.nodeName(a[0],"html")||(c=a.offset()),c.top+=m.css(a[0],"borderTopWidth",!0),c.left+=m.css(a[0],"borderLeftWidth",!0)),{top:b.top-c.top-m.css(d,"marginTop",!0),left:b.left-c.left-m.css(d,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||cd;while(a&&!m.nodeName(a,"html")&&"static"===m.css(a,"position"))a=a.offsetParent;return a||cd})}}),m.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c=/Y/.test(b);m.fn[a]=function(d){return V(this,function(a,d,e){var f=dd(a);return void 0===e?f?b in f?f[b]:f.document.documentElement[d]:a[d]:void(f?f.scrollTo(c?m(f).scrollLeft():e,c?e:m(f).scrollTop()):a[d]=e)},a,d,arguments.length,null)}}),m.each(["top","left"],function(a,b){m.cssHooks[b]=Lb(k.pixelPosition,function(a,c){return c?(c=Jb(a,b),Hb.test(c)?m(a).position()[b]+"px":c):void 0})}),m.each({Height:"height",Width:"width"},function(a,b){m.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){m.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return V(this,function(b,c,d){var e;return m.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?m.css(b,c,g):m.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),m.fn.size=function(){return this.length},m.fn.andSelf=m.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return m});var ed=a.jQuery,fd=a.$;return m.noConflict=function(b){return a.$===m&&(a.$=fd),b&&a.jQuery===m&&(a.jQuery=ed),m},typeof b===K&&(a.jQuery=a.$=m),m}); | ... | ... |
| 1 | +++ a/js/main.js | |
| ... | ... | @@ -0,0 +1,26 @@ |
| 1 | +// The template code | |
| 2 | +var templateSource = document.getElementById('proposal-template').innerHTML; | |
| 3 | + | |
| 4 | +// compile the template | |
| 5 | +var template = Handlebars.compile(templateSource); | |
| 6 | + | |
| 7 | +// The div/container that we are going to display the results in | |
| 8 | +var resultsPlaceholder = document.getElementById('proposal-result'); | |
| 9 | + | |
| 10 | + | |
| 11 | +$.ajax({ | |
| 12 | + dataType: "json", | |
| 13 | + url: 'http://localhost:3000/api/v1/articles?private_token=89419a2d331a17e815c3ecc53b303aac&content_type=ProposalsDiscussionPlugin::Topic&parent_id=377', | |
| 14 | + data: data, | |
| 15 | + success: success | |
| 16 | +}); | |
| 17 | + | |
| 18 | +var data = { | |
| 19 | + "proposal": | |
| 20 | + { | |
| 21 | + "title": "Handlebars", | |
| 22 | + "description": "Demo" | |
| 23 | + } | |
| 24 | +}; | |
| 25 | + | |
| 26 | +resultsPlaceholder.innerHTML = template(data); | ... | ... |