Prepares HTML elements for being able to receive socket.io's messages
as jQuery events on the element
495242
function($el) {
    // Reaction to socket.io messages
    $myelements.socket.on("message", function onMessage(message) {
      if ($el.data().templateScope === message.event) {
        // Update element scope (maybe re-render)
        var scope = {};
        scope[message.event] = message.data;
        $myelements.updateElementScope($el.get(0), scope);
      }

      // we forward socket.io's message as a jQuery event on the $el.
      $myelements.debug("forwarding backend message '%s' as jQuery event '%s' to element %s with data: %j", message.event, message.event, $el.get(0), message.data);
      // Kludge: If jQuery's trigger received an array as second parameters
      // it assumes you're trying to send multiple parameters to the event handlers,
      // so we enclose message.data in another array if message.data is an array
      // sent from the backend 
      if ($.isArray(message.data)) {
        $el.trigger(message.event, [message.data]);
      } else {
        $el.trigger(message.event, message.data);
      }
    });
    // Reaction on local events triggered on the element by jQuery
    $el.on("message", function onElementMessageEvent(jQueryEvent, message) {
      if (message.event === undefined || message.data === undefined) {
        $myelements.debug("event key or data not present in second argument to trigger()", message.event, message.data);
        console.error("myelements.jquery: $.fn.trigger('message') must be called with an object having the keys 'event' and 'data' as second argument.  ");
        return;
      }
      $myelements.debug("Sending message '%s' to backend with data: %j", message.event, message.data);
      $myelements.socket.send(message);
    });
  }
125918
function(event, context, callback, selector) {
        var options = this.options;

        // Replace tokens
        if (event === '{mode}') {
            event = options.mode;
        }

        if (selector === '{selector}') {
            selector = this.nodes ? this.nodes.selector : '';
        }

        // Find and bind the function
        if ($.type(callback) === 'string') {
            callback = this[callback].bind(this);
        }

        this.__events.push([event, context, callback, selector]);
    }
389079
function () {
                var msg = [], tp;
                msg.push('## ' + this.$classpath + ' ## ');
                for (var k in this) {
                    if (this.hasOwnProperty(k)) {
                        tp = typeof(this[k]);
                        if (tp == 'object' || tp == 'function')
                            msg.push(k += ':[' + tp + ']');
                        else if (tp == 'string')
                            msg.push(k += ':"' + this[k] + '"');
                        else
                            msg.push(k += ':' + this[k]);
                    }
                }
                Aria.$window.alert(msg.join('\n'));
                msg = null;
            }
106090
def display_event(div, attributes=[]):
    
    style = 'float: left; clear: left; font-size: 10pt'
    return CustomJS(args=dict(div=div), code="""
        var attrs = %s;
        var args = [];
        for (var i = 0; i<attrs.length; i++ ) {
            var val = JSON.stringify(cb_obj[attrs[i]], function(key, val) {
                return val.toFixed ? Number(val.toFixed(2)) : val;
            })
            args.push(attrs[i] + '=' + val)
        }
        var line = "<span style=%r><b>" + cb_obj.event_name + "</b>(" + args.join(", ") + ")</span>\\n";
        var text = div.text.concat(line);
        var lines = text.split("\\n")
        if (lines.length > 35)
            lines.shift();
        div.text = lines.join("\\n");
    """ % (attributes, style))
753217
function parseWebSocketEvent(event) {
      try {
        var params = JSON.parse(event.data);

        if (typeof params.data === 'string') {
          try {
            params.data = JSON.parse(params.data);
          } catch (e) {
            if (!(e instanceof SyntaxError)) {
              throw e;
            }
          }
        }

        return params;
      } catch (e) {
        self.emit('error', {type: 'MessageParseError', error: e, data: event.data});
      }
    }
