@function
@public

Plugin to generate URIs based on ID and parameters

@param {Object} server The server to be extended
@param {Object} pluginOptions The plugin options
504261
function akaya (server, pluginOptions) {
  server.decorate('server', 'aka', serverDecorator.bind(this, server))
  server.decorate('request', 'aka', function (id, params = {}, options = {}) {
    options = joi.attempt(options, internals.scheme.options)

    const path = server.aka(id, params)
    let protocol

    if (options.rel) {
      return path
    }

    switch (options.secure) {
      case true:
        protocol = 'https'
        break
      case false:
        protocol = 'http'
        break
      default:
        protocol = this.headers['x-forwarded-proto'] || server.info.protocol
    }

    return `${protocol}://${options.host || this.info.host}${path}`
  })
}
978453
function Plugin(element, options) {
    this.element = element;
    this.settings = $.extend({}, defaults, options);
    this.periodOptions = {
      title: this.settings.periodTitle,
      backgroundColor: this.settings.periodBackgroundColor,
      borderColor: this.settings.periodBorderColor,
      textColor: this.settings.periodTextColor
    };
    this.init();
  }
1124031
function sanitizeOptions(opts) {
	var content, text, ajax, once;

	if(invalidOpt(opts)) { return FALSE; }

	if(invalidOpt(opts.metadata)) {
		opts.metadata = { type: opts.metadata };
	}

	if('content' in opts) {
		content = opts.content;

		if(invalidOpt(content) || content.jquery || content.done) {
			text = invalidContent(content) ? FALSE : content;
			content = opts.content = {
				text: text
			};
		}
		else { text = content.text; }

		// DEPRECATED - Old content.ajax plugin functionality
		// Converts it into the proper Deferred syntax
		if('ajax' in content) {
			ajax = content.ajax;
			once = ajax && ajax.once !== FALSE;
			delete content.ajax;

			content.text = function(event, api) {
				var loading = text || $(this).attr(api.options.content.attr) || 'Loading...',

				deferred = $.ajax(
					$.extend({}, ajax, { context: api })
				)
				.then(ajax.success, NULL, ajax.error)
				.then(function(newContent) {
					if(newContent && once) { api.set('content.text', newContent); }
					return newContent;
				},
				function(xhr, status, error) {
					if(api.destroyed || xhr.status === 0) { return; }
					api.set('content.text', status + ': ' + error);
				});

				return !once ? (api.set('content.text', loading), deferred) : loading;
			};
		}

		if('title' in content) {
			if($.isPlainObject(content.title)) {
				content.button = content.title.button;
				content.title = content.title.text;
			}

			if(invalidContent(content.title || FALSE)) {
				content.title = FALSE;
			}
		}
	}

	if('position' in opts && invalidOpt(opts.position)) {
		opts.position = { my: opts.position, at: opts.position };
	}

	if('show' in opts && invalidOpt(opts.show)) {
		opts.show = opts.show.jquery ? { target: opts.show } :
			opts.show === TRUE ? { ready: TRUE } : { event: opts.show };
	}

	if('hide' in opts && invalidOpt(opts.hide)) {
		opts.hide = opts.hide.jquery ? { target: opts.hide } : { event: opts.hide };
	}

	if('style' in opts && invalidOpt(opts.style)) {
		opts.style = { classes: opts.style };
	}

	// Sanitize plugin options
	$.each(PLUGINS, function() {
		this.sanitize && this.sanitize(opts);
	});

	return opts;
}
1303726
function(url, protocols, options) {
    var that = this;
    that._options = {devel: false, debug: false, chunking: undefined};
    if (options) {
        utils.objectExtend(that._options, options);
    }
    that._base_url = utils.amendUrl(url);
    that._server = that._options.server || utils.random_number_string(1000);
    that._connid = utils.random_string(8);
    that._trans_url = that._base_url + '/' + that._server + '/' + that._connid;
    that._protocols = ['websocket',
                       'xhr-streaming',
                       'iframe-eventsource',
                       'iframe-htmlfile',
                       'xhr-polling',
                       'iframe-xhr-polling',
                       'jsonp-polling'];
    switch(typeof protocols) {
    case 'undefined': break;
    case 'string': that._protocols = [protocols]; break;
    default: that._protocols = protocols; break;
    }
    that.protocol = null;
    that.readyState = SockJS.CONNECTING;
    that._didClose();
}
988199
function (type, args, htmlpath, projectRoot, pageName) {
    var plugin = plugins.use(args);
    if (plugin[type] !== undefined) {
        return plugin[type](args[0], htmlpath, projectRoot, pageName, concatServerBaseUrl, projectPublishRoot);
    } else {
        return args[0];
    }
}
756258
function run(server, query) {
			if(server.options && typeof server.options.plugins === 'object') {
				return server.options.plugins;
			}
			return null;
		}
