Partyflock instance constructor
@prototype
@class  Partyflock
770684
function Partyflock(consumerKey, consumerSecret, endpoint, debug) {
  this.endpoint = 'partyflock.nl';
  // Check instance arguments
  this.endpoint = (endpoint ? endpoint : this.endpoint);
  this.consumerKey = (consumerKey ? consumerKey : false);
  this.consumerSecret = (consumerSecret ? consumerSecret : false);
  this.debug = (typeof debug !== 'undefined' ? debug : false);
  // Check config options
  if(config.partyflock) {
    this.consumerKey = (this.consumerKey === false ? config.partyflock.consumerKey : false);
    this.consumerSecret = (this.consumerSecret === false ? config.partyflock.consumerSecret : false);
    this.endpoint = (this.endpoint !== config.partyflock.endpoint ? config.partyflock.endpoint : this.endpoint);
    this.debug = (this.debug === false && config.partyflock.debug !== 'undefined' ? config.partyflock.debug : this.debug);
  }
  // CI integration
  if(process.env['CONSUMER_KEY'] && process.env['CONSUMER_SECRET']) {
    this.consumerKey = process.env['CONSUMER_KEY'];
    this.consumerSecret = process.env['CONSUMER_SECRET'];  
  }
  this.type = 'json';


  this.date = new date(this);
  this.location = new location(this);
  this.artist = new artist(this);
  this.user = new user(this);
  this.party = new party(this);

  this.oauth = new OAuth.OAuth(
    'https://' + this.endpoint + '/request_token',
    '', // no need for an oauth_token request
    this.consumerKey,
    this.consumerSecret,
    '1.0A',
    null,
    'HMAC-SHA1'
  );
}
1188806
function() {

		// Create an object which inherits its parent as the prototype and constructs a new event chain.
		var _this = this;
		var utils = _this.utils;
		var error = utils.error;
		var promise = utils.Promise();

		// Get parameters
		var p = utils.args({network: 's', options: 'o', callback: 'f'}, arguments);

		// Local vars
		var url;

		// Get all the custom options and store to be appended to the querystring
		var qs = utils.diffKey(p.options, _this.settings);

		// Merge/override options with app defaults
		var opts = p.options = utils.merge(_this.settings, p.options || {});

		// Merge/override options with app defaults
		opts.popup = utils.merge(_this.settings.popup, p.options.popup || {});

		// Network
		p.network = p.network || _this.settings.default_service;

		// Bind callback to both reject and fulfill states
		promise.proxy.then(p.callback, p.callback);

		// Trigger an event on the global listener
		function emit(s, value) {
			hello.emit(s, value);
		}

		promise.proxy.then(emit.bind(this, 'auth.login auth'), emit.bind(this, 'auth.failed auth'));

		// Is our service valid?
		if (typeof (p.network) !== 'string' || !(p.network in _this.services)) {
			// Trigger the default login.
			// Ahh we dont have one.
			return promise.reject(error('invalid_network', 'The provided network was not recognized'));
		}

		var provider = _this.services[p.network];

		// Create a global listener to capture events triggered out of scope
		var callbackId = utils.globalEvent(function(obj) {

			// The responseHandler returns a string, lets save this locally
			if (obj) {
				if (typeof (obj) == 'string') {
					obj = JSON.parse(obj);
				}
			}
			else {
				obj = error('cancelled', 'The authentication was not completed');
			}

			// Handle these response using the local
			// Trigger on the parent
			if (!obj.error) {

				// Save on the parent window the new credentials
				// This fixes an IE10 bug i think... atleast it does for me.
				utils.store(obj.network, obj);

				// Fulfill a successful login
				promise.fulfill({
					network: obj.network,
					authResponse: obj
				});
			}
			else {
				// Reject a successful login
				promise.reject(obj);
			}
		});

		var redirectUri = utils.url(opts.redirect_uri).href;

		// May be a space-delimited list of multiple, complementary types
		var responseType = provider.oauth.response_type || opts.response_type;

		// Fallback to token if the module hasn't defined a grant url
		if (/\bcode\b/.test(responseType) && !provider.oauth.grant) {
			responseType = responseType.replace(/\bcode\b/, 'token');
		}

		// Query string parameters, we may pass our own arguments to form the querystring
		p.qs = utils.merge(qs, {
			client_id: encodeURIComponent(provider.id),
			response_type: encodeURIComponent(responseType),
			redirect_uri: encodeURIComponent(redirectUri),
			state: {
				client_id: provider.id,
				network: p.network,
				display: opts.display,
				callback: callbackId,
				state: opts.state,
				redirect_uri: redirectUri
			}
		});

		// Get current session for merging scopes, and for quick auth response
		var session = utils.store(p.network);

		// Scopes (authentication permisions)
		// Ensure this is a string - IE has a problem moving Arrays between windows
		// Append the setup scope
		var SCOPE_SPLIT = /[,\s]+/;

		// Include default scope settings (cloned).
		var scope = _this.settings.scope ? [_this.settings.scope.toString()] : [];

		// Extend the providers scope list with the default
		var scopeMap = utils.merge(_this.settings.scope_map, provider.scope || {});

		// Add user defined scopes...
		if (opts.scope) {
			scope.push(opts.scope.toString());
		}

		// Append scopes from a previous session.
		// This helps keep app credentials constant,
		// Avoiding having to keep tabs on what scopes are authorized
		if (session && 'scope' in session && session.scope instanceof String) {
			scope.push(session.scope);
		}

		// Join and Split again
		scope = scope.join(',').split(SCOPE_SPLIT);

		// Format remove duplicates and empty values
		scope = utils.unique(scope).filter(filterEmpty);

		// Save the the scopes to the state with the names that they were requested with.
		p.qs.state.scope = scope.join(',');

		// Map scopes to the providers naming convention
		scope = scope.map(function(item) {
			// Does this have a mapping?
			return (item in scopeMap) ? scopeMap[item] : item;
		});

		// Stringify and Arrayify so that double mapped scopes are given the chance to be formatted
		scope = scope.join(',').split(SCOPE_SPLIT);

		// Again...
		// Format remove duplicates and empty values
		scope = utils.unique(scope).filter(filterEmpty);

		// Join with the expected scope delimiter into a string
		p.qs.scope = scope.join(provider.scope_delim || ',');

		// Is the user already signed in with the appropriate scopes, valid access_token?
		if (opts.force === false) {

			if (session && 'access_token' in session && session.access_token && 'expires' in session && session.expires > ((new Date()).getTime() / 1e3)) {
				// What is different about the scopes in the session vs the scopes in the new login?
				var diff = utils.diff((session.scope || '').split(SCOPE_SPLIT), (p.qs.state.scope || '').split(SCOPE_SPLIT));
				if (diff.length === 0) {

					// OK trigger the callback
					promise.fulfill({
						unchanged: true,
						network: p.network,
						authResponse: session
					});

					// Nothing has changed
					return promise;
				}
			}
		}

		// Page URL
		if (opts.display === 'page' && opts.page_uri) {
			// Add a page location, place to endup after session has authenticated
			p.qs.state.page_uri = utils.url(opts.page_uri).href;
		}

		// Bespoke
		// Override login querystrings from auth_options
		if ('login' in provider && typeof (provider.login) === 'function') {
			// Format the paramaters according to the providers formatting function
			provider.login(p);
		}

		// Add OAuth to state
		// Where the service is going to take advantage of the oauth_proxy
		if (!/\btoken\b/.test(responseType) ||
		parseInt(provider.oauth.version, 10) < 2 ||
		(opts.display === 'none' && provider.oauth.grant && session && session.refresh_token)) {

			// Add the oauth endpoints
			p.qs.state.oauth = provider.oauth;

			// Add the proxy url
			p.qs.state.oauth_proxy = opts.oauth_proxy;

		}

		// Convert state to a string
		p.qs.state = encodeURIComponent(JSON.stringify(p.qs.state));

		// URL
		if (parseInt(provider.oauth.version, 10) === 1) {

			// Turn the request to the OAuth Proxy for 3-legged auth
			url = utils.qs(opts.oauth_proxy, p.qs, encodeFunction);
		}

		// Refresh token
		else if (opts.display === 'none' && provider.oauth.grant && session && session.refresh_token) {

			// Add the refresh_token to the request
			p.qs.refresh_token = session.refresh_token;

			// Define the request path
			url = utils.qs(opts.oauth_proxy, p.qs, encodeFunction);
		}
		else {
			url = utils.qs(provider.oauth.auth, p.qs, encodeFunction);
		}

		// Broadcast this event as an auth:init
		emit('auth.init', p);

		// Execute
		// Trigger how we want self displayed
		if (opts.display === 'none') {
			// Sign-in in the background, iframe
			utils.iframe(url, redirectUri);
		}

		// Triggering popup?
		else if (opts.display === 'popup') {

			var popup = utils.popup(url, redirectUri, opts.popup);

			var timer = setInterval(function() {
				if (!popup || popup.closed) {
					clearInterval(timer);
					if (!promise.state) {

						var response = error('cancelled', 'Login has been cancelled');

						if (!popup) {
							response = error('blocked', 'Popup was blocked');
						}

						response.network = p.network;

						promise.reject(response);
					}
				}
			}, 100);
		}

		else {
			window.location = url;
		}

		return promise.proxy;

		function encodeFunction(s) {return s;}

		function filterEmpty(s) {return !!s;}
	}
