/*! slip.js 1.0.1, Copyright 2015 Colin Clark | github.com/colinbdclark/slip.js */ !function(a,b){"use strict";"object"==typeof exports?(a.slip=exports,b(exports)):"function"==typeof define&&define.amd?define(["exports"],function(c){return a.slip=c,a.slip,b(c)}):(a.slip={},b(a.slip))}(this,function(a){"use strict";var b=a;b.END=192,b.ESC=219,b.ESC_END=220,b.ESC_ESC=221,b.byteArray=function(a,b,c){return a instanceof ArrayBuffer?new Uint8Array(a,b,c):a},b.expandByteArray=function(a){var b=new Uint8Array(2*a.length);return b.set(a),b},b.sliceByteArray=function(a,b,c){var d=a.buffer.slice?a.buffer.slice(b,c):a.subarray(b,c);return new Uint8Array(d)},b.encode=function(a,c){c=c||{},c.bufferPadding=c.bufferPadding||4,a=b.byteArray(a,c.offset,c.byteLength);var d=a.length+c.bufferPadding+3&-4,e=new Uint8Array(d),f=1;e[0]=b.END;for(var g=0;ge.length-3&&(e=b.expandByteArray(e));var h=a[g];h===b.END?(e[f++]=b.ESC,h=b.ESC_END):h===b.ESC&&(e[f++]=b.ESC,h=b.ESC_ESC),e[f++]=h}return e[f]=b.END,b.sliceByteArray(e,0,f+1)},b.Decoder=function(a){a="function"!=typeof a?a||{}:{onMessage:a},this.maxMessageSize=a.maxMessageSize||10485760,this.bufferSize=a.bufferSize||1024,this.msgBuffer=new Uint8Array(this.bufferSize),this.msgBufferIdx=0,this.onMessage=a.onMessage,this.onError=a.onError,this.escape=!1};var c=b.Decoder.prototype;return c.decode=function(a){a=b.byteArray(a);for(var c,d=0;dthis.msgBuffer.length-1&&(this.msgBuffer=b.expandByteArray(this.msgBuffer)),this.msgBuffer[this.msgBufferIdx++]=a,this.escape=!1,this.msgBuffer.length