722392
function( elem, types, handler, data ) {
		if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
			return;
		}

		// For whatever reason, IE has trouble passing the window object
		// around, causing it to be cloned in the process
		if ( elem.setInterval && ( elem !== window && !elem.frameElement ) ) {
			elem = window;
		}

		// Make sure that the function being executed has a unique ID
		if ( !handler.guid ) {
			handler.guid = jQuery.guid++;
		}

		// if data is passed, bind to handler
		if ( data !== undefined ) {
			// Create temporary function pointer to original handler
			var fn = handler;

			// Create unique handler function, wrapped around original handler
			handler = jQuery.proxy( fn );

			// Store data in unique handler
			handler.data = data;
		}

		// Init the element's event structure
		var events = jQuery.data( elem, "events" ) || jQuery.data( elem, "events", {} ),
			handle = jQuery.data( elem, "handle" ), eventHandle;

		if ( !handle ) {
			eventHandle = function() {
				// Handle the second event of a trigger and when
				// an event is called after a page has unloaded
				return typeof jQuery !== "undefined" && !jQuery.event.triggered ?
					jQuery.event.handle.apply( eventHandle.elem, arguments ) :
					undefined;
			};

			handle = jQuery.data( elem, "handle", eventHandle );
		}

		// If no handle is found then we must be trying to bind to one of the
		// banned noData elements
		if ( !handle ) {
			return;
		}

		// Add elem as a property of the handle function
		// This is to prevent a memory leak with non-native
		// event in IE.
		handle.elem = elem;

		// Handle multiple events separated by a space
		// jQuery(...).bind("mouseover mouseout", fn);
		types = types.split( /\s+/ );

		var type, i = 0;

		while ( (type = types[ i++ ]) ) {
			// Namespaced event handlers
			var namespaces = type.split(".");
			type = namespaces.shift();

			if ( i > 1 ) {
				handler = jQuery.proxy( handler );

				if ( data !== undefined ) {
					handler.data = data;
				}
			}

			handler.type = namespaces.slice(0).sort().join(".");

			// Get the current list of functions bound to this event
			var handlers = events[ type ],
				special = this.special[ type ] || {};

			// Init the event handler queue
			if ( !handlers ) {
				handlers = events[ type ] = {};

				// Check for a special event handler
				// Only use addEventListener/attachEvent if the special
				// events handler returns false
				if ( !special.setup || special.setup.call( elem, data, namespaces, handler) === false ) {
					// Bind the global event handler to the element
					if ( elem.addEventListener ) {
						elem.addEventListener( type, handle, false );
					} else if ( elem.attachEvent ) {
						elem.attachEvent( "on" + type, handle );
					}
				}
			}

			if ( special.add ) {
				var modifiedHandler = special.add.call( elem, handler, data, namespaces, handlers );
				if ( modifiedHandler && jQuery.isFunction( modifiedHandler ) ) {
					modifiedHandler.guid = modifiedHandler.guid || handler.guid;
					modifiedHandler.data = modifiedHandler.data || handler.data;
					modifiedHandler.type = modifiedHandler.type || handler.type;
					handler = modifiedHandler;
				}
			}

			// Add the function to the element's handler list
			handlers[ handler.guid ] = handler;

			// Keep track of which events have been used, for global triggering
			this.global[ type ] = true;
		}

		// Nullify elem to prevent memory leaks in IE
		elem = null;
	}
293686
function(req, res){
		    return function(){
		        var buf = [],
		            messages = req.flash(),
		            types = Object.keys(messages),
		            len = types.length;
		        if (!len) {
		           return '';
	           }
		        buf.push('<div id="messages">');
		        for (var i = 0 ; i < len; ++i) {
		            var type = types[i],
		                msgs = messages[type], j;
		            buf.push('  <ul class="' + type + '">');
		            for (j = 0, len = msgs.length; j < len; ++j) {
		                var msg = msgs[j];
		                buf.push('    <li>' + msg + '</li>');
		            }
		            buf.push('  </ul>');
		        }
		        buf.push('</div>');
		        return buf.join('\n');
		    };
		}
235896
function prepareHTML(html, info) {
  const cssPath = `../doc_styles.css`;
  const nav = info.map(p => {
    return `<li><a href="/static/docs/${p.name.replace('@vx/', 'vx-')}.html">${p.name}</a></li>`;
  });
  return `
  <html>
    <head>
      <link rel="stylesheet" type="text/css" href="${cssPath}">
    </head>
    <div class="nav-container">
      <div class="nav">
        <div class="nav-inner">
          <div class="logo"></div>
          <ul>
          <li class="Item">
            <a href="/">Home</a>
          </li>
          <li class="Item">
            <a href="/docs">Docs</a>
          </li>
          <li class="Item">
            <a href="https://medium.com/vx-code">Guides</a>
          </li>
          <li class="Item">
            <a href="/gallery">Gallery</a>
          </li>
          </ul>
          <a class="github-button" href="https://github.com/hshoff/vx" data-show-count="true" aria-label="Star hshoff/vx on GitHub">Star</a>
          </div>
        </div>
    </div>
    <div class="doc-container">
      <div class="doc-nav">
        <ul>
        <li>Packages</li>
        ${nav.join('')}
        </ul>
      </div>
      <div class="content">
      ${html}
      </div>
    </div>
    <script async defer src="https://buttons.github.io/buttons.js"></script>
  </html>`;
}
1027871
function(element,eventName,event){
			// Prepare
			event = event || {};
			var uid = history.Adapter.uid(element),
				i,n;

			// Apply Listener
			history.Adapter.handlers[uid] = history.Adapter.handlers[uid] || {};
			history.Adapter.handlers[uid][eventName] = history.Adapter.handlers[uid][eventName] || [];

			// Fire Listeners
			for ( i=0,n=history.Adapter.handlers[uid][eventName].length; i<n; ++i ) {
				history.Adapter.handlers[uid][eventName][i].apply(this,[event]);
			}
		}
1360630
function emit(eventName, params) {

            //jshint unused:false
            var args    = Array.prototype.slice.call(arguments),
                scope   = $ember.get(this, 'socket');

            scope.emit.apply(scope, args);

        }
