eslint-disable-next-line
195634
function text(text) {
  if (typeof text === 'undefined') {
    if (this[0]) {
      return this[0].textContent.trim();
    }
    return null;
  }

  for (let i = 0; i < this.length; i += 1) {
    this[i].textContent = text;
  }
  return this;
}
13451
function onEnter(
    event: *,
    change: Change,
    editor: *,
    opts: Options
): void | any {
    // Pressing Shift+Enter
    // should split block normally
    if (event.shiftKey) {
        return undefined;
    }

    const { value } = change;
    const currentItem = getCurrentItem(opts, value);

    // Not in a list
    if (!currentItem) {
        return undefined;
    }

    event.preventDefault();

    // If expanded, delete first.
    if (value.isExpanded) {
        change.delete();
    }

    if (currentItem.isEmpty) {
        // Block is empty, we exit the list
        if (getItemDepth(opts, value) > 1) {
            return decreaseItemDepth(opts, change);
        }
        // Exit list
        return unwrapList(opts, change);
    }
    // Split list item
    return splitListItem(opts, change);
}
1035221
function lintJS(src, dest) {
  dest = dest || config.src.jsPath;

  return gulp.src(src)
    .pipe(eslint({
      fix: true
    }))
    .pipe(eslint.format())
    .pipe(isFixed(dest));
}
1151232
function lintCSS (args = []) {
  if (!Array.isArray(args)) {
    throw new TypeError('arguments has to be an array')
  }

  const command = [
    `node ${resolveBin('stylelint')}`,
    '"src/**/*.?(s)css"',
    '--syntax scss',
    `--custom-formatter ${require.resolve('stylelint-codeframe-formatter')}`,
    ...args
  ].join(' ')

  console.log(chalk`\nCommand:\n{green ${command}}\n`)

  try {
    execSync(command, { stdio: 'inherit' })
  } catch (error) {
    return false
  }

  return true
}
299260
function func_expr_eval(arg_scope={}, arg_expr_tree={ type:undefined}, arg_errors=[], arg_name_str )
{
	const context = 'func_expr_eval:'

	// console.log('func_expr_eval:scope=', arg_scope)
	// console.log('func_expr_eval:arg_expr_tree=', arg_expr_tree)
	// console.log('func_expr_eval:arg_errors=', arg_errors)

	switch(arg_expr_tree.type) {
		case 'Literal':             return arg_expr_tree.value
		case 'Identifier': {
			if (arg_expr_tree.name.length > 0 && arg_expr_tree.name[0] != '_') {
				return arg_expr_tree.name
			}
			arg_errors.push('Identifier:bad value [' + arg_expr_tree.name + ']')
			return undefined
		}
		case 'BinaryExpression':{
			try{
				const op = arg_expr_tree.operator
				const left_tree   = arg_expr_tree.left
				const right_tree  = arg_expr_tree.right
				const left_value  = func_expr_eval(arg_scope, left_tree, arg_errors, arg_name_str)
				const right_value = func_expr_eval(arg_scope, right_tree, arg_errors, arg_name_str)
				switch(op){
					case '+': return left_value + right_value
					case '-': return left_value - right_value
					case '*': return left_value * right_value
					case '/': return left_value / right_value
				}
			} catch(e){
				arg_errors.push('BinaryExpression:failure [' + e + '] for op=' + op + ' left=[' + left_value + '] right=[' + right_value + ']')
				return undefined
			}
		}
		case 'UnaryExpression':{
			try{
				const op = arg_expr_tree.operator
				const left_tree   = arg_expr_tree.argument
				const left_value  = func_expr_eval(arg_scope, left_tree, arg_errors, arg_name_str)
				switch(op){
					case '+': return left_value
					case '-': return - left_value
					case '!': return ! left_value
				}
			} catch(e){
				arg_errors.push('UnaryExpression:failure [' + e + '] for op=' + op + ' left=[' + left_value + ']')
				return undefined
			}
		}
		case 'MemberExpression': {
			const obj_name = func_expr_eval(arg_scope, arg_expr_tree.object,   arg_errors, arg_name_str)
			const att_name = func_expr_eval(arg_scope, arg_expr_tree.property, arg_errors, arg_name_str)
			if (! obj_name || ! att_name)
			{
				arg_errors.push('MemberExpression:bad object/attribute name')
				return undefined
			}
			const obj = arg_scope[obj_name]
			if (! obj)
			{
				arg_errors.push('MemberExpression:object not found in scope or bad object:[' + obj_name + ']')
				return undefined
			}
			if (att_name.length > 0 && att_name[0] == '_')
			{
				arg_errors.push('MemberExpression:object method is private:[' + obj_name + '].[' + att_name + ']')
				return undefined
			}
			if (! (att_name in obj) )
			{
				arg_errors.push('MemberExpression:attribute not found')
				return undefined
			}
			return obj[att_name]
		}
		case 'CallExpression':{
			const callee = arg_expr_tree.callee
			const opds = arg_expr_tree.arguments
			// console.log('func_expr_eval:CallExpression:opds=', opds)

			// EVAL OPERANDS
			const opds_results = []
			if (arg_name_str)
			{
				opds_results.push('##NAME##' + arg_name_str)
			}
			if (opds && opds.length > 0)
			{
				opds.forEach(
					(opd, index)=>{
						// console.log('func_expr_eval:CallExpression:opd=', opd)
						const opd_result = func_expr_eval(arg_scope, opd, arg_errors, arg_name_str)
						// console.log('func_expr_eval:CallExpression:opd_result=', opd_result)
						opds_results.push(opd_result)
					}
				)
			}
			// console.log(context + 'CallExpression:opds_results=', opds_results)

			// EVAL FUNCTION
			if (callee.type == 'Identifier')
			{
				const func_name = callee.name
				const func_call = arg_scope[func_name]
				if (! func_call)
				{
					arg_errors.push('CallExpression:function not found in scope or bad function:[' + func_name + ']')
					return undefined
				}

				if (opds_results.length == 0)
				{
					// console.log(context + 'CallExpression:func_call=', func_call)
					return func_call(null)
				}
				
				// console.log(context + 'CallExpression:func_call=', func_call, opds_results)
				return func_call.call(null, ...opds_results)
			}

			// EVAL METHOD
			if (callee.type == 'MemberExpression')
			{
				const object_name = callee.object.name
				const method_name = callee.property.name

				if (method_name.length > 0 && method_name[0] == '_')
				{
					arg_errors.push('CallExpression:object method is private:[' + object_name + '].[' + method_name + ']')
					return undefined
				}
				const object_instance = arg_scope[object_name]
				if (! object_instance || ! object_instance.get_method)
				{
					arg_errors.push('CallExpression:method object not found in scope or bad object:[' + object_name + ']')
					return undefined
				}

				const object_method = object_instance.get_method(method_name)
				if (! object_method)
				{
					arg_errors.push('CallExpression:method not found in object or bad method:[' + object_name + '].[' + method_name + ']')
					return undefined
				}

				if (opds_results.length == 0)
				{
					return object_method.apply(object_instance)
				}
				
				const call_result = object_method.apply(object_instance, opds_results)
				if (call_result.error)
				{
					return call_result.errors
				}
				return call_result.value
			}
		}
		case 'ArrayExpression':{
			const items_expressions = arg_expr_tree.elements
			const items = []
			items_expressions.forEach(
				(item_expr)=>{
					items.push( func_expr_eval(arg_scope, item_expr, arg_errors, arg_name_str) )
				}
			)
			return items
		}
		default:{
			console.log('func_expr_eval:scope=', arg_scope)
			console.log('func_expr_eval:arg_expr_tree=', arg_expr_tree)
			console.log('func_expr_eval:arg_errors=', arg_errors)
			console.log('func_expr_eval:arg_name_str=', arg_name_str)
		}
	}

	return undefined
}
922784
function occupySlice(
  targetArr: Array<?string>,
  start: number,
  end: number,
  componentKey: string
): void {
  // eslint-disable-next-line no-plusplus
  for (let ii = start; ii < end; ii++) {
    // eslint-disable-next-line no-param-reassign
    targetArr[ii] = componentKey;
  }
}
1151154
function __() {
    var us = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
    var store = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;

    store = typeof us === "boolean" ? us : store;
    us = typeof us === "boolean" ? [] : us;

    var seq = []; //seq is vanilla JS array + features
    seq.id = getID();
    seq.store = store;
    seq.us = us;
    seq.ds = [];
    seq.updatedTo = {};
    seq.us.map(function (u) {
      //  seq is a member of u.ds
      u.ds[u.ds.length] = seq;
      u.updatedTo[seq.id] = 0; // non-interference dependency
    });
    seq.IndexOnTimestamp = {};
    seq.TimestampOnIndex = {};
    seq.propagating = 0;
    seq.done = 0;
    seq.eqs = [];
    seq.addEq = function (eq) {
      return seq.eqs[seq.eqs.length] = eq;
    };
    seq.evalEqs = function (val) {
      var val0 = val;
      seq.eqs.map(function (eq) {
        return val = eq(val);
      });
      return seq.us.length === 0 ? val0 : val;
    };
    //api-----------------
    Object.keys(__.api).map(function (api) {
      seq[api] = __.api[api](__, seq, store);
    });
    //-----------------
    Object.defineProperties(seq, //detect t update on each seqs
    {
      t: {
        //foo.t
        get: function get() {
          return seq.valOnT;
        },
        set: function set(tval) {
          var sanityCheck = seq.propagating === 0 && seq.us.length !== 0 ? function () {
            throw new Error("Do not set a value of the sequence that depends on other sequences!");
          }() : function () {
            seq.propagating = 0;
            var core = seq.done === 0 ? function () {
              seq.valOnT = seq.evalEqs(tval); //self eqs eval
              seq.T = Date.now();
              var core1 = store ? function () {
                seq.IndexOnTimestamp[seq.T] = seq.length;
                seq.TimestampOnIndex[seq.length] = seq.T;
                seq[seq.length] = seq.valOnT; //after funcs
              }() : true;
              Object.keys(seq.updatedTo).map(function (key) {
                seq.updatedTo[key] = 1;
              });
              //clear updated us in non-interference way
              seq.us.map(function (u) {
                return u.updatedTo[seq.id] = 0;
              });
              seq.ds.map(function (d) {
                var usAllUpdated = d.us.map(function (u) {
                  return u.updatedTo[d.id];
                }).reduce(function (a, b) {
                  return a * b;
                });
                var core2 = usAllUpdated === 1 ? function () {
                  d.propagating = 1;
                  d.t = d.us.map(function (u) {
                    return u.t;
                  });
                }() : true;
              });
            }() : true;
          }();
        }
      }
    });
    return seq;
  }