534038
function construct() {
      var args = Array.prototype.slice.call(arguments);
      function Fn() {
        return main.Type.apply(this, args);
      }
      Fn.prototype = main.Type.prototype;
      return new Fn();
    }
722319
function bindEventListeners(instanceData) {
		var eventDelegates = instanceData.eventDelegates,
			moduleBehaviors = getBehaviors(instanceData);

		// bind the module events
		createAndBindEventDelegate(eventDelegates, instanceData.element, instanceData.instance);

		// bind the behavior(s) events
		for (var i = 0; i < moduleBehaviors.length; i++) {
			createAndBindEventDelegate(eventDelegates, instanceData.element, moduleBehaviors[i]);
		}
	}
1053071
function(service) {

		// Create self, which inherits from its parent
		var self = Object.create(this);

		// Inherit the prototype from its parent
		self.settings = Object.create(this.settings);

		// Define the default service
		if (service) {
			self.settings.default_service = service;
		}

		// Create an instance of Events
		self.utils.Event.call(self);

		return self;
	}
949783
function init(properties) {
            this.eventListeners = [];

            if (typeof properties !== 'undefined') {
                Object.keys(properties).forEach(function (property) {
                    this[property] = properties[property];
                }, this);
            }

            return this;
        }
431089
function EventsBus() {
    var events = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
    classCallCheck(this, EventsBus);

    this.events = events;
    this.hop = events.hasOwnProperty;
  }