693661
function (ws, message) {
  let clientMessage;

  try {
    clientMessage = JSON.parse(message);
    /* jshint ignore:start */
    if (_.get(clientMessage, 'type') === 'message') {
      ws.send(JSON.stringify({
        ok: true,
        reply_to: _.get(clientMessage, 'id'),
        ts: Date.now(),
        message: _.get(clientMessage, 'text', message),
        type: _.get(clientMessage, 'type', 'message'),
        user: _.get(clientMessage, 'user', 'U1234567'),
        channel: _.get(clientMessage, 'channel', 'C1234567'),
      }));
    }
    /* jshint ignore:end */
  } catch (err) {
    logger.info('Invalid socket data ', message);
  }
}
620850
function prepareEvents(raddec) {
  let elements = [];

  raddec.events.forEach(function(event) {
    let i = document.createElement('i');
    let space = document.createTextNode(' ');
    i.setAttribute('class', EVENT_ICONS[event]);
    elements.push(i);
    elements.push(space);
  });

  return elements;
}
350691
function preprocessor (socket) {
  debug('setting up "data" preprocessor');

  function ondata (chunk) {
    // TODO: don't be lazy, buffer if needed...
    assert(chunk.length >= 3, 'buffer too small! ' + chunk.length);
    if (/icy/i.test(chunk.slice(0, 3))) {
      debug('got ICY response!');
      var b = new Buffer(chunk.length + HTTP10.length - 'icy'.length);
      var i = 0;
      i += HTTP10.copy(b);
      i += chunk.copy(b, i, 3);
      assert.equal(i, b.length);
      chunk = b;
      socket._wasIcy = true;
    } else {
      socket._wasIcy = false;
    }

    return chunk;
  }

  var listeners;
  function icyOnData (buf) {
    var chunk = ondata(buf);

    // clean up, and re-emit "data" event
    socket.removeListener('data', icyOnData);
    listeners.forEach(function (listener) {
      socket.on('data', listener);
    });
    listeners = null;
    socket.emit('data', chunk);
  }

  if ('function' == typeof socket.ondata) {
    // node < v0.11.3, the `ondata` function is set on the socket
    var origOnData = socket.ondata;
    socket.ondata = function (buf, start, length) {
      var chunk = ondata(buf.slice(start, length));

      // now clean up and inject the modified `chunk`
      socket.ondata = origOnData;
      origOnData = null;
      socket.ondata(chunk, 0, chunk.length);
    };
  } else if (socket.listeners('data').length > 0) {
    // node >= v0.11.3, the "data" event is listened for directly

    // add our own "data" listener, and remove all the old ones
    listeners = socket.listeners('data');
    socket.removeAllListeners('data');
    socket.on('data', icyOnData);
  } else {
    // never?
    throw new Error('should not happen...');
  }
}
49711
function (ui, done) {

        var bs = ui.bs;

        ui.clients.on("connection", function (client) {

            client.emit("ui:connection", ui.options.toJS());

            ui.options.get("clientFiles").map(function (item) {
                if (item.get("active")) {
                    ui.addElement(client, item.toJS());
                }
            });
        });

        ui.socket.on("connection", function (client) {

            client.emit("connection", bs.getOptions().toJS());

            client.emit("ui:connection", ui.options.toJS());

            client.on("ui:get:options", function () {
                client.emit("ui:receive:options", {
                    bs: bs.getOptions().toJS(),
                    ui: ui.options.toJS()
                });
            });

            // proxy client events
            client.on("ui:client:proxy", function (evt) {
                ui.clients.emit(evt.event, evt.data);
            });

            client.on("ui", function (data) {
                ui.delegateEvent(data);
            });
        });
        done();
    }
868764
function receiveMessageFromNode(event, msgObj) {
        if (functionMap[msgObj.fn]) {
            if(domainID === msgObj.requester) {
                functionMap[msgObj.fn].apply(null, msgObj.args);
            }
        }
    }
245525
function(element) {

		// note: target of some events can be the root html tag (for example, mousedown on a scroll bar)
		var document_ref = window.document, // document > html > body > ...
			result = [];

		while (element && element != document_ref) {

			result.push(element);
			element = element.parentNode;

		}

		// you must not modify the returned array, but you can slice() it
		if (Lava.schema.DEBUG && Object.freeze) {
			Object.freeze(result);
		}

		return result;

	}
556179
function bindEvent(element, type, handler, context) {
    /**
     * Event handler
     * @param {Event} e - event object
     */
    function eventHandler(e) {
        handler.call(context || element, e || window.event);
    }

    /**
     * Event handler for normalize mouseenter event
     * @param {MouseEvent} e - event object
     */
    function mouseEnterHandler(e) {
        e = e || window.event;

        if (checkMouse(element, e)) {
            eventHandler(e);
        }
    }

    if ('addEventListener' in element) {
        if (type === 'mouseenter' || type === 'mouseleave') {
            type = (type === 'mouseenter') ? 'mouseover' : 'mouseout';
            element.addEventListener(type, mouseEnterHandler);
            memorizeHandler(element, type, handler, mouseEnterHandler);
        } else {
            element.addEventListener(type, eventHandler);
            memorizeHandler(element, type, handler, eventHandler);
        }
    } else if ('attachEvent' in element) {
        element.attachEvent(`on${type}`, eventHandler);
        memorizeHandler(element, type, handler, eventHandler);
    }
}