598017
function withOptions(scope, defaultOptions) {
  return function(plugin, options) {
    return scope.use(this, scope, plugin, scope.combine(defaultOptions, options))
  }
}
1075223
function augmentServer(server, opts) {
  server.templateReader = opts.templateReader || templateReader;
  server.documentRoot = opts.documentRoot || p.join(process.cwd(), 'web');
  server.saveRequestChunks = !!opts.saveRequestChunks;
  server.template = template;
  server.stack = [];
  server.stackInsertion = 0;
  defaultRoute.forEach(function(mkfn) { server.handle(mkfn(server)); });
  server.stackInsertion = 0;
  server.on('request', function(req, res) { listener(server, req, res) });
}
365651
function(options) {
    if (config.sourcemaps) {
        options = _.defaults(
            options,
            { devtool: '#source-map' }
        );
    }

    if (config.production) {
        var currPlugins = _.isArray(options.plugins) ? options.plugins : [];
        options.plugins = currPlugins.concat([new UglifyJsPlugin({ sourceMap: false })]);
    }

    return options;
}
1261051
function Plugin( element, options, speed ) {
    this.element = element;
    this.options = $.extend( {}, defaults, options);
    this._defaults = defaults;
    this._name = plugin_name;
    this._speed = speed;
    this._load = this.options.load
    this.init();
  }
289744
function Plugin(element, options, jsonData) {
        // same the DOM element.
        this.element = element;
        this.jsonData = jsonData;
        // merge the options.
        // the jQuery extend function, the later object will
        // overwrite the former object.
        this.options = $.extend({}, defaultOptions, options);
        // set the plugin name.
        this._name = pluginName;
        // call the initialize function.
        this.init();
    }