695574
function() {

    this.on = this.addEventListener = function(type, listener) {
        if (!this.events[type]) {
            this.events[type] = [];
        }

        this.events[type].push(listener);
    };

    this.off = this.removeEventListener = function (type, listener) {
        if (!!this.events[type]) {
            for(var i = 0; i < this.events[type].length; i++) {
                if (this.events[type][i] === listener) {
                    this.events[type][i] = null;
                    this.events[type].splice(i, 1);
                    return;
                }
            }
        }
    };

    this.removeAllListeners = function (type) {
        this.events[type] = [];
    };

    var emit = function(cb, event) {
        // Handle callbacks asynchronously
        setTimeout(function() {
            cb(event);
        }, 0);

    };

    this.dispatchEvent = function (event) {
        if (!!event.type) {
            var type = event.type;
            if (!!this.events[type]) {
                event.target = this;
                for (var i = 0; i < this.events[type].length && (event.returnValue === undefined || event.returnValue) ; i++) {
                    var cb = this.events[type][i];
                    // Dereference cb for async
                    emit(cb.bind(event.target), event);
                }
            }
        }
    };
}
585624
function createInstanceContext (
  instanceId,
  runtimeContext,
  data
) {
  if ( data === void 0 ) data = {};

  var weex = runtimeContext.weex;
  var instance = instanceOptions[instanceId] = {
    instanceId: instanceId,
    config: weex.config,
    document: weex.document,
    data: data
  };

  // Each instance has a independent `Vue` module instance
  var Vue = instance.Vue = createVueModuleInstance(instanceId, weex);

  // DEPRECATED
  var timerAPIs = getInstanceTimer(instanceId, weex.requireModule);

  var instanceContext = Object.assign({ Vue: Vue }, timerAPIs);
  Object.freeze(instanceContext);
  return instanceContext
}
661533
function Event(type) {
    var me = this;
    return (me == null || me.constructor != Event)
      ? new Event(type)
      : (type instanceof Event)
          ? type
          : extend(me, { 'timeStamp': +new Date }, typeof type == 'string' ? { 'type': type } : type);
  }