497079
function (aNode, sourceBuffer, owner) {

        // output main if
        var ifDirective = aNode.directives['if']; // eslint-disable-line dot-notation
        sourceBuffer.addRaw('if (' + compileExprSource.expr(ifDirective.value) + ') {');
        sourceBuffer.addRaw(
            aNodeCompiler.compile(
                aNode.ifRinsed,
                sourceBuffer,
                owner
            )
        );
        sourceBuffer.addRaw('}');

        // output elif and else
        each(aNode.elses, function (elseANode) {
            var elifDirective = elseANode.directives.elif;
            if (elifDirective) {
                sourceBuffer.addRaw('else if (' + compileExprSource.expr(elifDirective.value) + ') {');
            }
            else {
                sourceBuffer.addRaw('else {');
            }

            sourceBuffer.addRaw(
                aNodeCompiler.compile(
                    elseANode,
                    sourceBuffer,
                    owner
                )
            );
            sourceBuffer.addRaw('}');
        });
    }
150758
function replace_handler(rule, values) {
  return function (_, n, name) {
    return name ? values[rule.map[name].index + 1] : values[n];
  };
}
905894
async function compile(exitOnError = true) {
  config = config || (await asyncConfig());
  const startMessage = chalk.blue('Compiling Static Site...');
  const startTime = timer.start();
  let spinner;
  if (config.verbosity > 2) {
    console.log(startMessage);
  } else {
    spinner = ora(startMessage).start();
  }

  const pages = await getPages(config.srcDir);

  const renderPages = pages.map(async page => {
    const site = await getSiteData(pages);

    const layout = page.meta.layout ? page.meta.layout : 'default';
    const { ok, html, message } = await render(`@bolt/${layout}.twig`, {
      page,
      site,
    });

    if (!ok) {
      if (exitOnError) {
        log.errorAndExit(message);
      } else {
        log.error(message);
      }
    }

    const htmlFilePath = path.join(config.wwwDir, page.url);
    await mkdirp(path.dirname(htmlFilePath));
    await writeFile(htmlFilePath, html);
    if (config.verbosity > 3) {
      log.dim(`Wrote: ${htmlFilePath}`);
    }

    return true;
  });

  Promise.all(renderPages)
    .then(() => {
      const endMessage = chalk.green(
        `Compiled Static Site in ${timer.end(startTime)}`,
      );
      if (config.verbosity > 2) {
        console.log(endMessage);
      } else {
        spinner.succeed(endMessage);
      }
    })
    .catch(error => {
      console.log(error);
      const endMessage = chalk.red(
        `Compiling Static Site failed in ${timer.end(startTime)}`,
      );
      spinner.fail(endMessage);
    });
}
717462
function lint (options) {
  if (!options.language) {
    throw new Error('options.language missing')
  }

  if (!Array.isArray(options.arguments)) {
    throw new TypeError('options.arguments has to be an array')
  }

  process.env.NODE_ENV = 'development'

  if (options.language === 'css') {
    process.env.PANGOLIN_ENV = 'lint:css'

    lintCSS(options.arguments)
      ? process.exit(0)
      : process.exit(1)
  }

  if (options.language === 'js') {
    process.env.PANGOLIN_ENV = 'lint:js'

    lintJS(options.arguments)
      ? process.exit(0)
      : process.exit(1)
  }
}
248945
function (src, callback, context) {
    /*eslint max-statements: [2, 32]*/
    var setup;

    if (callback && typeof callback !== "function") {
      context = callback.context || context;
      setup = callback.setup;
      callback = callback.callback;
    }

    var script = document.createElement("script");
    var done = false;
    var err;
    var _cleanup; // _must_ be set below.

    /**
     * Final handler for error or completion.
     *
     * **Note**: Will only be called _once_.
     *
     * @returns {void}
     */
    var _finish = function () {
      // Only call once.
      if (done) { return; }
      done = true;

      // Internal cleanup.
      _cleanup();

      // Callback.
      if (callback) {
        callback.call(context, err);
      }
    };

    /**
     * Error handler
     *
     * @returns {void}
     */
    var _error = function () {
      err = new Error(src || "EMPTY");
      _finish();
    };

    if (script.readyState && !("async" in script)) {
      /*eslint-disable consistent-return*/

      // This section is only for IE<10. Some other old browsers may
      // satisfy the above condition and enter this branch, but we don't
      // support those browsers anyway.

      var id = scriptCounter++;
      var isReady = { loaded: true, complete: true };
      var inserted = false;

      // Clear out listeners, state.
      _cleanup = function () {
        script.onreadystatechange = script.onerror = null;
        pendingScripts[id] = void 0;
      };

      // Attach the handler before setting src, otherwise we might
      // miss events (consider that IE could fire them synchronously
      // upon setting src, for example).
      script.onreadystatechange = function () {
        var firstState = script.readyState;

        // Protect against any errors from state change randomness.
        if (err) { return; }

        if (!inserted && isReady[firstState]) {
          inserted = true;

          // Append to DOM.
          _addScript(script);
        }

        // --------------------------------------------------------------------
        //                       GLORIOUS IE8 HACKAGE!!!
        // --------------------------------------------------------------------
        //
        // Oh IE8, how you disappoint. IE8 won't call `script.onerror`, so
        // we have to resort to drastic measures.
        // See, e.g. http://www.quirksmode.org/dom/events/error.html#t02
        //
        // As with all things development, there's a Stack Overflow comment that
        // asserts the following combinations of state changes in IE8 indicate a
        // script load error. And crazily, it seems to work!
        //
        // http://stackoverflow.com/a/18840568/741892
        //
        // The `script.readyState` transitions we're interested are:
        //
        // * If state starts as `loaded`
        // * Call `script.children`, which _should_ change state to `complete`
        // * If state is now `loading`, then **we have a load error**
        //
        // For the reader's amusement, here is HeadJS's catalog of various
        // `readyState` transitions in normal operation for IE:
        // https://github.com/headjs/headjs/blob/master/src/2.0.0/load.js#L379-L419
        if (firstState === "loaded") {
          // The act of accessing the property should change the script's
          // `readyState`.
          //
          // And, oh yeah, this hack is so hacky-ish we need the following
          // eslint disable...
          /*eslint-disable no-unused-expressions*/
          script.children;
          /*eslint-enable no-unused-expressions*/

          if (script.readyState === "loading") {
            // State transitions indicate we've hit the load error.
            //
            // **Note**: We are not intending to _return_ a value, just have
            // a shorter short-circuit code path here.
            return _error();
          }
        }

        // It's possible for readyState to be "complete" immediately
        // after we insert (and execute) the script in the branch
        // above. So check readyState again here and react without
        // waiting for another onreadystatechange.
        if (script.readyState === "complete") {
          _finish();
        }
      };

      // Onerror handler _may_ work here.
      script.onerror = _error;

      // Since we're not appending the script to the DOM yet, the
      // reference to our script element might get garbage collected
      // when this function ends, without onreadystatechange ever being
      // fired. This has been witnessed to happen. Adding it to
      // `pendingScripts` ensures this can't happen.
      pendingScripts[id] = script;

      // call the setup callback to mutate the script tag
      if (setup) {
        setup.call(context, script);
      }

      // This triggers a request for the script, but its contents won't
      // be executed until we append it to the DOM.
      script.src = src;

      // In some cases, the readyState is already "loaded" immediately
      // after setting src. It's a lie! Don't append to the DOM until
      // the onreadystatechange event says so.

    } else {
      // This section is for modern browsers, including IE10+.

      // Clear out listeners.
      _cleanup = function () {
        script.onload = script.onerror = null;
      };

      script.onerror = _error;
      script.onload = _finish;
      script.async = true;
      script.charset = "utf-8";

      // call the setup callback to mutate the script tag
      if (setup) {
        setup.call(context, script);
      }

      script.src = src;

      // Append to DOM.
      _addScript(script);
    }
  }