634898
function createOptions( options ) {
	var object = optionsCache[ options ] = {};
	jQuery.each( options.split( core_rspace ), function( _, flag ) {
		object[ flag ] = true;
	});
	return object;
}
680208
function SockJS(url, protocols, options) {
  if (!(this instanceof SockJS)) {
    return new SockJS(url, protocols, options);
  }
  if (arguments.length < 1) {
    throw new TypeError("Failed to construct 'SockJS: 1 argument required, but only 0 present");
  }
  EventTarget.call(this);

  this.readyState = SockJS.CONNECTING;
  this.extensions = '';
  this.protocol = '';

  // non-standard extension
  options = options || {};
  if (options.protocols_whitelist) {
    log.warn("'protocols_whitelist' is DEPRECATED. Use 'transports' instead.");
  }
  this._transportsWhitelist = options.transports;
  this._transportOptions = options.transportOptions || {};

  var sessionId = options.sessionId || 8;
  if (typeof sessionId === 'function') {
    this._generateSessionId = sessionId;
  } else if (typeof sessionId === 'number') {
    this._generateSessionId = function() {
      return random.string(sessionId);
    };
  } else {
    throw new TypeError('If sessionId is used in the options, it needs to be a number or a function.');
  }

  this._server = options.server || random.numberString(1000);

  // Step 1 of WS spec - parse and validate the url. Issue #8
  var parsedUrl = new URL(url);
  if (!parsedUrl.host || !parsedUrl.protocol) {
    throw new SyntaxError("The URL '" + url + "' is invalid");
  } else if (parsedUrl.hash) {
    throw new SyntaxError('The URL must not contain a fragment');
  } else if (parsedUrl.protocol !== 'http:' && parsedUrl.protocol !== 'https:') {
    throw new SyntaxError("The URL's scheme must be either 'http:' or 'https:'. '" + parsedUrl.protocol + "' is not allowed.");
  }

  var secure = parsedUrl.protocol === 'https:';
  // Step 2 - don't allow secure origin with an insecure protocol
  if (loc.protocol === 'https:' && !secure) {
    throw new Error('SecurityError: An insecure SockJS connection may not be initiated from a page loaded over HTTPS');
  }

  // Step 3 - check port access - no need here
  // Step 4 - parse protocols argument
  if (!protocols) {
    protocols = [];
  } else if (!Array.isArray(protocols)) {
    protocols = [protocols];
  }

  // Step 5 - check protocols argument
  var sortedProtocols = protocols.sort();
  sortedProtocols.forEach(function(proto, i) {
    if (!proto) {
      throw new SyntaxError("The protocols entry '" + proto + "' is invalid.");
    }
    if (i < (sortedProtocols.length - 1) && proto === sortedProtocols[i + 1]) {
      throw new SyntaxError("The protocols entry '" + proto + "' is duplicated.");
    }
  });

  // Step 6 - convert origin
  var o = urlUtils.getOrigin(loc.href);
  this._origin = o ? o.toLowerCase() : null;

  // remove the trailing slash
  parsedUrl.set('pathname', parsedUrl.pathname.replace(/\/+$/, ''));

  // store the sanitized url
  this.url = parsedUrl.href;

  // Step 7 - start connection in background
  // obtain server info
  // http://sockjs.github.io/sockjs-protocol/sockjs-protocol-0.3.3.html#section-26
  this._urlInfo = {
    nullOrigin: !browser.hasDomain()
  , sameOrigin: urlUtils.isOriginEqual(this.url, loc.href)
  , sameScheme: urlUtils.isSchemeEqual(this.url, loc.href)
  };

  this._ir = new InfoReceiver(this.url, this._urlInfo);
  this._ir.once('finish', this._receiveInfo.bind(this));
}
562825
function Plugin(server) {
    this.server = server;
    this.config = server.config;
    //Check if we have the right config
    this.checkConfiguration();
    this.settings = this.config.githubAuth;
    //Init if not present
    if (typeof this.server.passport === "undefined")
        this.initGithubAuth();
    else
        this.passport = this.server.passport;
}
1352034
function usePlugins(core) {
  var installedPlugins = [];
  
  /**
   * @desc Register iro.js plugin
   * @param {Function} plugin = plugin constructor
   * @param {Object} pluginOptions = plugin options passed to constructor
   */
  core.use = function(plugin, pluginOptions) {
    if ( pluginOptions === void 0 ) pluginOptions = {};

    // Check that the plugin hasn't already been registered
    if (!(installedPlugins.indexOf(plugin) > -1)) {
      // Init plugin
      // TODO: consider collection of plugin utils, which are passed as a thrid param
      plugin(core, pluginOptions);
      // Register plugin
      installedPlugins.push(plugin);
    }
  };

  core.installedPlugins = installedPlugins;

  return core;
}
86276
function (pluginOptions) {
    // If user options are undefined, set an empty options object
    if (!pluginOptions) {
        pluginOptions = {};
    }
    // Save off pluginOptions so we can get it in `report()`
    tslintPlugin.pluginOptions = pluginOptions;
    // TSLint default options
    var options = {
        fix: pluginOptions.fix || false,
        formatter: pluginOptions.formatter || "prose",
        formattersDirectory: pluginOptions.formattersDirectory || null,
        rulesDirectory: pluginOptions.rulesDirectory || null
    };
    var linter = getTslint(pluginOptions);
    var tslint = new linter.Linter(options, pluginOptions.program);
    return map(function (file, cb) {
        // Skip
        if (file.isNull()) {
            return cb(null, file);
        }
        // Stream is not supported
        if (file.isStream()) {
            return cb(new PluginError("gulp-tslint", "Streaming not supported"));
        }
        var configuration = (pluginOptions.configuration === null ||
            pluginOptions.configuration === undefined ||
            isString(pluginOptions.configuration))
            // Configuration can be a file path or null, if it's unknown
            ? linter.Configuration.findConfiguration(pluginOptions.configuration || null, file.path).results
            : pluginOptions.configuration;
        tslint.lint(file.path, file.contents.toString("utf8"), configuration);
        file.tslint = tslint.getResult();
        // Clear all results for current file from tslint
        tslint.failures = [];
        tslint.fixes = [];
        // Pass file
        cb(null, file);
    });
}
504884
function Plugin(regexp, replacer, id) {
    // return value should be a callable function
    // with strictly defined options passed by markdown-it
    var self = function(md, options) {
        self.options = options;
        self.init(md);
    };

    // initialize plugin object
    self.__proto__ = Plugin.prototype;

    // clone regexp with all the flags
    var flags = (regexp.global ? 'g' : '') + (regexp.multiline ? 'm' : '') + (regexp.ignoreCase ? 'i' : '');

    self.regexp = RegExp('^' + regexp.source, flags);

    // copy init options
    self.replacer = replacer;

    // this plugin can be inserted multiple times,
    // so we're generating unique name for it
    self.id = id ? id : 'regexp-' + counter;
    counter++;

    return self;
}