810113
function EventsBinder() {
    var listeners = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
    classCallCheck(this, EventsBinder);

    this.listeners = listeners;
  }
1206411
function init() {  // {{{2
/**
 * Class constructor
 *
 * @method constructor
 */

  O.inherited(this)();

  this.setMaxListeners(Consts.coreListeners);

  this.subjectState = this.SUBJECT_STATE.INIT;

  this.homeTimeOffset = 0;

  this.lastTid = 0;  // {{{3
  /**
   * Autoincemental part of last transaction id created in this shard and peer
   *
   * @property lastTid
   * @type Number
   */

  this.lastEid = 0;  // {{{3
  /**
   * Autoincremental part of last entry id created in this shard and peer
   *
   * @property lastEid
   * @type Number
   */

  this.cache = {};  // {{{3
  /**
   * Object containing entries
   *
   * @property cache
   * @type Object
   */

  // }}}3

  return true;
}
1349144
function createServer() {
  function app(req, res, next) {
    app.handle(req, res, next);
  }
  app.method = '*';
  merge(app, proto);
  merge(app, EventEmitter.prototype);
  app.stack = [];
  app.params = [];
  app._cachedEvents = [] ;
  app.routedMethods = {} ;
  app.locals = Object.create(null);
  for (var i = 0; i < arguments.length; ++i) {
    app.use(arguments[i]);
  }

  //create methods app.invite, app.register, etc..
  methods.forEach((method) => {
    app[method.toLowerCase()] = app.use.bind(app, method.toLowerCase()) ;
  }) ;

  //special handling for cdr events
  app.on = function(event, listener) {
    if (0 === event.indexOf('cdr:')) {
      if (app.client) {
        app.client.on(event, function() {
          var args = Array.prototype.slice.call(arguments) ;
          EventEmitter.prototype.emit.apply(app, [event].concat(args)) ;
        }) ;
      }
      else {
        this._cachedEvents.push(event) ;
      }
    }
    //delegate all others to standard EventEmitter prototype
    return EventEmitter.prototype.addListener.call(app, event, listener) ;
  } ;

  return app;
}
77110
function component(settings = {}) {

	/**
	 * decorator
	 * @param  {function} ComponentClass
	 */
	return Class => {

		initCoreMap(storage, Class);

		let map = storage.get(Class);
		map.set('@component', settings);

		for(let callbackName of customElementHooks){
			Class.prototype[`${callbackName}Callback`] = function(vars){
				let callbacks = map.get('@callbacks').get(callbackName);
				this::init(callbackName, callbacks, vars);
			};
		}
	}
}
31340
function getEmitter(config) {
      function Emitter(n) {
        n = n || this;
        n.__events = n.__events || {};
        n.__once = n.__once || {};
      }

      Emitter.prototype.on = function(name, fn) {
        fn = fn || Function();
        this.__events[name] = (this.__events[name] || [])
        this.__events[name].push(fn);
      }

      Emitter.prototype.once = function(name, fn) {
        fn = fn || Function();
        this.__once[name] = (this.__once[name] || []);
        this.__once[name].push(fn);
      }

      Emitter.prototype.off = function(name, fn) {
        var i;

        fn = fn || Function();
        i = (this.__events[name] || []).indexOf(fn);
        if (~i) this.__events[name].splice(i, 1);

        i = (this.__once[name] || []).indexOf(fn);
        if (~i) this.__once[name].splice(i, 1);
      }

      Emitter.prototype.emit = function(name) {
        var args = [].slice.call(arguments),
            es = (this.__events[name] || []).slice(),
            i, self = this;

        args.shift();
        es.push.apply(es, this.__once[name] || []);

        for (i = 0; i < es.length; i++) {
          es[i].apply(self, args);
        }

        this.__once[name] = [];
      }

      Emitter.prototype.emitCtx = function(name, ctx) {
        var args = [].slice.call(arguments),
            es = (this.__events[name] || []).slice(),
            i, self = this;

        args.shift(); args.shift();
        es.push.apply(es, this.__once[name] || []);

        for (i = 0; i < es.length; i++) {
          es[i].apply(ctx, args);
        }

        this.__once[name] = [];
      }

      return Emitter;
    }