681062
function() {
    if ( !this.element ) { // eslint-disable-line no-negated-condition, inline-comments, max-len
      var attrs = assign( {}, this.attributes );
      attrs.id = this.id || this.u_id;
      if ( this.className ) attrs['class'] = this.className;
      this.setElement( document.createElement( this.tagName ) );
      this.setElementAttributes( attrs );
    } else {
      this.setElement( this.element );
    }
    this.element.setAttribute( 'data-bound', true );
  }
1319169
function lint(files) {
  return gulp.src(files)
    .pipe($.plumber())
    .pipe($.eslint())
    .pipe($.eslint.format())
    .pipe($.eslint.failOnError())
    .pipe($.jscs())
    .pipe($.jscs.reporter())
    .pipe($.jscs.reporter('fail'))
    .on('error', onError);
}
724055
function(file, lint, isError, isWarning, errorLocation) {
        var lintId = (isError) ? colors.bgRed(colors.white(lint.id)) : colors.bgYellow(colors.white(lint.id));
        var message = '';
        if (errorLocation) {
            message = file.path + ':' + (errorLocation.line + 1) + ':' + (errorLocation.column + 1) + ' ' + lintId + ' ' + lint.message;
        } else {
            message = file.path + ': ' + lintId + ' ' + lint.message;
        }

        if (isError) {
            log.error(message);
        } else {
            log.warning(message);
        }
    }
373386
function substArguments(str, args, key) {
        var reArgs = /\{\{\s*(.+?)\s*\}\}/g;
        return str.replace(reArgs, function(matched_text, arg) {
            if (args && arg in args) {
                return args[arg];
            }
            if (arg in gL10nData) {
                return gL10nData[arg];
            }
            console.log("argument {{" + arg + "}} for #" + key + " is undefined.");
            return matched_text;
        });
    }
404824
function () {
  var args = Array.prototype.slice.call(arguments);
  console.error();
  console.error.apply(console, [" "].concat(args));
  console.error();
  process.exit(1); // eslint-disable-line no-process-exit
}