From ed9cb3b8898c8b91a155a8484f8dcf2f8c77d739 Mon Sep 17 00:00:00 2001 From: RealDolos Date: Sat, 12 May 2018 13:47:37 +0200 Subject: [PATCH] Fix utf-8 decoder --- browser/decode.js | 2 +- dist/notepack.js | 2 +- dist/notepack.js.map | 2 +- test/browser.js | 11 +++++++++++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/browser/decode.js b/browser/decode.js index 674a8eb..b826b14 100644 --- a/browser/decode.js +++ b/browser/decode.js @@ -23,7 +23,7 @@ function utf8Read(view, offset, length) { } if ((byte & 0xe0) === 0xc0) { string += String.fromCharCode( - ((byte & 0x0f) << 6) | + ((byte & 0x1f) << 6) | (view.getUint8(++i) & 0x3f) ); continue; diff --git a/dist/notepack.js b/dist/notepack.js index 9390fde..b930236 100644 --- a/dist/notepack.js +++ b/dist/notepack.js @@ -1,2 +1,2 @@ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.notepack=e():t.notepack=e()}(this,function(){return function(t){function e(i){if(s[i])return s[i].exports;var f=s[i]={exports:{},id:i,loaded:!1};return t[i].call(f.exports,f,f.exports,e),f.loaded=!0,f.exports}var s={};return e.m=t,e.c=s,e.p="",e(0)}([function(t,e,s){e.encode=s(1),e.decode=s(2)},function(t,e){"use strict";function s(t,e,s){for(var i=0,f=0,r=s.length;f>6),t.setUint8(e++,128|63&i)):i<55296||i>=57344?(t.setUint8(e++,224|i>>12),t.setUint8(e++,128|i>>6&63),t.setUint8(e++,128|63&i)):(f++,i=65536+((1023&i)<<10|1023&s.charCodeAt(f)),t.setUint8(e++,240|i>>18),t.setUint8(e++,128|i>>12&63),t.setUint8(e++,128|i>>6&63),t.setUint8(e++,128|63&i))}function i(t){for(var e=0,s=0,i=0,f=t.length;i=57344?s+=3:(i++,s+=4);return s}function f(t,e,s){var r=typeof s,n=0,o=0,h=0,u=0,a=0,p=0;if("string"===r){if(a=i(s),a<32)t.push(160|a),p=1;else if(a<256)t.push(217,a),p=2;else if(a<65536)t.push(218,a>>8,a),p=3;else{if(!(a<4294967296))throw new Error("String too long");t.push(219,a>>24,a>>16,a>>8,a),p=5}return e.push({str:s,length:a,offset:t.length}),p+a}if("number"===r)return Math.floor(s)===s&&isFinite(s)?s>=0?s<128?(t.push(s),1):s<256?(t.push(204,s),2):s<65536?(t.push(205,s>>8,s),3):s<4294967296?(t.push(206,s>>24,s>>16,s>>8,s),5):(h=s/Math.pow(2,32)>>0,u=s>>>0,t.push(207,h>>24,h>>16,h>>8,h,u>>24,u>>16,u>>8,u),9):s>=-32?(t.push(s),1):s>=-128?(t.push(208,s),2):s>=-32768?(t.push(209,s>>8,s),3):s>=-2147483648?(t.push(210,s>>24,s>>16,s>>8,s),5):(h=Math.floor(s/Math.pow(2,32)),u=s>>>0,t.push(211,h>>24,h>>16,h>>8,h,u>>24,u>>16,u>>8,u),9):(t.push(203),e.push({float:s,length:8,offset:t.length}),9);if("object"===r){if(null===s)return t.push(192),1;if(Array.isArray(s)){if(a=s.length,a<16)t.push(144|a),p=1;else if(a<65536)t.push(220,a>>8,a),p=3;else{if(!(a<4294967296))throw new Error("Array too large");t.push(221,a>>24,a>>16,a>>8,a),p=5}for(n=0;n>>0,t.push(215,0,h>>24,h>>16,h>>8,h,u>>24,u>>16,u>>8,u),10}if(s instanceof ArrayBuffer){if(a=s.byteLength,a<256)t.push(196,a),p=2;else if(a<65536)t.push(197,a>>8,a),p=3;else{if(!(a<4294967296))throw new Error("Buffer too large");t.push(198,a>>24,a>>16,a>>8,a),p=5}return e.push({bin:s,length:a,offset:t.length}),p+a}if("function"==typeof s.toJSON)return f(t,e,s.toJSON());var g=[],w="",v=Object.keys(s);for(n=0,o=v.length;n>8,a),p=3;else{if(!(a<4294967296))throw new Error("Object too large");t.push(223,a>>24,a>>16,a>>8,a),p=5}for(n=0;n0&&(a=i[0].offset);for(var p,c=0,g=0,w=0,v=e.length;w=65536?(f-=65536,i+=String.fromCharCode((f>>>10)+55296,(1023&f)+56320)):i+=String.fromCharCode(f)}else i+=String.fromCharCode((15&o)<<12|(63&t.getUint8(++r))<<6|(63&t.getUint8(++r))<<0);else i+=String.fromCharCode((15&o)<<6|63&t.getUint8(++r));else i+=String.fromCharCode(o)}return i}function f(t){var e=new s(t),i=e.parse();if(e.offset!==t.byteLength)throw new Error(t.byteLength-e.offset+" trailing bytes");return i}s.prototype.array=function(t){for(var e=new Array(t),s=0;s223)return(255-e+1)*-1;switch(e){case 192:return null;case 194:return!1;case 195:return!0;case 196:return s=this.view.getUint8(this.offset),this.offset+=1,this.bin(s);case 197:return s=this.view.getUint16(this.offset),this.offset+=2,this.bin(s);case 198:return s=this.view.getUint32(this.offset),this.offset+=4,this.bin(s);case 199:return s=this.view.getUint8(this.offset),i=this.view.getInt8(this.offset+1),this.offset+=2,[i,this.bin(s)];case 200:return s=this.view.getUint16(this.offset),i=this.view.getInt8(this.offset+2),this.offset+=3,[i,this.bin(s)];case 201:return s=this.view.getUint32(this.offset),i=this.view.getInt8(this.offset+4),this.offset+=5,[i,this.bin(s)];case 202:return t=this.view.getFloat32(this.offset),this.offset+=4,t;case 203:return t=this.view.getFloat64(this.offset),this.offset+=8,t;case 204:return t=this.view.getUint8(this.offset),this.offset+=1,t;case 205:return t=this.view.getUint16(this.offset),this.offset+=2,t;case 206:return t=this.view.getUint32(this.offset),this.offset+=4,t;case 207:return f=this.view.getUint32(this.offset)*Math.pow(2,32),r=this.view.getUint32(this.offset+4),this.offset+=8,f+r;case 208:return t=this.view.getInt8(this.offset),this.offset+=1,t;case 209:return t=this.view.getInt16(this.offset),this.offset+=2,t;case 210:return t=this.view.getInt32(this.offset),this.offset+=4,t;case 211:return f=this.view.getInt32(this.offset)*Math.pow(2,32),r=this.view.getUint32(this.offset+4),this.offset+=8,f+r;case 212:return i=this.view.getInt8(this.offset),this.offset+=1,0===i?void(this.offset+=1):[i,this.bin(1)];case 213:return i=this.view.getInt8(this.offset),this.offset+=1,[i,this.bin(2)];case 214:return i=this.view.getInt8(this.offset),this.offset+=1,[i,this.bin(4)];case 215:return i=this.view.getInt8(this.offset),this.offset+=1,0===i?(f=this.view.getInt32(this.offset)*Math.pow(2,32),r=this.view.getUint32(this.offset+4),this.offset+=8,new Date(f+r)):[i,this.bin(8)];case 216:return i=this.view.getInt8(this.offset),this.offset+=1,[i,this.bin(16)];case 217:return s=this.view.getUint8(this.offset),this.offset+=1,this.str(s);case 218:return s=this.view.getUint16(this.offset),this.offset+=2,this.str(s);case 219:return s=this.view.getUint32(this.offset),this.offset+=4,this.str(s);case 220:return s=this.view.getUint16(this.offset),this.offset+=2,this.array(s);case 221:return s=this.view.getUint32(this.offset),this.offset+=4,this.array(s);case 222:return s=this.view.getUint16(this.offset),this.offset+=2,this.map(s);case 223:return s=this.view.getUint32(this.offset),this.offset+=4,this.map(s)}throw new Error("Could not parse")},t.exports=f}])}); +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.notepack=e():t.notepack=e()}(this,function(){return function(t){function e(i){if(s[i])return s[i].exports;var f=s[i]={exports:{},id:i,loaded:!1};return t[i].call(f.exports,f,f.exports,e),f.loaded=!0,f.exports}var s={};return e.m=t,e.c=s,e.p="",e(0)}([function(t,e,s){e.encode=s(1),e.decode=s(2)},function(t,e){"use strict";function s(t,e,s){for(var i=0,f=0,r=s.length;f>6),t.setUint8(e++,128|63&i)):i<55296||i>=57344?(t.setUint8(e++,224|i>>12),t.setUint8(e++,128|i>>6&63),t.setUint8(e++,128|63&i)):(f++,i=65536+((1023&i)<<10|1023&s.charCodeAt(f)),t.setUint8(e++,240|i>>18),t.setUint8(e++,128|i>>12&63),t.setUint8(e++,128|i>>6&63),t.setUint8(e++,128|63&i))}function i(t){for(var e=0,s=0,i=0,f=t.length;i=57344?s+=3:(i++,s+=4);return s}function f(t,e,s){var r=typeof s,n=0,o=0,h=0,u=0,a=0,p=0;if("string"===r){if(a=i(s),a<32)t.push(160|a),p=1;else if(a<256)t.push(217,a),p=2;else if(a<65536)t.push(218,a>>8,a),p=3;else{if(!(a<4294967296))throw new Error("String too long");t.push(219,a>>24,a>>16,a>>8,a),p=5}return e.push({str:s,length:a,offset:t.length}),p+a}if("number"===r)return Math.floor(s)===s&&isFinite(s)?s>=0?s<128?(t.push(s),1):s<256?(t.push(204,s),2):s<65536?(t.push(205,s>>8,s),3):s<4294967296?(t.push(206,s>>24,s>>16,s>>8,s),5):(h=s/Math.pow(2,32)>>0,u=s>>>0,t.push(207,h>>24,h>>16,h>>8,h,u>>24,u>>16,u>>8,u),9):s>=-32?(t.push(s),1):s>=-128?(t.push(208,s),2):s>=-32768?(t.push(209,s>>8,s),3):s>=-2147483648?(t.push(210,s>>24,s>>16,s>>8,s),5):(h=Math.floor(s/Math.pow(2,32)),u=s>>>0,t.push(211,h>>24,h>>16,h>>8,h,u>>24,u>>16,u>>8,u),9):(t.push(203),e.push({float:s,length:8,offset:t.length}),9);if("object"===r){if(null===s)return t.push(192),1;if(Array.isArray(s)){if(a=s.length,a<16)t.push(144|a),p=1;else if(a<65536)t.push(220,a>>8,a),p=3;else{if(!(a<4294967296))throw new Error("Array too large");t.push(221,a>>24,a>>16,a>>8,a),p=5}for(n=0;n>>0,t.push(215,0,h>>24,h>>16,h>>8,h,u>>24,u>>16,u>>8,u),10}if(s instanceof ArrayBuffer){if(a=s.byteLength,a<256)t.push(196,a),p=2;else if(a<65536)t.push(197,a>>8,a),p=3;else{if(!(a<4294967296))throw new Error("Buffer too large");t.push(198,a>>24,a>>16,a>>8,a),p=5}return e.push({bin:s,length:a,offset:t.length}),p+a}if("function"==typeof s.toJSON)return f(t,e,s.toJSON());var g=[],w="",v=Object.keys(s);for(n=0,o=v.length;n>8,a),p=3;else{if(!(a<4294967296))throw new Error("Object too large");t.push(223,a>>24,a>>16,a>>8,a),p=5}for(n=0;n0&&(a=i[0].offset);for(var p,c=0,g=0,w=0,v=e.length;w=65536?(f-=65536,i+=String.fromCharCode((f>>>10)+55296,(1023&f)+56320)):i+=String.fromCharCode(f)}else i+=String.fromCharCode((15&o)<<12|(63&t.getUint8(++r))<<6|(63&t.getUint8(++r))<<0);else i+=String.fromCharCode((31&o)<<6|63&t.getUint8(++r));else i+=String.fromCharCode(o)}return i}function f(t){var e=new s(t),i=e.parse();if(e.offset!==t.byteLength)throw new Error(t.byteLength-e.offset+" trailing bytes");return i}s.prototype.array=function(t){for(var e=new Array(t),s=0;s223)return(255-e+1)*-1;switch(e){case 192:return null;case 194:return!1;case 195:return!0;case 196:return s=this.view.getUint8(this.offset),this.offset+=1,this.bin(s);case 197:return s=this.view.getUint16(this.offset),this.offset+=2,this.bin(s);case 198:return s=this.view.getUint32(this.offset),this.offset+=4,this.bin(s);case 199:return s=this.view.getUint8(this.offset),i=this.view.getInt8(this.offset+1),this.offset+=2,[i,this.bin(s)];case 200:return s=this.view.getUint16(this.offset),i=this.view.getInt8(this.offset+2),this.offset+=3,[i,this.bin(s)];case 201:return s=this.view.getUint32(this.offset),i=this.view.getInt8(this.offset+4),this.offset+=5,[i,this.bin(s)];case 202:return t=this.view.getFloat32(this.offset),this.offset+=4,t;case 203:return t=this.view.getFloat64(this.offset),this.offset+=8,t;case 204:return t=this.view.getUint8(this.offset),this.offset+=1,t;case 205:return t=this.view.getUint16(this.offset),this.offset+=2,t;case 206:return t=this.view.getUint32(this.offset),this.offset+=4,t;case 207:return f=this.view.getUint32(this.offset)*Math.pow(2,32),r=this.view.getUint32(this.offset+4),this.offset+=8,f+r;case 208:return t=this.view.getInt8(this.offset),this.offset+=1,t;case 209:return t=this.view.getInt16(this.offset),this.offset+=2,t;case 210:return t=this.view.getInt32(this.offset),this.offset+=4,t;case 211:return f=this.view.getInt32(this.offset)*Math.pow(2,32),r=this.view.getUint32(this.offset+4),this.offset+=8,f+r;case 212:return i=this.view.getInt8(this.offset),this.offset+=1,0===i?void(this.offset+=1):[i,this.bin(1)];case 213:return i=this.view.getInt8(this.offset),this.offset+=1,[i,this.bin(2)];case 214:return i=this.view.getInt8(this.offset),this.offset+=1,[i,this.bin(4)];case 215:return i=this.view.getInt8(this.offset),this.offset+=1,0===i?(f=this.view.getInt32(this.offset)*Math.pow(2,32),r=this.view.getUint32(this.offset+4),this.offset+=8,new Date(f+r)):[i,this.bin(8)];case 216:return i=this.view.getInt8(this.offset),this.offset+=1,[i,this.bin(16)];case 217:return s=this.view.getUint8(this.offset),this.offset+=1,this.str(s);case 218:return s=this.view.getUint16(this.offset),this.offset+=2,this.str(s);case 219:return s=this.view.getUint32(this.offset),this.offset+=4,this.str(s);case 220:return s=this.view.getUint16(this.offset),this.offset+=2,this.array(s);case 221:return s=this.view.getUint32(this.offset),this.offset+=4,this.array(s);case 222:return s=this.view.getUint16(this.offset),this.offset+=2,this.map(s);case 223:return s=this.view.getUint32(this.offset),this.offset+=4,this.map(s)}throw new Error("Could not parse")},t.exports=f}])}); //# sourceMappingURL=notepack.js.map \ No newline at end of file diff --git a/dist/notepack.js.map b/dist/notepack.js.map index 8676481..6bbc86c 100644 --- a/dist/notepack.js.map +++ b/dist/notepack.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///notepack.js","webpack:///webpack/bootstrap 021f763394cb8091de38","webpack:///./lib/index.js","webpack:///./browser/encode.js","webpack:///./browser/decode.js"],"names":["root","factory","exports","module","define","amd","this","modules","__webpack_require__","moduleId","installedModules","id","loaded","call","m","c","p","encode","decode","utf8Write","view","offset","str","i","l","length","charCodeAt","setUint8","utf8Length","_encode","bytes","defers","value","type","hi","lo","size","push","Error","Math","floor","isFinite","pow","float","Array","isArray","Date","time","getTime","ArrayBuffer","byteLength","bin","toJSON","keys","key","allKeys","Object","buf","DataView","deferIndex","deferWritten","nextOffset","defer","deferLength","Uint8Array","j","undefined","setFloat64","Decoder","buffer","isView","byteOffset","utf8Read","string","chr","end","byte","getUint8","toString","String","fromCharCode","decoder","parse","prototype","array","map","slice","prefix","getUint16","getUint32","getInt8","getFloat32","getFloat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QAAA,EACAf,KAAA+E,IAAA5D,EACA,UAGA,MAFAA,GAAAnB,KAAAc,KAAAqE,UAAAnF,KAAAe,QACAf,KAAAe,QAAA,EACAf,KAAA+E,IAAA5D,GAGA,SAAAa,OAAA,oBAYAnC,EAAAD,QAAAgB","file":"notepack.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"notepack\"] = factory();\n\telse\n\t\troot[\"notepack\"] = factory();\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"notepack\"] = factory();\n\telse\n\t\troot[\"notepack\"] = factory();\n})(this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\texports.encode = __webpack_require__(1);\n\texports.decode = __webpack_require__(2);\n\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports) {\n\n\t'use strict';\n\t\n\tfunction utf8Write(view, offset, str) {\n\t var c = 0;\n\t for (var i = 0, l = str.length; i < l; i++) {\n\t c = str.charCodeAt(i);\n\t if (c < 0x80) {\n\t view.setUint8(offset++, c);\n\t }\n\t else if (c < 0x800) {\n\t view.setUint8(offset++, 0xc0 | (c >> 6));\n\t view.setUint8(offset++, 0x80 | (c & 0x3f));\n\t }\n\t else if (c < 0xd800 || c >= 0xe000) {\n\t view.setUint8(offset++, 0xe0 | (c >> 12));\n\t view.setUint8(offset++, 0x80 | (c >> 6) & 0x3f);\n\t view.setUint8(offset++, 0x80 | (c & 0x3f));\n\t }\n\t else {\n\t i++;\n\t c = 0x10000 + (((c & 0x3ff) << 10) | (str.charCodeAt(i) & 0x3ff));\n\t view.setUint8(offset++, 0xf0 | (c >> 18));\n\t view.setUint8(offset++, 0x80 | (c >> 12) & 0x3f);\n\t view.setUint8(offset++, 0x80 | (c >> 6) & 0x3f);\n\t view.setUint8(offset++, 0x80 | (c & 0x3f));\n\t }\n\t }\n\t}\n\t\n\tfunction utf8Length(str) {\n\t var c = 0, length = 0;\n\t for (var i = 0, l = str.length; i < l; i++) {\n\t c = str.charCodeAt(i);\n\t if (c < 0x80) {\n\t length += 1;\n\t }\n\t else if (c < 0x800) {\n\t length += 2;\n\t }\n\t else if (c < 0xd800 || c >= 0xe000) {\n\t length += 3;\n\t }\n\t else {\n\t i++;\n\t length += 4;\n\t }\n\t }\n\t return length;\n\t}\n\t\n\tfunction _encode(bytes, defers, value) {\n\t var type = typeof value, i = 0, l = 0, hi = 0, lo = 0, length = 0, size = 0;\n\t\n\t if (type === 'string') {\n\t length = utf8Length(value);\n\t\n\t // fixstr\n\t if (length < 0x20) {\n\t bytes.push(length | 0xa0);\n\t size = 1;\n\t }\n\t // str 8\n\t else if (length < 0x100) {\n\t bytes.push(0xd9, length);\n\t size = 2;\n\t }\n\t // str 16\n\t else if (length < 0x10000) {\n\t bytes.push(0xda, length >> 8, length);\n\t size = 3;\n\t }\n\t // str 32\n\t else if (length < 0x100000000) {\n\t bytes.push(0xdb, length >> 24, length >> 16, length >> 8, length);\n\t size = 5;\n\t } else {\n\t throw new Error('String too long');\n\t }\n\t defers.push({ str: value, length: length, offset: bytes.length });\n\t return size + length;\n\t }\n\t if (type === 'number') {\n\t // TODO: encode to float 32?\n\t\n\t // float 64\n\t if (Math.floor(value) !== value || !isFinite(value)) {\n\t bytes.push(0xcb);\n\t defers.push({ float: value, length: 8, offset: bytes.length });\n\t return 9;\n\t }\n\t\n\t if (value >= 0) {\n\t // positive fixnum\n\t if (value < 0x80) {\n\t bytes.push(value);\n\t return 1;\n\t }\n\t // uint 8\n\t if (value < 0x100) {\n\t bytes.push(0xcc, value);\n\t return 2;\n\t }\n\t // uint 16\n\t if (value < 0x10000) {\n\t bytes.push(0xcd, value >> 8, value);\n\t return 3;\n\t }\n\t // uint 32\n\t if (value < 0x100000000) {\n\t bytes.push(0xce, value >> 24, value >> 16, value >> 8, value);\n\t return 5;\n\t }\n\t // uint 64\n\t hi = (value / Math.pow(2, 32)) >> 0;\n\t lo = value >>> 0;\n\t bytes.push(0xcf, hi >> 24, hi >> 16, hi >> 8, hi, lo >> 24, lo >> 16, lo >> 8, lo);\n\t return 9;\n\t } else {\n\t // negative fixnum\n\t if (value >= -0x20) {\n\t bytes.push(value);\n\t return 1;\n\t }\n\t // int 8\n\t if (value >= -0x80) {\n\t bytes.push(0xd0, value);\n\t return 2;\n\t }\n\t // int 16\n\t if (value >= -0x8000) {\n\t bytes.push(0xd1, value >> 8, value);\n\t return 3;\n\t }\n\t // int 32\n\t if (value >= -0x80000000) {\n\t bytes.push(0xd2, value >> 24, value >> 16, value >> 8, value);\n\t return 5;\n\t }\n\t // int 64\n\t hi = Math.floor(value / Math.pow(2, 32));\n\t lo = value >>> 0;\n\t bytes.push(0xd3, hi >> 24, hi >> 16, hi >> 8, hi, lo >> 24, lo >> 16, lo >> 8, lo);\n\t return 9;\n\t }\n\t }\n\t if (type === 'object') {\n\t // nil\n\t if (value === null) {\n\t bytes.push(0xc0);\n\t return 1;\n\t }\n\t\n\t if (Array.isArray(value)) {\n\t length = value.length;\n\t\n\t // fixarray\n\t if (length < 0x10) {\n\t bytes.push(length | 0x90);\n\t size = 1;\n\t }\n\t // array 16\n\t else if (length < 0x10000) {\n\t bytes.push(0xdc, length >> 8, length);\n\t size = 3;\n\t }\n\t // array 32\n\t else if (length < 0x100000000) {\n\t bytes.push(0xdd, length >> 24, length >> 16, length >> 8, length);\n\t size = 5;\n\t } else {\n\t throw new Error('Array too large');\n\t }\n\t for (i = 0; i < length; i++) {\n\t size += _encode(bytes, defers, value[i]);\n\t }\n\t return size;\n\t }\n\t\n\t // fixext 8 / Date\n\t if (value instanceof Date) {\n\t var time = value.getTime();\n\t hi = Math.floor(time / Math.pow(2, 32));\n\t lo = time >>> 0;\n\t bytes.push(0xd7, 0, hi >> 24, hi >> 16, hi >> 8, hi, lo >> 24, lo >> 16, lo >> 8, lo);\n\t return 10;\n\t }\n\t\n\t if (value instanceof ArrayBuffer) {\n\t length = value.byteLength;\n\t\n\t // bin 8\n\t if (length < 0x100) {\n\t bytes.push(0xc4, length);\n\t size = 2;\n\t } else\n\t // bin 16\n\t if (length < 0x10000) {\n\t bytes.push(0xc5, length >> 8, length);\n\t size = 3;\n\t } else\n\t // bin 32\n\t if (length < 0x100000000) {\n\t bytes.push(0xc6, length >> 24, length >> 16, length >> 8, length);\n\t size = 5;\n\t } else {\n\t throw new Error('Buffer too large');\n\t }\n\t defers.push({ bin: value, length: length, offset: bytes.length });\n\t return size + length;\n\t }\n\t\n\t if (typeof value.toJSON === 'function') {\n\t return _encode(bytes, defers, value.toJSON());\n\t }\n\t\n\t var keys = [], key = '';\n\t\n\t var allKeys = Object.keys(value);\n\t for (i = 0, l = allKeys.length; i < l; i++) {\n\t key = allKeys[i];\n\t if (typeof value[key] !== 'function') {\n\t keys.push(key);\n\t }\n\t }\n\t length = keys.length;\n\t\n\t // fixmap\n\t if (length < 0x10) {\n\t bytes.push(length | 0x80);\n\t size = 1;\n\t }\n\t // map 16\n\t else if (length < 0x10000) {\n\t bytes.push(0xde, length >> 8, length);\n\t size = 3;\n\t }\n\t // map 32\n\t else if (length < 0x100000000) {\n\t bytes.push(0xdf, length >> 24, length >> 16, length >> 8, length);\n\t size = 5;\n\t } else {\n\t throw new Error('Object too large');\n\t }\n\t\n\t for (i = 0; i < length; i++) {\n\t key = keys[i];\n\t size += _encode(bytes, defers, key);\n\t size += _encode(bytes, defers, value[key]);\n\t }\n\t return size;\n\t }\n\t // false/true\n\t if (type === 'boolean') {\n\t bytes.push(value ? 0xc3 : 0xc2);\n\t return 1;\n\t }\n\t // fixext 1 / undefined\n\t if (type === 'undefined') {\n\t bytes.push(0xd4, 0, 0);\n\t return 3;\n\t }\n\t throw new Error('Could not encode');\n\t}\n\t\n\tfunction encode(value) {\n\t var bytes = [];\n\t var defers = [];\n\t var size = _encode(bytes, defers, value);\n\t var buf = new ArrayBuffer(size);\n\t var view = new DataView(buf);\n\t\n\t var deferIndex = 0;\n\t var deferWritten = 0;\n\t var nextOffset = -1;\n\t if (defers.length > 0) {\n\t nextOffset = defers[0].offset;\n\t }\n\t\n\t var defer, deferLength = 0, offset = 0;\n\t for (var i = 0, l = bytes.length; i < l; i++) {\n\t view.setUint8(deferWritten + i, bytes[i]);\n\t if (i + 1 !== nextOffset) { continue; }\n\t defer = defers[deferIndex];\n\t deferLength = defer.length;\n\t offset = deferWritten + nextOffset;\n\t if (defer.bin) {\n\t var bin = new Uint8Array(defer.bin);\n\t for (var j = 0; j < deferLength; j++) {\n\t view.setUint8(offset + j, bin[j]);\n\t }\n\t } else if (defer.str) {\n\t utf8Write(view, offset, defer.str);\n\t } else if (defer.float !== undefined) {\n\t view.setFloat64(offset, defer.float);\n\t }\n\t deferIndex++;\n\t deferWritten += deferLength;\n\t if (defers[deferIndex]) {\n\t nextOffset = defers[deferIndex].offset;\n\t }\n\t }\n\t return buf;\n\t}\n\t\n\tmodule.exports = encode;\n\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports) {\n\n\t'use strict';\n\t\n\tfunction Decoder(buffer) {\n\t this.offset = 0;\n\t if (buffer instanceof ArrayBuffer) {\n\t this.buffer = buffer;\n\t this.view = new DataView(this.buffer);\n\t } else if (ArrayBuffer.isView(buffer)) {\n\t this.buffer = buffer.buffer;\n\t this.view = new DataView(this.buffer, buffer.byteOffset, buffer.byteLength);\n\t } else {\n\t throw new Error('Invalid argument');\n\t }\n\t}\n\t\n\tfunction utf8Read(view, offset, length) {\n\t var string = '', chr = 0;\n\t for (var i = offset, end = offset + length; i < end; i++) {\n\t var byte = view.getUint8(i);\n\t if ((byte & 0x80) === 0x00) {\n\t string += String.fromCharCode(byte);\n\t continue;\n\t }\n\t if ((byte & 0xe0) === 0xc0) {\n\t string += String.fromCharCode(\n\t ((byte & 0x0f) << 6) |\n\t (view.getUint8(++i) & 0x3f)\n\t );\n\t continue;\n\t }\n\t if ((byte & 0xf0) === 0xe0) {\n\t string += String.fromCharCode(\n\t ((byte & 0x0f) << 12) |\n\t ((view.getUint8(++i) & 0x3f) << 6) |\n\t ((view.getUint8(++i) & 0x3f) << 0)\n\t );\n\t continue;\n\t }\n\t if ((byte & 0xf8) === 0xf0) {\n\t chr = ((byte & 0x07) << 18) |\n\t ((view.getUint8(++i) & 0x3f) << 12) |\n\t ((view.getUint8(++i) & 0x3f) << 6) |\n\t ((view.getUint8(++i) & 0x3f) << 0);\n\t if (chr >= 0x010000) { // surrogate pair\n\t chr -= 0x010000;\n\t string += String.fromCharCode((chr >>> 10) + 0xD800, (chr & 0x3FF) + 0xDC00);\n\t } else {\n\t string += String.fromCharCode(chr);\n\t }\n\t continue;\n\t }\n\t throw new Error('Invalid byte ' + byte.toString(16));\n\t }\n\t return string;\n\t}\n\t\n\tDecoder.prototype.array = function (length) {\n\t var value = new Array(length);\n\t for (var i = 0; i < length; i++) {\n\t value[i] = this.parse();\n\t }\n\t return value;\n\t};\n\t\n\tDecoder.prototype.map = function (length) {\n\t var key = '', value = {};\n\t for (var i = 0; i < length; i++) {\n\t key = this.parse();\n\t value[key] = this.parse();\n\t }\n\t return value;\n\t};\n\t\n\tDecoder.prototype.str = function (length) {\n\t var value = utf8Read(this.view, this.offset, length);\n\t this.offset += length;\n\t return value;\n\t};\n\t\n\tDecoder.prototype.bin = function (length) {\n\t var value = this.buffer.slice(this.offset, this.offset + length);\n\t this.offset += length;\n\t return value;\n\t};\n\t\n\tDecoder.prototype.parse = function () {\n\t var prefix = this.view.getUint8(this.offset++);\n\t var value, length = 0, type = 0, hi = 0, lo = 0;\n\t\n\t if (prefix < 0xc0) {\n\t // positive fixint\n\t if (prefix < 0x80) {\n\t return prefix;\n\t }\n\t // fixmap\n\t if (prefix < 0x90) {\n\t return this.map(prefix & 0x0f);\n\t }\n\t // fixarray\n\t if (prefix < 0xa0) {\n\t return this.array(prefix & 0x0f);\n\t }\n\t // fixstr\n\t return this.str(prefix & 0x1f);\n\t }\n\t\n\t // negative fixint\n\t if (prefix > 0xdf) {\n\t return (0xff - prefix + 1) * -1;\n\t }\n\t\n\t switch (prefix) {\n\t // nil\n\t case 0xc0:\n\t return null;\n\t // false\n\t case 0xc2:\n\t return false;\n\t // true\n\t case 0xc3:\n\t return true;\n\t\n\t // bin\n\t case 0xc4:\n\t length = this.view.getUint8(this.offset);\n\t this.offset += 1;\n\t return this.bin(length);\n\t case 0xc5:\n\t length = this.view.getUint16(this.offset);\n\t this.offset += 2;\n\t return this.bin(length);\n\t case 0xc6:\n\t length = this.view.getUint32(this.offset);\n\t this.offset += 4;\n\t return this.bin(length);\n\t\n\t // ext\n\t case 0xc7:\n\t length = this.view.getUint8(this.offset);\n\t type = this.view.getInt8(this.offset + 1);\n\t this.offset += 2;\n\t return [type, this.bin(length)];\n\t case 0xc8:\n\t length = this.view.getUint16(this.offset);\n\t type = this.view.getInt8(this.offset + 2);\n\t this.offset += 3;\n\t return [type, this.bin(length)];\n\t case 0xc9:\n\t length = this.view.getUint32(this.offset);\n\t type = this.view.getInt8(this.offset + 4);\n\t this.offset += 5;\n\t return [type, this.bin(length)];\n\t\n\t // float\n\t case 0xca:\n\t value = this.view.getFloat32(this.offset);\n\t this.offset += 4;\n\t return value;\n\t case 0xcb:\n\t value = this.view.getFloat64(this.offset);\n\t this.offset += 8;\n\t return value;\n\t\n\t // uint\n\t case 0xcc:\n\t value = this.view.getUint8(this.offset);\n\t this.offset += 1;\n\t return value;\n\t case 0xcd:\n\t value = this.view.getUint16(this.offset);\n\t this.offset += 2;\n\t return value;\n\t case 0xce:\n\t value = this.view.getUint32(this.offset);\n\t this.offset += 4;\n\t return value;\n\t case 0xcf:\n\t hi = this.view.getUint32(this.offset) * Math.pow(2, 32);\n\t lo = this.view.getUint32(this.offset + 4);\n\t this.offset += 8;\n\t return hi + lo;\n\t\n\t // int\n\t case 0xd0:\n\t value = this.view.getInt8(this.offset);\n\t this.offset += 1;\n\t return value;\n\t case 0xd1:\n\t value = this.view.getInt16(this.offset);\n\t this.offset += 2;\n\t return value;\n\t case 0xd2:\n\t value = this.view.getInt32(this.offset);\n\t this.offset += 4;\n\t return value;\n\t case 0xd3:\n\t hi = this.view.getInt32(this.offset) * Math.pow(2, 32);\n\t lo = this.view.getUint32(this.offset + 4);\n\t this.offset += 8;\n\t return hi + lo;\n\t\n\t // fixext\n\t case 0xd4:\n\t type = this.view.getInt8(this.offset);\n\t this.offset += 1;\n\t if (type === 0x00) {\n\t this.offset += 1;\n\t return void 0;\n\t }\n\t return [type, this.bin(1)];\n\t case 0xd5:\n\t type = this.view.getInt8(this.offset);\n\t this.offset += 1;\n\t return [type, this.bin(2)];\n\t case 0xd6:\n\t type = this.view.getInt8(this.offset);\n\t this.offset += 1;\n\t return [type, this.bin(4)];\n\t case 0xd7:\n\t type = this.view.getInt8(this.offset);\n\t this.offset += 1;\n\t if (type === 0x00) {\n\t hi = this.view.getInt32(this.offset) * Math.pow(2, 32);\n\t lo = this.view.getUint32(this.offset + 4);\n\t this.offset += 8;\n\t return new Date(hi + lo);\n\t }\n\t return [type, this.bin(8)];\n\t case 0xd8:\n\t type = this.view.getInt8(this.offset);\n\t this.offset += 1;\n\t return [type, this.bin(16)];\n\t\n\t // str\n\t case 0xd9:\n\t length = this.view.getUint8(this.offset);\n\t this.offset += 1;\n\t return this.str(length);\n\t case 0xda:\n\t length = this.view.getUint16(this.offset);\n\t this.offset += 2;\n\t return this.str(length);\n\t case 0xdb:\n\t length = this.view.getUint32(this.offset);\n\t this.offset += 4;\n\t return this.str(length);\n\t\n\t // array\n\t case 0xdc:\n\t length = this.view.getUint16(this.offset);\n\t this.offset += 2;\n\t return this.array(length);\n\t case 0xdd:\n\t length = this.view.getUint32(this.offset);\n\t this.offset += 4;\n\t return this.array(length);\n\t\n\t // map\n\t case 0xde:\n\t length = this.view.getUint16(this.offset);\n\t this.offset += 2;\n\t return this.map(length);\n\t case 0xdf:\n\t length = this.view.getUint32(this.offset);\n\t this.offset += 4;\n\t return this.map(length);\n\t }\n\t\n\t throw new Error('Could not parse');\n\t};\n\t\n\tfunction decode(buffer) {\n\t var decoder = new Decoder(buffer);\n\t var value = decoder.parse();\n\t if (decoder.offset !== buffer.byteLength) {\n\t throw new Error((buffer.byteLength - decoder.offset) + ' trailing bytes');\n\t }\n\t return value;\n\t}\n\t\n\tmodule.exports = decode;\n\n\n/***/ })\n/******/ ])\n});\n;\n\n\n// WEBPACK FOOTER //\n// notepack.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 021f763394cb8091de38","exports.encode = require('./encode');\nexports.decode = require('./decode');\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/index.js\n// module id = 0\n// module chunks = 0","'use strict';\n\nfunction utf8Write(view, offset, str) {\n var c = 0;\n for (var i = 0, l = str.length; i < l; i++) {\n c = str.charCodeAt(i);\n if (c < 0x80) {\n view.setUint8(offset++, c);\n }\n else if (c < 0x800) {\n view.setUint8(offset++, 0xc0 | (c >> 6));\n view.setUint8(offset++, 0x80 | (c & 0x3f));\n }\n else if (c < 0xd800 || c >= 0xe000) {\n view.setUint8(offset++, 0xe0 | (c >> 12));\n view.setUint8(offset++, 0x80 | (c >> 6) & 0x3f);\n view.setUint8(offset++, 0x80 | (c & 0x3f));\n }\n else {\n i++;\n c = 0x10000 + (((c & 0x3ff) << 10) | (str.charCodeAt(i) & 0x3ff));\n view.setUint8(offset++, 0xf0 | (c >> 18));\n view.setUint8(offset++, 0x80 | (c >> 12) & 0x3f);\n view.setUint8(offset++, 0x80 | (c >> 6) & 0x3f);\n view.setUint8(offset++, 0x80 | (c & 0x3f));\n }\n }\n}\n\nfunction utf8Length(str) {\n var c = 0, length = 0;\n for (var i = 0, l = str.length; i < l; i++) {\n c = str.charCodeAt(i);\n if (c < 0x80) {\n length += 1;\n }\n else if (c < 0x800) {\n length += 2;\n }\n else if (c < 0xd800 || c >= 0xe000) {\n length += 3;\n }\n else {\n i++;\n length += 4;\n }\n }\n return length;\n}\n\nfunction _encode(bytes, defers, value) {\n var type = typeof value, i = 0, l = 0, hi = 0, lo = 0, length = 0, size = 0;\n\n if (type === 'string') {\n length = utf8Length(value);\n\n // fixstr\n if (length < 0x20) {\n bytes.push(length | 0xa0);\n size = 1;\n }\n // str 8\n else if (length < 0x100) {\n bytes.push(0xd9, length);\n size = 2;\n }\n // str 16\n else if (length < 0x10000) {\n bytes.push(0xda, length >> 8, length);\n size = 3;\n }\n // str 32\n else if (length < 0x100000000) {\n bytes.push(0xdb, length >> 24, length >> 16, length >> 8, length);\n size = 5;\n } else {\n throw new Error('String too long');\n }\n defers.push({ str: value, length: length, offset: bytes.length });\n return size + length;\n }\n if (type === 'number') {\n // TODO: encode to float 32?\n\n // float 64\n if (Math.floor(value) !== value || !isFinite(value)) {\n bytes.push(0xcb);\n defers.push({ float: value, length: 8, offset: bytes.length });\n return 9;\n }\n\n if (value >= 0) {\n // positive fixnum\n if (value < 0x80) {\n bytes.push(value);\n return 1;\n }\n // uint 8\n if (value < 0x100) {\n bytes.push(0xcc, value);\n return 2;\n }\n // uint 16\n if (value < 0x10000) {\n bytes.push(0xcd, value >> 8, value);\n return 3;\n }\n // uint 32\n if (value < 0x100000000) {\n bytes.push(0xce, value >> 24, value >> 16, value >> 8, value);\n return 5;\n }\n // uint 64\n hi = (value / Math.pow(2, 32)) >> 0;\n lo = value >>> 0;\n bytes.push(0xcf, hi >> 24, hi >> 16, hi >> 8, hi, lo >> 24, lo >> 16, lo >> 8, lo);\n return 9;\n } else {\n // negative fixnum\n if (value >= -0x20) {\n bytes.push(value);\n return 1;\n }\n // int 8\n if (value >= -0x80) {\n bytes.push(0xd0, value);\n return 2;\n }\n // int 16\n if (value >= -0x8000) {\n bytes.push(0xd1, value >> 8, value);\n return 3;\n }\n // int 32\n if (value >= -0x80000000) {\n bytes.push(0xd2, value >> 24, value >> 16, value >> 8, value);\n return 5;\n }\n // int 64\n hi = Math.floor(value / Math.pow(2, 32));\n lo = value >>> 0;\n bytes.push(0xd3, hi >> 24, hi >> 16, hi >> 8, hi, lo >> 24, lo >> 16, lo >> 8, lo);\n return 9;\n }\n }\n if (type === 'object') {\n // nil\n if (value === null) {\n bytes.push(0xc0);\n return 1;\n }\n\n if (Array.isArray(value)) {\n length = value.length;\n\n // fixarray\n if (length < 0x10) {\n bytes.push(length | 0x90);\n size = 1;\n }\n // array 16\n else if (length < 0x10000) {\n bytes.push(0xdc, length >> 8, length);\n size = 3;\n }\n // array 32\n else if (length < 0x100000000) {\n bytes.push(0xdd, length >> 24, length >> 16, length >> 8, length);\n size = 5;\n } else {\n throw new Error('Array too large');\n }\n for (i = 0; i < length; i++) {\n size += _encode(bytes, defers, value[i]);\n }\n return size;\n }\n\n // fixext 8 / Date\n if (value instanceof Date) {\n var time = value.getTime();\n hi = Math.floor(time / Math.pow(2, 32));\n lo = time >>> 0;\n bytes.push(0xd7, 0, hi >> 24, hi >> 16, hi >> 8, hi, lo >> 24, lo >> 16, lo >> 8, lo);\n return 10;\n }\n\n if (value instanceof ArrayBuffer) {\n length = value.byteLength;\n\n // bin 8\n if (length < 0x100) {\n bytes.push(0xc4, length);\n size = 2;\n } else\n // bin 16\n if (length < 0x10000) {\n bytes.push(0xc5, length >> 8, length);\n size = 3;\n } else\n // bin 32\n if (length < 0x100000000) {\n bytes.push(0xc6, length >> 24, length >> 16, length >> 8, length);\n size = 5;\n } else {\n throw new Error('Buffer too large');\n }\n defers.push({ bin: value, length: length, offset: bytes.length });\n return size + length;\n }\n\n if (typeof value.toJSON === 'function') {\n return _encode(bytes, defers, value.toJSON());\n }\n\n var keys = [], key = '';\n\n var allKeys = Object.keys(value);\n for (i = 0, l = allKeys.length; i < l; i++) {\n key = allKeys[i];\n if (typeof value[key] !== 'function') {\n keys.push(key);\n }\n }\n length = keys.length;\n\n // fixmap\n if (length < 0x10) {\n bytes.push(length | 0x80);\n size = 1;\n }\n // map 16\n else if (length < 0x10000) {\n bytes.push(0xde, length >> 8, length);\n size = 3;\n }\n // map 32\n else if (length < 0x100000000) {\n bytes.push(0xdf, length >> 24, length >> 16, length >> 8, length);\n size = 5;\n } else {\n throw new Error('Object too large');\n }\n\n for (i = 0; i < length; i++) {\n key = keys[i];\n size += _encode(bytes, defers, key);\n size += _encode(bytes, defers, value[key]);\n }\n return size;\n }\n // false/true\n if (type === 'boolean') {\n bytes.push(value ? 0xc3 : 0xc2);\n return 1;\n }\n // fixext 1 / undefined\n if (type === 'undefined') {\n bytes.push(0xd4, 0, 0);\n return 3;\n }\n throw new Error('Could not encode');\n}\n\nfunction encode(value) {\n var bytes = [];\n var defers = [];\n var size = _encode(bytes, defers, value);\n var buf = new ArrayBuffer(size);\n var view = new DataView(buf);\n\n var deferIndex = 0;\n var deferWritten = 0;\n var nextOffset = -1;\n if (defers.length > 0) {\n nextOffset = defers[0].offset;\n }\n\n var defer, deferLength = 0, offset = 0;\n for (var i = 0, l = bytes.length; i < l; i++) {\n view.setUint8(deferWritten + i, bytes[i]);\n if (i + 1 !== nextOffset) { continue; }\n defer = defers[deferIndex];\n deferLength = defer.length;\n offset = deferWritten + nextOffset;\n if (defer.bin) {\n var bin = new Uint8Array(defer.bin);\n for (var j = 0; j < deferLength; j++) {\n view.setUint8(offset + j, bin[j]);\n }\n } else if (defer.str) {\n utf8Write(view, offset, defer.str);\n } else if (defer.float !== undefined) {\n view.setFloat64(offset, defer.float);\n }\n deferIndex++;\n deferWritten += deferLength;\n if (defers[deferIndex]) {\n nextOffset = defers[deferIndex].offset;\n }\n }\n return buf;\n}\n\nmodule.exports = encode;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./browser/encode.js\n// module id = 1\n// module chunks = 0","'use strict';\n\nfunction Decoder(buffer) {\n this.offset = 0;\n if (buffer instanceof ArrayBuffer) {\n this.buffer = buffer;\n this.view = new DataView(this.buffer);\n } else if (ArrayBuffer.isView(buffer)) {\n this.buffer = buffer.buffer;\n this.view = new DataView(this.buffer, buffer.byteOffset, buffer.byteLength);\n } else {\n throw new Error('Invalid argument');\n }\n}\n\nfunction utf8Read(view, offset, length) {\n var string = '', chr = 0;\n for (var i = offset, end = offset + length; i < end; i++) {\n var byte = view.getUint8(i);\n if ((byte & 0x80) === 0x00) {\n string += String.fromCharCode(byte);\n continue;\n }\n if ((byte & 0xe0) === 0xc0) {\n string += String.fromCharCode(\n ((byte & 0x0f) << 6) |\n (view.getUint8(++i) & 0x3f)\n );\n continue;\n }\n if ((byte & 0xf0) === 0xe0) {\n string += String.fromCharCode(\n ((byte & 0x0f) << 12) |\n ((view.getUint8(++i) & 0x3f) << 6) |\n ((view.getUint8(++i) & 0x3f) << 0)\n );\n continue;\n }\n if ((byte & 0xf8) === 0xf0) {\n chr = ((byte & 0x07) << 18) |\n ((view.getUint8(++i) & 0x3f) << 12) |\n ((view.getUint8(++i) & 0x3f) << 6) |\n ((view.getUint8(++i) & 0x3f) << 0);\n if (chr >= 0x010000) { // surrogate pair\n chr -= 0x010000;\n string += String.fromCharCode((chr >>> 10) + 0xD800, (chr & 0x3FF) + 0xDC00);\n } else {\n string += String.fromCharCode(chr);\n }\n continue;\n }\n throw new Error('Invalid byte ' + byte.toString(16));\n }\n return string;\n}\n\nDecoder.prototype.array = function (length) {\n var value = new Array(length);\n for (var i = 0; i < length; i++) {\n value[i] = this.parse();\n }\n return value;\n};\n\nDecoder.prototype.map = function (length) {\n var key = '', value = {};\n for (var i = 0; i < length; i++) {\n key = this.parse();\n value[key] = this.parse();\n }\n return value;\n};\n\nDecoder.prototype.str = function (length) {\n var value = utf8Read(this.view, this.offset, length);\n this.offset += length;\n return value;\n};\n\nDecoder.prototype.bin = function (length) {\n var value = this.buffer.slice(this.offset, this.offset + length);\n this.offset += length;\n return value;\n};\n\nDecoder.prototype.parse = function () {\n var prefix = this.view.getUint8(this.offset++);\n var value, length = 0, type = 0, hi = 0, lo = 0;\n\n if (prefix < 0xc0) {\n // positive fixint\n if (prefix < 0x80) {\n return prefix;\n }\n // fixmap\n if (prefix < 0x90) {\n return this.map(prefix & 0x0f);\n }\n // fixarray\n if (prefix < 0xa0) {\n return this.array(prefix & 0x0f);\n }\n // fixstr\n return this.str(prefix & 0x1f);\n }\n\n // negative fixint\n if (prefix > 0xdf) {\n return (0xff - prefix + 1) * -1;\n }\n\n switch (prefix) {\n // nil\n case 0xc0:\n return null;\n // false\n case 0xc2:\n return false;\n // true\n case 0xc3:\n return true;\n\n // bin\n case 0xc4:\n length = this.view.getUint8(this.offset);\n this.offset += 1;\n return this.bin(length);\n case 0xc5:\n length = this.view.getUint16(this.offset);\n this.offset += 2;\n return this.bin(length);\n case 0xc6:\n length = this.view.getUint32(this.offset);\n this.offset += 4;\n return this.bin(length);\n\n // ext\n case 0xc7:\n length = this.view.getUint8(this.offset);\n type = this.view.getInt8(this.offset + 1);\n this.offset += 2;\n return [type, this.bin(length)];\n case 0xc8:\n length = this.view.getUint16(this.offset);\n type = this.view.getInt8(this.offset + 2);\n this.offset += 3;\n return [type, this.bin(length)];\n case 0xc9:\n length = this.view.getUint32(this.offset);\n type = this.view.getInt8(this.offset + 4);\n this.offset += 5;\n return [type, this.bin(length)];\n\n // float\n case 0xca:\n value = this.view.getFloat32(this.offset);\n this.offset += 4;\n return value;\n case 0xcb:\n value = this.view.getFloat64(this.offset);\n this.offset += 8;\n return value;\n\n // uint\n case 0xcc:\n value = this.view.getUint8(this.offset);\n this.offset += 1;\n return value;\n case 0xcd:\n value = this.view.getUint16(this.offset);\n this.offset += 2;\n return value;\n case 0xce:\n value = this.view.getUint32(this.offset);\n this.offset += 4;\n return value;\n case 0xcf:\n hi = this.view.getUint32(this.offset) * Math.pow(2, 32);\n lo = this.view.getUint32(this.offset + 4);\n this.offset += 8;\n return hi + lo;\n\n // int\n case 0xd0:\n value = this.view.getInt8(this.offset);\n this.offset += 1;\n return value;\n case 0xd1:\n value = this.view.getInt16(this.offset);\n this.offset += 2;\n return value;\n case 0xd2:\n value = this.view.getInt32(this.offset);\n this.offset += 4;\n return value;\n case 0xd3:\n hi = this.view.getInt32(this.offset) * Math.pow(2, 32);\n lo = this.view.getUint32(this.offset + 4);\n this.offset += 8;\n return hi + lo;\n\n // fixext\n case 0xd4:\n type = this.view.getInt8(this.offset);\n this.offset += 1;\n if (type === 0x00) {\n this.offset += 1;\n return void 0;\n }\n return [type, this.bin(1)];\n case 0xd5:\n type = this.view.getInt8(this.offset);\n this.offset += 1;\n return [type, this.bin(2)];\n case 0xd6:\n type = this.view.getInt8(this.offset);\n this.offset += 1;\n return [type, this.bin(4)];\n case 0xd7:\n type = this.view.getInt8(this.offset);\n this.offset += 1;\n if (type === 0x00) {\n hi = this.view.getInt32(this.offset) * Math.pow(2, 32);\n lo = this.view.getUint32(this.offset + 4);\n this.offset += 8;\n return new Date(hi + lo);\n }\n return [type, this.bin(8)];\n case 0xd8:\n type = this.view.getInt8(this.offset);\n this.offset += 1;\n return [type, this.bin(16)];\n\n // str\n case 0xd9:\n length = this.view.getUint8(this.offset);\n this.offset += 1;\n return this.str(length);\n case 0xda:\n length = this.view.getUint16(this.offset);\n this.offset += 2;\n return this.str(length);\n case 0xdb:\n length = this.view.getUint32(this.offset);\n this.offset += 4;\n return this.str(length);\n\n // array\n case 0xdc:\n length = this.view.getUint16(this.offset);\n this.offset += 2;\n return this.array(length);\n case 0xdd:\n length = this.view.getUint32(this.offset);\n this.offset += 4;\n return this.array(length);\n\n // map\n case 0xde:\n length = this.view.getUint16(this.offset);\n this.offset += 2;\n return this.map(length);\n case 0xdf:\n length = this.view.getUint32(this.offset);\n this.offset += 4;\n return this.map(length);\n }\n\n throw new Error('Could not parse');\n};\n\nfunction decode(buffer) {\n var decoder = new Decoder(buffer);\n var value = decoder.parse();\n if (decoder.offset !== buffer.byteLength) {\n throw new Error((buffer.byteLength - decoder.offset) + ' trailing bytes');\n }\n return value;\n}\n\nmodule.exports = decode;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./browser/decode.js\n// module id = 2\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///notepack.js","webpack:///webpack/bootstrap cfc79bcf2d5a2753c8f9","webpack:///./lib/index.js","webpack:///./browser/encode.js","webpack:///./browser/decode.js"],"names":["root","factory","exports","module","define","amd","this","modules","__webpack_require__","moduleId","installedModules","id","loaded","call","m","c","p","encode","decode","utf8Write","view","offset","str","i","l","length","charCodeAt","setUint8","utf8Length","_encode","bytes","defers","value","type","hi","lo","size","push","Error","Math","floor","isFinite","pow","float","Array","isArray","Date","time","getTime","ArrayBuffer","byteLength","bin","toJSON","keys","key","allKeys","Object","buf","DataView","deferIndex","deferWritten","nextOffset","defer","deferLength","Uint8Array","j","undefined","setFloat64","Decoder","buffer","isView","byteOffset","utf8Read","string","chr","end","byte","getUint8","toString","String","fromCharCode","decoder","parse","prototype","array","map","slice","prefix","getUint16","getUint32","getInt8","getFloat32","getFloat64","getInt16","getInt32"],"mappings":"CAAA,SAAAA,EAAAC,GACA,gBAAAC,UAAA,gBAAAC,QACAA,OAAAD,QAAAD,IACA,kBAAAG,gBAAAC,IACAD,UAAAH,GACA,gBAAAC,SACAA,QAAA,SAAAD,IAEAD,EAAA,SAAAC,KACCK,KAAA,WACD,MCAgB,UAAUC,GCN1B,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAP,OAGA,IAAAC,GAAAO,EAAAD,IACAP,WACAS,GAAAF,EACAG,QAAA,EAUA,OANAL,GAAAE,GAAAI,KAAAV,EAAAD,QAAAC,IAAAD,QAAAM,GAGAL,EAAAS,QAAA,EAGAT,EAAAD,QAvBA,GAAAQ,KAqCA,O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nF,KAAAe,OAAA,GACAf,KAAAe,QAAA,EACA,GAAAyB,MAAAZ,EAAAC,KAEAF,EAAA3B,KAAA6C,IAAA,GACA,UAGA,MAFAlB,GAAA3B,KAAAc,KAAAsE,QAAApF,KAAAe,QACAf,KAAAe,QAAA,GACAY,EAAA3B,KAAA6C,IAAA,IAGA,UAGA,MAFA1B,GAAAnB,KAAAc,KAAAyD,SAAAvE,KAAAe,QACAf,KAAAe,QAAA,EACAf,KAAAgB,IAAAG,EACA,UAGA,MAFAA,GAAAnB,KAAAc,KAAAoE,UAAAlF,KAAAe,QACAf,KAAAe,QAAA,EACAf,KAAAgB,IAAAG,EACA,UAGA,MAFAA,GAAAnB,KAAAc,KAAAqE,UAAAnF,KAAAe,QACAf,KAAAe,QAAA,EACAf,KAAAgB,IAAAG,EAGA,UAGA,MAFAA,GAAAnB,KAAAc,KAAAoE,UAAAlF,KAAAe,QACAf,KAAAe,QAAA,EACAf,KAAA8E,MAAA3D,EACA,UAGA,MAFAA,GAAAnB,KAAAc,KAAAqE,UAAAnF,KAAAe,QACAf,KAAAe,QAAA,EACAf,KAAA8E,MAAA3D,EAGA,UAGA,MAFAA,GAAAnB,KAAAc,KAAAoE,UAAAlF,KAAAe,QACAf,KAAAe,QAAA,EACAf,KAAA+E,IAAA5D,EACA,UAGA,MAFAA,GAAAnB,KAAAc,KAAAqE,UAAAnF,KAAAe,QACAf,KAAAe,QAAA,EACAf,KAAA+E,IAAA5D,GAGA,SAAAa,OAAA,oBAYAnC,EAAAD,QAAAgB","file":"notepack.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"notepack\"] = factory();\n\telse\n\t\troot[\"notepack\"] = factory();\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"notepack\"] = factory();\n\telse\n\t\troot[\"notepack\"] = factory();\n})(this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\texports.encode = __webpack_require__(1);\n\texports.decode = __webpack_require__(2);\n\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports) {\n\n\t'use strict';\n\t\n\tfunction utf8Write(view, offset, str) {\n\t var c = 0;\n\t for (var i = 0, l = str.length; i < l; i++) {\n\t c = str.charCodeAt(i);\n\t if (c < 0x80) {\n\t view.setUint8(offset++, c);\n\t }\n\t else if (c < 0x800) {\n\t view.setUint8(offset++, 0xc0 | (c >> 6));\n\t view.setUint8(offset++, 0x80 | (c & 0x3f));\n\t }\n\t else if (c < 0xd800 || c >= 0xe000) {\n\t view.setUint8(offset++, 0xe0 | (c >> 12));\n\t view.setUint8(offset++, 0x80 | (c >> 6) & 0x3f);\n\t view.setUint8(offset++, 0x80 | (c & 0x3f));\n\t }\n\t else {\n\t i++;\n\t c = 0x10000 + (((c & 0x3ff) << 10) | (str.charCodeAt(i) & 0x3ff));\n\t view.setUint8(offset++, 0xf0 | (c >> 18));\n\t view.setUint8(offset++, 0x80 | (c >> 12) & 0x3f);\n\t view.setUint8(offset++, 0x80 | (c >> 6) & 0x3f);\n\t view.setUint8(offset++, 0x80 | (c & 0x3f));\n\t }\n\t }\n\t}\n\t\n\tfunction utf8Length(str) {\n\t var c = 0, length = 0;\n\t for (var i = 0, l = str.length; i < l; i++) {\n\t c = str.charCodeAt(i);\n\t if (c < 0x80) {\n\t length += 1;\n\t }\n\t else if (c < 0x800) {\n\t length += 2;\n\t }\n\t else if (c < 0xd800 || c >= 0xe000) {\n\t length += 3;\n\t }\n\t else {\n\t i++;\n\t length += 4;\n\t }\n\t }\n\t return length;\n\t}\n\t\n\tfunction _encode(bytes, defers, value) {\n\t var type = typeof value, i = 0, l = 0, hi = 0, lo = 0, length = 0, size = 0;\n\t\n\t if (type === 'string') {\n\t length = utf8Length(value);\n\t\n\t // fixstr\n\t if (length < 0x20) {\n\t bytes.push(length | 0xa0);\n\t size = 1;\n\t }\n\t // str 8\n\t else if (length < 0x100) {\n\t bytes.push(0xd9, length);\n\t size = 2;\n\t }\n\t // str 16\n\t else if (length < 0x10000) {\n\t bytes.push(0xda, length >> 8, length);\n\t size = 3;\n\t }\n\t // str 32\n\t else if (length < 0x100000000) {\n\t bytes.push(0xdb, length >> 24, length >> 16, length >> 8, length);\n\t size = 5;\n\t } else {\n\t throw new Error('String too long');\n\t }\n\t defers.push({ str: value, length: length, offset: bytes.length });\n\t return size + length;\n\t }\n\t if (type === 'number') {\n\t // TODO: encode to float 32?\n\t\n\t // float 64\n\t if (Math.floor(value) !== value || !isFinite(value)) {\n\t bytes.push(0xcb);\n\t defers.push({ float: value, length: 8, offset: bytes.length });\n\t return 9;\n\t }\n\t\n\t if (value >= 0) {\n\t // positive fixnum\n\t if (value < 0x80) {\n\t bytes.push(value);\n\t return 1;\n\t }\n\t // uint 8\n\t if (value < 0x100) {\n\t bytes.push(0xcc, value);\n\t return 2;\n\t }\n\t // uint 16\n\t if (value < 0x10000) {\n\t bytes.push(0xcd, value >> 8, value);\n\t return 3;\n\t }\n\t // uint 32\n\t if (value < 0x100000000) {\n\t bytes.push(0xce, value >> 24, value >> 16, value >> 8, value);\n\t return 5;\n\t }\n\t // uint 64\n\t hi = (value / Math.pow(2, 32)) >> 0;\n\t lo = value >>> 0;\n\t bytes.push(0xcf, hi >> 24, hi >> 16, hi >> 8, hi, lo >> 24, lo >> 16, lo >> 8, lo);\n\t return 9;\n\t } else {\n\t // negative fixnum\n\t if (value >= -0x20) {\n\t bytes.push(value);\n\t return 1;\n\t }\n\t // int 8\n\t if (value >= -0x80) {\n\t bytes.push(0xd0, value);\n\t return 2;\n\t }\n\t // int 16\n\t if (value >= -0x8000) {\n\t bytes.push(0xd1, value >> 8, value);\n\t return 3;\n\t }\n\t // int 32\n\t if (value >= -0x80000000) {\n\t bytes.push(0xd2, value >> 24, value >> 16, value >> 8, value);\n\t return 5;\n\t }\n\t // int 64\n\t hi = Math.floor(value / Math.pow(2, 32));\n\t lo = value >>> 0;\n\t bytes.push(0xd3, hi >> 24, hi >> 16, hi >> 8, hi, lo >> 24, lo >> 16, lo >> 8, lo);\n\t return 9;\n\t }\n\t }\n\t if (type === 'object') {\n\t // nil\n\t if (value === null) {\n\t bytes.push(0xc0);\n\t return 1;\n\t }\n\t\n\t if (Array.isArray(value)) {\n\t length = value.length;\n\t\n\t // fixarray\n\t if (length < 0x10) {\n\t bytes.push(length | 0x90);\n\t size = 1;\n\t }\n\t // array 16\n\t else if (length < 0x10000) {\n\t bytes.push(0xdc, length >> 8, length);\n\t size = 3;\n\t }\n\t // array 32\n\t else if (length < 0x100000000) {\n\t bytes.push(0xdd, length >> 24, length >> 16, length >> 8, length);\n\t size = 5;\n\t } else {\n\t throw new Error('Array too large');\n\t }\n\t for (i = 0; i < length; i++) {\n\t size += _encode(bytes, defers, value[i]);\n\t }\n\t return size;\n\t }\n\t\n\t // fixext 8 / Date\n\t if (value instanceof Date) {\n\t var time = value.getTime();\n\t hi = Math.floor(time / Math.pow(2, 32));\n\t lo = time >>> 0;\n\t bytes.push(0xd7, 0, hi >> 24, hi >> 16, hi >> 8, hi, lo >> 24, lo >> 16, lo >> 8, lo);\n\t return 10;\n\t }\n\t\n\t if (value instanceof ArrayBuffer) {\n\t length = value.byteLength;\n\t\n\t // bin 8\n\t if (length < 0x100) {\n\t bytes.push(0xc4, length);\n\t size = 2;\n\t } else\n\t // bin 16\n\t if (length < 0x10000) {\n\t bytes.push(0xc5, length >> 8, length);\n\t size = 3;\n\t } else\n\t // bin 32\n\t if (length < 0x100000000) {\n\t bytes.push(0xc6, length >> 24, length >> 16, length >> 8, length);\n\t size = 5;\n\t } else {\n\t throw new Error('Buffer too large');\n\t }\n\t defers.push({ bin: value, length: length, offset: bytes.length });\n\t return size + length;\n\t }\n\t\n\t if (typeof value.toJSON === 'function') {\n\t return _encode(bytes, defers, value.toJSON());\n\t }\n\t\n\t var keys = [], key = '';\n\t\n\t var allKeys = Object.keys(value);\n\t for (i = 0, l = allKeys.length; i < l; i++) {\n\t key = allKeys[i];\n\t if (typeof value[key] !== 'function') {\n\t keys.push(key);\n\t }\n\t }\n\t length = keys.length;\n\t\n\t // fixmap\n\t if (length < 0x10) {\n\t bytes.push(length | 0x80);\n\t size = 1;\n\t }\n\t // map 16\n\t else if (length < 0x10000) {\n\t bytes.push(0xde, length >> 8, length);\n\t size = 3;\n\t }\n\t // map 32\n\t else if (length < 0x100000000) {\n\t bytes.push(0xdf, length >> 24, length >> 16, length >> 8, length);\n\t size = 5;\n\t } else {\n\t throw new Error('Object too large');\n\t }\n\t\n\t for (i = 0; i < length; i++) {\n\t key = keys[i];\n\t size += _encode(bytes, defers, key);\n\t size += _encode(bytes, defers, value[key]);\n\t }\n\t return size;\n\t }\n\t // false/true\n\t if (type === 'boolean') {\n\t bytes.push(value ? 0xc3 : 0xc2);\n\t return 1;\n\t }\n\t // fixext 1 / undefined\n\t if (type === 'undefined') {\n\t bytes.push(0xd4, 0, 0);\n\t return 3;\n\t }\n\t throw new Error('Could not encode');\n\t}\n\t\n\tfunction encode(value) {\n\t var bytes = [];\n\t var defers = [];\n\t var size = _encode(bytes, defers, value);\n\t var buf = new ArrayBuffer(size);\n\t var view = new DataView(buf);\n\t\n\t var deferIndex = 0;\n\t var deferWritten = 0;\n\t var nextOffset = -1;\n\t if (defers.length > 0) {\n\t nextOffset = defers[0].offset;\n\t }\n\t\n\t var defer, deferLength = 0, offset = 0;\n\t for (var i = 0, l = bytes.length; i < l; i++) {\n\t view.setUint8(deferWritten + i, bytes[i]);\n\t if (i + 1 !== nextOffset) { continue; }\n\t defer = defers[deferIndex];\n\t deferLength = defer.length;\n\t offset = deferWritten + nextOffset;\n\t if (defer.bin) {\n\t var bin = new Uint8Array(defer.bin);\n\t for (var j = 0; j < deferLength; j++) {\n\t view.setUint8(offset + j, bin[j]);\n\t }\n\t } else if (defer.str) {\n\t utf8Write(view, offset, defer.str);\n\t } else if (defer.float !== undefined) {\n\t view.setFloat64(offset, defer.float);\n\t }\n\t deferIndex++;\n\t deferWritten += deferLength;\n\t if (defers[deferIndex]) {\n\t nextOffset = defers[deferIndex].offset;\n\t }\n\t }\n\t return buf;\n\t}\n\t\n\tmodule.exports = encode;\n\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports) {\n\n\t'use strict';\n\t\n\tfunction Decoder(buffer) {\n\t this.offset = 0;\n\t if (buffer instanceof ArrayBuffer) {\n\t this.buffer = buffer;\n\t this.view = new DataView(this.buffer);\n\t } else if (ArrayBuffer.isView(buffer)) {\n\t this.buffer = buffer.buffer;\n\t this.view = new DataView(this.buffer, buffer.byteOffset, buffer.byteLength);\n\t } else {\n\t throw new Error('Invalid argument');\n\t }\n\t}\n\t\n\tfunction utf8Read(view, offset, length) {\n\t var string = '', chr = 0;\n\t for (var i = offset, end = offset + length; i < end; i++) {\n\t var byte = view.getUint8(i);\n\t if ((byte & 0x80) === 0x00) {\n\t string += String.fromCharCode(byte);\n\t continue;\n\t }\n\t if ((byte & 0xe0) === 0xc0) {\n\t string += String.fromCharCode(\n\t ((byte & 0x1f) << 6) |\n\t (view.getUint8(++i) & 0x3f)\n\t );\n\t continue;\n\t }\n\t if ((byte & 0xf0) === 0xe0) {\n\t string += String.fromCharCode(\n\t ((byte & 0x0f) << 12) |\n\t ((view.getUint8(++i) & 0x3f) << 6) |\n\t ((view.getUint8(++i) & 0x3f) << 0)\n\t );\n\t continue;\n\t }\n\t if ((byte & 0xf8) === 0xf0) {\n\t chr = ((byte & 0x07) << 18) |\n\t ((view.getUint8(++i) & 0x3f) << 12) |\n\t ((view.getUint8(++i) & 0x3f) << 6) |\n\t ((view.getUint8(++i) & 0x3f) << 0);\n\t if (chr >= 0x010000) { // surrogate pair\n\t chr -= 0x010000;\n\t string += String.fromCharCode((chr >>> 10) + 0xD800, (chr & 0x3FF) + 0xDC00);\n\t } else {\n\t string += String.fromCharCode(chr);\n\t }\n\t continue;\n\t }\n\t throw new Error('Invalid byte ' + byte.toString(16));\n\t }\n\t return string;\n\t}\n\t\n\tDecoder.prototype.array = function (length) {\n\t var value = new Array(length);\n\t for (var i = 0; i < length; i++) {\n\t value[i] = this.parse();\n\t }\n\t return value;\n\t};\n\t\n\tDecoder.prototype.map = function (length) {\n\t var key = '', value = {};\n\t for (var i = 0; i < length; i++) {\n\t key = this.parse();\n\t value[key] = this.parse();\n\t }\n\t return value;\n\t};\n\t\n\tDecoder.prototype.str = function (length) {\n\t var value = utf8Read(this.view, this.offset, length);\n\t this.offset += length;\n\t return value;\n\t};\n\t\n\tDecoder.prototype.bin = function (length) {\n\t var value = this.buffer.slice(this.offset, this.offset + length);\n\t this.offset += length;\n\t return value;\n\t};\n\t\n\tDecoder.prototype.parse = function () {\n\t var prefix = this.view.getUint8(this.offset++);\n\t var value, length = 0, type = 0, hi = 0, lo = 0;\n\t\n\t if (prefix < 0xc0) {\n\t // positive fixint\n\t if (prefix < 0x80) {\n\t return prefix;\n\t }\n\t // fixmap\n\t if (prefix < 0x90) {\n\t return this.map(prefix & 0x0f);\n\t }\n\t // fixarray\n\t if (prefix < 0xa0) {\n\t return this.array(prefix & 0x0f);\n\t }\n\t // fixstr\n\t return this.str(prefix & 0x1f);\n\t }\n\t\n\t // negative fixint\n\t if (prefix > 0xdf) {\n\t return (0xff - prefix + 1) * -1;\n\t }\n\t\n\t switch (prefix) {\n\t // nil\n\t case 0xc0:\n\t return null;\n\t // false\n\t case 0xc2:\n\t return false;\n\t // true\n\t case 0xc3:\n\t return true;\n\t\n\t // bin\n\t case 0xc4:\n\t length = this.view.getUint8(this.offset);\n\t this.offset += 1;\n\t return this.bin(length);\n\t case 0xc5:\n\t length = this.view.getUint16(this.offset);\n\t this.offset += 2;\n\t return this.bin(length);\n\t case 0xc6:\n\t length = this.view.getUint32(this.offset);\n\t this.offset += 4;\n\t return this.bin(length);\n\t\n\t // ext\n\t case 0xc7:\n\t length = this.view.getUint8(this.offset);\n\t type = this.view.getInt8(this.offset + 1);\n\t this.offset += 2;\n\t return [type, this.bin(length)];\n\t case 0xc8:\n\t length = this.view.getUint16(this.offset);\n\t type = this.view.getInt8(this.offset + 2);\n\t this.offset += 3;\n\t return [type, this.bin(length)];\n\t case 0xc9:\n\t length = this.view.getUint32(this.offset);\n\t type = this.view.getInt8(this.offset + 4);\n\t this.offset += 5;\n\t return [type, this.bin(length)];\n\t\n\t // float\n\t case 0xca:\n\t value = this.view.getFloat32(this.offset);\n\t this.offset += 4;\n\t return value;\n\t case 0xcb:\n\t value = this.view.getFloat64(this.offset);\n\t this.offset += 8;\n\t return value;\n\t\n\t // uint\n\t case 0xcc:\n\t value = this.view.getUint8(this.offset);\n\t this.offset += 1;\n\t return value;\n\t case 0xcd:\n\t value = this.view.getUint16(this.offset);\n\t this.offset += 2;\n\t return value;\n\t case 0xce:\n\t value = this.view.getUint32(this.offset);\n\t this.offset += 4;\n\t return value;\n\t case 0xcf:\n\t hi = this.view.getUint32(this.offset) * Math.pow(2, 32);\n\t lo = this.view.getUint32(this.offset + 4);\n\t this.offset += 8;\n\t return hi + lo;\n\t\n\t // int\n\t case 0xd0:\n\t value = this.view.getInt8(this.offset);\n\t this.offset += 1;\n\t return value;\n\t case 0xd1:\n\t value = this.view.getInt16(this.offset);\n\t this.offset += 2;\n\t return value;\n\t case 0xd2:\n\t value = this.view.getInt32(this.offset);\n\t this.offset += 4;\n\t return value;\n\t case 0xd3:\n\t hi = this.view.getInt32(this.offset) * Math.pow(2, 32);\n\t lo = this.view.getUint32(this.offset + 4);\n\t this.offset += 8;\n\t return hi + lo;\n\t\n\t // fixext\n\t case 0xd4:\n\t type = this.view.getInt8(this.offset);\n\t this.offset += 1;\n\t if (type === 0x00) {\n\t this.offset += 1;\n\t return void 0;\n\t }\n\t return [type, this.bin(1)];\n\t case 0xd5:\n\t type = this.view.getInt8(this.offset);\n\t this.offset += 1;\n\t return [type, this.bin(2)];\n\t case 0xd6:\n\t type = this.view.getInt8(this.offset);\n\t this.offset += 1;\n\t return [type, this.bin(4)];\n\t case 0xd7:\n\t type = this.view.getInt8(this.offset);\n\t this.offset += 1;\n\t if (type === 0x00) {\n\t hi = this.view.getInt32(this.offset) * Math.pow(2, 32);\n\t lo = this.view.getUint32(this.offset + 4);\n\t this.offset += 8;\n\t return new Date(hi + lo);\n\t }\n\t return [type, this.bin(8)];\n\t case 0xd8:\n\t type = this.view.getInt8(this.offset);\n\t this.offset += 1;\n\t return [type, this.bin(16)];\n\t\n\t // str\n\t case 0xd9:\n\t length = this.view.getUint8(this.offset);\n\t this.offset += 1;\n\t return this.str(length);\n\t case 0xda:\n\t length = this.view.getUint16(this.offset);\n\t this.offset += 2;\n\t return this.str(length);\n\t case 0xdb:\n\t length = this.view.getUint32(this.offset);\n\t this.offset += 4;\n\t return this.str(length);\n\t\n\t // array\n\t case 0xdc:\n\t length = this.view.getUint16(this.offset);\n\t this.offset += 2;\n\t return this.array(length);\n\t case 0xdd:\n\t length = this.view.getUint32(this.offset);\n\t this.offset += 4;\n\t return this.array(length);\n\t\n\t // map\n\t case 0xde:\n\t length = this.view.getUint16(this.offset);\n\t this.offset += 2;\n\t return this.map(length);\n\t case 0xdf:\n\t length = this.view.getUint32(this.offset);\n\t this.offset += 4;\n\t return this.map(length);\n\t }\n\t\n\t throw new Error('Could not parse');\n\t};\n\t\n\tfunction decode(buffer) {\n\t var decoder = new Decoder(buffer);\n\t var value = decoder.parse();\n\t if (decoder.offset !== buffer.byteLength) {\n\t throw new Error((buffer.byteLength - decoder.offset) + ' trailing bytes');\n\t }\n\t return value;\n\t}\n\t\n\tmodule.exports = decode;\n\n\n/***/ })\n/******/ ])\n});\n;\n\n\n// WEBPACK FOOTER //\n// notepack.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap cfc79bcf2d5a2753c8f9","exports.encode = require('./encode');\nexports.decode = require('./decode');\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/index.js\n// module id = 0\n// module chunks = 0","'use strict';\n\nfunction utf8Write(view, offset, str) {\n var c = 0;\n for (var i = 0, l = str.length; i < l; i++) {\n c = str.charCodeAt(i);\n if (c < 0x80) {\n view.setUint8(offset++, c);\n }\n else if (c < 0x800) {\n view.setUint8(offset++, 0xc0 | (c >> 6));\n view.setUint8(offset++, 0x80 | (c & 0x3f));\n }\n else if (c < 0xd800 || c >= 0xe000) {\n view.setUint8(offset++, 0xe0 | (c >> 12));\n view.setUint8(offset++, 0x80 | (c >> 6) & 0x3f);\n view.setUint8(offset++, 0x80 | (c & 0x3f));\n }\n else {\n i++;\n c = 0x10000 + (((c & 0x3ff) << 10) | (str.charCodeAt(i) & 0x3ff));\n view.setUint8(offset++, 0xf0 | (c >> 18));\n view.setUint8(offset++, 0x80 | (c >> 12) & 0x3f);\n view.setUint8(offset++, 0x80 | (c >> 6) & 0x3f);\n view.setUint8(offset++, 0x80 | (c & 0x3f));\n }\n }\n}\n\nfunction utf8Length(str) {\n var c = 0, length = 0;\n for (var i = 0, l = str.length; i < l; i++) {\n c = str.charCodeAt(i);\n if (c < 0x80) {\n length += 1;\n }\n else if (c < 0x800) {\n length += 2;\n }\n else if (c < 0xd800 || c >= 0xe000) {\n length += 3;\n }\n else {\n i++;\n length += 4;\n }\n }\n return length;\n}\n\nfunction _encode(bytes, defers, value) {\n var type = typeof value, i = 0, l = 0, hi = 0, lo = 0, length = 0, size = 0;\n\n if (type === 'string') {\n length = utf8Length(value);\n\n // fixstr\n if (length < 0x20) {\n bytes.push(length | 0xa0);\n size = 1;\n }\n // str 8\n else if (length < 0x100) {\n bytes.push(0xd9, length);\n size = 2;\n }\n // str 16\n else if (length < 0x10000) {\n bytes.push(0xda, length >> 8, length);\n size = 3;\n }\n // str 32\n else if (length < 0x100000000) {\n bytes.push(0xdb, length >> 24, length >> 16, length >> 8, length);\n size = 5;\n } else {\n throw new Error('String too long');\n }\n defers.push({ str: value, length: length, offset: bytes.length });\n return size + length;\n }\n if (type === 'number') {\n // TODO: encode to float 32?\n\n // float 64\n if (Math.floor(value) !== value || !isFinite(value)) {\n bytes.push(0xcb);\n defers.push({ float: value, length: 8, offset: bytes.length });\n return 9;\n }\n\n if (value >= 0) {\n // positive fixnum\n if (value < 0x80) {\n bytes.push(value);\n return 1;\n }\n // uint 8\n if (value < 0x100) {\n bytes.push(0xcc, value);\n return 2;\n }\n // uint 16\n if (value < 0x10000) {\n bytes.push(0xcd, value >> 8, value);\n return 3;\n }\n // uint 32\n if (value < 0x100000000) {\n bytes.push(0xce, value >> 24, value >> 16, value >> 8, value);\n return 5;\n }\n // uint 64\n hi = (value / Math.pow(2, 32)) >> 0;\n lo = value >>> 0;\n bytes.push(0xcf, hi >> 24, hi >> 16, hi >> 8, hi, lo >> 24, lo >> 16, lo >> 8, lo);\n return 9;\n } else {\n // negative fixnum\n if (value >= -0x20) {\n bytes.push(value);\n return 1;\n }\n // int 8\n if (value >= -0x80) {\n bytes.push(0xd0, value);\n return 2;\n }\n // int 16\n if (value >= -0x8000) {\n bytes.push(0xd1, value >> 8, value);\n return 3;\n }\n // int 32\n if (value >= -0x80000000) {\n bytes.push(0xd2, value >> 24, value >> 16, value >> 8, value);\n return 5;\n }\n // int 64\n hi = Math.floor(value / Math.pow(2, 32));\n lo = value >>> 0;\n bytes.push(0xd3, hi >> 24, hi >> 16, hi >> 8, hi, lo >> 24, lo >> 16, lo >> 8, lo);\n return 9;\n }\n }\n if (type === 'object') {\n // nil\n if (value === null) {\n bytes.push(0xc0);\n return 1;\n }\n\n if (Array.isArray(value)) {\n length = value.length;\n\n // fixarray\n if (length < 0x10) {\n bytes.push(length | 0x90);\n size = 1;\n }\n // array 16\n else if (length < 0x10000) {\n bytes.push(0xdc, length >> 8, length);\n size = 3;\n }\n // array 32\n else if (length < 0x100000000) {\n bytes.push(0xdd, length >> 24, length >> 16, length >> 8, length);\n size = 5;\n } else {\n throw new Error('Array too large');\n }\n for (i = 0; i < length; i++) {\n size += _encode(bytes, defers, value[i]);\n }\n return size;\n }\n\n // fixext 8 / Date\n if (value instanceof Date) {\n var time = value.getTime();\n hi = Math.floor(time / Math.pow(2, 32));\n lo = time >>> 0;\n bytes.push(0xd7, 0, hi >> 24, hi >> 16, hi >> 8, hi, lo >> 24, lo >> 16, lo >> 8, lo);\n return 10;\n }\n\n if (value instanceof ArrayBuffer) {\n length = value.byteLength;\n\n // bin 8\n if (length < 0x100) {\n bytes.push(0xc4, length);\n size = 2;\n } else\n // bin 16\n if (length < 0x10000) {\n bytes.push(0xc5, length >> 8, length);\n size = 3;\n } else\n // bin 32\n if (length < 0x100000000) {\n bytes.push(0xc6, length >> 24, length >> 16, length >> 8, length);\n size = 5;\n } else {\n throw new Error('Buffer too large');\n }\n defers.push({ bin: value, length: length, offset: bytes.length });\n return size + length;\n }\n\n if (typeof value.toJSON === 'function') {\n return _encode(bytes, defers, value.toJSON());\n }\n\n var keys = [], key = '';\n\n var allKeys = Object.keys(value);\n for (i = 0, l = allKeys.length; i < l; i++) {\n key = allKeys[i];\n if (typeof value[key] !== 'function') {\n keys.push(key);\n }\n }\n length = keys.length;\n\n // fixmap\n if (length < 0x10) {\n bytes.push(length | 0x80);\n size = 1;\n }\n // map 16\n else if (length < 0x10000) {\n bytes.push(0xde, length >> 8, length);\n size = 3;\n }\n // map 32\n else if (length < 0x100000000) {\n bytes.push(0xdf, length >> 24, length >> 16, length >> 8, length);\n size = 5;\n } else {\n throw new Error('Object too large');\n }\n\n for (i = 0; i < length; i++) {\n key = keys[i];\n size += _encode(bytes, defers, key);\n size += _encode(bytes, defers, value[key]);\n }\n return size;\n }\n // false/true\n if (type === 'boolean') {\n bytes.push(value ? 0xc3 : 0xc2);\n return 1;\n }\n // fixext 1 / undefined\n if (type === 'undefined') {\n bytes.push(0xd4, 0, 0);\n return 3;\n }\n throw new Error('Could not encode');\n}\n\nfunction encode(value) {\n var bytes = [];\n var defers = [];\n var size = _encode(bytes, defers, value);\n var buf = new ArrayBuffer(size);\n var view = new DataView(buf);\n\n var deferIndex = 0;\n var deferWritten = 0;\n var nextOffset = -1;\n if (defers.length > 0) {\n nextOffset = defers[0].offset;\n }\n\n var defer, deferLength = 0, offset = 0;\n for (var i = 0, l = bytes.length; i < l; i++) {\n view.setUint8(deferWritten + i, bytes[i]);\n if (i + 1 !== nextOffset) { continue; }\n defer = defers[deferIndex];\n deferLength = defer.length;\n offset = deferWritten + nextOffset;\n if (defer.bin) {\n var bin = new Uint8Array(defer.bin);\n for (var j = 0; j < deferLength; j++) {\n view.setUint8(offset + j, bin[j]);\n }\n } else if (defer.str) {\n utf8Write(view, offset, defer.str);\n } else if (defer.float !== undefined) {\n view.setFloat64(offset, defer.float);\n }\n deferIndex++;\n deferWritten += deferLength;\n if (defers[deferIndex]) {\n nextOffset = defers[deferIndex].offset;\n }\n }\n return buf;\n}\n\nmodule.exports = encode;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./browser/encode.js\n// module id = 1\n// module chunks = 0","'use strict';\n\nfunction Decoder(buffer) {\n this.offset = 0;\n if (buffer instanceof ArrayBuffer) {\n this.buffer = buffer;\n this.view = new DataView(this.buffer);\n } else if (ArrayBuffer.isView(buffer)) {\n this.buffer = buffer.buffer;\n this.view = new DataView(this.buffer, buffer.byteOffset, buffer.byteLength);\n } else {\n throw new Error('Invalid argument');\n }\n}\n\nfunction utf8Read(view, offset, length) {\n var string = '', chr = 0;\n for (var i = offset, end = offset + length; i < end; i++) {\n var byte = view.getUint8(i);\n if ((byte & 0x80) === 0x00) {\n string += String.fromCharCode(byte);\n continue;\n }\n if ((byte & 0xe0) === 0xc0) {\n string += String.fromCharCode(\n ((byte & 0x1f) << 6) |\n (view.getUint8(++i) & 0x3f)\n );\n continue;\n }\n if ((byte & 0xf0) === 0xe0) {\n string += String.fromCharCode(\n ((byte & 0x0f) << 12) |\n ((view.getUint8(++i) & 0x3f) << 6) |\n ((view.getUint8(++i) & 0x3f) << 0)\n );\n continue;\n }\n if ((byte & 0xf8) === 0xf0) {\n chr = ((byte & 0x07) << 18) |\n ((view.getUint8(++i) & 0x3f) << 12) |\n ((view.getUint8(++i) & 0x3f) << 6) |\n ((view.getUint8(++i) & 0x3f) << 0);\n if (chr >= 0x010000) { // surrogate pair\n chr -= 0x010000;\n string += String.fromCharCode((chr >>> 10) + 0xD800, (chr & 0x3FF) + 0xDC00);\n } else {\n string += String.fromCharCode(chr);\n }\n continue;\n }\n throw new Error('Invalid byte ' + byte.toString(16));\n }\n return string;\n}\n\nDecoder.prototype.array = function (length) {\n var value = new Array(length);\n for (var i = 0; i < length; i++) {\n value[i] = this.parse();\n }\n return value;\n};\n\nDecoder.prototype.map = function (length) {\n var key = '', value = {};\n for (var i = 0; i < length; i++) {\n key = this.parse();\n value[key] = this.parse();\n }\n return value;\n};\n\nDecoder.prototype.str = function (length) {\n var value = utf8Read(this.view, this.offset, length);\n this.offset += length;\n return value;\n};\n\nDecoder.prototype.bin = function (length) {\n var value = this.buffer.slice(this.offset, this.offset + length);\n this.offset += length;\n return value;\n};\n\nDecoder.prototype.parse = function () {\n var prefix = this.view.getUint8(this.offset++);\n var value, length = 0, type = 0, hi = 0, lo = 0;\n\n if (prefix < 0xc0) {\n // positive fixint\n if (prefix < 0x80) {\n return prefix;\n }\n // fixmap\n if (prefix < 0x90) {\n return this.map(prefix & 0x0f);\n }\n // fixarray\n if (prefix < 0xa0) {\n return this.array(prefix & 0x0f);\n }\n // fixstr\n return this.str(prefix & 0x1f);\n }\n\n // negative fixint\n if (prefix > 0xdf) {\n return (0xff - prefix + 1) * -1;\n }\n\n switch (prefix) {\n // nil\n case 0xc0:\n return null;\n // false\n case 0xc2:\n return false;\n // true\n case 0xc3:\n return true;\n\n // bin\n case 0xc4:\n length = this.view.getUint8(this.offset);\n this.offset += 1;\n return this.bin(length);\n case 0xc5:\n length = this.view.getUint16(this.offset);\n this.offset += 2;\n return this.bin(length);\n case 0xc6:\n length = this.view.getUint32(this.offset);\n this.offset += 4;\n return this.bin(length);\n\n // ext\n case 0xc7:\n length = this.view.getUint8(this.offset);\n type = this.view.getInt8(this.offset + 1);\n this.offset += 2;\n return [type, this.bin(length)];\n case 0xc8:\n length = this.view.getUint16(this.offset);\n type = this.view.getInt8(this.offset + 2);\n this.offset += 3;\n return [type, this.bin(length)];\n case 0xc9:\n length = this.view.getUint32(this.offset);\n type = this.view.getInt8(this.offset + 4);\n this.offset += 5;\n return [type, this.bin(length)];\n\n // float\n case 0xca:\n value = this.view.getFloat32(this.offset);\n this.offset += 4;\n return value;\n case 0xcb:\n value = this.view.getFloat64(this.offset);\n this.offset += 8;\n return value;\n\n // uint\n case 0xcc:\n value = this.view.getUint8(this.offset);\n this.offset += 1;\n return value;\n case 0xcd:\n value = this.view.getUint16(this.offset);\n this.offset += 2;\n return value;\n case 0xce:\n value = this.view.getUint32(this.offset);\n this.offset += 4;\n return value;\n case 0xcf:\n hi = this.view.getUint32(this.offset) * Math.pow(2, 32);\n lo = this.view.getUint32(this.offset + 4);\n this.offset += 8;\n return hi + lo;\n\n // int\n case 0xd0:\n value = this.view.getInt8(this.offset);\n this.offset += 1;\n return value;\n case 0xd1:\n value = this.view.getInt16(this.offset);\n this.offset += 2;\n return value;\n case 0xd2:\n value = this.view.getInt32(this.offset);\n this.offset += 4;\n return value;\n case 0xd3:\n hi = this.view.getInt32(this.offset) * Math.pow(2, 32);\n lo = this.view.getUint32(this.offset + 4);\n this.offset += 8;\n return hi + lo;\n\n // fixext\n case 0xd4:\n type = this.view.getInt8(this.offset);\n this.offset += 1;\n if (type === 0x00) {\n this.offset += 1;\n return void 0;\n }\n return [type, this.bin(1)];\n case 0xd5:\n type = this.view.getInt8(this.offset);\n this.offset += 1;\n return [type, this.bin(2)];\n case 0xd6:\n type = this.view.getInt8(this.offset);\n this.offset += 1;\n return [type, this.bin(4)];\n case 0xd7:\n type = this.view.getInt8(this.offset);\n this.offset += 1;\n if (type === 0x00) {\n hi = this.view.getInt32(this.offset) * Math.pow(2, 32);\n lo = this.view.getUint32(this.offset + 4);\n this.offset += 8;\n return new Date(hi + lo);\n }\n return [type, this.bin(8)];\n case 0xd8:\n type = this.view.getInt8(this.offset);\n this.offset += 1;\n return [type, this.bin(16)];\n\n // str\n case 0xd9:\n length = this.view.getUint8(this.offset);\n this.offset += 1;\n return this.str(length);\n case 0xda:\n length = this.view.getUint16(this.offset);\n this.offset += 2;\n return this.str(length);\n case 0xdb:\n length = this.view.getUint32(this.offset);\n this.offset += 4;\n return this.str(length);\n\n // array\n case 0xdc:\n length = this.view.getUint16(this.offset);\n this.offset += 2;\n return this.array(length);\n case 0xdd:\n length = this.view.getUint32(this.offset);\n this.offset += 4;\n return this.array(length);\n\n // map\n case 0xde:\n length = this.view.getUint16(this.offset);\n this.offset += 2;\n return this.map(length);\n case 0xdf:\n length = this.view.getUint32(this.offset);\n this.offset += 4;\n return this.map(length);\n }\n\n throw new Error('Could not parse');\n};\n\nfunction decode(buffer) {\n var decoder = new Decoder(buffer);\n var value = decoder.parse();\n if (decoder.offset !== buffer.byteLength) {\n throw new Error((buffer.byteLength - decoder.offset) + ' trailing bytes');\n }\n return value;\n}\n\nmodule.exports = decode;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./browser/decode.js\n// module id = 2\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/test/browser.js b/test/browser.js index 405f2a4..80f34eb 100644 --- a/test/browser.js +++ b/test/browser.js @@ -50,6 +50,17 @@ describe('notepack (browser build)', function() { expect(notepack.encode(obj)).to.deep.equal(notepack.encode('c')); }); + it('utf-8', function() { + // 1-byte + expect(notepack.decode(notepack.encode('äß'))).to.equal('äß'); + // 2-byte + expect(notepack.decode(notepack.encode('עִבְרִית'))).to.equal('עִבְרִית'); + // 3-byte + expect(notepack.decode(notepack.encode('\u13DA'))).to.equal('\u13DA'); + // 4-byte + expect(notepack.decode(notepack.encode('🌐'))).to.equal('🌐'); + }); + it('all formats', function () { this.timeout(20000); var expected = {