883038
function Event(type) {
      var event = this;
      if (type instanceof Event) {
        return type;
      }
      return (event instanceof Event)
        ? _.assign(event, { 'timeStamp': _.now() }, typeof type == 'string' ? { 'type': type } : type)
        : new Event(type);
    }
548775
function Router () {
  if (!(this instanceof Router)) return new Router();

  var index = 0;

  /**
   * @api public
   */

  function router () {
    router.route.apply(router, slice.call(arguments));
  }

  router.__proto__ = Router.prototype;

  /**
   * Inc the index
   *
   * @api private
   * @return Number
   */

  router.index = function () {
    return index++;
  };

  /**
   * Pushes the socket and arguments through the middleware
   *
   * @api public
   * @param {Error} err *optional
   * @param {Socket} socket
   * @param {Array} args
   * @param {Function} cb
   */

  router.route = function () {
    var args = slice.call(arguments);
    var name = '*';
    var err = null;
    var cb = function () { console.warn('default callback', slice.call(arguments)); };
    var end = function (err) { 
      if (cb.called) return;
      cb.called = new Date(); 
      cb.apply(cb, [err ? err : null].concat(args)); 
    };

    if ('string' === typeof args[0]) name = args.shift();
    if ('object' === typeof args[0] && args[0] instanceof Error) err = args.shift();
    if ('function' === typeof args[args.length - 1]) cb = args.pop();

    var i = 0, path = router.getPath(name), len = path.length;

    debug('got path the length is %s', len);

    (function step (err) {
      
      if (cb.called) return;

      debug('current step %s of %s', i+1, len);

      function next (err) {
        if (++i >= len) {
          end(err);
        }
        else {
          step(err);
        }
      }

      var fn = path[i];
      if (!fn) return next();

      try {
        if (err) {
          if (fn.err) {
            if (fn instanceof Router) {
              fn.route.apply(fn,[name, err].concat(args).concat(next).concat(end));
            }
            else {
              fn.apply(fn, [err].concat(args).concat(next).concat(end));
            }
          }
          else {
            next(err);
          }
        }
        else {
          if (fn.err) {
            next();
          }
          else {
            if (fn instanceof Router) {
              fn.route.apply(fn,[name].concat(args).concat(next).concat(end));
            }
            else {
              fn.apply(fn, args.concat(next).concat(end));
            }
          }
        }
      }
      catch(e) {
        debug('caught error %s', e);
        debug('the fn causing problems', fn);
        console.error(e.stack);
        next(e);
      }
      
    })(err);

  };
  
  return router;

}