diff --git a/Drama Script.pdf b/Drama Script.pdf new file mode 100644 index 0000000..2cd0f03 Binary files /dev/null and b/Drama Script.pdf differ diff --git a/Modern-white-inspired-home-office-design.jpg b/Modern-white-inspired-home-office-design.jpg new file mode 100644 index 0000000..248dea3 Binary files /dev/null and b/Modern-white-inspired-home-office-design.jpg differ diff --git a/README.md b/README.md index 2d57090..5d4951e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -sfxboard -======== -sfxboard +# The entire set used in our EL drama + +Undocumented yet. Sorry! \ No newline at end of file diff --git a/SFX.get.md b/SFX.get.md new file mode 100644 index 0000000..9e76b29 --- /dev/null +++ b/SFX.get.md @@ -0,0 +1,17 @@ +• car impact +• car driving +• handcuffs +• car driving off (car driving off) +screams +• car doors open and closing +• ambulance +door knocks +phone ring +clock ticking +seaside +(laptop screen + vlc) +bomb beeping +• explosion (Nice guy: http://www.freesound.org/people/DJ%20Chronos/packs/7725/) +• gun fire (4 types, random) + +background bass diff --git a/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E.aup b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E.aup new file mode 100644 index 0000000..d0ae765 --- /dev/null +++ b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E.aup @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e000005d.au b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e000005d.au new file mode 100644 index 0000000..a6f396e Binary files /dev/null and b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e000005d.au differ diff --git a/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000126.au b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000126.au new file mode 100644 index 0000000..a48a511 Binary files /dev/null and b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000126.au differ diff --git a/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000152.au b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000152.au new file mode 100644 index 0000000..94be757 Binary files /dev/null and b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000152.au differ diff --git a/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000183.au b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000183.au new file mode 100644 index 0000000..d6c7954 Binary files /dev/null and b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000183.au differ diff --git a/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000190.au b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000190.au new file mode 100644 index 0000000..c67db22 Binary files /dev/null and b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000190.au differ diff --git a/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e00001c7.au b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e00001c7.au new file mode 100644 index 0000000..4757f28 Binary files /dev/null and b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e00001c7.au differ diff --git a/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e00001ed.au b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e00001ed.au new file mode 100644 index 0000000..100f0af Binary files /dev/null and b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e00001ed.au differ diff --git a/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e00002d9.au b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e00002d9.au new file mode 100644 index 0000000..81d6fef Binary files /dev/null and b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e00002d9.au differ diff --git a/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000315.au b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000315.au new file mode 100644 index 0000000..5cc1cfe Binary files /dev/null and b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000315.au differ diff --git a/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000366.au b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000366.au new file mode 100644 index 0000000..9d3a746 Binary files /dev/null and b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000366.au differ diff --git a/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e00003b9.au b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e00003b9.au new file mode 100644 index 0000000..51f548b Binary files /dev/null and b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e00003b9.au differ diff --git a/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e00004f9.au b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e00004f9.au new file mode 100644 index 0000000..aedac78 Binary files /dev/null and b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e00004f9.au differ diff --git a/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000512.au b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000512.au new file mode 100644 index 0000000..0e5bb97 Binary files /dev/null and b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000512.au differ diff --git a/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e00005af.au b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e00005af.au new file mode 100644 index 0000000..aa16a79 Binary files /dev/null and b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e00005af.au differ diff --git a/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000783.au b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000783.au new file mode 100644 index 0000000..a06a66a Binary files /dev/null and b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000783.au differ diff --git a/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000867.au b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000867.au new file mode 100644 index 0000000..772bb9f Binary files /dev/null and b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000867.au differ diff --git a/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e00008b5.au b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e00008b5.au new file mode 100644 index 0000000..439d6ac Binary files /dev/null and b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e00008b5.au differ diff --git a/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e00008f8.au b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e00008f8.au new file mode 100644 index 0000000..067185b Binary files /dev/null and b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e00008f8.au differ diff --git a/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000a2e.au b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000a2e.au new file mode 100644 index 0000000..dfda083 Binary files /dev/null and b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000a2e.au differ diff --git a/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000abc.au b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000abc.au new file mode 100644 index 0000000..e184de6 Binary files /dev/null and b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000abc.au differ diff --git a/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000b72.au b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000b72.au new file mode 100644 index 0000000..110f13c Binary files /dev/null and b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000b72.au differ diff --git a/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000b82.au b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000b82.au new file mode 100644 index 0000000..99ca6db Binary files /dev/null and b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000b82.au differ diff --git a/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000b8f.au b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000b8f.au new file mode 100644 index 0000000..404d497 Binary files /dev/null and b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000b8f.au differ diff --git a/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000bb8.au b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000bb8.au new file mode 100644 index 0000000..221c414 Binary files /dev/null and b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000bb8.au differ diff --git a/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000bd6.au b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000bd6.au new file mode 100644 index 0000000..fbcea69 Binary files /dev/null and b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000bd6.au differ diff --git a/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000bee.au b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000bee.au new file mode 100644 index 0000000..83daf75 Binary files /dev/null and b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000bee.au differ diff --git a/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000c4a.au b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000c4a.au new file mode 100644 index 0000000..e827257 Binary files /dev/null and b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000c4a.au differ diff --git a/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000c84.au b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000c84.au new file mode 100644 index 0000000..662f9ca Binary files /dev/null and b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000c84.au differ diff --git a/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000c9e.au b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000c9e.au new file mode 100644 index 0000000..8572546 Binary files /dev/null and b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000c9e.au differ diff --git a/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000cd3.au b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000cd3.au new file mode 100644 index 0000000..3fa664a Binary files /dev/null and b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000cd3.au differ diff --git a/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000ddb.au b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000ddb.au new file mode 100644 index 0000000..cb8f84f Binary files /dev/null and b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000ddb.au differ diff --git a/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000de3.au b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000de3.au new file mode 100644 index 0000000..61cc965 Binary files /dev/null and b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000de3.au differ diff --git a/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000e62.au b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000e62.au new file mode 100644 index 0000000..ebe3c15 Binary files /dev/null and b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000e62.au differ diff --git a/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000eaf.au b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000eaf.au new file mode 100644 index 0000000..2d32ad2 Binary files /dev/null and b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000eaf.au differ diff --git a/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000ece.au b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000ece.au new file mode 100644 index 0000000..5b8b715 Binary files /dev/null and b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000ece.au differ diff --git a/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000f99.au b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000f99.au new file mode 100644 index 0000000..c6cfff1 Binary files /dev/null and b/aup/Zack Hemsey - 'See What I've Become'-lWDYAJ2-Y1E_data/e00/d00/e0000f99.au differ diff --git a/aup/beep1.aup b/aup/beep1.aup new file mode 100644 index 0000000..df17bbd --- /dev/null +++ b/aup/beep1.aup @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/aup/beep1_data/e00/d00/e0000296.au b/aup/beep1_data/e00/d00/e0000296.au new file mode 100644 index 0000000..b2e1613 Binary files /dev/null and b/aup/beep1_data/e00/d00/e0000296.au differ diff --git a/aup/beep1_data/e00/d00/e0000697.au b/aup/beep1_data/e00/d00/e0000697.au new file mode 100644 index 0000000..f3573e5 Binary files /dev/null and b/aup/beep1_data/e00/d00/e0000697.au differ diff --git a/aup/beep1_data/e00/d00/e0000e5b.au b/aup/beep1_data/e00/d00/e0000e5b.au new file mode 100644 index 0000000..ad16689 Binary files /dev/null and b/aup/beep1_data/e00/d00/e0000e5b.au differ diff --git a/aup/beep2.aup b/aup/beep2.aup new file mode 100644 index 0000000..1b4029d --- /dev/null +++ b/aup/beep2.aup @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/aup/beep2_data/e00/d00/e00003fd.au b/aup/beep2_data/e00/d00/e00003fd.au new file mode 100644 index 0000000..a97bc13 Binary files /dev/null and b/aup/beep2_data/e00/d00/e00003fd.au differ diff --git a/aup/beep2_data/e00/d00/e00004c5.au b/aup/beep2_data/e00/d00/e00004c5.au new file mode 100644 index 0000000..09b62bc Binary files /dev/null and b/aup/beep2_data/e00/d00/e00004c5.au differ diff --git a/aup/beep2_data/e00/d00/e000054b.au b/aup/beep2_data/e00/d00/e000054b.au new file mode 100644 index 0000000..c02f480 Binary files /dev/null and b/aup/beep2_data/e00/d00/e000054b.au differ diff --git a/aup/car1.wav.aup b/aup/car1.wav.aup new file mode 100644 index 0000000..e87df3e --- /dev/null +++ b/aup/car1.wav.aup @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/aup/car1.wav_data/e00/d00/e00007e4.au b/aup/car1.wav_data/e00/d00/e00007e4.au new file mode 100644 index 0000000..f554ac2 Binary files /dev/null and b/aup/car1.wav_data/e00/d00/e00007e4.au differ diff --git a/aup/car1.wav_data/e00/d00/e0000ad6.au b/aup/car1.wav_data/e00/d00/e0000ad6.au new file mode 100644 index 0000000..86f5ab5 Binary files /dev/null and b/aup/car1.wav_data/e00/d00/e0000ad6.au differ diff --git a/aup/car1.wav_data/e00/d00/e0000b21.au b/aup/car1.wav_data/e00/d00/e0000b21.au new file mode 100644 index 0000000..c2b46d1 Binary files /dev/null and b/aup/car1.wav_data/e00/d00/e0000b21.au differ diff --git a/aup/car1.wav_data/e00/d00/e0000bbd.au b/aup/car1.wav_data/e00/d00/e0000bbd.au new file mode 100644 index 0000000..1f7a1f1 Binary files /dev/null and b/aup/car1.wav_data/e00/d00/e0000bbd.au differ diff --git a/aup/car2.wav.aup b/aup/car2.wav.aup new file mode 100644 index 0000000..989602b --- /dev/null +++ b/aup/car2.wav.aup @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/aup/car2.wav_data/e00/d00/e000010d.au b/aup/car2.wav_data/e00/d00/e000010d.au new file mode 100644 index 0000000..3d73efd Binary files /dev/null and b/aup/car2.wav_data/e00/d00/e000010d.au differ diff --git a/aup/car2.wav_data/e00/d00/e0000451.au b/aup/car2.wav_data/e00/d00/e0000451.au new file mode 100644 index 0000000..38f47a1 Binary files /dev/null and b/aup/car2.wav_data/e00/d00/e0000451.au differ diff --git a/aup/car2.wav_data/e00/d00/e000061e.au b/aup/car2.wav_data/e00/d00/e000061e.au new file mode 100644 index 0000000..de3f83b Binary files /dev/null and b/aup/car2.wav_data/e00/d00/e000061e.au differ diff --git a/aup/car2.wav_data/e00/d00/e0000694.au b/aup/car2.wav_data/e00/d00/e0000694.au new file mode 100644 index 0000000..4b8ca39 Binary files /dev/null and b/aup/car2.wav_data/e00/d00/e0000694.au differ diff --git a/aup/car2.wav_data/e00/d00/e0000af0.au b/aup/car2.wav_data/e00/d00/e0000af0.au new file mode 100644 index 0000000..048f13b Binary files /dev/null and b/aup/car2.wav_data/e00/d00/e0000af0.au differ diff --git a/aup/car2.wav_data/e00/d00/e0000bad.au b/aup/car2.wav_data/e00/d00/e0000bad.au new file mode 100644 index 0000000..3f0762c Binary files /dev/null and b/aup/car2.wav_data/e00/d00/e0000bad.au differ diff --git a/aup/car2.wav_data/e00/d00/e0000dfe.au b/aup/car2.wav_data/e00/d00/e0000dfe.au new file mode 100644 index 0000000..5cb9fbb Binary files /dev/null and b/aup/car2.wav_data/e00/d00/e0000dfe.au differ diff --git a/aup/car2.wav_data/e00/d00/e0000ed4.au b/aup/car2.wav_data/e00/d00/e0000ed4.au new file mode 100644 index 0000000..4c78edb Binary files /dev/null and b/aup/car2.wav_data/e00/d00/e0000ed4.au differ diff --git a/aup/cardoorclose.wav.aup b/aup/cardoorclose.wav.aup new file mode 100644 index 0000000..e1cccd7 --- /dev/null +++ b/aup/cardoorclose.wav.aup @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/aup/cardoorclose.wav_data/e00/d00/e000066d.au b/aup/cardoorclose.wav_data/e00/d00/e000066d.au new file mode 100644 index 0000000..237e563 Binary files /dev/null and b/aup/cardoorclose.wav_data/e00/d00/e000066d.au differ diff --git a/aup/cardoorclose.wav_data/e00/d00/e0000e6f.au b/aup/cardoorclose.wav_data/e00/d00/e0000e6f.au new file mode 100644 index 0000000..37abb9a Binary files /dev/null and b/aup/cardoorclose.wav_data/e00/d00/e0000e6f.au differ diff --git a/aup/cardooropen.wav.aup b/aup/cardooropen.wav.aup new file mode 100644 index 0000000..d6798ca --- /dev/null +++ b/aup/cardooropen.wav.aup @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/aup/cardooropen.wav_data/e00/d00/e00001c6.au b/aup/cardooropen.wav_data/e00/d00/e00001c6.au new file mode 100644 index 0000000..736b37d Binary files /dev/null and b/aup/cardooropen.wav_data/e00/d00/e00001c6.au differ diff --git a/aup/cardooropen.wav_data/e00/d00/e0000d8f.au b/aup/cardooropen.wav_data/e00/d00/e0000d8f.au new file mode 100644 index 0000000..d3a6b08 Binary files /dev/null and b/aup/cardooropen.wav_data/e00/d00/e0000d8f.au differ diff --git a/aup/carstart.aiff b/aup/carstart.aiff new file mode 100644 index 0000000..7f04581 Binary files /dev/null and b/aup/carstart.aiff differ diff --git a/aup/carstart.aup b/aup/carstart.aup new file mode 100644 index 0000000..07c62e4 --- /dev/null +++ b/aup/carstart.aup @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/aup/carstart.mp3 b/aup/carstart.mp3 new file mode 100644 index 0000000..3dad20c Binary files /dev/null and b/aup/carstart.mp3 differ diff --git a/aup/carstart_data/e00/d00/e0000136.au b/aup/carstart_data/e00/d00/e0000136.au new file mode 100644 index 0000000..8f85fe9 Binary files /dev/null and b/aup/carstart_data/e00/d00/e0000136.au differ diff --git a/aup/explosion.aup b/aup/explosion.aup new file mode 100644 index 0000000..8282f93 --- /dev/null +++ b/aup/explosion.aup @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/aup/explosion_data/e00/d00/e00000ba.au b/aup/explosion_data/e00/d00/e00000ba.au new file mode 100644 index 0000000..4254c79 Binary files /dev/null and b/aup/explosion_data/e00/d00/e00000ba.au differ diff --git a/aup/explosion_data/e00/d00/e000029b.au b/aup/explosion_data/e00/d00/e000029b.au new file mode 100644 index 0000000..2097b65 Binary files /dev/null and b/aup/explosion_data/e00/d00/e000029b.au differ diff --git a/aup/explosion_data/e00/d00/e000057b.au b/aup/explosion_data/e00/d00/e000057b.au new file mode 100644 index 0000000..b4bda61 Binary files /dev/null and b/aup/explosion_data/e00/d00/e000057b.au differ diff --git a/aup/explosion_data/e00/d00/e000066a.au b/aup/explosion_data/e00/d00/e000066a.au new file mode 100644 index 0000000..054a02d Binary files /dev/null and b/aup/explosion_data/e00/d00/e000066a.au differ diff --git a/aup/explosion_data/e00/d00/e0000803.au b/aup/explosion_data/e00/d00/e0000803.au new file mode 100644 index 0000000..bc74fdb Binary files /dev/null and b/aup/explosion_data/e00/d00/e0000803.au differ diff --git a/aup/explosion_data/e00/d00/e0000a37.au b/aup/explosion_data/e00/d00/e0000a37.au new file mode 100644 index 0000000..bc74fdb Binary files /dev/null and b/aup/explosion_data/e00/d00/e0000a37.au differ diff --git a/aup/firereload.wav.aup b/aup/firereload.wav.aup new file mode 100644 index 0000000..ed98910 --- /dev/null +++ b/aup/firereload.wav.aup @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/aup/firereload.wav_data/e00/d00/e0000627.au b/aup/firereload.wav_data/e00/d00/e0000627.au new file mode 100644 index 0000000..c428635 Binary files /dev/null and b/aup/firereload.wav_data/e00/d00/e0000627.au differ diff --git a/aup/policesiren.wav.aup b/aup/policesiren.wav.aup new file mode 100644 index 0000000..771be79 --- /dev/null +++ b/aup/policesiren.wav.aup @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/aup/policesiren.wav_data/e00/d00/e00000c1.au b/aup/policesiren.wav_data/e00/d00/e00000c1.au new file mode 100644 index 0000000..a4e73d8 Binary files /dev/null and b/aup/policesiren.wav_data/e00/d00/e00000c1.au differ diff --git a/aup/revolver1.wav.aup b/aup/revolver1.wav.aup new file mode 100644 index 0000000..c31dd3e --- /dev/null +++ b/aup/revolver1.wav.aup @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/aup/revolver1.wav_data/e00/d00/e0000957.au b/aup/revolver1.wav_data/e00/d00/e0000957.au new file mode 100644 index 0000000..1a7ff3e Binary files /dev/null and b/aup/revolver1.wav_data/e00/d00/e0000957.au differ diff --git a/aup/revolver1.wav_data/e00/d00/e0000b60.au b/aup/revolver1.wav_data/e00/d00/e0000b60.au new file mode 100644 index 0000000..e499b47 Binary files /dev/null and b/aup/revolver1.wav_data/e00/d00/e0000b60.au differ diff --git a/aup/revolver2.wav.aup b/aup/revolver2.wav.aup new file mode 100644 index 0000000..b5db2b1 --- /dev/null +++ b/aup/revolver2.wav.aup @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/aup/revolver2.wav_data/e00/d00/e00001a9.au b/aup/revolver2.wav_data/e00/d00/e00001a9.au new file mode 100644 index 0000000..ffd7be7 Binary files /dev/null and b/aup/revolver2.wav_data/e00/d00/e00001a9.au differ diff --git a/aup/revolver2.wav_data/e00/d00/e0000a6a.au b/aup/revolver2.wav_data/e00/d00/e0000a6a.au new file mode 100644 index 0000000..91e3e53 Binary files /dev/null and b/aup/revolver2.wav_data/e00/d00/e0000a6a.au differ diff --git a/aup/see.wav.aup b/aup/see.wav.aup new file mode 100644 index 0000000..8a9262c --- /dev/null +++ b/aup/see.wav.aup @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/aup/see.wav_data/e00/d00/e0000061.au b/aup/see.wav_data/e00/d00/e0000061.au new file mode 100644 index 0000000..aa16a79 Binary files /dev/null and b/aup/see.wav_data/e00/d00/e0000061.au differ diff --git a/aup/see.wav_data/e00/d00/e00000ff.au b/aup/see.wav_data/e00/d00/e00000ff.au new file mode 100644 index 0000000..8a4ce2a Binary files /dev/null and b/aup/see.wav_data/e00/d00/e00000ff.au differ diff --git a/aup/see.wav_data/e00/d00/e0000141.au b/aup/see.wav_data/e00/d00/e0000141.au new file mode 100644 index 0000000..58704a4 Binary files /dev/null and b/aup/see.wav_data/e00/d00/e0000141.au differ diff --git a/aup/see.wav_data/e00/d00/e00001f9.au b/aup/see.wav_data/e00/d00/e00001f9.au new file mode 100644 index 0000000..a06a66a Binary files /dev/null and b/aup/see.wav_data/e00/d00/e00001f9.au differ diff --git a/aup/see.wav_data/e00/d00/e0000262.au b/aup/see.wav_data/e00/d00/e0000262.au new file mode 100644 index 0000000..221c414 Binary files /dev/null and b/aup/see.wav_data/e00/d00/e0000262.au differ diff --git a/aup/see.wav_data/e00/d00/e00002c1.au b/aup/see.wav_data/e00/d00/e00002c1.au new file mode 100644 index 0000000..61cc965 Binary files /dev/null and b/aup/see.wav_data/e00/d00/e00002c1.au differ diff --git a/aup/see.wav_data/e00/d00/e00002e4.au b/aup/see.wav_data/e00/d00/e00002e4.au new file mode 100644 index 0000000..5cc1cfe Binary files /dev/null and b/aup/see.wav_data/e00/d00/e00002e4.au differ diff --git a/aup/see.wav_data/e00/d00/e0000503.au b/aup/see.wav_data/e00/d00/e0000503.au new file mode 100644 index 0000000..067185b Binary files /dev/null and b/aup/see.wav_data/e00/d00/e0000503.au differ diff --git a/aup/see.wav_data/e00/d00/e000069b.au b/aup/see.wav_data/e00/d00/e000069b.au new file mode 100644 index 0000000..110f13c Binary files /dev/null and b/aup/see.wav_data/e00/d00/e000069b.au differ diff --git a/aup/see.wav_data/e00/d00/e0000722.au b/aup/see.wav_data/e00/d00/e0000722.au new file mode 100644 index 0000000..772bb9f Binary files /dev/null and b/aup/see.wav_data/e00/d00/e0000722.au differ diff --git a/aup/see.wav_data/e00/d00/e00008bd.au b/aup/see.wav_data/e00/d00/e00008bd.au new file mode 100644 index 0000000..cb8f84f Binary files /dev/null and b/aup/see.wav_data/e00/d00/e00008bd.au differ diff --git a/aup/see.wav_data/e00/d00/e00008c6.au b/aup/see.wav_data/e00/d00/e00008c6.au new file mode 100644 index 0000000..83daf75 Binary files /dev/null and b/aup/see.wav_data/e00/d00/e00008c6.au differ diff --git a/aup/see.wav_data/e00/d00/e00008d8.au b/aup/see.wav_data/e00/d00/e00008d8.au new file mode 100644 index 0000000..94be757 Binary files /dev/null and b/aup/see.wav_data/e00/d00/e00008d8.au differ diff --git a/aup/see.wav_data/e00/d00/e0000996.au b/aup/see.wav_data/e00/d00/e0000996.au new file mode 100644 index 0000000..c67db22 Binary files /dev/null and b/aup/see.wav_data/e00/d00/e0000996.au differ diff --git a/aup/see.wav_data/e00/d00/e0000a82.au b/aup/see.wav_data/e00/d00/e0000a82.au new file mode 100644 index 0000000..a6f396e Binary files /dev/null and b/aup/see.wav_data/e00/d00/e0000a82.au differ diff --git a/aup/see.wav_data/e00/d00/e0000cd3.au b/aup/see.wav_data/e00/d00/e0000cd3.au new file mode 100644 index 0000000..e184de6 Binary files /dev/null and b/aup/see.wav_data/e00/d00/e0000cd3.au differ diff --git a/aup/see.wav_data/e00/d00/e0000d58.au b/aup/see.wav_data/e00/d00/e0000d58.au new file mode 100644 index 0000000..2d32ad2 Binary files /dev/null and b/aup/see.wav_data/e00/d00/e0000d58.au differ diff --git a/aup/see.wav_data/e00/d00/e0000d62.au b/aup/see.wav_data/e00/d00/e0000d62.au new file mode 100644 index 0000000..51f548b Binary files /dev/null and b/aup/see.wav_data/e00/d00/e0000d62.au differ diff --git a/aup/see.wav_data/e00/d00/e0000ec3.au b/aup/see.wav_data/e00/d00/e0000ec3.au new file mode 100644 index 0000000..aedac78 Binary files /dev/null and b/aup/see.wav_data/e00/d00/e0000ec3.au differ diff --git a/aup/see.wav_data/e00/d00/e0000f52.au b/aup/see.wav_data/e00/d00/e0000f52.au new file mode 100644 index 0000000..662f9ca Binary files /dev/null and b/aup/see.wav_data/e00/d00/e0000f52.au differ diff --git a/aup/siren.wav.aup b/aup/siren.wav.aup new file mode 100644 index 0000000..56f60f8 --- /dev/null +++ b/aup/siren.wav.aup @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/aup/siren.wav_data/e00/d00/e00003fb.au b/aup/siren.wav_data/e00/d00/e00003fb.au new file mode 100644 index 0000000..986c062 Binary files /dev/null and b/aup/siren.wav_data/e00/d00/e00003fb.au differ diff --git a/aup/siren.wav_data/e00/d00/e0000fd1.au b/aup/siren.wav_data/e00/d00/e0000fd1.au new file mode 100644 index 0000000..1c6baa2 Binary files /dev/null and b/aup/siren.wav_data/e00/d00/e0000fd1.au differ diff --git a/aup/threeknocks.wav.aup b/aup/threeknocks.wav.aup new file mode 100644 index 0000000..1c9f5e7 --- /dev/null +++ b/aup/threeknocks.wav.aup @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/aup/threeknocks.wav_data/e00/d00/e0000315.au b/aup/threeknocks.wav_data/e00/d00/e0000315.au new file mode 100644 index 0000000..f67fc7c Binary files /dev/null and b/aup/threeknocks.wav_data/e00/d00/e0000315.au differ diff --git a/aup/threeknocks.wav_data/e00/d00/e0000c80.au b/aup/threeknocks.wav_data/e00/d00/e0000c80.au new file mode 100644 index 0000000..15a4bbd Binary files /dev/null and b/aup/threeknocks.wav_data/e00/d00/e0000c80.au differ diff --git a/aup/what.wav.aup b/aup/what.wav.aup new file mode 100644 index 0000000..0d53b41 --- /dev/null +++ b/aup/what.wav.aup @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/aup/what.wav_data/e00/d00/e0000137.au b/aup/what.wav_data/e00/d00/e0000137.au new file mode 100644 index 0000000..8572546 Binary files /dev/null and b/aup/what.wav_data/e00/d00/e0000137.au differ diff --git a/aup/what.wav_data/e00/d00/e0000163.au b/aup/what.wav_data/e00/d00/e0000163.au new file mode 100644 index 0000000..81d6fef Binary files /dev/null and b/aup/what.wav_data/e00/d00/e0000163.au differ diff --git a/aup/what.wav_data/e00/d00/e000025f.au b/aup/what.wav_data/e00/d00/e000025f.au new file mode 100644 index 0000000..fbcea69 Binary files /dev/null and b/aup/what.wav_data/e00/d00/e000025f.au differ diff --git a/aup/what.wav_data/e00/d00/e0000304.au b/aup/what.wav_data/e00/d00/e0000304.au new file mode 100644 index 0000000..c6cfff1 Binary files /dev/null and b/aup/what.wav_data/e00/d00/e0000304.au differ diff --git a/aup/what.wav_data/e00/d00/e000035e.au b/aup/what.wav_data/e00/d00/e000035e.au new file mode 100644 index 0000000..ebe3c15 Binary files /dev/null and b/aup/what.wav_data/e00/d00/e000035e.au differ diff --git a/aup/what.wav_data/e00/d00/e00003b9.au b/aup/what.wav_data/e00/d00/e00003b9.au new file mode 100644 index 0000000..9d3a746 Binary files /dev/null and b/aup/what.wav_data/e00/d00/e00003b9.au differ diff --git a/aup/what.wav_data/e00/d00/e0000789.au b/aup/what.wav_data/e00/d00/e0000789.au new file mode 100644 index 0000000..439d6ac Binary files /dev/null and b/aup/what.wav_data/e00/d00/e0000789.au differ diff --git a/aup/what.wav_data/e00/d00/e000089d.au b/aup/what.wav_data/e00/d00/e000089d.au new file mode 100644 index 0000000..160dc21 Binary files /dev/null and b/aup/what.wav_data/e00/d00/e000089d.au differ diff --git a/aup/what.wav_data/e00/d00/e00009ec.au b/aup/what.wav_data/e00/d00/e00009ec.au new file mode 100644 index 0000000..99ca6db Binary files /dev/null and b/aup/what.wav_data/e00/d00/e00009ec.au differ diff --git a/aup/what.wav_data/e00/d00/e0000b54.au b/aup/what.wav_data/e00/d00/e0000b54.au new file mode 100644 index 0000000..0e5bb97 Binary files /dev/null and b/aup/what.wav_data/e00/d00/e0000b54.au differ diff --git a/aup/what.wav_data/e00/d00/e0000c3e.au b/aup/what.wav_data/e00/d00/e0000c3e.au new file mode 100644 index 0000000..a48a511 Binary files /dev/null and b/aup/what.wav_data/e00/d00/e0000c3e.au differ diff --git a/aup/what.wav_data/e00/d00/e0000ced.au b/aup/what.wav_data/e00/d00/e0000ced.au new file mode 100644 index 0000000..404d497 Binary files /dev/null and b/aup/what.wav_data/e00/d00/e0000ced.au differ diff --git a/aup/what.wav_data/e00/d00/e0000cfe.au b/aup/what.wav_data/e00/d00/e0000cfe.au new file mode 100644 index 0000000..94ba2a4 Binary files /dev/null and b/aup/what.wav_data/e00/d00/e0000cfe.au differ diff --git a/aup/what.wav_data/e00/d00/e0000d3f.au b/aup/what.wav_data/e00/d00/e0000d3f.au new file mode 100644 index 0000000..3fa664a Binary files /dev/null and b/aup/what.wav_data/e00/d00/e0000d3f.au differ diff --git a/aup/what.wav_data/e00/d00/e0000dcb.au b/aup/what.wav_data/e00/d00/e0000dcb.au new file mode 100644 index 0000000..d6c7954 Binary files /dev/null and b/aup/what.wav_data/e00/d00/e0000dcb.au differ diff --git a/aup/what.wav_data/e00/d00/e0000e4c.au b/aup/what.wav_data/e00/d00/e0000e4c.au new file mode 100644 index 0000000..e827257 Binary files /dev/null and b/aup/what.wav_data/e00/d00/e0000e4c.au differ diff --git a/aup/what.wav_data/e00/d00/e0000f12.au b/aup/what.wav_data/e00/d00/e0000f12.au new file mode 100644 index 0000000..100f0af Binary files /dev/null and b/aup/what.wav_data/e00/d00/e0000f12.au differ diff --git a/aup/what.wav_data/e00/d00/e0000f6a.au b/aup/what.wav_data/e00/d00/e0000f6a.au new file mode 100644 index 0000000..4757f28 Binary files /dev/null and b/aup/what.wav_data/e00/d00/e0000f6a.au differ diff --git a/b5a.wav b/b5a.wav new file mode 100644 index 0000000..b4870db Binary files /dev/null and b/b5a.wav differ diff --git a/b5c.wav b/b5c.wav new file mode 100644 index 0000000..701225e Binary files /dev/null and b/b5c.wav differ diff --git a/beach.jpg b/beach.jpg new file mode 100644 index 0000000..be6decb Binary files /dev/null and b/beach.jpg differ diff --git a/beach.wav b/beach.wav new file mode 100644 index 0000000..1467c86 Binary files /dev/null and b/beach.wav differ diff --git a/beep1.wav b/beep1.wav new file mode 100644 index 0000000..a9965f6 Binary files /dev/null and b/beep1.wav differ diff --git a/beep2.wav b/beep2.wav new file mode 100644 index 0000000..7ea7269 Binary files /dev/null and b/beep2.wav differ diff --git a/bowlingalley.jpg b/bowlingalley.jpg new file mode 100644 index 0000000..7a21830 Binary files /dev/null and b/bowlingalley.jpg differ diff --git a/car1.wav b/car1.wav new file mode 100644 index 0000000..6b2c183 Binary files /dev/null and b/car1.wav differ diff --git a/car2.wav b/car2.wav new file mode 100644 index 0000000..39c21d6 Binary files /dev/null and b/car2.wav differ diff --git a/car21.aup b/car21.aup new file mode 100644 index 0000000..df48350 --- /dev/null +++ b/car21.aup @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/car21.wav b/car21.wav new file mode 100644 index 0000000..60db299 Binary files /dev/null and b/car21.wav differ diff --git a/car21_data/e00/d00/e0000658.au b/car21_data/e00/d00/e0000658.au new file mode 100644 index 0000000..592154b Binary files /dev/null and b/car21_data/e00/d00/e0000658.au differ diff --git a/car21_data/e00/d00/e00006d1.au b/car21_data/e00/d00/e00006d1.au new file mode 100644 index 0000000..a0cc1bb Binary files /dev/null and b/car21_data/e00/d00/e00006d1.au differ diff --git a/car21_data/e00/d00/e0000a1c.au b/car21_data/e00/d00/e0000a1c.au new file mode 100644 index 0000000..4557020 Binary files /dev/null and b/car21_data/e00/d00/e0000a1c.au differ diff --git a/car21_data/e00/d00/e0000a52.au b/car21_data/e00/d00/e0000a52.au new file mode 100644 index 0000000..8a12a1e Binary files /dev/null and b/car21_data/e00/d00/e0000a52.au differ diff --git a/cardoorclose.wav b/cardoorclose.wav new file mode 100644 index 0000000..e94d9b4 Binary files /dev/null and b/cardoorclose.wav differ diff --git a/cardooropen.wav b/cardooropen.wav new file mode 100644 index 0000000..72ea2cc Binary files /dev/null and b/cardooropen.wav differ diff --git a/carstart.wav b/carstart.wav new file mode 100644 index 0000000..4b4d72b Binary files /dev/null and b/carstart.wav differ diff --git a/classroom.jpg b/classroom.jpg new file mode 100644 index 0000000..d4f0219 Binary files /dev/null and b/classroom.jpg differ diff --git a/clock.svg b/clock.svg new file mode 100755 index 0000000..29958d5 --- /dev/null +++ b/clock.svg @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/crash.wav b/crash.wav new file mode 100644 index 0000000..15b1ab3 Binary files /dev/null and b/crash.wav differ diff --git a/cuff.wav b/cuff.wav new file mode 100644 index 0000000..4068582 Binary files /dev/null and b/cuff.wav differ diff --git a/erevolver1.wav b/erevolver1.wav new file mode 100644 index 0000000..a4c768a Binary files /dev/null and b/erevolver1.wav differ diff --git a/explosion-mix.wav b/explosion-mix.wav new file mode 100644 index 0000000..1f9ee6b Binary files /dev/null and b/explosion-mix.wav differ diff --git a/explosion.wav b/explosion.wav new file mode 100644 index 0000000..c002ae6 Binary files /dev/null and b/explosion.wav differ diff --git a/explosion1.wav b/explosion1.wav new file mode 100644 index 0000000..bc16997 Binary files /dev/null and b/explosion1.wav differ diff --git a/extschool.jpg b/extschool.jpg new file mode 100644 index 0000000..d9e8004 Binary files /dev/null and b/extschool.jpg differ diff --git a/extschool2.jpg b/extschool2.jpg new file mode 100644 index 0000000..a457e3c Binary files /dev/null and b/extschool2.jpg differ diff --git a/firereload.wav b/firereload.wav new file mode 100644 index 0000000..1009487 Binary files /dev/null and b/firereload.wav differ diff --git a/kick.wav b/kick.wav new file mode 100755 index 0000000..eb10f2e Binary files /dev/null and b/kick.wav differ diff --git a/kidnapped-null.jpg b/kidnapped-null.jpg new file mode 100644 index 0000000..f83e8d5 Binary files /dev/null and b/kidnapped-null.jpg differ diff --git a/kidnapped.2.jpg b/kidnapped.2.jpg new file mode 100644 index 0000000..f2ed4f7 Binary files /dev/null and b/kidnapped.2.jpg differ diff --git a/kidnapped.2.xcf b/kidnapped.2.xcf new file mode 100644 index 0000000..2150514 Binary files /dev/null and b/kidnapped.2.xcf differ diff --git a/kidnapped.jpg b/kidnapped.jpg new file mode 100644 index 0000000..74a2860 Binary files /dev/null and b/kidnapped.jpg differ diff --git a/main.css b/main.css index 6f4d05a..b27f576 100644 --- a/main.css +++ b/main.css @@ -1,5 +1,5 @@ body { - font-family: "Exo", "Comic Sans MS"; + font-family: "Exo"; } table td { padding: 4px; diff --git a/main.js b/main.js index d831a90..38ff45f 100644 --- a/main.js +++ b/main.js @@ -2,6 +2,12 @@ var socket = io.connect(); var KEYCODES = { + /** + * The most common keycodes defined by : + * @type {Object.} + * @const + */ + // KEYMAP : { STRG: 17, CTRL: 17, CTRLRIGHT: 18, @@ -36,6 +42,12 @@ var KEYCODES = { F10: 121, F11: 122, F12: 123, + // }, + /** + * @type {Object.} + * @const + */ + // KEYCODES : { 'backspace' : '8', 'tab' : '9', 'enter' : '13', @@ -134,6 +146,7 @@ var KEYCODES = { 'backslash' : '220', 'closebracket' : '221', 'single_quote' : '222' + // } } var sounds = {}; @@ -142,6 +155,7 @@ var sounds = {}; window.AudioContext = window.AudioContext || window.webkitAudioContext; var context = new AudioContext(); +// var mastergain = context.createGainNode(); var mastergain = context.createGain(); mastergain.gain.value = 1; @@ -210,6 +224,20 @@ window.addEventListener("keyup", function (e) { } }); }, false); +// window.addEventListener("keyup", function (e) { +// document.querySelectorAll("td").forEach(function (ele) { +// ele.classList.remove("active"); +// }); +// }, false); + +var lengthInSamples = 4 * context.sampleRate; +noiseBuffer = context.createBuffer( 1, lengthInSamples, context.sampleRate ); +var bufferData = noiseBuffer.getChannelData( 0 ); +for (var i = 0; i < lengthInSamples; ++i) { + bufferData[i] = (2*Math.random() - 1); // -1 to +1 +} + +// var shiftrate = 0.25; var shiftrate = 0.1; var movegaintoint = null; @@ -220,6 +248,7 @@ function movegainto(val, changeslider) { movegaintoint = null; movegaintoint = setInterval(function () { mastergain.gain.value += (val - mastergain.gain.value) * shiftrate; + // mastergain.gain.value = Math.round(mastergain.gain.value * 1000) / 1000; document.querySelector("#gainval").innerHTML = mastergain.gain.value; if (changeslider == true) { document.querySelector("#gainctrl").value = mastergain.gain.value; @@ -232,6 +261,9 @@ function movegainto(val, changeslider) { }, 100); } +// document.querySelector("#gainctrl").addEventListener("mousemove", function (e) { +// movegainto(e.target.value); +// }, false); document.querySelector("#gainctrl").addEventListener("change", function (e) { movegainto(e.target.value, true); }, false); @@ -239,6 +271,23 @@ document.querySelector("#reset").addEventListener("click", function (e) { movegainto(1, true); }, true); +// document.querySelector("#gainctrl").addEventListener("mousemove", function (e) { +// mastergain.gain.value = e.target.value; +// document.querySelector("#gainval").innerHTML = mastergain.gain.value; +// }, false); +// document.querySelector("#gainctrl").addEventListener("change", function (e) { +// mastergain.gain.value = e.target.value; +// document.querySelector("#gainval").innerHTML = mastergain.gain.value; +// }, false); +// document.querySelector("#reset").addEventListener("click", function (e) { +// document.querySelector("#gainctrl").value = 1; +// mastergain.gain.value = document.querySelector("#gainctrl").value; +// document.querySelector("#gainval").innerHTML = mastergain.gain.value; +// }, true); +// setInterval(function () { +// mastergain.gain.value = document.querySelector("#gainctrl").value; +// document.querySelector("#gainval").innerHTML = document.querySelector("#gainctrl").value; +// }, 200); function loadsound(idname, url, gain) { @@ -271,23 +320,25 @@ function loadsound(idname, url, gain) { var nowplaying = []; function playsound(buffer, gain) { - + // var volume = context.createGainNode(); var volume = context.createGain(); volume.gain.value = gain; var source = context.createBufferSource(); source.buffer = buffer; - + // source.connect(context.destination); source.connect(volume); volume.connect(mastergain); mastergain.connect(context.destination); source.start(0); setTimeout(function () { nowplaying.push(source); + // }, 50); }, 150); source.onended = function () { nowplaying.splice(tostop.indexOf(source), 1); } + return source; } function stopall() { @@ -307,14 +358,192 @@ function updatekeys() { document.querySelector("#keys").innerHTML = ht; } +// var inputs = document.querySelectorAll("input"); +// for (var i = 0; i < inputs.length; ++i) { +// inputs[i].addEventListener("keydown", function (e) { +// e.stopPropagation(); +// }, false); +// } + +// document.querySelector("#binder").addEventListener("submit", function (e) { +// e.preventDefault(); +// var name = document.querySelector("#name").value; +// var file = document.querySelector("#file").value; +// var key = document.querySelector("#key").value; +// loadsound(name, file); +// bindkey(key, name); +// updatekeys(); +// }, false); + var toload = [ { - name: "b5a", - verbal: "Darkness", - file: "b5a.wav", - key: "1", + name: "waves", + verbal: "back: Beach Waves", + file: "beach.wav", + key: "comma", + gain: 0.2 +}, +{ + name: "z-see", + verbal: "back: See", + file: "z-see.wav", + key: "period", + gain: 0.6 +}, +{ + name: "z-what", + verbal: "back: What", + file: "z-what.wav", + key: "forward_slash", + gain: 0.5 +}, +// { +// name: "b5c", +// verbal: "back: Darkness (Long)", +// file: "b5c.wav", +// key: "3", +// gain: 0.5 +// }, +{ + name: "car1", + verbal: "Car Nearer", + file: "car21.wav", + key: "q", + gain: 0.7 +}, +{ + name: "crash1", + verbal: "Car Crash", + file: "crash.wav", + key: "p", + gain: 2 +}, +// { +// name: "carstarting", +// verbal: "Car Starting", +// file: "carstart.wav", +// key: "a", +// gain: 2 +// }, +{ + name: "car2", + verbal: "Car Leaving", + file: "car2.wav", + key: "l", + gain: 0.5 +}, +{ + name: "emptyrevolver", + verbal: "Empty Revolver", + file: ["erevolver1.wav"], + key: "m", + gain: 1.8 +}, +{ + name: "revolver", + verbal: "Revolver", + file: ["revolver1.wav", "revolver2.wav", "revolver3.wav", "revolver4.wav", "revolver5.wav", "revolver6.wav"], + key: "n", + gain: 1.25 +}, +// { +// name: "fire", +// verbal: "Fire", +// file: ["fire1.wav", "fire2.wav", "fire3.wav", "fire4.wav"], +// key: "n", +// gain: 1 +// }, +// { +// name: "reload", +// verbal: "Reload", +// file: "firereload.wav", +// key: "b", +// gain: 1 +// }, +{ + name: "revolvercock", + verbal: "Revolver Cock", + file: "revolvercock.wav", + key: "b", + gain: 1.2 +}, +{ + name: "cuff", + verbal: "Cuffs", + file: "cuff.wav", + key: "c", gain: 1 }, +// { +// name: "scream1", +// verbal: "Scream 1", +// file: "scream1.wav", +// key: "h", +// gain: 0.5 +// }, +// { +// name: "scream2", +// verbal: "Scream 2", +// file: "scream2.wav", +// key: "j", +// gain: 1 +// }, +{ + name: "asiren", + verbal: "Ambulance Siren", + file: "siren.wav", + key: "z", + gain: 1 +}, +{ + name: "policesrien", + verbal: "Police Srien", + file: "policesiren.wav", + key: "x", + gain: 1 +}, +// { +// name: "cardooropen", +// verbal: "Car Door Open", +// file: "cardooropen.wav", +// key: "t", +// gain: 1 +// }, +// { +// name: "cardoorclose", +// verbal: "Car Door Close", +// file: "cardoorclose.wav", +// key: "y", +// gain: 1 +// }, +{ + name: "doorknocks", + verbal: "Door Knocks (three)", + file: "threeknocks.wav", + key: "u", + gain: 1.5 +}, +{ + name: "explosion", + verbal: "Explosion", + file: "explosion.wav", + key: "e", + gain: 2.5 +}, +{ + name: "ringtone", + verbal: "Ringtone", + file: "ringtone.wav", + key: "i", + gain: 1 +}, +// { +// name: "beep", +// verbal: "Beep", +// file: "beep2.wav", +// key: "w", +// gain: 2 +// }, ]; toload.forEach(function (obj) { @@ -325,6 +554,7 @@ toload.forEach(function (obj) { bindkey(obj.key, obj.verbal, function () { var i = Math.floor(Math.random() * obj.file.length); sounds[obj.name + i].play(); + // console.log(i); }); } else { @@ -335,44 +565,263 @@ toload.forEach(function (obj) { } }); - -var beep; -bindkey("s", "Beep", function () { - beep = setInterval(function () { - playiso(2000, 50, 0, 0.5, "sine"); +var explosionbeepgain = 0.5, beepslow, beepmedium, beepfast, beepxfast; +bindkey("s", "Beep Slow", function () { + playiso(2000, 50, 0, beepgain, "sine"); + beepslow = setInterval(function () { + playiso(2000, 50, 0, beepgain, "sine"); }, 2000); }, function () { - clearInterval(beep); + clearInterval(beepslow); +}); +bindkey("d", "Beep Medium", function () { + playiso(2000, 50, 0, beepgain, "sine"); + beepmedium = setInterval(function () { + playiso(2000, 50, 0, beepgain, "sine"); + }, 500); +}, function () { + clearInterval(beepmedium); +}); +bindkey("f", "Beep Fast", function () { + playiso(2000, 50, 0, beepgain, "sine"); + beepfast = setInterval(function () { + playiso(2000, 50, 0, beepgain, "sine"); + }, 200); +}, function () { + clearInterval(beepfast); +}); +bindkey("g", "Beep Extrafast", function () { + beepxfast = playiso(2000, "callback", 0, beepgain, "sine"); +}, function () { + beepxfast(); +}); + +var noiseSource; +bindkey("equal_sign", "Noise", function () { + noiseSource = playsound(noiseBuffer, 0.1); +}, function () { + noiseSource.stop(); }); +var busytone1, busytone2; +// American +// bindkey("dash", "Busy", function () { +// playiso(480, 500, 0, beepgain, "sine"); +// playiso(620, 500, 0, beepgain, "sine"); +// busytone = setInterval(function () { +// playiso(480, 500, 0, beepgain, "sine"); +// playiso(620, 500, 0, beepgain, "sine"); +// }, 1000); +// }, function () { +// clearInterval(busytone); +// }); +// British +// bindkey("dash", "Busy", function () { +// playiso(400, 375, 0, beepgain, "sine"); +// busytone = setInterval(function () { +// playiso(400, 375, 0, beepgain, "sine"); +// }, 750); +// }, function () { +// clearInterval(busytone); +// }); +// Singapore +// bindkey("dash", "Busy", function () { +// playiso(400, 125, 0, beepgain, "sine"); +// setTimeout(function () { +// playiso(400, 125, 0, beepgain, "sine"); +// }, 250); +// setTimeout(function () { +// playiso(400, 125, 0, beepgain, "sine"); +// }, 500); +// }); +// Manual +bindkey("dash", "Busy", function () { + busytone1 = playiso(400, "callback", 0, 0.15, "sine"); + // busytone2 = playiso(400, "callback", 0, 0.05, "square"); +}, function () { + busytone1(); + // busytone2(); +}); + + +var tones = []; +var beepgain = 0.15; +bindkey("open_bracket", "Dial Stolen Stone Phone", function () { + playiso(1477, 150, 0, beepgain, "sine"); + playiso(852, 150, 0, beepgain, "sine"); + setTimeout(function () { + playiso(1209, 150, 0, beepgain, "sine"); + playiso(697, 150, 0, beepgain, "sine"); + }, 200); + setTimeout(function () { + playiso(1336, 150, 0, beepgain, "sine"); + playiso(697, 150, 0, beepgain, "sine"); + }, 402); + setTimeout(function () { + playiso(1209, 160, 0, beepgain, "sine"); + playiso(697, 160, 0, beepgain, "sine"); + }, 600); + setTimeout(function () { + playiso(1336, 150, 0, beepgain, "sine"); + playiso(941, 150, 0, beepgain, "sine"); + }, 800); + setTimeout(function () { + playiso(1336, 150, 0, beepgain, "sine"); + playiso(941, 150, 0, beepgain, "sine"); + }, 990); + setTimeout(function () { + playiso(1209, 150, 0, beepgain, "sine"); + playiso(852, 150, 0, beepgain, "sine"); + }, 1223); + setTimeout(function () { + playiso(1209, 150, 0, beepgain, "sine"); + playiso(852, 150, 0, beepgain, "sine"); + }, 1392); +}); +// bindkey("dash", "Dial 1", function () { +// tones[0] = []; +// tones[0][0] = playiso(1209, "callback", 0, beepgain, "sine"); +// tones[0][1] = playiso(697, "callback", 0, beepgain, "sine"); +// }, function () { +// tones[0][0](); +// tones[0][1](); +// }); +// bindkey("equal_sign", "Dial 2", function () { +// tones[1] = []; +// tones[1][0] = playiso(1336, "callback", 0, beepgain, "sine"); +// tones[1][1] = playiso(697, "callback", 0, beepgain, "sine"); +// }, function () { +// tones[1][0](); +// tones[1][1](); +// }); +// bindkey("open_bracket", "Dial 3", function () { +// tones[2] = []; +// tones[2][0] = playiso(1477, "callback", 0, beepgain, "sine"); +// tones[2][1] = playiso(697, "callback", 0, beepgain, "sine"); +// }, function () { +// tones[2][0](); +// tones[2][1](); +// }); +// bindkey("closebracket", "Dial 4", function () { +// tones[3] = []; +// tones[3][0] = playiso(1209, "callback", 0, beepgain, "sine"); +// tones[3][1] = playiso(770, "callback", 0, beepgain, "sine"); +// }, function () { +// tones[3][0](); +// tones[3][1](); +// }); +// bindkey("backslash", "Dial 5", function () { +// tones[4] = []; +// tones[4][0] = playiso(1336, "callback", 0, beepgain, "sine"); +// tones[4][1] = playiso(770, "callback", 0, beepgain, "sine"); +// }, function () { +// tones[4][0](); +// tones[4][1](); +// }); +// bindkey("semi_colon", "Dial 6", function () { +// tones[5] = []; +// tones[5][0] = playiso(1477, "callback", 0, beepgain, "sine"); +// tones[5][1] = playiso(770, "callback", 0, beepgain, "sine"); +// }, function () { +// tones[5][0](); +// tones[5][1](); +// }); +// bindkey("single_quote", "Dial 7", function () { +// tones[6] = []; +// tones[6][0] = playiso(1209, "callback", 0, beepgain, "sine"); +// tones[6][1] = playiso(852, "callback", 0, beepgain, "sine"); +// }, function () { +// tones[6][0](); +// tones[6][1](); +// }); +// bindkey("comma", "Dial 8", function () { +// tones[7] = []; +// tones[7][0] = playiso(1336, "callback", 0, beepgain, "sine"); +// tones[7][1] = playiso(852, "callback", 0, beepgain, "sine"); +// }, function () { +// tones[7][0](); +// tones[7][1](); +// }); +// bindkey("period", "Dial 9", function () { +// tones[8] = []; +// tones[8][0] = playiso(1477, "callback", 0, beepgain, "sine"); +// tones[8][1] = playiso(852, "callback", 0, beepgain, "sine"); +// }, function () { +// tones[8][0](); +// tones[8][1](); +// }); +// bindkey("forward_slash", "Dial 0", function () { +// tones[9] = []; +// tones[9][0] = playiso(1336, "callback", 0, beepgain, "sine"); +// tones[9][1] = playiso(941, "callback", 0, beepgain, "sine"); +// }, function () { +// tones[9][0](); +// tones[9][1](); +// }); + var sbinds = [ { - name: "slidea", - verbal: "A", + name: "kidnapped", + verbal: "Kidnapped", + key: "1" +}, +{ + name: "bowl", + verbal: "Bowling Alley", + key: "2" +}, +{ + name: "street", + verbal: "Street", + key: "3" +}, +{ + name: "beach", + verbal: "Beach", key: "4" }, { - name: "slideb", - verbal: "B", + name: "classroom", + verbal: "Classroom", key: "5" }, +{ + name: "schcampus", + verbal: "School Campus", + key: "6" +}, +{ + name: "office", + verbal: "Office", + key: "7" +}, +{ + name: "flashback", + verbal: "3 years later", + key: "8" +}, +{ + name: "mur", + verbal: "4 Rounds", + key: "9" +}, { name: "blank", - verbal: "blankscreen", + verbal: "Blank", key: "0" -} +}, ]; sbinds.forEach(function (obj) { - bindkey(obj.key, obj.verbal, function () { + bindkey(obj.key, "slide: " + obj.verbal, function () { socket.emit("data", { name: obj.name }) }); }); - +// bindkey("BACKSPACE", "Stop All", function () { bindkey("BACKSPACE", "Stop All", function () { stopall(); }); @@ -384,6 +833,7 @@ updatekeys(); function playiso(freq, time, detune, gain, type) { var osc = context.createOscillator(); + // var volume = context.createGainNode(); var volume = context.createGain(); volume.gain.value = gain; osc.type = type; @@ -392,6 +842,8 @@ function playiso(freq, time, detune, gain, type) { osc.connect(volume); volume.connect(mastergain); mastergain.connect(context.destination); + // osc.setWaveTable(waveTable); + // osc.connect(audio_context.destination); osc.start(0); if (time == "callback") { return function () { @@ -399,10 +851,15 @@ function playiso(freq, time, detune, gain, type) { } } else if (time > 0) { + // setTimeout(function() { osc.stop(context.currentTime + time / 1000); + // }, time); } } +// playiso(40, 0, 0.4, "sine"); +// playiso(40, 0, 0.2, "triangle"); + diff --git a/node_modules/socket.io/.npmignore b/node_modules/socket.io/.npmignore new file mode 100644 index 0000000..39e9864 --- /dev/null +++ b/node_modules/socket.io/.npmignore @@ -0,0 +1,3 @@ +support +test +examples diff --git a/node_modules/socket.io/.travis.yml b/node_modules/socket.io/.travis.yml new file mode 100644 index 0000000..c32adcd --- /dev/null +++ b/node_modules/socket.io/.travis.yml @@ -0,0 +1,13 @@ +language: node_js +node_js: + - "0.8" + - "0.10" + - "0.11" + +matrix: + fast_finish: true + allow_failures: + - node_js: "0.11" + +notifications: + irc: "irc.freenode.org#socket.io" diff --git a/node_modules/socket.io/History.md b/node_modules/socket.io/History.md new file mode 100644 index 0000000..ef0de1f --- /dev/null +++ b/node_modules/socket.io/History.md @@ -0,0 +1,399 @@ + +1.0.6 / 2014-06-19 +================== + + * package: bump `socket.io-client` + +1.0.5 / 2014-06-16 +================== + + * package: bump `engine.io` to fix jsonp `\n` bug and CORS warnings + * index: fix typo [yanatan16] + * add `removeListener` to blacklisted events + * examples: clearer instructions to install chat example + * index: fix namespace `connectBuffer` issue + +1.0.4 / 2014-06-02 +================== + + * package: bump socket.io-client + +1.0.3 / 2014-05-31 +================== + + * package: bump `socket.io-client` + * package: bump `socket.io-parser` for binary ACK fix + * package: bump `engine.io` for binary UTF8 fix + * example: fix XSS in chat example + +1.0.2 / 2014-05-28 +================== + + * package: bump `socket.io-parser` for windows fix + +1.0.1 / 2014-05-28 +================== + + * bump due to bad npm tag + +1.0.0 / 2014-05-28 +================== + + * stable release + +1.0.0-pre5 / 2014-05-22 +======================= + + * package: bump `socket.io-client` for parser fixes + * package: bump `engine.io` + +1.0.0-pre4 / 2014-05-19 +======================= + + * package: bump client + +1.0.0-pre3 / 2014-05-17 +======================= + + * package: bump parser + * package: bump engine.io + +1.0.0-pre2 / 2014-04-27 +======================= + + * package: bump `engine.io` + * added backwards compatible of engine.io maxHttpBufferSize + * added test that server and client using same protocol + * added support for setting allowed origins + * added information about logging + * the set function in server can be used to set some attributes for BC + * fix error in callback call 'done' instead of 'next' in docs + * package: bump `socket.io-parser` + * package: bump `expect.js` + * added some new tests, including binary with acks + +1.0.0-pre / 2014-03-14 +====================== + + * implemented `engine.io` + * implemented `socket.io-adapter` + * implemented `socket.io-protocol` + * implemented `debug` and improved instrumentation + * added binary support + * added new `require('io')(srv)` signature + * simplified `socket.io-client` serving + +0.9.14 / 2013-03-29 +=================== + + * manager: fix memory leak with SSL [jpallen] + +0.9.13 / 2012-12-13 +=================== + + * package: fixed `base64id` requirement + +0.9.12 / 2012-12-13 +=================== + + * manager: fix for latest node which is returning a clone with `listeners` [viirya] + +0.9.11 / 2012-11-02 +=================== + + * package: move redis to optionalDependenices [3rd-Eden] + * bumped client + +0.9.10 / 2012-08-10 +=================== + + * Don't lowercase log messages + * Always set the HTTP response in case an error should be returned to the client + * Create or destroy the flash policy server on configuration change + * Honour configuration to disable flash policy server + * Add express 3.0 instructions on Readme.md + * Bump client + +0.9.9 / 2012-08-01 +================== + + * Fixed sync disconnect xhrs handling + * Put license text in its own file (#965) + * Add warning to .listen() to ease the migration to Express 3.x + * Restored compatibility with node 0.4.x + +0.9.8 / 2012-07-24 +================== + + * Bumped client. + +0.9.7 / 2012-07-24 +================== + + * Prevent crash when socket leaves a room twice. + * Corrects unsafe usage of for..in + * Fix for node 0.8 with `gzip compression` [vadimi] + * Update redis to support Node 0.8.x + * Made ID generation securely random + * Fix Redis Store race condition in manager onOpen unsubscribe callback + * Fix for EventEmitters always reusing the same Array instance for listeners + +0.9.6 / 2012-04-17 +================== + + * Fixed XSS in jsonp-polling. + +0.9.5 / 2012-04-05 +================== + + * Added test for polling and socket close. + * Ensure close upon request close. + * Fix disconnection reason being lost for polling transports. + * Ensure that polling transports work with Connection: close. + * Log disconnection reason. + +0.9.4 / 2012-04-01 +================== + + * Disconnecting from namespace improvement (#795) [DanielBaulig] + * Bumped client with polling reconnection loop (#438) + +0.9.3 / 2012-03-28 +================== + + * Fix "Syntax error" on FF Web Console with XHR Polling [mikito] + +0.9.2 / 2012-03-13 +================== + + * More sensible close `timeout default` (fixes disconnect issue) + +0.9.1-1 / 2012-03-02 +==================== + + * Bumped client with NPM dependency fix. + +0.9.1 / 2012-03-02 +================== + + * Changed heartbeat timeout and interval defaults (60 and 25 seconds) + * Make tests work both on 0.4 and 0.6 + * Updated client (improvements + bug fixes). + +0.9.0 / 2012-02-26 +================== + + * Make it possible to use a regexp to match the socket.io resource URL. + We need this because we have to prefix the socket.io URL with a variable ID. + * Supplemental fix to gavinuhma/authfix, it looks like the same Access-Control-Origin logic is needed in the http and xhr-polling transports + * Updated express dep for windows compatibility. + * Combine two substr calls into one in decodePayload to improve performance + * Minor documentation fix + * Minor. Conform to style of other files. + * Switching setting to 'match origin protocol' + * Revert "Fixes leaking Redis subscriptions for #663. The local flag was not getting passed through onClientDisconnect()." + * Revert "Handle leaked dispatch:[id] subscription." + * Merge pull request #667 from dshaw/patch/redis-disconnect + * Handle leaked dispatch:[id] subscription. + * Fixes leaking Redis subscriptions for #663. The local flag was not getting passed through onClientDisconnect(). + * Prevent memory leaking on uncompleted requests & add max post size limitation + * Fix for testcase + * Set Access-Control-Allow-Credentials true, regardless of cookie + * Remove assertvarnish from package as it breaks on 0.6 + * Correct irc channel + * Added proper return after reserved field error + * Fixes manager.js failure to close connection after transport error has happened + * Added implicit port 80 for origin checks. fixes #638 + * Fixed bug #432 in 0.8.7 + * Set Access-Control-Allow-Origin header to origin to enable withCredentials + * Adding configuration variable matchOriginProtocol + * Fixes location mismatch error in Safari. + * Use tty to detect if we should add colors or not by default. + * Updated the package location. + +0.8.7 / 2011-11-05 +================== + + * Fixed memory leaks in closed clients. + * Fixed memory leaks in namespaces. + * Fixed websocket handling for malformed requests from proxies. [einaros] + * Node 0.6 compatibility. [einaros] [3rd-Eden] + * Adapted tests and examples. + +0.8.6 / 2011-10-27 +================== + + * Added JSON decoding on jsonp-polling transport. + * Fixed README example. + * Major speed optimizations [3rd-Eden] [einaros] [visionmedia] + * Added decode/encode benchmarks [visionmedia] + * Added support for black-listing client sent events. + * Fixed logging options, closes #540 [3rd-Eden] + * Added vary header for gzip [3rd-Eden] + * Properly cleaned up async websocket / flashsocket tests, after patching node-websocket-client + * Patched to properly shut down when a finishClose call is made during connection establishment + * Added support for socket.io version on url and far-future Expires [3rd-Eden] [getify] + * Began IE10 compatibility [einaros] [tbranyen] + * Misc WebSocket fixes [einaros] + * Added UTF8 to respone headers for htmlfile [3rd-Eden] + +0.8.5 / 2011-10-07 +================== + + * Added websocket draft HyBi-16 support. [einaros] + * Fixed websocket continuation bugs. [einaros] + * Fixed flashsocket transport name. + * Fixed websocket tests. + * Ensured `parser#decodePayload` doesn't choke. + * Added http referrer verification to manager verifyOrigin. + * Added access control for cross domain xhr handshakes [3rd-Eden] + * Added support for automatic generation of socket.io files [3rd-Eden] + * Added websocket binary support [einaros] + * Added gzip support for socket.io.js [3rd-Eden] + * Expose socket.transport [3rd-Eden] + * Updated client. + +0.8.4 / 2011-09-06 +================== + + * Client build + +0.8.3 / 2011-09-03 +================== + + * Fixed `\n` parsing for non-JSON packets (fixes #479). + * Fixed parsing of certain unicode characters (fixes #451). + * Fixed transport message packet logging. + * Fixed emission of `error` event resulting in an uncaught exception if unhandled (fixes #476). + * Fixed; allow for falsy values as the configuration value of `log level` (fixes #491). + * Fixed repository URI in `package.json`. Fixes #504. + * Added text/plain content-type to handshake responses [einaros] + * Improved single byte writes [einaros] + * Updated socket.io-flashsocket default port from 843 to 10843 [3rd-Eden] + * Updated client. + +0.8.2 / 2011-08-29 +================== + + * Updated client. + +0.8.1 / 2011-08-29 +================== + + * Fixed utf8 bug in send framing in websocket [einaros] + * Fixed typo in docs [Znarkus] + * Fixed bug in send framing for over 64kB of data in websocket [einaros] + * Corrected ping handling in websocket transport [einaros] + +0.8.0 / 2011-08-28 +================== + + * Updated to work with two-level websocket versioning. [einaros] + * Added hybi07 support. [einaros] + * Added hybi10 support. [einaros] + * Added http referrer verification to manager.js verifyOrigin. [einaors] + +0.7.11 / 2011-08-27 +=================== + + * Updated socket.io-client. + +0.7.10 / 2011-08-27 +=================== + + * Updated socket.io-client. + +0.7.9 / 2011-08-12 +================== + + * Updated socket.io-client. + * Make sure we only do garbage collection when the server we receive is actually run. + +0.7.8 / 2011-08-08 +================== + + * Changed; make sure sio#listen passes options to both HTTP server and socket.io manager. + * Added docs for sio#listen. + * Added options parameter support for Manager constructor. + * Added memory leaks tests and test-leaks Makefile task. + * Removed auto npm-linking from make test. + * Make sure that you can disable heartbeats. [3rd-Eden] + * Fixed rooms memory leak [3rd-Eden] + * Send response once we got all POST data, not immediately [Pita] + * Fixed onLeave behavior with missing clientsk [3rd-Eden] + * Prevent duplicate references in rooms. + * Added alias for `to` to `in` and `in` to `to`. + * Fixed roomClients definition. + * Removed dependency on redis for installation without npm [3rd-Eden] + * Expose path and querystring in handshakeData [3rd-Eden] + +0.7.7 / 2011-07-12 +================== + + * Fixed double dispatch handling with emit to closed clients. + * Added test for emitting to closed clients to prevent regression. + * Fixed race condition in redis test. + * Changed Transport#end instrumentation. + * Leveraged $emit instead of emit internally. + * Made tests faster. + * Fixed double disconnect events. + * Fixed disconnect logic + * Simplified remote events handling in Socket. + * Increased testcase timeout. + * Fixed unknown room emitting (GH-291). [3rd-Eden] + * Fixed `address` in handshakeData. [3rd-Eden] + * Removed transports definition in chat example. + * Fixed room cleanup + * Fixed; make sure the client is cleaned up after booting. + * Make sure to mark the client as non-open if the connection is closed. + * Removed unneeded `buffer` declarations. + * Fixed; make sure to clear socket handlers and subscriptions upon transport close. + +0.7.6 / 2011-06-30 +================== + + * Fixed general dispatching when a client has closed. + +0.7.5 / 2011-06-30 +================== + + * Fixed dispatching to clients that are disconnected. + +0.7.4 / 2011-06-30 +================== + + * Fixed; only clear handlers if they were set. [level09] + +0.7.3 / 2011-06-30 +================== + + * Exposed handshake data to clients. + * Refactored dispatcher interface. + * Changed; Moved id generation method into the manager. + * Added sub-namespace authorization. [3rd-Eden] + * Changed; normalized SocketNamespace local eventing [dvv] + * Changed; Use packet.reason or default to 'packet' [3rd-Eden] + * Changed console.error to console.log. + * Fixed; bind both servers at the same time do that the test never times out. + * Added 304 support. + * Removed `Transport#name` for abstract interface. + * Changed; lazily require http and https module only when needed. [3rd-Eden] + +0.7.2 / 2011-06-22 +================== + + * Make sure to write a packet (of type `noop`) when closing a poll. + This solves a problem with cross-domain requests being flagged as aborted and + reconnection being triggered. + * Added `noop` message type. + +0.7.1 / 2011-06-21 +================== + + * Fixed cross-domain XHR. + * Added CORS test to xhr-polling suite. + +0.7.0 / 2010-06-21 +================== + + * http://socket.io/announcement.html diff --git a/node_modules/socket.io/LICENSE b/node_modules/socket.io/LICENSE new file mode 100644 index 0000000..81a9275 --- /dev/null +++ b/node_modules/socket.io/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2014 Automattic + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/socket.io/Makefile b/node_modules/socket.io/Makefile new file mode 100644 index 0000000..4acf1e5 --- /dev/null +++ b/node_modules/socket.io/Makefile @@ -0,0 +1,15 @@ + +REPORTER = dot + +test: + @./node_modules/.bin/mocha \ + --reporter $(REPORTER) \ + --slow 200ms \ + --bail + +test-cov: + @./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha -- \ + --reporter $(REPORTER) \ + test/ + +.PHONY: test diff --git a/node_modules/socket.io/Readme.md b/node_modules/socket.io/Readme.md new file mode 100644 index 0000000..674b263 --- /dev/null +++ b/node_modules/socket.io/Readme.md @@ -0,0 +1,346 @@ + +# socket.io + +[![Build Status](https://secure.travis-ci.org/Automattic/socket.io.png)](http://travis-ci.org/Automattic/socket.io) +[![NPM version](https://badge.fury.io/js/socket.io.png)](http://badge.fury.io/js/socket.io) + +## How to use + +The following example attaches socket.io to a plain Node.JS +HTTP server listening on port `3000`. + +```js +var server = require('http').Server(); +var io = require('socket.io')(server); +io.on('connection', function(socket){ + socket.on('event', function(data){}); + socket.on('disconnect', function(){}); +}); +server.listen(3000); +``` + +### Standalone + +```js +var io = require('socket.io')(); +io.on('connection', function(socket){}); +io.listen(3000); +``` + +### In conjunction with Express + +Starting with **3.0**, express applications have become request handler +functions that you pass to `http` or `http` `Server` instances. You need +to pass the `Server` to `socket.io`, and not the express application +function. + +```js +var app = require('express')(); +var server = require('http').Server(app); +var io = require('socket.io')(server); +io.on('connection', function(){ /* … */ }); +server.listen(3000); +``` + +### In conjunction with Koa + +Like Express.JS, Koa works by exposing an application as a request +handler function, but only by calling the `callback` method. + +```js +var app = require('koa')(); +var server = require('http').Server(app.callback()); +var io = require('socket.io')(server); +io.on('connection', function(){ /* … */ }); +server.listen(3000); +``` + +## API + +### Server + + Exposed by `require('socket.io')`. + +### Server() + + Creates a new `Server`. Works with and without `new`: + + ```js + var io = require('socket.io')(); + // or + var Server = require('socket.io'); + var io = new Server(); + ``` + +### Server(opts:Object) + + Optionally, the first or second argument (see below) of the `Server` + constructor can be an options object. + + The following options are supported: + + - `serveClient` sets the value for Server#serveClient() + - `path` sets the value for Server#path() + + The same options passed to socket.io are always passed to + the `engine.io` `Server` that gets created. See engine.io + [options](https://github.com/learnboost/engine.io#methods-1) + as reference. + +### Server(srv:http#Server, opts:Object) + + Creates a new `Server` and attaches it to the given `srv`. Optionally + `opts` can be passed. + +### Server(port:Number, opts:Object) + + Binds socket.io to a new `http.Server` that listens on `port`. + +### Server#serveClient(v:Boolean):Server + + If `v` is `true` the attached server (see `Server#attach`) will serve + the client files. Defaults to `true`. + + This method has no effect after `attach` is called. + + ```js + // pass a server and the `serveClient` option + var io = require('socket.io')(http, { serveClient: false }); + + // or pass no server and then you can call the method + var io = require('socket.io')(); + io.serveClient(false); + io.attach(http); + ``` + + If no arguments are supplied this method returns the current value. + +### Server#path(v:String):Server + + Sets the path `v` under which `engine.io` and the static files will be + served. Defaults to `/socket.io`. + + If no arguments are supplied this method returns the current value. + +### Server#adapter(v:Adapter):Server + + Sets the adapter `v`. Defaults to an instance of the `Adapter` that + ships with socket.io which is memory based. See + [socket.io-adapter](https://github.com/Automattic/socket.io-adapter). + + If no arguments are supplied this method returns the current value. + +### Server#origins(v:String):Server + + Sets the allowed origins `v`. Defaults to any origins being allowed. + + If no arguments are supplied this method returns the current value. + + +### Server#sockets:Namespace + + The default (`/`) namespace. + +### Server#attach(srv:http#Server, opts:Object):Server + + Attaches the `Server` to an engine.io instance on `srv` with the + supplied `opts` (optionally). + +### Server#attach(port:Number, opts:Object):Server + + Attaches the `Server` to an engine.io instance that is bound to `port` + with the given `opts` (optionally). + +### Server#listen + + Synonym of `Server#attach`. + +### Server#bind(srv:engine#Server):Server + + Advanced use only. Binds the server to a specific engine.io `Server` + (or compatible API) instance. + +### Server#onconnection(socket:engine#Socket):Server + + Advanced use only. Creates a new `socket.io` client from the incoming + engine.io (or compatible API) `socket`. + +### Server#of(nsp:String):Namespace + + Initializes and retrieves the given `Namespace` by its pathname + identifier `nsp`. + + If the namespace was already initialized it returns it right away. + +### Server#emit + + Emits an event to all connected clients. The following two are + equivalent: + + ```js + var io = require('socket.io')(); + io.sockets.emit('an event sent to all connected clients'); + io.emit('an event sent to all connected clients'); + ``` + + For other available methods, see `Namespace` below. + +### Server#use + + See `Namespace#use` below. + +### Namespace + + Represents a pool of sockets connected under a given scope identified + by a pathname (eg: `/chat`). + + By default the client always connects to `/`. + +#### Events + + - `connection` / `connect`. Fired upon a connection. + + Parameters: + - `Socket` the incoming socket. + +### Namespace#name:String + + The namespace identifier property. + +### Namespace#connected:Object + + Hash of `Socket` objects that are connected to this namespace indexed + by `id`. + +### Namespace#use(fn:Function):Namespace + + Registers a middleware, which is a function that gets executed for + every incoming `Socket` and receives as parameter the socket and a + function to optionally defer execution to the next registered + middleware. + + ```js + var io = require('socket.io')(); + io.use(function(socket, next){ + if (socket.request.headers.cookie) return next(); + next(new Error('Authentication error')); + }); + ``` + + Errors passed to middleware callbacks are sent as special `error` + packets to clients. + +### Socket + + A `Socket` is the fundamental class for interacting with browser + clients. A `Socket` belongs to a certain `Namespace` (by default `/`) + and uses an underlying `Client` to communicate. + +### Socket#rooms:Array + + A list of strings identifying the rooms this socket is in. + +### Socket#client:Client + + A reference to the underlying `Client` object. + +### Socket#conn:Socket + + A reference to the underyling `Client` transport connection (engine.io + `Socket` object). + +### Socket#request:Request + + A getter proxy that returns the reference to the `request` that + originated the underlying engine.io `Client`. Useful for accessing + request headers such as `Cookie` or `User-Agent`. + +### Socket#id:String + + A unique identifier for the socket session, that comes from the + underlying `Client`. + +### Socket#emit(name:String[, …]):Socket + + Emits an event to the socket identified by the string `name`. Any + other parameters can be included. + + All datastructures are supported, including `Buffer`. JavaScript + functions can't be serialized/deserialized. + + ```js + var io = require('socket.io')(); + io.on('connection', function(socket){ + socket.emit('an event', { some: 'data' }); + }); + ``` + +### Socket#join(name:String[, fn:Function]):Socket + + Adds the socket to the `room`, and fires optionally a callback `fn` + with `err` signature (if any). + + The socket is automatically a member of a room identified with its + session id (see `Socket#id`). + + The mechanics of joining rooms are handled by the `Adapter` + that has been configured (see `Server#adapter` above), defaulting to + [socket.io-adapter](https://github.com/Automattic/socket.io-adapter). + +### Socket#leave(name:String[, fn:Function]):Socket + + Removes the socket from `room`, and fires optionally a callback `fn` + with `err` signature (if any). + + **Rooms are left automatically upon disconnection**. + + The mechanics of leaving rooms are handled by the `Adapter` + that has been configured (see `Server#adapter` above), defaulting to + [socket.io-adapter](https://github.com/Automattic/socket.io-adapter). + +### Socket#to(room:String):Socket +### Socket#in(room:String):Socket + + Sets a modifier for a subsequent event emission that the event will + only be _broadcasted_ to sockets that have joined the given `room`. + + To emit to multiple rooms, you can call `to` several times. + + ```js + var io = require('socket.io')(); + io.on('connection', function(socket){ + socket.to('others').emit('an event', { some: 'data' }); + }); + ``` + +### Client + + The `Client` class represents an incoming transport (engine.io) + connection. A `Client` can be associated with many multiplexed `Socket` + that belong to different `Namespace`s. + +### Client#conn + + A reference to the underlying `engine.io` `Socket` connection. + +### Client#request + + A getter proxy that returns the reference to the `request` that + originated the engine.io connection. Useful for accessing + request headers such as `Cookie` or `User-Agent`. + +## Debug / logging + +Socket.IO is powered by [debug](http://github.com/visionmedia/debug). +In order to see all the debug output, run your app with the environment variable +`DEBUG` including the desired scope. + +To see the output from all of Socket.IO's debugging scopes you can use: + +``` +DEBUG=socket.io* node myapp +``` + +## License + +MIT diff --git a/node_modules/socket.io/index.js b/node_modules/socket.io/index.js new file mode 100644 index 0000000..ce22d97 --- /dev/null +++ b/node_modules/socket.io/index.js @@ -0,0 +1,2 @@ + +module.exports = require('./lib'); diff --git a/node_modules/socket.io/latest b/node_modules/socket.io/latest new file mode 100755 index 0000000..a100193 --- /dev/null +++ b/node_modules/socket.io/latest @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +npm tag socket.io@0.9.16 latest diff --git a/node_modules/socket.io/lib/client.js b/node_modules/socket.io/lib/client.js new file mode 100644 index 0000000..1836fce --- /dev/null +++ b/node_modules/socket.io/lib/client.js @@ -0,0 +1,220 @@ + +/** + * Module dependencies. + */ + +var parser = require('socket.io-parser'); +var debug = require('debug')('socket.io:client'); + +/** + * Module exports. + */ + +module.exports = Client; + +/** + * Client constructor. + * + * @param {Server} server instance + * @param {Socket} connection + * @api private + */ + +function Client(server, conn){ + this.server = server; + this.conn = conn; + this.encoder = new parser.Encoder(); + this.decoder = new parser.Decoder(); + this.id = conn.id; + this.request = conn.request; + this.setup(); + this.sockets = []; + this.nsps = {}; + this.connectBuffer = []; +} + +/** + * Sets up event listeners. + * + * @api private + */ + +Client.prototype.setup = function(){ + this.onclose = this.onclose.bind(this); + this.ondata = this.ondata.bind(this); + this.ondecoded = this.ondecoded.bind(this); + this.decoder.on('decoded', this.ondecoded); + this.conn.on('data', this.ondata); + this.conn.on('close', this.onclose); +}; + +/** + * Connects a client to a namespace. + * + * @param {String} namespace name + * @api private + */ + +Client.prototype.connect = function(name){ + debug('connecting to namespace %s', name); + var nsp = this.server.of(name); + if ('/' != name && !this.nsps['/']) { + this.connectBuffer.push(name); + return; + } + + var self = this; + var socket = nsp.add(this, function(){ + self.sockets.push(socket); + self.nsps[nsp.name] = socket; + + if ('/' == nsp.name && self.connectBuffer) { + self.connectBuffer.forEach(self.connect, self); + delete self.connectBuffer; + } + }); +}; + +/** + * Disconnects from all namespaces and closes transport. + * + * @api private + */ + +Client.prototype.disconnect = function(){ + var socket; + // we don't use a for loop because the length of + // `sockets` changes upon each iteration + while (socket = this.sockets.shift()) { + socket.disconnect(); + } + this.close(); +}; + +/** + * Removes a socket. Called by each `Socket`. + * + * @api private + */ + +Client.prototype.remove = function(socket){ + var i = this.sockets.indexOf(socket); + if (~i) { + var nsp = this.sockets[i].nsp.name; + this.sockets.splice(i, 1); + delete this.nsps[nsp]; + } else { + debug('ignoring remove for %s', socket.id); + } +}; + +/** + * Closes the underlying connection. + * + * @api private + */ + +Client.prototype.close = function(){ + if ('open' == this.conn.readyState) { + debug('forcing transport close'); + this.conn.close(); + this.onclose('forced server close'); + } +}; + +/** + * Writes a packet to the transport. + * + * @param {Object} packet object + * @param {Boolean} whether packet is already encoded + * @param {Boolean} whether packet is volatile + * @api private + */ + +Client.prototype.packet = function(packet, preEncoded, volatile){ + var self = this; + + // this writes to the actual connection + function writeToEngine(encodedPackets) { + if (volatile && !self.conn.transport.writable) return; + for (var i = 0; i < encodedPackets.length; i++) { + self.conn.write(encodedPackets[i]); + } + } + + if ('open' == this.conn.readyState) { + debug('writing packet %j', packet); + if(!preEncoded) { // not broadcasting, need to encode + this.encoder.encode(packet, function (encodedPackets) { // encode, then write results to engine + writeToEngine(encodedPackets); + }); + } else { // a broadcast pre-encodes a packet + writeToEngine(packet); + } + } else { + debug('ignoring packet write %j', packet); + } +}; + +/** + * Called with incoming transport data. + * + * @api private + */ + +Client.prototype.ondata = function(data){ + this.decoder.add(data); +}; + +/** + * Called when parser fully decodes a packet. + * + * @api private + */ + +Client.prototype.ondecoded = function(packet) { + if (parser.CONNECT == packet.type) { + this.connect(packet.nsp); + } else { + var socket = this.nsps[packet.nsp]; + if (socket) { + socket.onpacket(packet); + } else { + debug('no socket for namespace %s', packet.nsp); + } + } +}; + +/** + * Called upon transport close. + * + * @param {String} reason + * @api private + */ + +Client.prototype.onclose = function(reason){ + debug('client close with reason %s', reason); + + // ignore a potential subsequent `close` event + this.destroy(); + + // `nsps` and `sockets` are cleaned up seamlessly + var socket; + while (socket = this.sockets.shift()) { + socket.onclose(reason); + } + + this.decoder.destroy(); // clean up decoder +}; + +/** + * Cleans up event listeners. + * + * @api private + */ + +Client.prototype.destroy = function(){ + this.conn.removeListener('data', this.ondata); + this.conn.removeListener('close', this.onclose); + this.decoder.removeListener('decoded', this.ondecoded); +}; diff --git a/node_modules/socket.io/lib/index.js b/node_modules/socket.io/lib/index.js new file mode 100644 index 0000000..6e6d049 --- /dev/null +++ b/node_modules/socket.io/lib/index.js @@ -0,0 +1,353 @@ + +/** + * Module dependencies. + */ + +var http = require('http'); +var read = require('fs').readFileSync; +var parse = require('url').parse; +var engine = require('engine.io'); +var client = require('socket.io-client'); +var clientVersion = require('socket.io-client/package').version; +var Client = require('./client'); +var Namespace = require('./namespace'); +var Adapter = require('socket.io-adapter'); +var debug = require('debug')('socket.io:server'); +var url = require('url'); + +/** + * Module exports. + */ + +module.exports = Server; + +/** + * Socket.IO client source. + */ + +var clientSource = read(require.resolve('socket.io-client/socket.io.js'), 'utf-8'); + +/** + * Server constructor. + * + * @param {http.Server|Number|Object} http server, port or options + * @param {Object} options + * @api public + */ + +function Server(srv, opts){ + if (!(this instanceof Server)) return new Server(srv, opts); + if ('object' == typeof srv && !srv.listen) { + opts = srv; + srv = null; + } + opts = opts || {}; + this.nsps = {}; + this.path(opts.path || '/socket.io'); + this.serveClient(false !== opts.serveClient); + this.adapter(opts.adapter || Adapter); + this.origins(opts.origins || '*:*'); + this.sockets = this.of('/'); + if (srv) this.attach(srv, opts); +} + +/** + * Server request verification function, that checks for allowed origins + * + * @param {http.IncomingMessage} request + * @param {Function} callback to be called with the result: `fn(err, success)` + */ + +Server.prototype.checkRequest = function(req, fn) { + var origin = req.headers.origin || req.headers.referer; + + // file:// URLs produce a null Origin which can't be authorized via echo-back + if ('null' == origin) origin = '*'; + + if (this._origins.indexOf('*:*') !== -1) return fn(null, true); + if (origin) { + try { + var parts = url.parse(origin); + parts.port = parts.port || 80; + var ok = + ~this._origins.indexOf(parts.hostname + ':' + parts.port) || + ~this._origins.indexOf(parts.hostname + ':*') || + ~this._origins.indexOf('*:' + parts.port); + return fn(null, !!ok); + } catch (ex) { + } + } + fn(null, false); +}; + +/** + * Sets/gets whether client code is being served. + * + * @param {Boolean} whether to serve client code + * @return {Server|Boolean} self when setting or value when getting + * @api public + */ + +Server.prototype.serveClient = function(v){ + if (!arguments.length) return this._serveClient; + this._serveClient = v; + return this; +}; + +/** + * Old settings for backwards compatibility + */ + +var oldSettings = { + "transports": "transports", + "heartbeat timeout": "pingTimeout", + "heartbeat interval": "pingInterval", + "destroy buffer size": "maxHttpBufferSize" +}; + +/** + * Backwards compatiblity. + * + * @api public + */ + +Server.prototype.set = function(key, val){ + if ('authorization' == key && val) { + this.use(function(socket, next) { + val(socket.request, function(err, authorized) { + if (err) return next(new Error(err)); + if (!authorized) return next(new Error('Not authorized')); + next(); + }); + }); + } else if ('origins' == key && val) { + this.origins(val); + } else if ('resource' == key) { + this.path(val); + } else if (oldSettings[key] && this.eio[oldSettings[key]]) { + this.eio[oldSettings[key]] = val; + } else { + console.error('Option %s is not valid. Please refer to the README.', key); + } + + return this; +}; + +/** + * Sets the client serving path. + * + * @param {String} pathname + * @return {Server|String} self when setting or value when getting + * @api public + */ + +Server.prototype.path = function(v){ + if (!arguments.length) return this._path; + this._path = v.replace(/\/$/, ''); + return this; +}; + +/** + * Sets the adapter for rooms. + * + * @param {Adapter} pathname + * @return {Server|Adapter} self when setting or value when getting + * @api public + */ + +Server.prototype.adapter = function(v){ + if (!arguments.length) return this._adapter; + this._adapter = v; + for (var i in this.nsps) { + if (this.nsps.hasOwnProperty(i)) { + this.nsps[i].initAdapter(); + } + } + return this; +}; + +/** + * Sets the allowed origins for requests. + * + * @param {String} origins + * @return {Server|Adapter} self when setting or value when getting + * @api public + */ + +Server.prototype.origins = function(v){ + if (!arguments.length) return this._origins; + + this._origins = v; + return this; +}; + +/** + * Attaches socket.io to a server or port. + * + * @param {http.Server|Number} server or port + * @param {Object} options passed to engine.io + * @return {Server} self + * @api public + */ + +Server.prototype.listen = +Server.prototype.attach = function(srv, opts){ + if ('function' == typeof srv) { + var msg = 'You are trying to attach socket.io to an express' + + 'request handler function. Please pass a http.Server instance.'; + throw new Error(msg); + } + + // handle a port as a string + if (Number(srv) == srv) { + srv = Number(srv); + } + + if ('number' == typeof srv) { + debug('creating http server and binding to %d', srv); + var port = srv; + srv = http.Server(function(req, res){ + res.writeHead(404); + res.end(); + }); + srv.listen(port); + } + + // set engine.io path to `/socket.io` + opts = opts || {}; + opts.path = opts.path || '/socket.io'; + // set origins verification + opts.allowRequest = this.checkRequest.bind(this); + + // initialize engine + debug('creating engine.io instance with opts %j', opts); + this.eio = engine.attach(srv, opts); + + // attach static file serving + if (this._serveClient) this.attachServe(srv); + + // bind to engine events + this.bind(this.eio); + + return this; +}; + +/** + * Attaches the static file serving. + * + * @param {Function|http.Server} http server + * @api private + */ + +Server.prototype.attachServe = function(srv){ + debug('attaching client serving req handler'); + var url = this._path + '/socket.io.js'; + var evs = srv.listeners('request').slice(0); + var self = this; + srv.removeAllListeners('request'); + srv.on('request', function(req, res) { + if (0 == req.url.indexOf(url)) { + self.serve(req, res); + } else { + for (var i = 0; i < evs.length; i++) { + evs[i].call(srv, req, res); + } + } + }); +}; + +/** + * Handles a request serving `/socket.io.js` + * + * @param {http.Request} req + * @param {http.Response} res + * @api private + */ + +Server.prototype.serve = function(req, res){ + if (req.headers.etag) { + if (clientVersion == req.headers.etag) { + debug('serve client 304'); + res.writeHead(304); + res.end(); + return; + } + } + + debug('serve client source'); + res.setHeader('Content-Type', 'application/javascript'); + res.setHeader('ETag', clientVersion); + res.writeHead(200); + res.end(clientSource); +}; + +/** + * Binds socket.io to an engine.io instance. + * + * @param {engine.Server} engine.io (or compatible) server + * @return {Server} self + * @api public + */ + +Server.prototype.bind = function(engine){ + this.engine = engine; + this.engine.on('connection', this.onconnection.bind(this)); + return this; +}; + +/** + * Called with each incoming transport connection. + * + * @param {engine.Socket} socket + * @return {Server} self + * @api public + */ + +Server.prototype.onconnection = function(conn){ + debug('incoming connection with id %s', conn.id); + var client = new Client(this, conn); + client.connect('/'); + return this; +}; + +/** + * Looks up a namespace. + * + * @param {String} nsp name + * @param {Function} optional, nsp `connection` ev handler + * @api public + */ + +Server.prototype.of = function(name, fn){ + if (!this.nsps[name]) { + debug('initializing namespace %s', name); + var nsp = new Namespace(this, name); + this.nsps[name] = nsp; + } + if (fn) this.nsps[name].on('connect', fn); + return this.nsps[name]; +}; + +/** + * Expose main namespace (/). + */ + +['on', 'to', 'in', 'use', 'emit', 'send', 'write'].forEach(function(fn){ + Server.prototype[fn] = function(){ + var nsp = this.sockets[fn]; + return nsp.apply(this.sockets, arguments); + }; +}); + +Namespace.flags.forEach(function(flag){ + Server.prototype.__defineGetter__(flag, function(name){ + this.flags.push(name); + return this; + }); +}); + +/** + * BC with `io.listen` + */ + +Server.listen = Server; diff --git a/node_modules/socket.io/lib/namespace.js b/node_modules/socket.io/lib/namespace.js new file mode 100644 index 0000000..4ae0b15 --- /dev/null +++ b/node_modules/socket.io/lib/namespace.js @@ -0,0 +1,242 @@ + +/** + * Module dependencies. + */ + +var Socket = require('./socket'); +var Emitter = require('events').EventEmitter; +var parser = require('socket.io-parser'); +var debug = require('debug')('socket.io:namespace'); +var hasBin = require('has-binary-data'); + +/** + * Module exports. + */ + +module.exports = exports = Namespace; + +/** + * Blacklisted events. + */ + +exports.events = [ + 'connect', // for symmetry with client + 'connection', + 'newListener' +]; + +/** + * Flags. + */ + +exports.flags = ['json']; + +/** + * `EventEmitter#emit` reference. + */ + +var emit = Emitter.prototype.emit; + +/** + * Namespace constructor. + * + * @param {Server} server instance + * @param {Socket} name + * @api private + */ + +function Namespace(server, name){ + this.name = name; + this.server = server; + this.sockets = []; + this.connected = {}; + this.fns = []; + this.ids = 0; + this.acks = {}; + this.initAdapter(); +} + +/** + * Inherits from `EventEmitter`. + */ + +Namespace.prototype.__proto__ = Emitter.prototype; + +/** + * Apply flags from `Socket`. + */ + +exports.flags.forEach(function(flag){ + Namespace.prototype.__defineGetter__(flag, function(){ + this.flags = this.flags || {}; + this.flags[flag] = true; + return this; + }); +}); + +/** + * Initializes the `Adapter` for this nsp. + * Run upon changing adapter by `Server#adapter` + * in addition to the constructor. + * + * @api private + */ + +Namespace.prototype.initAdapter = function(){ + this.adapter = new (this.server.adapter())(this); +}; + +/** + * Sets up namespace middleware. + * + * @return {Namespace} self + * @api public + */ + +Namespace.prototype.use = function(fn){ + this.fns.push(fn); + return this; +}; + +/** + * Executes the middleware for an incoming client. + * + * @param {Socket} socket that will get added + * @param {Function} last fn call in the middleware + * @api private + */ + +Namespace.prototype.run = function(socket, fn){ + var fns = this.fns.slice(0); + if (!fns.length) return fn(null); + + function run(i){ + fns[i](socket, function(err){ + // upon error, short-circuit + if (err) return fn(err); + + // if no middleware left, summon callback + if (!fns[i + 1]) return fn(null); + + // go on to next + run(i + 1); + }); + } + + run(0); +}; + +/** + * Targets a room when emitting. + * + * @param {String} name + * @return {Namespace} self + * @api public + */ + +Namespace.prototype.to = +Namespace.prototype['in'] = function(name){ + this.rooms = this.rooms || []; + if (!~this.rooms.indexOf(name)) this.rooms.push(name); + return this; +}; + +/** + * Adds a new client. + * + * @return {Socket} + * @api private + */ + +Namespace.prototype.add = function(client, fn){ + debug('adding socket to nsp %s', this.name); + var socket = new Socket(this, client); + var self = this; + this.run(socket, function(err){ + process.nextTick(function(){ + if ('open' == client.conn.readyState) { + if (err) return socket.error(err.data || err.message); + + // track socket + self.sockets.push(socket); + + // it's paramount that the internal `onconnect` logic + // fires before user-set events to prevent state order + // violations (such as a disconnection before the connection + // logic is complete) + socket.onconnect(); + if (fn) fn(); + + // fire user-set events + self.emit('connect', socket); + self.emit('connection', socket); + } else { + debug('next called after client was closed - ignoring socket'); + } + }); + }); + return socket; +}; + +/** + * Removes a client. Called by each `Socket`. + * + * @api private + */ + +Namespace.prototype.remove = function(socket){ + var i = this.sockets.indexOf(socket); + if (~i) { + this.sockets.splice(i, 1); + } else { + debug('ignoring remove for %s', socket.id); + } +}; + +/** + * Emits to all clients. + * + * @return {Namespace} self + * @api public + */ + +Namespace.prototype.emit = function(ev){ + if (~exports.events.indexOf(ev)) { + emit.apply(this, arguments); + } else { + // set up packet object + var args = Array.prototype.slice.call(arguments); + var parserType = parser.EVENT; // default + if (hasBin(args)) { parserType = parser.BINARY_EVENT; } // binary + + var packet = { type: parserType, data: args }; + + if ('function' == typeof args[args.length - 1]) { + throw new Error('Callbacks are not supported when broadcasting'); + } + + this.adapter.broadcast(packet, { + rooms: this.rooms, + flags: this.flags + }); + + delete this.rooms; + delete this.flags; + } + return this; +}; + +/** + * Sends a `message` event to all clients. + * + * @return {Namespace} self + * @api public + */ + +Namespace.prototype.send = +Namespace.prototype.write = function(){ + var args = Array.prototype.slice.call(arguments); + args.unshift('message'); + this.emit.apply(this, args); + return this; +}; diff --git a/node_modules/socket.io/lib/socket.js b/node_modules/socket.io/lib/socket.js new file mode 100644 index 0000000..64cf544 --- /dev/null +++ b/node_modules/socket.io/lib/socket.js @@ -0,0 +1,429 @@ + +/** + * Module dependencies. + */ + +var Emitter = require('events').EventEmitter; +var parser = require('socket.io-parser'); +var url = require('url'); +var debug = require('debug')('socket.io:socket'); +var hasBin = require('has-binary-data'); + +/** + * Module exports. + */ + +module.exports = exports = Socket; + +/** + * Blacklisted events. + * + * @api public + */ + +exports.events = [ + 'error', + 'connect', + 'disconnect', + 'newListener', + 'removeListener' +]; + +/** + * Flags. + * + * @api private + */ + +var flags = [ + 'json', + 'volatile', + 'broadcast' +]; + +/** + * `EventEmitter#emit` reference. + */ + +var emit = Emitter.prototype.emit; + +/** + * Interface to a `Client` for a given `Namespace`. + * + * @param {Namespace} nsp + * @param {Client} client + * @api public + */ + +function Socket(nsp, client){ + this.nsp = nsp; + this.server = nsp.server; + this.adapter = this.nsp.adapter; + this.id = client.id; + this.request = client.request; + this.client = client; + this.conn = client.conn; + this.rooms = []; + this.acks = {}; + this.connected = true; + this.disconnected = false; + this.handshake = this.buildHandshake(); +} + +/** + * Inherits from `EventEmitter`. + */ + +Socket.prototype.__proto__ = Emitter.prototype; + +/** + * Apply flags from `Socket`. + */ + +flags.forEach(function(flag){ + Socket.prototype.__defineGetter__(flag, function(){ + this.flags = this.flags || {}; + this.flags[flag] = true; + return this; + }); +}); + +/** + * `request` engine.io shorcut. + * + * @api public + */ + +Socket.prototype.__defineGetter__('request', function(){ + return this.conn.request; +}); + +/** + * Builds the `handshake` BC object + * + * @api private + */ + +Socket.prototype.buildHandshake = function(){ + return { + headers: this.request.headers, + time: (new Date) + '', + address: this.request.connection.address(), + xdomain: !!this.request.headers.origin, + secure: !!this.request.connection.encrypted, + issued: +(new Date), + url: this.request.url, + query: url.parse(this.request.url, true).query || {} + }; +}; + +/** + * Emits to this client. + * + * @return {Socket} self + * @api public + */ + +Socket.prototype.emit = function(ev){ + if (~exports.events.indexOf(ev)) { + emit.apply(this, arguments); + } else { + var args = Array.prototype.slice.call(arguments); + var packet = {}; + packet.type = hasBin(args) ? parser.BINARY_EVENT : parser.EVENT; + packet.data = args; + + // access last argument to see if it's an ACK callback + if ('function' == typeof args[args.length - 1]) { + if (this._rooms || (this.flags && this.flags.broadcast)) { + throw new Error('Callbacks are not supported when broadcasting'); + } + + debug('emitting packet with ack id %d', this.nsp.ids); + this.acks[this.nsp.ids] = args.pop(); + packet.id = this.nsp.ids++; + } + + if (this._rooms || (this.flags && this.flags.broadcast)) { + this.adapter.broadcast(packet, { + except: [this.id], + rooms: this._rooms, + flags: this.flags + }); + } else { + // dispatch packet + this.packet(packet); + } + + // reset flags + delete this._rooms; + delete this.flags; + } + return this; +}; + +/** + * Targets a room when broadcasting. + * + * @param {String} name + * @return {Socket} self + * @api public + */ + +Socket.prototype.to = +Socket.prototype.in = function(name){ + this._rooms = this._rooms || []; + if (!~this._rooms.indexOf(name)) this._rooms.push(name); + return this; +}; + +/** + * Sends a `message` event. + * + * @return {Socket} self + * @api public + */ + +Socket.prototype.send = +Socket.prototype.write = function(){ + var args = Array.prototype.slice.call(arguments); + args.unshift('message'); + this.emit.apply(this, args); + return this; +}; + +/** + * Writes a packet. + * + * @param {Object} packet object + * @api private + */ + +Socket.prototype.packet = function(packet, preEncoded){ + packet.nsp = this.nsp.name; + var volatile = this.flags && this.flags.volatile; + this.client.packet(packet, preEncoded, volatile); +}; + +/** + * Joins a room. + * + * @param {String} room + * @param {Function} optional, callback + * @return {Socket} self + * @api private + */ + +Socket.prototype.join = function(room, fn){ + debug('joining room %s', room); + var self = this; + if (~this.rooms.indexOf(room)) return this; + this.adapter.add(this.id, room, function(err){ + if (err) return fn && fn(err); + debug('joined room %s', room); + self.rooms.push(room); + fn && fn(null); + }); + return this; +}; + +/** + * Leaves a room. + * + * @param {String} room + * @param {Function} optional, callback + * @return {Socket} self + * @api private + */ + +Socket.prototype.leave = function(room, fn){ + debug('leave room %s', room); + var self = this; + this.adapter.del(this.id, room, function(err){ + if (err) return fn && fn(err); + debug('left room %s', room); + self.rooms.splice(self.rooms.indexOf(room, 1)); + fn && fn(null); + }); + return this; +}; + +/** + * Leave all rooms. + * + * @api private + */ + +Socket.prototype.leaveAll = function(){ + this.adapter.delAll(this.id); +}; + +/** + * Called by `Namespace` upon succesful + * middleware execution (ie: authorization). + * + * @api private + */ + +Socket.prototype.onconnect = function(){ + debug('socket connected - writing packet'); + this.join(this.id); + this.packet({ type: parser.CONNECT }); + this.nsp.connected[this.id] = this; +}; + +/** + * Called with each packet. Called by `Client`. + * + * @param {Object} packet + * @api private + */ + +Socket.prototype.onpacket = function(packet){ + debug('got packet %j', packet); + switch (packet.type) { + case parser.EVENT: + this.onevent(packet); + break; + + case parser.BINARY_EVENT: + this.onevent(packet); + break; + + case parser.ACK: + this.onack(packet); + break; + + case parser.BINARY_ACK: + this.onack(packet); + break; + + case parser.DISCONNECT: + this.ondisconnect(); + break; + + case parser.ERROR: + this.emit('error', packet.data); + } +}; + +/** + * Called upon event packet. + * + * @param {Object} packet object + * @api private + */ + +Socket.prototype.onevent = function(packet){ + var args = packet.data || []; + debug('emitting event %j', args); + + if (null != packet.id) { + debug('attaching ack callback to event'); + args.push(this.ack(packet.id)); + } + + emit.apply(this, args); +}; + +/** + * Produces an ack callback to emit with an event. + * + * @param {Number} packet id + * @api private + */ + +Socket.prototype.ack = function(id){ + var self = this; + var sent = false; + return function(){ + // prevent double callbacks + if (sent) return; + var args = Array.prototype.slice.call(arguments); + debug('sending ack %j', args); + + var type = hasBin(args) ? parser.BINARY_ACK : parser.ACK; + self.packet({ + id: id, + type: type, + data: args + }); + }; +}; + +/** + * Called upon ack packet. + * + * @api private + */ + +Socket.prototype.onack = function(packet){ + var ack = this.acks[packet.id]; + if ('function' == typeof ack) { + debug('calling ack %s with %j', packet.id, packet.data); + ack.apply(this, packet.data); + delete this.acks[packet.id]; + } else { + debug('bad ack %s', packet.id); + } +}; + +/** + * Called upon client disconnect packet. + * + * @api private + */ + +Socket.prototype.ondisconnect = function(){ + debug('got disconnect packet'); + this.onclose('client namespace disconnect'); +}; + +/** + * Called upon closing. Called by `Client`. + * + * @param {String} reason + * @api private + */ + +Socket.prototype.onclose = function(reason){ + if (!this.connected) return this; + debug('closing socket - reason %s', reason); + this.leaveAll(); + this.nsp.remove(this); + this.client.remove(this); + this.connected = false; + this.disconnected = true; + delete this.nsp.connected[this.id]; + this.emit('disconnect', reason); +}; + +/** + * Produces an `error` packet. + * + * @param {Object} error object + * @api private + */ + +Socket.prototype.error = function(err){ + this.packet({ type: parser.ERROR, data: err }); +}; + +/** + * Disconnects this client. + * + * @param {Boolean} if `true`, closes the underlying connection + * @return {Socket} self + * @api public + */ + +Socket.prototype.disconnect = function(close){ + if (!this.connected) return this; + if (close) { + this.client.disconnect(); + } else { + this.packet({ type: parser.DISCONNECT }); + this.onclose('server namespace disconnect'); + } + return this; +}; diff --git a/node_modules/socket.io/node_modules/debug/Readme.md b/node_modules/socket.io/node_modules/debug/Readme.md new file mode 100644 index 0000000..c5a34e8 --- /dev/null +++ b/node_modules/socket.io/node_modules/debug/Readme.md @@ -0,0 +1,115 @@ +# debug + + tiny node.js debugging utility modelled after node core's debugging technique. + +## Installation + +``` +$ npm install debug +``` + +## Usage + + With `debug` you simply invoke the exported function to generate your debug function, passing it a name which will determine if a noop function is returned, or a decorated `console.error`, so all of the `console` format string goodies you're used to work fine. A unique color is selected per-function for visibility. + +Example _app.js_: + +```js +var debug = require('debug')('http') + , http = require('http') + , name = 'My App'; + +// fake app + +debug('booting %s', name); + +http.createServer(function(req, res){ + debug(req.method + ' ' + req.url); + res.end('hello\n'); +}).listen(3000, function(){ + debug('listening'); +}); + +// fake worker of some kind + +require('./worker'); +``` + +Example _worker.js_: + +```js +var debug = require('debug')('worker'); + +setInterval(function(){ + debug('doing some work'); +}, 1000); +``` + + The __DEBUG__ environment variable is then used to enable these based on space or comma-delimited names. Here are some examples: + + ![debug http and worker](http://f.cl.ly/items/18471z1H402O24072r1J/Screenshot.png) + + ![debug worker](http://f.cl.ly/items/1X413v1a3M0d3C2c1E0i/Screenshot.png) + +## Millisecond diff + + When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls. + + ![](http://f.cl.ly/items/2i3h1d3t121M2Z1A3Q0N/Screenshot.png) + + When stderr is not a TTY, `Date#toUTCString()` is used, making it more useful for logging the debug information as shown below: + _(NOTE: Debug now uses stderr instead of stdout, so the correct shell command for this example is actually `DEBUG=* node example/worker 2> out &`)_ + + ![](http://f.cl.ly/items/112H3i0e0o0P0a2Q2r11/Screenshot.png) + +## Conventions + + If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". + +## Wildcards + + The "*" character may be used as a wildcard. Suppose for example your library has debuggers named "connect:bodyParser", "connect:compress", "connect:session", instead of listing all three with `DEBUG=connect:bodyParser,connect.compress,connect:session`, you may simply do `DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`. + + You can also exclude specific debuggers by prefixing them with a "-" character. For example, `DEBUG=* -connect:*` would include all debuggers except those starting with "connect:". + +## Browser support + + Debug works in the browser as well, currently persisted by `localStorage`. For example if you have `worker:a` and `worker:b` as shown below, and wish to debug both type `debug.enable('worker:*')` in the console and refresh the page, this will remain until you disable with `debug.disable()`. + +```js +a = debug('worker:a'); +b = debug('worker:b'); + +setInterval(function(){ + a('doing some work'); +}, 1000); + +setInterval(function(){ + a('doing some work'); +}, 1200); +``` + +## License + +(The MIT License) + +Copyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/socket.io/node_modules/debug/debug.js b/node_modules/socket.io/node_modules/debug/debug.js new file mode 100644 index 0000000..509dc0d --- /dev/null +++ b/node_modules/socket.io/node_modules/debug/debug.js @@ -0,0 +1,137 @@ + +/** + * Expose `debug()` as the module. + */ + +module.exports = debug; + +/** + * Create a debugger with the given `name`. + * + * @param {String} name + * @return {Type} + * @api public + */ + +function debug(name) { + if (!debug.enabled(name)) return function(){}; + + return function(fmt){ + fmt = coerce(fmt); + + var curr = new Date; + var ms = curr - (debug[name] || curr); + debug[name] = curr; + + fmt = name + + ' ' + + fmt + + ' +' + debug.humanize(ms); + + // This hackery is required for IE8 + // where `console.log` doesn't have 'apply' + window.console + && console.log + && Function.prototype.apply.call(console.log, console, arguments); + } +} + +/** + * The currently active debug mode names. + */ + +debug.names = []; +debug.skips = []; + +/** + * Enables a debug mode by name. This can include modes + * separated by a colon and wildcards. + * + * @param {String} name + * @api public + */ + +debug.enable = function(name) { + try { + localStorage.debug = name; + } catch(e){} + + var split = (name || '').split(/[\s,]+/) + , len = split.length; + + for (var i = 0; i < len; i++) { + name = split[i].replace('*', '.*?'); + if (name[0] === '-') { + debug.skips.push(new RegExp('^' + name.substr(1) + '$')); + } + else { + debug.names.push(new RegExp('^' + name + '$')); + } + } +}; + +/** + * Disable debug output. + * + * @api public + */ + +debug.disable = function(){ + debug.enable(''); +}; + +/** + * Humanize the given `ms`. + * + * @param {Number} m + * @return {String} + * @api private + */ + +debug.humanize = function(ms) { + var sec = 1000 + , min = 60 * 1000 + , hour = 60 * min; + + if (ms >= hour) return (ms / hour).toFixed(1) + 'h'; + if (ms >= min) return (ms / min).toFixed(1) + 'm'; + if (ms >= sec) return (ms / sec | 0) + 's'; + return ms + 'ms'; +}; + +/** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + +debug.enabled = function(name) { + for (var i = 0, len = debug.skips.length; i < len; i++) { + if (debug.skips[i].test(name)) { + return false; + } + } + for (var i = 0, len = debug.names.length; i < len; i++) { + if (debug.names[i].test(name)) { + return true; + } + } + return false; +}; + +/** + * Coerce `val`. + */ + +function coerce(val) { + if (val instanceof Error) return val.stack || val.message; + return val; +} + +// persist + +try { + if (window.localStorage) debug.enable(localStorage.debug); +} catch(e){} diff --git a/node_modules/socket.io/node_modules/debug/index.js b/node_modules/socket.io/node_modules/debug/index.js new file mode 100644 index 0000000..e02c13b --- /dev/null +++ b/node_modules/socket.io/node_modules/debug/index.js @@ -0,0 +1,5 @@ +if ('undefined' == typeof window) { + module.exports = require('./lib/debug'); +} else { + module.exports = require('./debug'); +} diff --git a/node_modules/socket.io/node_modules/debug/lib/debug.js b/node_modules/socket.io/node_modules/debug/lib/debug.js new file mode 100644 index 0000000..3b0a918 --- /dev/null +++ b/node_modules/socket.io/node_modules/debug/lib/debug.js @@ -0,0 +1,147 @@ +/** + * Module dependencies. + */ + +var tty = require('tty'); + +/** + * Expose `debug()` as the module. + */ + +module.exports = debug; + +/** + * Enabled debuggers. + */ + +var names = [] + , skips = []; + +(process.env.DEBUG || '') + .split(/[\s,]+/) + .forEach(function(name){ + name = name.replace('*', '.*?'); + if (name[0] === '-') { + skips.push(new RegExp('^' + name.substr(1) + '$')); + } else { + names.push(new RegExp('^' + name + '$')); + } + }); + +/** + * Colors. + */ + +var colors = [6, 2, 3, 4, 5, 1]; + +/** + * Previous debug() call. + */ + +var prev = {}; + +/** + * Previously assigned color. + */ + +var prevColor = 0; + +/** + * Is stdout a TTY? Colored output is disabled when `true`. + */ + +var isatty = tty.isatty(2); + +/** + * Select a color. + * + * @return {Number} + * @api private + */ + +function color() { + return colors[prevColor++ % colors.length]; +} + +/** + * Humanize the given `ms`. + * + * @param {Number} m + * @return {String} + * @api private + */ + +function humanize(ms) { + var sec = 1000 + , min = 60 * 1000 + , hour = 60 * min; + + if (ms >= hour) return (ms / hour).toFixed(1) + 'h'; + if (ms >= min) return (ms / min).toFixed(1) + 'm'; + if (ms >= sec) return (ms / sec | 0) + 's'; + return ms + 'ms'; +} + +/** + * Create a debugger with the given `name`. + * + * @param {String} name + * @return {Type} + * @api public + */ + +function debug(name) { + function disabled(){} + disabled.enabled = false; + + var match = skips.some(function(re){ + return re.test(name); + }); + + if (match) return disabled; + + match = names.some(function(re){ + return re.test(name); + }); + + if (!match) return disabled; + var c = color(); + + function colored(fmt) { + fmt = coerce(fmt); + + var curr = new Date; + var ms = curr - (prev[name] || curr); + prev[name] = curr; + + fmt = ' \u001b[9' + c + 'm' + name + ' ' + + '\u001b[3' + c + 'm\u001b[90m' + + fmt + '\u001b[3' + c + 'm' + + ' +' + humanize(ms) + '\u001b[0m'; + + console.error.apply(this, arguments); + } + + function plain(fmt) { + fmt = coerce(fmt); + + fmt = new Date().toUTCString() + + ' ' + name + ' ' + fmt; + console.error.apply(this, arguments); + } + + colored.enabled = plain.enabled = true; + + return isatty || process.env.DEBUG_COLORS + ? colored + : plain; +} + +/** + * Coerce `val`. + */ + +function coerce(val) { + if (val instanceof Error) return val.stack || val.message; + return val; +} diff --git a/node_modules/socket.io/node_modules/debug/package.json b/node_modules/socket.io/node_modules/debug/package.json new file mode 100644 index 0000000..8a959a5 --- /dev/null +++ b/node_modules/socket.io/node_modules/debug/package.json @@ -0,0 +1,62 @@ +{ + "name": "debug", + "version": "0.7.4", + "repository": { + "type": "git", + "url": "git://github.com/visionmedia/debug.git" + }, + "description": "small debugging utility", + "keywords": [ + "debug", + "log", + "debugger" + ], + "author": { + "name": "TJ Holowaychuk", + "email": "tj@vision-media.ca" + }, + "dependencies": {}, + "devDependencies": { + "mocha": "*" + }, + "main": "lib/debug.js", + "browser": "./debug.js", + "engines": { + "node": "*" + }, + "files": [ + "lib/debug.js", + "debug.js", + "index.js" + ], + "component": { + "scripts": { + "debug/index.js": "index.js", + "debug/debug.js": "debug.js" + } + }, + "bugs": { + "url": "https://github.com/visionmedia/debug/issues" + }, + "homepage": "https://github.com/visionmedia/debug", + "_id": "debug@0.7.4", + "dist": { + "shasum": "06e1ea8082c2cb14e39806e22e2f6f757f92af39", + "tarball": "http://registry.npmjs.org/debug/-/debug-0.7.4.tgz" + }, + "_from": "debug@0.7.4", + "_npmVersion": "1.3.13", + "_npmUser": { + "name": "tjholowaychuk", + "email": "tj@vision-media.ca" + }, + "maintainers": [ + { + "name": "tjholowaychuk", + "email": "tj@vision-media.ca" + } + ], + "directories": {}, + "_shasum": "06e1ea8082c2cb14e39806e22e2f6f757f92af39", + "_resolved": "https://registry.npmjs.org/debug/-/debug-0.7.4.tgz" +} diff --git a/node_modules/socket.io/node_modules/engine.io/.npmignore b/node_modules/socket.io/node_modules/engine.io/.npmignore new file mode 100644 index 0000000..ce0640b --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/.npmignore @@ -0,0 +1,5 @@ +examples +node_modules +test +npm-debug.log +coverage.html diff --git a/node_modules/socket.io/node_modules/engine.io/.travis.yml b/node_modules/socket.io/node_modules/engine.io/.travis.yml new file mode 100644 index 0000000..04a6969 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/.travis.yml @@ -0,0 +1,7 @@ +language: node_js +node_js: + - "0.10" + - "0.8" + +notifications: + irc: "irc.freenode.org#socket.io" diff --git a/node_modules/socket.io/node_modules/engine.io/History.md b/node_modules/socket.io/node_modules/engine.io/History.md new file mode 100644 index 0000000..784861b --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/History.md @@ -0,0 +1,363 @@ + +1.3.1 / 2014-06-19 +================== + + * package: bump `engine.io-client` + +1.3.0 / 2014-06-13 +================== + + * update example to use v1.2.2 + * fixed newline parsing in jsonp + * make require('engine.io')() return a new Server instance [defunctzombie] + * add Server.attach method [defunctzombie] + * fix GH-211, set CORS headers when sending error message [mokesmokes] + +1.2.2 / 2014-05-30 +================== + + * package: bump `engine.io-parser` for binary utf8 fix + +1.2.1 / 2014-05-22 +================== + + * package: bump engine.io-client + +1.2.0 / 2014-05-18 +================== + + * removed flashsocket, moving to userland + +1.1.1 / 2014-05-14 +================== + + * test: reduce packet size + * package: bump parser + +1.1.0 / 2014-04-27 +================== + + * socket: removed unneeded `clearTimeout` (fixes #250) + * made the request verification process async + * package: bump `engine.io-parser` + * use _query instead of query, fixes compat with restify + * added a maximum buffer size to received data from polling + * fixing looping array via for in to normal loop + +1.0.5 / 2014-03-18 +================== + + * package: bump `engine.io-parser` and `engine.io-client` + +1.0.4 / 2014-03-14 +================== + + * package: bump `engine.io-client` + +1.0.3 / 2014-03-12 +================== + + * package: bump `engine.io-client` + +1.0.2 / 2014-03-12 +================== + + * bump engine.io-client + +1.0.1 / 2014-03-06 +================== + + * package: bump `engine.io-parser` + * transports: fix jshint warnings and style + +1.0.0 / 2014-03-06 +================== + + * polling-xhr: added `OPTIONS` support, fixes CORS + * close() properly when triggered in connection handler + * fix DDOS vector by setting up too many intervals + * binary support + +0.9.0 / 2014-02-09 +================== + + * Prevent errors with connections behind proxies without WS support + like Squid [nicklagrow, samaanghani, davidhcummings] + * Socket#request a simple property [mokesmokes] + * Changed `Socket`'s `upgrade` event to happen after upgrade [mokesmokes] + * Document `Socket#id` [mokesmokes] + +0.8.2 / 2014-01-18 +================== + + * package: bump `engine.io-client` + +0.8.1 / 2014-01-17 +================== + + * package: bump `engine.io-client` + * package: pin dev deps + * examples: fix port output + * fix latency example + +0.8.0 / 2014-01-05 +================== + + * package: bump `engine.io-client` to `0.8.0` + * test: fix syntax, remove globals + +0.7.14 / 2014-01-01 +=================== + + * package: bump `engine.io-client` to `0.7.14` + +0.7.13 / 2013-12-20 +=================== + + * package: bump `engine.io-client` + * transports: added support for XSS filters on IE [guille, 3rd-eden] + +0.7.12 / 2013-11-11 +=================== + + * package: bump `engine.io-client` + +0.7.11 / 2013-11-06 +=================== + + * package: bump engine.io-client + * fix GH-198 + +0.7.10 / 2013-10-28 +=================== + + * package: bump `engine.io-client` + * package: update "ws" to v0.4.31 + +0.7.9 / 2013-08-30 +================== + + * package: bump `engine.io-client` + +0.7.8 / 2013-08-30 +================== + + * package: bump `engine.io-client` + * package: bump ws + +0.7.7 / 2013-08-30 +================== + + * package: bump `engine.io-client` + +0.7.6 / 2013-08-30 +================== + + * package: bump engine.io-client + +0.7.5 / 2013-08-30 +================== + + * package: bump engine.io-client + +0.7.4 / 2013-08-25 +================== + + * package: bump `engine.io-client` + +0.7.3 / 2013-08-23 +================== + + * package: bump engine.io-client (noop) + * package: fix regresison in upgrade cause by ws update + +0.7.2 / 2013-08-23 +================== + + * package: bump `engine.io-client` for `WebSocket` browser fix + +0.7.1 / 2013-08-23 +================== + + * package: bump engine.io-client for ws fix + +0.7.0 / 2013-08-23 +================== + + * package: bump engine.io-client + * updated example + * inline merge + * added support node version 0.10 to .travis.yml + * fixed respond to flash policy request test. Closes #184 + * fixed upgrade with timeout test. Closes #185 + * engine.io: don't use __proto__, closes #170 + +0.6.3 / 2013-06-21 +================== + + * package: bumped `engine.io-client` to `0.6.3` + +0.6.2 / 2013-06-15 +================== + + * fix upgrade stalling edge case introduced with #174 fix + * remove unneeded client code related to iOS + * added test for `engine.io-client` `0.6.1` + +0.6.1 / 2013-06-06 +================== + + * package: bumped `engine.io-client` to `0.6.1` + +0.6.0 / 2013-05-31 +================== + + * socket: clear timer after sending one noop packet (fixes #174) + * clear all timers on socket close + * sending error on transport creation upon a bad request + * added test for client-side buffer cleanup + * changed flushComplete to flush + * ended support for node 0.6 + +0.5.0 / 2013-03-16 +================== + + * polling: implemented new parser + * test writeBuffer isn't cleared onError, removed 'closing' check in .flush() + * fixed bug89 and added tests: writeBuffer not flushed until nextTick + +0.4.3 / 2013-02-08 +================== + + * package: bumped `engine.io-client` to `0.4.3` + +0.4.2 / 2013-02-08 +================== + + * Only end upgrade socket connections if unhandled + * Fix websocket dependency + * Close socket if upgrade is received and socket.readyState != open + +0.4.1 / 2013-01-18 +================== + + * package: bumped versions + * Fixed bugs in previous send callback fix and updated test cases + * Added a test case which makes the code before the send callback fix fail + * socket: emit `data` event (synonym with `message`) + * socket: added `Socket#write` + * engine.io: cleanup + * engine.io: deprecated `resource` + * `npm docs engine.io` works now + +0.3.10 / 2012-12-03 +=================== + + * package: bumped `engine.io-client` with `close` fixes + * add packetCreate event [jxck] + * add packet event to socket [jxck] + * transport: remove `Connection` headers and let node handle it + * server: send validation failure reason to clients + * engine: invoking as a function causes attach + * socket: reset `writeBuffer` before send + +0.3.9 / 2012-10-23 +================== + + * package: bumped `engine.io-client` + +0.3.8 / 2012-10-23 +================== + + * package: bumped engine.io-client + * examples: added first example + +0.3.7 / 2012-10-21 +================== + + * package: bumped `engine.io-client` + +0.3.6 / 2012-10-21 +================== + + [skipped] + +0.3.5 / 2012-10-14 +================== + + * package: reverted last commit - we use the parser from the client + +0.3.4 / 2012-10-14 +================== + + * package: `engine.io-client` moved to `devDependencies` + * socket: added missing jsdoc + +0.3.3 / 2012-10-10 +================== + + * socket: fixed check interval clearing [joewalnes] + * transports: improved instrumentation + +0.3.2 / 2012-10-08 +================== + + * socket: improve check interval for upgrade + +0.3.1 / 2012-10-08 +================== + + * socket: faster upgrades (we perform a check immediately) + * server: don't assume sid is numeric + +0.3.0 / 2012-10-04 +================== + + * socket: `writeBuffer` now gets sliced, and is recoverable after `close` [afshinm] + * server: expect ping from client and send interval with handshake [cadorn] + * polling-jsonp: prevent client breakage with utf8 whitespace + * socket: fix `flush` and `drain` events + * socket: add `send` callback [afshinm] + * transport: avoid unhandled error events for stale transports + * README: documentation improvements [EugenDueck] + +0.2.2 / 2012-08-26 +================== + + * server: remove buffering for flash policy requests + * transport: avoid unhandled error events for stale transports (fixes #69) + * readme: documented `toString` behavior on `send` [EugenDueck] + +0.2.1 / 2012-08-13 +================== + + * polling-xhr: skip Keep-Alive when it's implied [EugenDueck] + * polling-jsonp: skip Keep-Alive when it's implied [EugenDueck] + * README: added plugins list with engine.io-conflation + * socket: added flush/drain events (fixes #56) + * server: avoid passing websocket to non-websocket transports (fixes #24) + +0.2.0 / 2012-08-06 +================== + + * Bumped client + * test: added closing connection test + * server: implemented stronger id generator with collision detection + +0.1.2 / 2012-08-02 +================== + + * Fixed a jsonp bug in Nokia mobile phones and potentially other UAs. + +0.1.1 / 2012-08-01 +================== + + * Fixed errors when a socket is closed while upgrade probe is happening. + * Improved WS error handling + * Replaced websocket.io with ws, now that it supports older drafts + * README fixes + +0.1.0 / 2012-07-03 +================== + + * Initial release. diff --git a/node_modules/socket.io/node_modules/engine.io/Makefile b/node_modules/socket.io/node_modules/engine.io/Makefile new file mode 100644 index 0000000..5046ced --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/Makefile @@ -0,0 +1,23 @@ + +TESTS = test/*.js +BENCHMARKS = $(shell find bench -type f ! -name 'runner.js') +REPORTER = dot + +test: + @./node_modules/.bin/mocha \ + --reporter $(REPORTER) \ + --slow 500ms \ + --bail \ + --globals ___eio,document \ + $(TESTS) + +test-cov: lib-cov + EIO_COV=1 $(MAKE) test REPORTER=html-cov > coverage.html + +lib-cov: + jscoverage --no-highlight lib lib-cov + +bench: + @node $(PROFILEFLAGS) bench/runner.js $(BENCHMARKS) + +.PHONY: test test-cov bench diff --git a/node_modules/socket.io/node_modules/engine.io/README.md b/node_modules/socket.io/node_modules/engine.io/README.md new file mode 100644 index 0000000..bf57ac0 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/README.md @@ -0,0 +1,518 @@ + +# Engine.IO: the realtime engine + +[![Build Status](https://secure.travis-ci.org/Automattic/engine.io.png)](http://travis-ci.org/Automattic/engine.io) +[![NPM version](https://badge.fury.io/js/engine.io.png)](http://badge.fury.io/js/engine.io) + +`Engine.IO` is the implementation of transport-based +cross-browser/cross-device bi-directional communication layer for +[Socket.IO](http://github.com/learnboost/socket.io). + +## How to use + +### Server + +#### (A) Listening on a port + +```js +var engine = require('engine.io'); +var server = engine.listen(80); + +server.on('connection', function(socket){ + socket.send('utf 8 string'); + socket.send(new Buffer([0, 1, 2, 3, 4, 5])); // binary data +}); +``` + +#### (B) Intercepting requests for a http.Server + +```js +var engine = require('engine.io'); +var http = require('http').createServer().listen(3000); +var server = engine.attach(http); + +server.on('connection', function (socket) { + socket.on('message', function(data){ }); + socket.on('close', function(){ }); +}); +``` + +#### (C) Passing in requests + +```js +var engine = require('engine.io'); +var server = new engine.Server(); + +server.on('connection', function(socket){ + socket.send('hi'); +}); + +// … +httpServer.on('upgrade', function(req, socket, head){ + server.handleUpgrade(req, socket, head); +}); +httpServer.on('request', function(req, res){ + server.handleRequest(req, res); +}); +``` + +### Client + +```html + + +``` + +For more information on the client refer to the +[engine-client](http://github.com/learnboost/engine.io-client) repository. + +## What features does it have? + +- **Maximum reliability**. Connections are established even in the presence of: + - proxies and load balancers. + - personal firewall and antivirus software. + - for more information refer to **Goals** and **Architecture** sections +- **Minimal client size** aided by: + - lazy loading of flash transports. + - lack of redundant transports. +- **Scalable** + - load balancer friendly +- **Future proof** +- **100% Node.JS core style** + - No API sugar (left for higher level projects) + - Written in readable vanilla JavaScript + +## API + +### Server + +

+ +#### Top-level + +These are exposed by `require('engine.io')`: + +##### Events + +- `flush` + - Called when a socket buffer is being flushed. + - **Arguments** + - `Socket`: socket being flushed + - `Array`: write buffer +- `drain` + - Called when a socket buffer is drained + - **Arguments** + - `Socket`: socket being flushed + +##### Properties + +- `protocol` _(Number)_: protocol revision number +- `Server`: Server class constructor +- `Socket`: Socket class constructor +- `Transport` _(Function)_: transport constructor +- `transports` _(Object)_: map of available transports + +##### Methods + +- `()` + - Returns a new `Server` instance. If the first argument is an `http.Server` then the + new `Server` instance will be attached to it. Otherwise, the arguments are passed + directly to the `Server` constructor. + - **Parameters** + - `http.Server`: optional, server to attach to. + - `Object`: optional, options object (see `Server#constructor` api docs below) + + The following are identical ways to instantiate a server and then attach it. + ```js + var httpServer; // previously created with `http.createServer();` from node.js api. + + // create a server first, and then attach + var eioServer = require('engine.io').Server(); + eioServer.attach(httpServer); + + // or call the module as a function to get `Server` + var eioServer = require('engine.io')(); + eioServer.attach(httpServer); + + // immediately attach + var eioServer = require('engine.io')(http_server); + ``` + +- `listen` + - Creates an `http.Server` which listens on the given port and attaches WS + to it. It returns `501 Not Implemented` for regular http requests. + - **Parameters** + - `Number`: port to listen on. + - `Object`: optional, options object + - `Function`: callback for `listen`. + - **Options** + - All options from `Server.attach` method, documented below. + - **Additionally** See Server `constructor` below for options you can pass for creating the new Server + - **Returns** `Server` +- `attach` + - Captures `upgrade` requests for a `http.Server`. In other words, makes + a regular http.Server WebSocket-compatible. + - **Parameters** + - `http.Server`: server to attach to. + - `Object`: optional, options object + - **Options** + - All options from `Server.attach` method, documented below. + - **Additionally** See Server `constructor` below for options you can pass for creating the new Server + - **Returns** `Server` a new Server instance. + +

+ +#### Server + +The main server/manager. _Inherits from EventEmitter_. + +##### Events + +- `connection` + - Fired when a new connection is established. + - **Arguments** + - `Socket`: a Socket object + +##### Properties + +**Important**: if you plan to use Engine.IO in a scalable way, please +keep in mind the properties below will only reflect the clients connected +to a single process. + +- `clients` _(Object)_: hash of connected clients by id. +- `clientsCount` _(Number)_: number of connected clients. + +##### Methods + +- **constructor** + - Initializes the server + - **Parameters** + - `Object`: optional, options object + - **Options** + - `pingTimeout` (`Number`): how many ms without a pong packet to + consider the connection closed (`60000`) + - `pingInterval` (`Number`): how many ms before sending a new ping + packet (`25000`) + - `maxHttpBufferSize` (`Number`): how many bytes or characters a message + can be when polling, before closing the session (to avoid DoS). Default + value is `10E7`. + - `allowRequest` (`Function`): A function that receives a given handshake + or upgrade request as its first parameter, and can decide whether to + continue or not. The second argument is a function that needs to be + called with the decided information: `fn(err, success)`, where + `success` is a boolean value where false means that the request is + rejected, and err is an error code. + - `transports` (` String`): transports to allow connections + to (`['polling', 'websocket']`) + - `allowUpgrades` (`Boolean`): whether to allow transport upgrades + (`true`) + - `cookie` (`String|Boolean`): name of the HTTP cookie that + contains the client sid to send as part of handshake response + headers. Set to `false` to not send one. (`io`) +- `close` + - Closes all clients + - **Returns** `Server` for chaining +- `handleRequest` + - Called internally when a `Engine` request is intercepted. + - **Parameters** + - `http.ServerRequest`: a node request object + - `http.ServerResponse`: a node response object + - **Returns** `Server` for chaining +- `handleUpgrade` + - Called internally when a `Engine` ws upgrade is intercepted. + - **Parameters** (same as `upgrade` event) + - `http.ServerRequest`: a node request object + - `net.Stream`: TCP socket for the request + - `Buffer`: legacy tail bytes + - **Returns** `Server` for chaining +- `attach` + - Attach this Server instance to an `http.Server` + - Captures `upgrade` requests for a `http.Server`. In other words, makes + a regular http.Server WebSocket-compatible. + - **Parameters** + - `http.Server`: server to attach to. + - `Object`: optional, options object + - **Options** + - `path` (`String`): name of the path to capture (`/engine.io`). + - `destroyUpgrade` (`Boolean`): destroy unhandled upgrade requests (`true`) + - `destroyUpgradeTimeout` (`Number`): milliseconds after which unhandled requests are ended (`1000`) + +

+ +#### Socket + +A representation of a client. _Inherits from EventEmitter_. + +##### Events + +- `close` + - Fired when the client is disconnected. + - **Arguments** + - `String`: reason for closing + - `Object`: description object (optional) +- `message` + - Fired when the client sends a message. + - **Arguments** + - `String` or `Buffer`: Unicode string or Buffer with binary contents +- `error` + - Fired when an error occurs. + - **Arguments** + - `Error`: error object +- `flush` + - Called when the write buffer is being flushed. + - **Arguments** + - `Array`: write buffer +- `drain` + - Called when the write buffer is drained +- `packet` + - Called when a socket received a packet (`message`, `ping`) + - **Arguments** + - `type`: packet type + - `data`: packet data (if type is message) +- `packetCreate` + - Called before a socket sends a packet (`message`, `pong`) + - **Arguments** + - `type`: packet type + - `data`: packet data (if type is message) + +##### Properties + +- `id` _(String)_: unique identifier +- `server` _(Server)_: engine parent reference +- `request` _(http.ServerRequest)_: request that originated the Socket +- `upgraded` _(Boolean)_: whether the transport has been upgraded +- `readyState` _(String)_: opening|open|closing|closed +- `transport` _(Transport)_: transport reference + +##### Methods + +- `send`: + - Sends a message, performing `message = toString(arguments[0])` unless + sending binary data, which is sent as is. + - **Parameters** + - `String` | `Buffer` | `ArrayBuffer` | `ArrayBufferView`: a string or any object implementing `toString()`, with outgoing data, or a Buffer or ArrayBuffer with binary data. Also any ArrayBufferView can be sent as is. + - `Function`: optional, a callback executed when the message gets flushed out by the transport + - **Returns** `Socket` for chaining +- `close` + - Disconnects the client + - **Returns** `Socket` for chaining + +### Client + +

+ +Exposed in the `eio` global namespace (in the browser), or by +`require('engine.io-client')` (in Node.JS). + +For the client API refer to the +[engine-client](http://github.com/learnboost/engine.io-client) repository. + +## Debug / logging + +Engine.IO is powered by [debug](http://github.com/visionmedia/debug). +In order to see all the debug output, run your app with the environment variable +`DEBUG` including the desired scope. + +To see the output from all of Engine.IO's debugging scopes you can use: + +``` +DEBUG=engine* node myapp +``` + +## Transports + +- `polling`: XHR / JSONP polling transport. +- `websocket`: WebSocket transport. + +## Plugins + +- [engine.io-conflation](https://github.com/EugenDueck/engine.io-conflation): Makes **conflation and aggregation** of messages straightforward. + +## Support + +The support channels for `engine.io` are the same as `socket.io`: + - irc.freenode.net **#socket.io** + - [Google Groups](http://groups.google.com/group/socket_io) + - [Website](http://socket.io) + +## Development + +To contribute patches, run tests or benchmarks, make sure to clone the +repository: + +``` +git clone git://github.com/LearnBoost/engine.io.git +``` + +Then: + +``` +cd engine.io +npm install +``` + +## Tests + +Tests run with `make test`. It runs the server tests that are aided by +the usage of `engine.io-client`. + +Make sure `npm install` is run first. + +## Goals + +The main goal of `Engine` is ensuring the most reliable realtime communication. +Unlike the previous Socket.IO core, it always establishes a long-polling +connection first, then tries to upgrade to better transports that are "tested" on +the side. + +During the lifetime of the Socket.IO projects, we've found countless drawbacks +to relying on `HTML5 WebSocket` or `Flash Socket` as the first connection +mechanisms. + +Both are clearly the _right way_ of establishing a bidirectional communication, +with HTML5 WebSocket being the way of the future. However, to answer most business +needs, alternative traditional HTTP 1.1 mechanisms are just as good as delivering +the same solution. + +WebSocket based connections have two fundamental benefits: + +1. **Better server performance** + + - _A: Load balancers_
+ Load balancing a long polling connection poses a serious architectural nightmare + since requests can come from any number of open sockets by the user agent, but + they all need to be routed to the process and computer that owns the `Engine` + connection. This negatively impacts RAM and CPU usage. + - _B: Network traffic_
+ WebSocket is designed around the premise that each message frame has to be + surrounded by the least amount of data. In HTTP 1.1 transports, each message + frame is surrounded by HTTP headers and chunked encoding frames. If you try to + send the message _"Hello world"_ with xhr-polling, the message ultimately + becomes larger than if you were to send it with WebSocket. + - _C: Lightweight parser_
+ As an effect of **B**, the server has to do a lot more work to parse the network + data and figure out the message when traditional HTTP requests are used + (as in long polling). This means that another advantage of WebSocket is + less server CPU usage. + +2. **Better user experience** + + Due to the reasons stated in point **1**, the most important effect of being able + to establish a WebSocket connection is raw data transfer speed, which translates + in _some_ cases in better user experience. + + Applications with heavy realtime interaction (such as games) will benefit greatly, + whereas applications like realtime chat (Gmail/Facebook), newsfeeds (Facebook) or + timelines (Twitter) will have negligible user experience improvements. + +Having said this, attempting to establish a WebSocket connection directly so far has +proven problematic: + +1. **Proxies**
+ Many corporate proxies block WebSocket traffic. + +2. **Personal firewall and antivirus software**
+ As a result of our research, we've found that at least 3 personal security + applications block WebSocket traffic. + +3. **Cloud application platforms**
+ Platforms like Heroku or No.de have had trouble keeping up with the fast-paced + nature of the evolution of the WebSocket protocol. Applications therefore end up + inevitably using long polling, but the seamless installation experience of + Socket.IO we strive for (_"require() it and it just works"_) disappears. + +Some of these problems have solutions. In the case of proxies and personal programs, +however, the solutions many times involve upgrading software. Experience has shown +that relying on client software upgrades to deliver a business solution is +fruitless: the very existence of this project has to do with a fragmented panorama +of user agent distribution, with clients connecting with latest versions of the most +modern user agents (Chrome, Firefox and Safari), but others with versions as low as +IE 5.5. + +From the user perspective, an unsuccessful WebSocket connection can translate in +up to at least 10 seconds of waiting for the realtime application to begin +exchanging data. This **perceptively** hurts user experience. + +To summarize, **Engine** focuses on reliability and user experience first, marginal +potential UX improvements and increased server performance second. `Engine` is the +result of all the lessons learned with WebSocket in the wild. + +## Architecture + +The main premise of `Engine`, and the core of its existence, is the ability to +swap transports on the fly. A connection starts as xhr-polling, but it can +switch to WebSocket. + +The central problem this poses is: how do we switch transports without losing +messages? + +`Engine` only switches from polling to another transport in between polling +cycles. Since the server closes the connection after a certain timeout when +there's no activity, and the polling transport implementation buffers messages +in between connections, this ensures no message loss and optimal performance. + +Another benefit of this design is that we workaround almost all the limitations +of **Flash Socket**, such as slow connection times, increased file size (we can +safely lazy load it without hurting user experience), etc. + +## FAQ + +### Can I use engine without Socket.IO ? + +Absolutely. Although the recommended framework for building realtime applications +is Socket.IO, since it provides fundamental features for real-world applications +such as multiplexing, reconnection support, etc. + +`Engine` is to Socket.IO what Connect is to Express. An essential piece for building +realtime frameworks, but something you _probably_ won't be using for building +actual applications. + +### Does the server serve the client? + +No. The main reason is that `Engine` is meant to be bundled with frameworks. +Socket.IO includes `Engine`, therefore serving two clients is not necessary. If +you use Socket.IO, including + +```html + + + + + + + diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/debug/example/wildcards.js b/node_modules/socket.io/node_modules/engine.io/node_modules/debug/example/wildcards.js new file mode 100644 index 0000000..1fdac20 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/debug/example/wildcards.js @@ -0,0 +1,10 @@ + +var debug = { + foo: require('../')('test:foo'), + bar: require('../')('test:bar'), + baz: require('../')('test:baz') +}; + +debug.foo('foo') +debug.bar('bar') +debug.baz('baz') \ No newline at end of file diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/debug/example/worker.js b/node_modules/socket.io/node_modules/engine.io/node_modules/debug/example/worker.js new file mode 100644 index 0000000..7f6d288 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/debug/example/worker.js @@ -0,0 +1,22 @@ + +// DEBUG=* node example/worker +// DEBUG=worker:* node example/worker +// DEBUG=worker:a node example/worker +// DEBUG=worker:b node example/worker + +var a = require('../')('worker:a') + , b = require('../')('worker:b'); + +function work() { + a('doing lots of uninteresting work'); + setTimeout(work, Math.random() * 1000); +} + +work(); + +function workb() { + b('doing some work'); + setTimeout(workb, Math.random() * 2000); +} + +workb(); \ No newline at end of file diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/debug/index.js b/node_modules/socket.io/node_modules/engine.io/node_modules/debug/index.js new file mode 100644 index 0000000..ee54454 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/debug/index.js @@ -0,0 +1,2 @@ + +module.exports = require('./lib/debug'); \ No newline at end of file diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/debug/lib/debug.js b/node_modules/socket.io/node_modules/engine.io/node_modules/debug/lib/debug.js new file mode 100644 index 0000000..984dfb5 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/debug/lib/debug.js @@ -0,0 +1,147 @@ + +/*! + * debug + * Copyright(c) 2012 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var tty = require('tty'); + +/** + * Expose `debug()` as the module. + */ + +module.exports = debug; + +/** + * Library version. + */ + +exports.version = '0.6.0'; + +/** + * Enabled debuggers. + */ + +var names = [] + , skips = []; + +(process.env.DEBUG || '') + .split(/[\s,]+/) + .forEach(function(name){ + name = name.replace('*', '.*?'); + if (name[0] === '-') { + skips.push(new RegExp('^' + name.substr(1) + '$')); + } else { + names.push(new RegExp('^' + name + '$')); + } + }); + +/** + * Colors. + */ + +var colors = [6, 2, 3, 4, 5, 1]; + +/** + * Previous debug() call. + */ + +var prev = {}; + +/** + * Previously assigned color. + */ + +var prevColor = 0; + +/** + * Is stdout a TTY? Colored output is disabled when `true`. + */ + +var isatty = tty.isatty(2); + +/** + * Select a color. + * + * @return {Number} + * @api private + */ + +function color() { + return colors[prevColor++ % colors.length]; +} + +/** + * Humanize the given `ms`. + * + * @param {Number} m + * @return {String} + * @api private + */ + +function humanize(ms) { + var sec = 1000 + , min = 60 * 1000 + , hour = 60 * min; + + if (ms >= hour) return (ms / hour).toFixed(1) + 'h'; + if (ms >= min) return (ms / min).toFixed(1) + 'm'; + if (ms >= sec) return (ms / sec | 0) + 's'; + return ms + 'ms'; +} + +/** + * Create a debugger with the given `name`. + * + * @param {String} name + * @return {Type} + * @api public + */ + +function debug(name) { + function disabled(){} + disabled.enabled = false; + + var match = skips.some(function(re){ + return re.test(name); + }); + + if (match) return disabled; + + match = names.some(function(re){ + return re.test(name); + }); + + if (!match) return disabled; + var c = color(); + + function colored(fmt) { + var curr = new Date; + var ms = curr - (prev[name] || curr); + prev[name] = curr; + + fmt = ' \033[9' + c + 'm' + name + ' ' + + '\033[3' + c + 'm\033[90m' + + fmt + '\033[3' + c + 'm' + + ' +' + humanize(ms) + '\033[0m'; + + console.error.apply(this, arguments); + } + + function plain(fmt) { + fmt = new Date().toUTCString() + + ' ' + name + ' ' + fmt; + console.error.apply(this, arguments); + } + + colored.enabled = plain.enabled = true; + + return isatty + ? colored + : plain; +} diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/debug/package.json b/node_modules/socket.io/node_modules/engine.io/node_modules/debug/package.json new file mode 100644 index 0000000..75a22c1 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/debug/package.json @@ -0,0 +1,28 @@ +{ + "name": "debug", + "version": "0.6.0", + "description": "small debugging utility", + "keywords": [ + "debug", + "log", + "debugger" + ], + "author": { + "name": "TJ Holowaychuk", + "email": "tj@vision-media.ca" + }, + "dependencies": {}, + "devDependencies": { + "mocha": "*" + }, + "main": "index", + "engines": { + "node": "*" + }, + "readme": "\n# debug\n\n tiny node.js debugging utility.\n\n## Installation\n\n```\n$ npm install debug\n```\n\n## Example\n\n This module is modelled after node core's debugging technique, allowing you to enable one or more topic-specific debugging functions, for example core does the following within many modules:\n\n```js\nvar debug;\nif (process.env.NODE_DEBUG && /cluster/.test(process.env.NODE_DEBUG)) {\n debug = function(x) {\n var prefix = process.pid + ',' +\n (process.env.NODE_WORKER_ID ? 'Worker' : 'Master');\n console.error(prefix, x);\n };\n} else {\n debug = function() { };\n}\n```\n\n This concept is extremely simple but it works well. With `debug` you simply invoke the exported function to generate your debug function, passing it a name which will determine if a noop function is returned, or a decorated `console.error`, so all of the `console` format string goodies you're used to work fine. A unique color is selected per-function for visibility.\n \nExample _app.js_:\n\n```js\nvar debug = require('debug')('http')\n , http = require('http')\n , name = 'My App';\n\n// fake app\n\ndebug('booting %s', name);\n\nhttp.createServer(function(req, res){\n debug(req.method + ' ' + req.url);\n res.end('hello\\n');\n}).listen(3000, function(){\n debug('listening');\n});\n\n// fake worker of some kind\n\nrequire('./worker');\n```\n\nExample _worker.js_:\n\n```js\nvar debug = require('debug')('worker');\n\nsetInterval(function(){\n debug('doing some work');\n}, 1000);\n```\n\n The __DEBUG__ environment variable is then used to enable these based on space or comma-delimited names. Here are some examples:\n\n ![debug http and worker](http://f.cl.ly/items/18471z1H402O24072r1J/Screenshot.png)\n\n ![debug worker](http://f.cl.ly/items/1X413v1a3M0d3C2c1E0i/Screenshot.png)\n\n## Millisecond diff\n\n When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the \"+NNNms\" will show you how much time was spent between calls.\n\n ![](http://f.cl.ly/items/2i3h1d3t121M2Z1A3Q0N/Screenshot.png)\n\n When stdout is not a TTY, `Date#toUTCString()` is used, making it more useful for logging the debug information as shown below:\n \n ![](http://f.cl.ly/items/112H3i0e0o0P0a2Q2r11/Screenshot.png)\n\n## Conventions\n\n If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use \":\" to separate features. For example \"bodyParser\" from Connect would then be \"connect:bodyParser\". \n\n## Wildcards\n\n The \"*\" character may be used as a wildcard. Suppose for example your library has debuggers named \"connect:bodyParser\", \"connect:compress\", \"connect:session\", instead of listing all three with `DEBUG=connect:bodyParser,connect.compress,connect:session`, you may simply do `DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`.\n\n You can also exclude specific debuggers by prefixing them with a \"-\" character. For example, `DEBUG=* -connect:*` would include all debuggers except those starting with \"connect:\".\n\n## Browser support\n\n Debug works in the browser as well, currently persisted by `localStorage`. For example if you have `worker:a` and `worker:b` as shown below, and wish to debug both type `debug.enable('worker:*')` in the console and refresh the page, this will remain until you disable with `debug.disable()`. \n\n```js\na = debug('worker:a');\nb = debug('worker:b');\n\nsetInterval(function(){\n a('doing some work');\n}, 1000);\n\nsetInterval(function(){\n a('doing some work');\n}, 1200);\n```\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.", + "readmeFilename": "Readme.md", + "_id": "debug@0.6.0", + "_shasum": "ce9d5d025d5294b3f0748a494bebaf3c9fd8734f", + "_from": "debug@0.6.0", + "_resolved": "https://registry.npmjs.org/debug/-/debug-0.6.0.tgz" +} diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/.npmignore b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/.npmignore new file mode 100644 index 0000000..f841db0 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/.npmignore @@ -0,0 +1,17 @@ +lib-cov +*.seed +*.log +*.csv +*.dat +*.out +*.pid +*.gz + +pids +logs +results + +npm-debug.log +node_modules/* + +test diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/.travis.yml b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/.travis.yml new file mode 100644 index 0000000..cba8ce6 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/.travis.yml @@ -0,0 +1,9 @@ +language: node_js +node_js: +- 0.10 +notifications: + irc: irc.freenode.org##socket.io +env: + global: + - secure: ZS6AzV1n1K1exomhZoK0SorBHEy4/7/qdk1p5/dm0tQdStSVwRDJyQk5wUIgJFsJaVlN8O/MH8LBkiLlalohR/DdE2ZtkNJqfMnetE/ZqPX7r8mzwDasnHJNJnKWJlBVqOpy7hciiPV2yZGIJoe2OQfwWxFEcLJ6NGOXCEkyLAg= + - secure: hcqk+nIqzrwJSQs+5T1sKN4YiCghQdP849RjH64bb7Ayslh+o0DmihTE3Wl+cCWFcRBvwBJdmDV2gJpsVcODTc2VdOrJnv8ezfQ8zvAyDZFYxno47PtbjQUi0By2wBPp6zlfigcnXxQ2z6997EDRvsI4VgQVqKsGLot4cMU9oz0= diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/.zuul.yml b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/.zuul.yml new file mode 100644 index 0000000..fb9da14 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/.zuul.yml @@ -0,0 +1,18 @@ +ui: mocha-bdd +browsers: + - name: chrome + version: 29..latest + - name: firefox + version: latest + - name: safari + version: latest + - name: ie + version: 10 + platform: Windows 2012 + - name: ie + version: 9 + version: [6..9, latest] + - name: iphone + version: oldest..latest + - name: android + version: latest diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/History.md b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/History.md new file mode 100644 index 0000000..55745a4 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/History.md @@ -0,0 +1,64 @@ + +1.0.6 / 2014-05-30 +================== + + * utf8 fixes when using binary encoding [nkzawa] + +1.0.5 / 2014-05-06 +================== + + * fix range error + +1.0.4 / 2014-04-13 +================== + + * fix `encodePayloadAsBinary` method encodes packets to base64 + +1.0.3 / 2014-04-10 +================== + + * Fix length calculation when encoding as binary [binlain] + +1.0.2 / 2014-03-16 +================== + + * fix binary for android due to a bug in Blob XHR2 implementation [Rase-] + +1.0.1 / 2014-03-06 +================== + + * implement `blob` module to simplify code + * bump `arraybuffer.slice` + * style fixes + +1.0.0 / 2014-02-18 +================== + + * parser: added binary encoding [Rase-] + * parser: switched to an async interface [Rase-] + +0.3.0 / 2013-03-16 +================== + + * parser: if callback returns `false` ignore rest of payload + * test: fixed all broken tests + +0.2.1 / 2013-03-16 +================== + + * added protocol version to index.js [albertyfwu] + +0.2.0 / 2013-02-26 +================== + + * Changed `decodePayload` to use a callback instead of returning an array [sweetieSong, albertyfwu] + +0.1.1 / 2013-01-26 +================== + + * package.json fixes + +0.1.0 / 2013-01-19 +================== + + * Initial release diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/LICENSE b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/LICENSE new file mode 100644 index 0000000..9006d30 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2014 Automattic + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/Makefile b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/Makefile new file mode 100644 index 0000000..271b2ea --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/Makefile @@ -0,0 +1,10 @@ + +REPORTER = dot + +test: + @./node_modules/.bin/mocha \ + --reporter $(REPORTER) \ + test/index.js + @./node_modules/.bin/zuul -- test/index.js + +.PHONY: test diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/Readme.md b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/Readme.md new file mode 100644 index 0000000..5f16174 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/Readme.md @@ -0,0 +1,14 @@ + +# engine.io-parser + +[![Build Status](https://secure.travis-ci.org/LearnBoost/engine.io-parser.png)](http://travis-ci.org/LearnBoost/engine.io-parser) +[![NPM version](https://badge.fury.io/js/engine.io-parser.png)](http://badge.fury.io/js/engine.io-parser) + +This is the JavaScript parser for the engine.io protocol encoding, +shared by both +[engine.io-client](https://github.com/LearnBoost/engine.io-client) and +[engine.io-server](https://github.com/LearnBoost/engine.io-server). + +## License + +MIT \ No newline at end of file diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/index.js b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/index.js new file mode 100644 index 0000000..887727f --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/index.js @@ -0,0 +1,2 @@ + +module.exports = require('./lib/'); diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/lib/browser.js b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/lib/browser.js new file mode 100644 index 0000000..b46891a --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/lib/browser.js @@ -0,0 +1,543 @@ +/** + * Module dependencies. + */ + +var keys = require('./keys'); +var sliceBuffer = require('arraybuffer.slice'); +var base64encoder = require('base64-arraybuffer'); +var after = require('after'); +var utf8 = require('utf8'); + +/** + * Check if we are running an android browser. That requires us to use + * ArrayBuffer with polling transports... + * + * http://ghinda.net/jpeg-blob-ajax-android/ + */ + +var isAndroid = navigator.userAgent.match(/Android/i); + +/** + * Current protocol version. + */ + +exports.protocol = 2; + +/** + * Packet types. + */ + +var packets = exports.packets = { + open: 0 // non-ws + , close: 1 // non-ws + , ping: 2 + , pong: 3 + , message: 4 + , upgrade: 5 + , noop: 6 +}; + +var packetslist = keys(packets); + +/** + * Premade error packet. + */ + +var err = { type: 'error', data: 'parser error' }; + +/** + * Create a blob api even for blob builder when vendor prefixes exist + */ + +var Blob = require('blob'); + +/** + * Encodes a packet. + * + * [ ] + * + * Example: + * + * 5hello world + * 3 + * 4 + * + * Binary is encoded in an identical principle + * + * @api private + */ + +exports.encodePacket = function (packet, supportsBinary, callback) { + if (typeof supportsBinary == 'function') { + callback = supportsBinary; + supportsBinary = false; + } + + var data = (packet.data === undefined) + ? undefined + : packet.data.buffer || packet.data; + + if (global.ArrayBuffer && data instanceof ArrayBuffer) { + return encodeArrayBuffer(packet, supportsBinary, callback); + } else if (Blob && data instanceof global.Blob) { + return encodeBlob(packet, supportsBinary, callback); + } + + // Sending data as a utf-8 string + var encoded = packets[packet.type]; + + // data fragment is optional + if (undefined !== packet.data) { + encoded += utf8.encode(String(packet.data)); + } + + return callback('' + encoded); + +}; + +/** + * Encode packet helpers for binary types + */ + +function encodeArrayBuffer(packet, supportsBinary, callback) { + if (!supportsBinary) { + return exports.encodeBase64Packet(packet, callback); + } + + var data = packet.data; + var contentArray = new Uint8Array(data); + var resultBuffer = new Uint8Array(1 + data.byteLength); + + resultBuffer[0] = packets[packet.type]; + for (var i = 0; i < contentArray.length; i++) { + resultBuffer[i+1] = contentArray[i]; + } + + return callback(resultBuffer.buffer); +} + +function encodeBlobAsArrayBuffer(packet, supportsBinary, callback) { + if (!supportsBinary) { + return exports.encodeBase64Packet(packet, callback); + } + + var fr = new FileReader(); + fr.onload = function() { + packet.data = fr.result; + exports.encodePacket(packet, supportsBinary, callback); + }; + return fr.readAsArrayBuffer(packet.data); +} + +function encodeBlob(packet, supportsBinary, callback) { + if (!supportsBinary) { + return exports.encodeBase64Packet(packet, callback); + } + + if (isAndroid) { + return encodeBlobAsArrayBuffer(packet, supportsBinary, callback); + } + + var length = new Uint8Array(1); + length[0] = packets[packet.type]; + var blob = new Blob([length.buffer, packet.data]); + + return callback(blob); +} + +/** + * Encodes a packet with binary data in a base64 string + * + * @param {Object} packet, has `type` and `data` + * @return {String} base64 encoded message + */ + +exports.encodeBase64Packet = function(packet, callback) { + var message = 'b' + exports.packets[packet.type]; + if (Blob && packet.data instanceof Blob) { + var fr = new FileReader(); + fr.onload = function() { + var b64 = fr.result.split(',')[1]; + callback(message + b64); + }; + return fr.readAsDataURL(packet.data); + } + + var b64data; + try { + b64data = String.fromCharCode.apply(null, new Uint8Array(packet.data)); + } catch (e) { + // iPhone Safari doesn't let you apply with typed arrays + var typed = new Uint8Array(packet.data); + var basic = new Array(typed.length); + for (var i = 0; i < typed.length; i++) { + basic[i] = typed[i]; + } + b64data = String.fromCharCode.apply(null, basic); + } + message += global.btoa(b64data); + return callback(message); +}; + +/** + * Decodes a packet. Changes format to Blob if requested. + * + * @return {Object} with `type` and `data` (if any) + * @api private + */ + +exports.decodePacket = function (data, binaryType) { + // String data + if (typeof data == 'string' || data === undefined) { + if (data.charAt(0) == 'b') { + return exports.decodeBase64Packet(data.substr(1), binaryType); + } + + data = utf8.decode(data); + var type = data.charAt(0); + + if (Number(type) != type || !packetslist[type]) { + return err; + } + + if (data.length > 1) { + return { type: packetslist[type], data: data.substring(1) }; + } else { + return { type: packetslist[type] }; + } + } + + var asArray = new Uint8Array(data); + var type = asArray[0]; + var rest = sliceBuffer(data, 1); + if (Blob && binaryType === 'blob') { + rest = new Blob([rest]); + } + return { type: packetslist[type], data: rest }; +}; + +/** + * Decodes a packet encoded in a base64 string + * + * @param {String} base64 encoded message + * @return {Object} with `type` and `data` (if any) + */ + +exports.decodeBase64Packet = function(msg, binaryType) { + var type = packetslist[msg.charAt(0)]; + if (!global.ArrayBuffer) { + return { type: type, data: { base64: true, data: msg.substr(1) } }; + } + + var data = base64encoder.decode(msg.substr(1)); + + if (binaryType === 'blob' && Blob) { + data = new Blob([data]); + } + + return { type: type, data: data }; +}; + +/** + * Encodes multiple messages (payload). + * + * :data + * + * Example: + * + * 11:hello world2:hi + * + * If any contents are binary, they will be encoded as base64 strings. Base64 + * encoded strings are marked with a b before the length specifier + * + * @param {Array} packets + * @api private + */ + +exports.encodePayload = function (packets, supportsBinary, callback) { + if (typeof supportsBinary == 'function') { + callback = supportsBinary; + supportsBinary = null; + } + + if (supportsBinary) { + if (Blob && !isAndroid) { + return exports.encodePayloadAsBlob(packets, callback); + } + + return exports.encodePayloadAsArrayBuffer(packets, callback); + } + + if (!packets.length) { + return callback('0:'); + } + + function setLengthHeader(message) { + return message.length + ':' + message; + } + + function encodeOne(packet, doneCallback) { + exports.encodePacket(packet, supportsBinary, function(message) { + doneCallback(null, setLengthHeader(message)); + }); + } + + map(packets, encodeOne, function(err, results) { + return callback(results.join('')); + }); +}; + +/** + * Async array map using after + */ + +function map(ary, each, done) { + var result = new Array(ary.length); + var next = after(ary.length, done); + + var eachWithIndex = function(i, el, cb) { + each(el, function(error, msg) { + result[i] = msg; + cb(error, result); + }); + }; + + for (var i = 0; i < ary.length; i++) { + eachWithIndex(i, ary[i], next); + } +} + +/* + * Decodes data when a payload is maybe expected. Possible binary contents are + * decoded from their base64 representation + * + * @param {String} data, callback method + * @api public + */ + +exports.decodePayload = function (data, binaryType, callback) { + if (typeof data != 'string') { + return exports.decodePayloadAsBinary(data, binaryType, callback); + } + + if (typeof binaryType === 'function') { + callback = binaryType; + binaryType = null; + } + + var packet; + if (data == '') { + // parser error - ignoring payload + return callback(err, 0, 1); + } + + var length = '' + , n, msg; + + for (var i = 0, l = data.length; i < l; i++) { + var chr = data.charAt(i); + + if (':' != chr) { + length += chr; + } else { + if ('' == length || (length != (n = Number(length)))) { + // parser error - ignoring payload + return callback(err, 0, 1); + } + + msg = data.substr(i + 1, n); + + if (length != msg.length) { + // parser error - ignoring payload + return callback(err, 0, 1); + } + + if (msg.length) { + packet = exports.decodePacket(msg, binaryType); + + if (err.type == packet.type && err.data == packet.data) { + // parser error in individual packet - ignoring payload + return callback(err, 0, 1); + } + + var ret = callback(packet, i + n, l); + if (false === ret) return; + } + + // advance cursor + i += n; + length = ''; + } + } + + if (length != '') { + // parser error - ignoring payload + return callback(err, 0, 1); + } + +}; + +/** + * Encodes multiple messages (payload) as binary. + * + * <1 = binary, 0 = string>[...] + * + * Example: + * 1 3 255 1 2 3, if the binary contents are interpreted as 8 bit integers + * + * @param {Array} packets + * @return {ArrayBuffer} encoded payload + * @api private + */ + +exports.encodePayloadAsArrayBuffer = function(packets, callback) { + if (!packets.length) { + return callback(new ArrayBuffer(0)); + } + + function encodeOne(packet, doneCallback) { + exports.encodePacket(packet, true, function(data) { + return doneCallback(null, data); + }); + } + + map(packets, encodeOne, function(err, encodedPackets) { + var totalLength = encodedPackets.reduce(function(acc, p) { + var len; + if (typeof p === 'string'){ + len = p.length; + } else { + len = p.byteLength; + } + return acc + len.toString().length + len + 2; // string/binary identifier + separator = 2 + }, 0); + + var resultArray = new Uint8Array(totalLength); + + var bufferIndex = 0; + encodedPackets.forEach(function(p) { + var isString = typeof p === 'string'; + var ab = p; + if (isString) { + var view = new Uint8Array(p.length); + for (var i = 0; i < p.length; i++) { + view[i] = p.charCodeAt(i); + } + ab = view.buffer; + } + + if (isString) { // not true binary + resultArray[bufferIndex++] = 0; + } else { // true binary + resultArray[bufferIndex++] = 1; + } + + var lenStr = ab.byteLength.toString(); + for (var i = 0; i < lenStr.length; i++) { + resultArray[bufferIndex++] = parseInt(lenStr[i]); + } + resultArray[bufferIndex++] = 255; + + var view = new Uint8Array(ab); + for (var i = 0; i < view.length; i++) { + resultArray[bufferIndex++] = view[i]; + } + }); + + return callback(resultArray.buffer); + }); +}; + +/** + * Encode as Blob + */ + +exports.encodePayloadAsBlob = function(packets, callback) { + function encodeOne(packet, doneCallback) { + exports.encodePacket(packet, true, function(encoded) { + var binaryIdentifier = new Uint8Array(1); + binaryIdentifier[0] = 1; + if (typeof encoded === 'string') { + var view = new Uint8Array(encoded.length); + for (var i = 0; i < encoded.length; i++) { + view[i] = encoded.charCodeAt(i); + } + encoded = view.buffer; + binaryIdentifier[0] = 0; + } + + var len = (encoded instanceof ArrayBuffer) + ? encoded.byteLength + : encoded.size; + + var lenStr = len.toString(); + var lengthAry = new Uint8Array(lenStr.length + 1); + for (var i = 0; i < lenStr.length; i++) { + lengthAry[i] = parseInt(lenStr[i]); + } + lengthAry[lenStr.length] = 255; + + if (Blob) { + var blob = new Blob([binaryIdentifier.buffer, lengthAry.buffer, encoded]); + doneCallback(null, blob); + } + }); + } + + map(packets, encodeOne, function(err, results) { + return callback(new Blob(results)); + }); +}; + +/* + * Decodes data when a payload is maybe expected. Strings are decoded by + * interpreting each byte as a key code for entries marked to start with 0. See + * description of encodePayloadAsBinary + * + * @param {ArrayBuffer} data, callback method + * @api public + */ + +exports.decodePayloadAsBinary = function (data, binaryType, callback) { + if (typeof binaryType === 'function') { + callback = binaryType; + binaryType = null; + } + + var bufferTail = data; + var buffers = []; + + while (bufferTail.byteLength > 0) { + var tailArray = new Uint8Array(bufferTail); + var isString = tailArray[0] === 0; + var msgLength = ''; + for (var i = 1; ; i++) { + if (tailArray[i] == 255) break; + msgLength += tailArray[i]; + } + bufferTail = sliceBuffer(bufferTail, 2 + msgLength.length); + msgLength = parseInt(msgLength); + + var msg = sliceBuffer(bufferTail, 0, msgLength); + if (isString) { + try { + msg = String.fromCharCode.apply(null, new Uint8Array(msg)); + } catch (e) { + // iPhone Safari doesn't let you apply to typed arrays + var typed = new Uint8Array(msg); + msg = ''; + for (var i = 0; i < typed.length; i++) { + msg += String.fromCharCode(typed[i]); + } + } + } + buffers.push(msg); + bufferTail = sliceBuffer(bufferTail, msgLength); + } + + var total = buffers.length; + buffers.forEach(function(buffer, i) { + callback(exports.decodePacket(buffer, binaryType), i, total); + }); +}; diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/lib/index.js b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/lib/index.js new file mode 100644 index 0000000..beb8805 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/lib/index.js @@ -0,0 +1,449 @@ +/** + * Module dependencies. + */ + +var utf8 = require('utf8'); +var after = require('after'); +var keys = require('./keys'); + +/** + * Current protocol version. + */ +exports.protocol = 3; + +/** + * Packet types. + */ + +var packets = exports.packets = { + open: 0 // non-ws + , close: 1 // non-ws + , ping: 2 + , pong: 3 + , message: 4 + , upgrade: 5 + , noop: 6 +}; + +var packetslist = keys(packets); + +/** + * Premade error packet. + */ + +var err = { type: 'error', data: 'parser error' }; + +/** + * Encodes a packet. + * + * [ ] + * + * Example: + * + * 5hello world + * 3 + * 4 + * + * Binary is encoded in an identical principle + * + * @api private + */ + +exports.encodePacket = function (packet, supportsBinary, callback) { + if (typeof supportsBinary == 'function') { + callback = supportsBinary; + supportsBinary = null; + } + + var data = (packet.data === undefined) + ? undefined + : packet.data.buffer || packet.data; + + if (Buffer.isBuffer(data)) { + return encodeBuffer(packet, supportsBinary, callback); + } else if (data instanceof ArrayBuffer) { + return encodeArrayBuffer(packet, supportsBinary, callback); + } + + // Sending data as a utf-8 string + var encoded = packets[packet.type]; + + // data fragment is optional + if (undefined !== packet.data) { + encoded += utf8.encode(String(packet.data)); + } + + return callback('' + encoded); +}; + +/** + * Encode Buffer data + */ + +function encodeBuffer(packet, supportsBinary, callback) { + var data = packet.data; + if (!supportsBinary) { + return exports.encodeBase64Packet(packet, callback); + } + + var typeBuffer = new Buffer(1); + typeBuffer[0] = packets[packet.type]; + return callback(Buffer.concat([typeBuffer, data])); +} + +function encodeArrayBuffer(packet, supportsBinary, callback) { + var data = (packet.data === undefined) + ? undefined + : packet.data.buffer || packet.data; + + if (!supportsBinary) { + return exports.encodeBase64Packet(packet, callback); + } + + var contentArray = new Uint8Array(data); + var resultBuffer = new Buffer(1 + data.byteLength); + + resultBuffer[0] = packets[packet.type]; + for (var i = 0; i < contentArray.length; i++){ + resultBuffer[i+1] = contentArray[i]; + } + return callback(resultBuffer); +} + +/** + * Encodes a packet with binary data in a base64 string + * + * @param {Object} packet, has `type` and `data` + * @return {String} base64 encoded message + */ + +exports.encodeBase64Packet = function(packet, callback){ + var data = packet.data.buffer || packet.data; + if (data instanceof ArrayBuffer) { + var buf = new Buffer(data.byteLength); + for (var i = 0; i < buf.length; i++) { + buf[i] = data[i]; + } + packet.data = buf; + } + + var message = 'b' + packets[packet.type]; + message += packet.data.toString('base64'); + return callback(message); +}; + +/** + * Decodes a packet. Data also available as an ArrayBuffer if requested. + * + * @return {Object} with `type` and `data` (if any) + * @api private + */ + +exports.decodePacket = function (data, binaryType) { + // String data + if (typeof data == 'string' || data === undefined) { + if (data.charAt(0) == 'b') { + return exports.decodeBase64Packet(data.substr(1), binaryType); + } + + var type = data.charAt(0); + data = utf8.decode(data); + + if (Number(type) != type || !packetslist[type]) { + return err; + } + + if (data.length > 1) { + return { type: packetslist[type], data: data.substring(1) }; + } else { + return { type: packetslist[type] }; + } + } + + // Binary data + if (binaryType === 'arraybuffer') { + var type = data[0]; + var intArray = new Uint8Array(data.length - 1); + for (var i = 1; i < data.length; i++) { + intArray[i - 1] = data[i]; + } + return { type: packetslist[type], data: intArray.buffer }; + } + var type = data[0]; + return { type: packetslist[type], data: data.slice(1) }; +}; + +/** + * Decodes a packet encoded in a base64 string. + * + * @param {String} base64 encoded message + * @return {Object} with `type` and `data` (if any) + */ + +exports.decodeBase64Packet = function(msg, binaryType) { + var type = packetslist[msg.charAt(0)]; + var data = new Buffer(msg.substr(1), 'base64'); + if (binaryType === 'arraybuffer') { + var abv = new Uint8Array(data.length); + for (var i = 0; i < abv.length; i++){ + abv[i] = data[i]; + } + data = abv.buffer; + } + return { type: type, data: data }; +}; + +/** + * Encodes multiple messages (payload). + * + * :data + * + * Example: + * + * 11:hello world2:hi + * + * If any contents are binary, they will be encoded as base64 strings. Base64 + * encoded strings are marked with a b before the length specifier + * + * @param {Array} packets + * @api private + */ + +exports.encodePayload = function (packets, supportsBinary, callback) { + if (typeof supportsBinary == 'function') { + callback = supportsBinary; + supportsBinary = null; + } + + if (supportsBinary) { + return exports.encodePayloadAsBinary(packets, callback); + } + + if (!packets.length) { + return callback('0:'); + } + + function setLengthHeader(message) { + return message.length + ':' + message; + } + + function encodeOne(packet, doneCallback) { + exports.encodePacket(packet, supportsBinary, function(message) { + doneCallback(null, setLengthHeader(message)); + }); + } + + map(packets, encodeOne, function(err, results) { + return callback(results.join('')); + }); +}; + +/** + * Async array map using after + */ + +function map(ary, each, done) { + var result = new Array(ary.length); + var next = after(ary.length, done); + + var eachWithIndex = function(i, el, cb) { + each(el, function(error, msg) { + result[i] = msg; + cb(error, result); + }); + }; + + for (var i = 0; i < ary.length; i++) { + eachWithIndex(i, ary[i], next); + } +} + +/* + * Decodes data when a payload is maybe expected. Possible binary contents are + * decoded from their base64 representation + * + * @param {String} data, callback method + * @api public + */ + +exports.decodePayload = function (data, binaryType, callback) { + if ('string' != typeof data) { + return exports.decodePayloadAsBinary(data, binaryType, callback); + } + + if (typeof binaryType === 'function') { + callback = binaryType; + binaryType = null; + } + + var packet; + if (data == '') { + // parser error - ignoring payload + return callback(err, 0, 1); + } + + var length = '' + , n, msg; + + for (var i = 0, l = data.length; i < l; i++) { + var chr = data.charAt(i); + + if (':' != chr) { + length += chr; + } else { + if ('' == length || (length != (n = Number(length)))) { + // parser error - ignoring payload + return callback(err, 0, 1); + } + + msg = data.substr(i + 1, n); + + if (length != msg.length) { + // parser error - ignoring payload + return callback(err, 0, 1); + } + + if (msg.length) { + packet = exports.decodePacket(msg, binaryType); + + if (err.type == packet.type && err.data == packet.data) { + // parser error in individual packet - ignoring payload + return callback(err, 0, 1); + } + + var ret = callback(packet, i + n, l); + if (false === ret) return; + } + + // advance cursor + i += n; + length = ''; + } + } + + if (length != '') { + // parser error - ignoring payload + return callback(err, 0, 1); + } + +}; + +/** + * + * Converts a buffer to a utf8.js encoded string + * + * @api private + */ + +function bufferToString(buffer) { + var str = ''; + for (var i = 0; i < buffer.length; i++) { + str += String.fromCharCode(buffer[i]); + } + return str; +} + +/** + * + * Converts a utf8.js encoded string to a buffer + * + * @api private + */ + +function stringToBuffer(string) { + var buf = new Buffer(string.length); + for (var i = 0; i < string.length; i++) { + buf.writeUInt8(string.charCodeAt(i), i); + } + return buf; +} + +/** + * Encodes multiple messages (payload) as binary. + * + * <1 = binary, 0 = string>[...] + * + * Example: + * 1 3 255 1 2 3, if the binary contents are interpreted as 8 bit integers + * + * @param {Array} packets + * @return {Buffer} encoded payload + * @api private + */ + +exports.encodePayloadAsBinary = function (packets, callback) { + if (!packets.length) { + return callback(new Buffer(0)); + } + + function encodeOne(p, doneCallback) { + exports.encodePacket(p, true, function(packet) { + + if (typeof packet === 'string') { + var encodingLength = '' + packet.length; + var sizeBuffer = new Buffer(encodingLength.length + 2); + sizeBuffer[0] = 0; // is a string (not true binary = 0) + for (var i = 0; i < encodingLength.length; i++) { + sizeBuffer[i + 1] = parseInt(encodingLength[i], 10); + } + sizeBuffer[sizeBuffer.length - 1] = 255; + return doneCallback(null, Buffer.concat([sizeBuffer, stringToBuffer(packet)])); + } + + var encodingLength = '' + packet.length; + var sizeBuffer = new Buffer(encodingLength.length + 2); + sizeBuffer[0] = 1; // is binary (true binary = 1) + for (var i = 0; i < encodingLength.length; i++) { + sizeBuffer[i + 1] = parseInt(encodingLength[i], 10); + } + sizeBuffer[sizeBuffer.length - 1] = 255; + doneCallback(null, Buffer.concat([sizeBuffer, packet])); + }); + } + + map(packets, encodeOne, function(err, results) { + return callback(Buffer.concat(results)); + }); +}; + +/* + * Decodes data when a payload is maybe expected. Strings are decoded by + * interpreting each byte as a key code for entries marked to start with 0. See + * description of encodePayloadAsBinary + + * @param {Buffer} data, callback method + * @api public + */ + +exports.decodePayloadAsBinary = function (data, binaryType, callback) { + if (typeof binaryType === 'function') { + callback = binaryType; + binaryType = null; + } + + var bufferTail = data; + var buffers = []; + + while (bufferTail.length > 0) { + var strLen = ''; + var isString = bufferTail[0] === 0; + for (var i = 1; ; i++) { + if (bufferTail[i] == 255) break; + strLen += '' + bufferTail[i]; + } + bufferTail = bufferTail.slice(strLen.length + 1); + + var msgLength = parseInt(strLen, 10); + + var msg = bufferTail.slice(1, msgLength + 1); + if (isString) msg = bufferToString(msg); + buffers.push(msg); + bufferTail = bufferTail.slice(msgLength + 1); + } + + var total = buffers.length; + buffers.forEach(function(buffer, i) { + callback(exports.decodePacket(buffer, binaryType), i, total); + }); +}; diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/lib/keys.js b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/lib/keys.js new file mode 100644 index 0000000..947dafd --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/lib/keys.js @@ -0,0 +1,19 @@ + +/** + * Gets the keys for an object. + * + * @return {Array} keys + * @api private + */ + +module.exports = Object.keys || function keys (obj){ + var arr = []; + var has = Object.prototype.hasOwnProperty; + + for (var i in obj) { + if (has.call(obj, i)) { + arr.push(i); + } + } + return arr; +}; diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/after/.npmignore b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/after/.npmignore new file mode 100644 index 0000000..6c78602 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/after/.npmignore @@ -0,0 +1,2 @@ +node_modules +.monitor diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/after/.travis.yml b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/after/.travis.yml new file mode 100644 index 0000000..84fd7ca --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/after/.travis.yml @@ -0,0 +1,5 @@ +language: node_js +node_js: + - 0.6 + - 0.8 + - 0.9 diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/after/LICENCE b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/after/LICENCE new file mode 100644 index 0000000..7c35130 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/after/LICENCE @@ -0,0 +1,19 @@ +Copyright (c) 2011 Raynos. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/after/README.md b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/after/README.md new file mode 100644 index 0000000..0012d35 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/after/README.md @@ -0,0 +1,75 @@ +# After [![Build Status][1]][2] + +Invoke callback after n calls + +## Status: production ready + +## Example + + var after = require("after") + , next = after(3, logItWorks) + + next() + next() + next() // it works + + function logItWorks() { + console.log("it works!") + } + +## Example with error handling + + var after = require("after") + , next = after(3, logError) + + next() + next(new Error("oops")) // logs oops + next() // does nothing + + function logError(err) { + console.log(err) + } + +## After < 0.6.0 + +Older versions of after had iterators and flows in them. + +These have been replaced with seperate modules + + - [iterators][8] + - [composite][9] + +## Installation + +`npm install after` + +## Tests + +`npm test` + +## Blog post + + - [Flow control in node.js][3] + +## Examples : + + - [Determining the end of asynchronous operations][4] + - [In javascript what are best practices for executing multiple asynchronous functions][5] + - [JavaScript performance long running tasks][6] + - [Synchronous database queries with node.js][7] + +## Contributors + + - Raynos + +## MIT Licenced + + [1]: https://secure.travis-ci.org/Raynos/after.png + [2]: http://travis-ci.org/Raynos/after + [3]: http://raynos.org/blog/2/Flow-control-in-node.js + [4]: http://stackoverflow.com/questions/6852059/determining-the-end-of-asynchronous-operations-javascript/6852307#6852307 + [5]: http://stackoverflow.com/questions/6869872/in-javascript-what-are-best-practices-for-executing-multiple-asynchronous-functi/6870031#6870031 + [6]: http://stackoverflow.com/questions/6864397/javascript-performance-long-running-tasks/6889419#6889419 + [7]: http://stackoverflow.com/questions/6597493/synchronous-database-queries-with-node-js/6620091#6620091 + [8]: http://github.com/Raynos/iterators + [9]: http://github.com/Raynos/composite diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/after/index.js b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/after/index.js new file mode 100644 index 0000000..ec24879 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/after/index.js @@ -0,0 +1,28 @@ +module.exports = after + +function after(count, callback, err_cb) { + var bail = false + err_cb = err_cb || noop + proxy.count = count + + return (count === 0) ? callback() : proxy + + function proxy(err, result) { + if (proxy.count <= 0) { + throw new Error('after called too many times') + } + --proxy.count + + // after first error, rest are passed to err_cb + if (err) { + bail = true + callback(err) + // future error callbacks will go to error handler + callback = err_cb + } else if (proxy.count === 0 && !bail) { + callback(null, result) + } + } +} + +function noop() {} diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/after/package.json b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/after/package.json new file mode 100644 index 0000000..7928c09 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/after/package.json @@ -0,0 +1,62 @@ +{ + "name": "after", + "description": "after - tiny flow control", + "version": "0.8.1", + "author": { + "name": "Raynos", + "email": "raynos2@gmail.com" + }, + "contributors": [ + { + "name": "Raynos", + "email": "raynos2@gmail.com", + "url": "http://raynos.org" + } + ], + "scripts": { + "test": "mocha --ui tdd --reporter spec test/*.js" + }, + "devDependencies": { + "mocha": "~1.8.1" + }, + "keywords": [ + "flowcontrol", + "after", + "flow", + "control", + "arch" + ], + "repository": { + "type": "git", + "url": "git://github.com/Raynos/after.git" + }, + "readme": "# After [![Build Status][1]][2]\n\nInvoke callback after n calls\n\n## Status: production ready\n\n## Example\n\n var after = require(\"after\")\n , next = after(3, logItWorks)\n\n next()\n next()\n next() // it works\n\n function logItWorks() {\n console.log(\"it works!\")\n }\n\n## Example with error handling\n\n var after = require(\"after\")\n , next = after(3, logError)\n\n next()\n next(new Error(\"oops\")) // logs oops\n next() // does nothing\n\n function logError(err) {\n console.log(err)\n }\n\n## After < 0.6.0\n\nOlder versions of after had iterators and flows in them.\n\nThese have been replaced with seperate modules\n\n - [iterators][8]\n - [composite][9]\n\n## Installation\n\n`npm install after`\n\n## Tests\n\n`npm test`\n\n## Blog post\n\n - [Flow control in node.js][3]\n\n## Examples :\n\n - [Determining the end of asynchronous operations][4]\n - [In javascript what are best practices for executing multiple asynchronous functions][5]\n - [JavaScript performance long running tasks][6]\n - [Synchronous database queries with node.js][7]\n\n## Contributors\n\n - Raynos\n\n## MIT Licenced\n\n [1]: https://secure.travis-ci.org/Raynos/after.png\n [2]: http://travis-ci.org/Raynos/after\n [3]: http://raynos.org/blog/2/Flow-control-in-node.js\n [4]: http://stackoverflow.com/questions/6852059/determining-the-end-of-asynchronous-operations-javascript/6852307#6852307\n [5]: http://stackoverflow.com/questions/6869872/in-javascript-what-are-best-practices-for-executing-multiple-asynchronous-functi/6870031#6870031\n [6]: http://stackoverflow.com/questions/6864397/javascript-performance-long-running-tasks/6889419#6889419\n [7]: http://stackoverflow.com/questions/6597493/synchronous-database-queries-with-node-js/6620091#6620091\n [8]: http://github.com/Raynos/iterators\n [9]: http://github.com/Raynos/composite\n", + "readmeFilename": "README.md", + "bugs": { + "url": "https://github.com/Raynos/after/issues" + }, + "_id": "after@0.8.1", + "dist": { + "shasum": "ab5d4fb883f596816d3515f8f791c0af486dd627", + "tarball": "http://registry.npmjs.org/after/-/after-0.8.1.tgz" + }, + "_from": "after@0.8.1", + "_npmVersion": "1.2.25", + "_npmUser": { + "name": "raynos", + "email": "raynos2@gmail.com" + }, + "maintainers": [ + { + "name": "raynos", + "email": "raynos2@gmail.com" + }, + { + "name": "shtylman", + "email": "shtylman@gmail.com" + } + ], + "directories": {}, + "_shasum": "ab5d4fb883f596816d3515f8f791c0af486dd627", + "_resolved": "https://registry.npmjs.org/after/-/after-0.8.1.tgz" +} diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/after/test/after-test.js b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/after/test/after-test.js new file mode 100644 index 0000000..0d63f4c --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/after/test/after-test.js @@ -0,0 +1,120 @@ +/*global suite, test*/ + +var assert = require("assert") + , after = require("../") + +test("exists", function () { + assert(typeof after === "function", "after is not a function") +}) + +test("after when called with 0 invokes", function (done) { + after(0, done) +}); + +test("after 1", function (done) { + var next = after(1, done) + next() +}) + +test("after 5", function (done) { + var next = after(5, done) + , i = 5 + + while (i--) { + next() + } +}) + +test("manipulate count", function (done) { + var next = after(1, done) + , i = 5 + + next.count = i + while (i--) { + next() + } +}) + +test("after terminates on error", function (done) { + var next = after(2, function(err) { + assert.equal(err.message, 'test'); + done(); + }) + next(new Error('test')) + next(new Error('test2')) +}) + +test('gee', function(done) { + done = after(2, done) + + function cb(err) { + assert.equal(err.message, 1); + done() + } + + var next = after(3, cb, function(err) { + assert.equal(err.message, 2) + done() + }); + + next() + next(new Error(1)) + next(new Error(2)) +}) + +test('eee', function(done) { + done = after(3, done) + + function cb(err) { + assert.equal(err.message, 1); + done() + } + + var next = after(3, cb, function(err) { + assert.equal(err.message, 2) + done() + }); + + next(new Error(1)) + next(new Error(2)) + next(new Error(2)) +}) + +test('gge', function(done) { + function cb(err) { + assert.equal(err.message, 1); + done() + } + + var next = after(3, cb, function(err) { + // should not happen + assert.ok(false); + }); + + next() + next() + next(new Error(1)) +}) + +test('egg', function(done) { + function cb(err) { + assert.equal(err.message, 1); + done() + } + + var next = after(3, cb, function(err) { + // should not happen + assert.ok(false); + }); + + next(new Error(1)) + next() + next() +}) + +test('throws on too many calls', function(done) { + var next = after(1, done); + next() + assert.throws(next, /after called too many times/); +}); + diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/arraybuffer.slice/.npmignore b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/arraybuffer.slice/.npmignore new file mode 100644 index 0000000..cfbee8d --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/arraybuffer.slice/.npmignore @@ -0,0 +1,17 @@ +lib-cov +lcov.info +*.seed +*.log +*.csv +*.dat +*.out +*.pid +*.gz + +pids +logs +results +build +.grunt + +node_modules diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/arraybuffer.slice/Makefile b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/arraybuffer.slice/Makefile new file mode 100644 index 0000000..849887f --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/arraybuffer.slice/Makefile @@ -0,0 +1,8 @@ + +REPORTER = dot + +test: + @./node_modules/.bin/mocha \ + --reporter $(REPORTER) + +.PHONY: test diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/arraybuffer.slice/README.md b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/arraybuffer.slice/README.md new file mode 100644 index 0000000..15e465e --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/arraybuffer.slice/README.md @@ -0,0 +1,17 @@ +# How to +```javascript +var sliceBuffer = require('arraybuffer.slice'); +var ab = (new Int8Array(5)).buffer; +var sliced = sliceBuffer(ab, 1, 3); +sliced = sliceBuffer(ab, 1); +``` + +# Licence (MIT) +Copyright (C) 2013 Rase- + + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/arraybuffer.slice/index.js b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/arraybuffer.slice/index.js new file mode 100644 index 0000000..11ac556 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/arraybuffer.slice/index.js @@ -0,0 +1,29 @@ +/** + * An abstraction for slicing an arraybuffer even when + * ArrayBuffer.prototype.slice is not supported + * + * @api public + */ + +module.exports = function(arraybuffer, start, end) { + var bytes = arraybuffer.byteLength; + start = start || 0; + end = end || bytes; + + if (arraybuffer.slice) { return arraybuffer.slice(start, end); } + + if (start < 0) { start += bytes; } + if (end < 0) { end += bytes; } + if (end > bytes) { end = bytes; } + + if (start >= bytes || start >= end || bytes === 0) { + return new ArrayBuffer(0); + } + + var abv = new Uint8Array(arraybuffer); + var result = new Uint8Array(end - start); + for (var i = start, ii = 0; i < end; i++, ii++) { + result[ii] = abv[i]; + } + return result.buffer; +}; diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/arraybuffer.slice/package.json b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/arraybuffer.slice/package.json new file mode 100644 index 0000000..30af679 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/arraybuffer.slice/package.json @@ -0,0 +1,38 @@ +{ + "name": "arraybuffer.slice", + "description": "Exports a function for slicing ArrayBuffers (no polyfilling)", + "version": "0.0.6", + "homepage": "https://github.com/rase-/arraybuffer.slice", + "dependencies": {}, + "devDependencies": { + "mocha": "1.17.1", + "expect.js": "0.2.0" + }, + "repository": { + "type": "git", + "url": "git@github.com:rase-/arraybuffer.slice.git" + }, + "bugs": { + "url": "https://github.com/rase-/arraybuffer.slice/issues" + }, + "_id": "arraybuffer.slice@0.0.6", + "dist": { + "shasum": "f33b2159f0532a3f3107a272c0ccfbd1ad2979ca", + "tarball": "http://registry.npmjs.org/arraybuffer.slice/-/arraybuffer.slice-0.0.6.tgz" + }, + "_from": "arraybuffer.slice@0.0.6", + "_npmVersion": "1.3.5", + "_npmUser": { + "name": "rase-", + "email": "tonykovanen@hotmail.com" + }, + "maintainers": [ + { + "name": "rase-", + "email": "tonykovanen@hotmail.com" + } + ], + "directories": {}, + "_shasum": "f33b2159f0532a3f3107a272c0ccfbd1ad2979ca", + "_resolved": "https://registry.npmjs.org/arraybuffer.slice/-/arraybuffer.slice-0.0.6.tgz" +} diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/arraybuffer.slice/test/slice-buffer.js b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/arraybuffer.slice/test/slice-buffer.js new file mode 100644 index 0000000..4778da6 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/arraybuffer.slice/test/slice-buffer.js @@ -0,0 +1,227 @@ +/* + * Test dependencies + */ + +var sliceBuffer = require('../index.js'); +var expect = require('expect.js'); + +/** + * Tests + */ + +describe('sliceBuffer', function() { + describe('using standard slice', function() { + it('should slice correctly with only start provided', function() { + var abv = new Uint8Array(10); + for (var i = 0; i < abv.length; i++) { + abv[i] = i; + } + + var sliced = sliceBuffer(abv.buffer, 3); + var sabv = new Uint8Array(sliced); + for (var i = 3, ii = 0; i < abv.length; i++, ii++) { + expect(abv[i]).to.equal(sabv[ii]); + } + }); + + it('should slice correctly with start and end provided', function() { + var abv = new Uint8Array(10); + for (var i = 0; i < abv.length; i++) { + abv[i] = i; + } + + var sliced = sliceBuffer(abv.buffer, 3, 8); + var sabv = new Uint8Array(sliced); + for (var i = 3, ii = 0; i < 8; i++, ii++) { + expect(abv[i]).to.equal(sabv[ii]); + } + }); + + it('should slice correctly with negative start', function() { + var abv = new Uint8Array(10); + for (var i = 0; i < abv.length; i++) { + abv[i] = i; + } + + var sliced = sliceBuffer(abv.buffer, -3); + var sabv = new Uint8Array(sliced); + for (var i = abv.length - 3, ii = 0; i < abv.length; i++, ii++) { + expect(abv[i]).to.equal(sabv[ii]); + } + }); + + it('should slice correctly with negative end', function() { + var abv = new Uint8Array(10); + for (var i = 0; i < abv.length; i++) { + abv[i] = i; + } + + var sliced = sliceBuffer(abv.buffer, 0, -3); + var sabv = new Uint8Array(sliced); + for (var i = 0, ii = 0; i < abv.length - 3; i++, ii++) { + expect(abv[i]).to.equal(sabv[ii]); + } + }); + + it('should slice correctly with negative start and end', function() { + var abv = new Uint8Array(10); + for (var i = 0; i < abv.length; i++) { + abv[i] = i; + } + + var sliced = sliceBuffer(abv.buffer, -6, -3); + var sabv = new Uint8Array(sliced); + for (var i = abv.length - 6, ii = 0; i < abv.length - 3; i++, ii++) { + expect(abv[i]).to.equal(sabv[ii]); + } + }); + + it('should slice correctly with equal start and end', function() { + var abv = new Uint8Array(10); + for (var i = 0; i < abv.length; i++) { + abv[i] = i; + } + + var sliced = sliceBuffer(abv.buffer, 1, 1); + expect(sliced.byteLength).to.equal(0); + }); + + it('should slice correctly when end larger than buffer', function() { + var abv = new Uint8Array(10); + for (var i = 0; i < abv.length; i++) { + abv[i] = i; + } + + var sliced = sliceBuffer(abv.buffer, 0, 100); + expect(new Uint8Array(sliced)).to.eql(abv); + }); + + it('shoud slice correctly when start larger than end', function() { + var abv = new Uint8Array(10); + for (var i = 0; i < abv.length; i++) { + abv[i] = i; + } + + var sliced = sliceBuffer(abv.buffer, 6, 5); + expect(sliced.byteLength).to.equal(0); + }); + }); + + describe('using fallback', function() { + it('should slice correctly with only start provided', function() { + var abv = new Uint8Array(10); + for (var i = 0; i < abv.length; i++) { + abv[i] = i; + } + var ab = abv.buffer; + ab.slice = undefined; + + var sliced = sliceBuffer(ab, 3); + var sabv = new Uint8Array(sliced); + for (var i = 3, ii = 0; i < abv.length; i++, ii++) { + expect(abv[i]).to.equal(sabv[ii]); + } + }); + + it('should slice correctly with start and end provided', function() { + var abv = new Uint8Array(10); + for (var i = 0; i < abv.length; i++) { + abv[i] = i; + } + var ab = abv.buffer; + ab.slice = undefined; + + + var sliced = sliceBuffer(ab, 3, 8); + var sabv = new Uint8Array(sliced); + for (var i = 3, ii = 0; i < 8; i++, ii++) { + expect(abv[i]).to.equal(sabv[ii]); + } + }); + + it('should slice correctly with negative start', function() { + var abv = new Uint8Array(10); + for (var i = 0; i < abv.length; i++) { + abv[i] = i; + } + var ab = abv.buffer; + ab.slice = undefined; + + + var sliced = sliceBuffer(ab, -3); + var sabv = new Uint8Array(sliced); + for (var i = abv.length - 3, ii = 0; i < abv.length; i++, ii++) { + expect(abv[i]).to.equal(sabv[ii]); + } + }); + + it('should slice correctly with negative end', function() { + var abv = new Uint8Array(10); + for (var i = 0; i < abv.length; i++) { + abv[i] = i; + } + var ab = abv.buffer; + ab.slice = undefined; + + var sliced = sliceBuffer(ab, 0, -3); + var sabv = new Uint8Array(sliced); + for (var i = 0, ii = 0; i < abv.length - 3; i++, ii++) { + expect(abv[i]).to.equal(sabv[ii]); + } + }); + + it('should slice correctly with negative start and end', function() { + var abv = new Uint8Array(10); + for (var i = 0; i < abv.length; i++) { + abv[i] = i; + } + var ab = abv.buffer; + ab.slice = undefined; + + var sliced = sliceBuffer(ab, -6, -3); + var sabv = new Uint8Array(sliced); + for (var i = abv.length - 6, ii = 0; i < abv.length - 3; i++, ii++) { + expect(abv[i]).to.equal(sabv[ii]); + } + }); + + it('should slice correctly with equal start and end', function() { + var abv = new Uint8Array(10); + for (var i = 0; i < abv.length; i++) { + abv[i] = i; + } + var ab = abv.buffer; + ab.slice = undefined; + + var sliced = sliceBuffer(ab, 1, 1); + expect(sliced.byteLength).to.equal(0); + }); + + it('should slice correctly when end larger than buffer', function() { + var abv = new Uint8Array(10); + for (var i = 0; i < abv.length; i++) { + abv[i] = i; + } + var ab = abv.buffer; + ab.slice = undefined; + + var sliced = sliceBuffer(ab, 0, 100); + var sabv = new Uint8Array(sliced); + for (var i = 0; i < abv.length; i++) { + expect(abv[i]).to.equal(sabv[i]); + } + }); + + it('shoud slice correctly when start larger than end', function() { + var abv = new Uint8Array(10); + for (var i = 0; i < abv.length; i++) { + abv[i] = i; + } + var ab = abv.buffer; + ab.slice = undefined; + + var sliced = sliceBuffer(ab, 6, 5); + expect(sliced.byteLength).to.equal(0); + }); + }); +}); diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/base64-arraybuffer/.npmignore b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/base64-arraybuffer/.npmignore new file mode 100644 index 0000000..2ccbe46 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/base64-arraybuffer/.npmignore @@ -0,0 +1 @@ +/node_modules/ diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/base64-arraybuffer/.travis.yml b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/base64-arraybuffer/.travis.yml new file mode 100644 index 0000000..e2eeb99 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/base64-arraybuffer/.travis.yml @@ -0,0 +1,6 @@ +--- +language: node_js +node_js: +- '0.10' +before_script: +- npm install diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/base64-arraybuffer/LICENSE-MIT b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/base64-arraybuffer/LICENSE-MIT new file mode 100644 index 0000000..ed27b41 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/base64-arraybuffer/LICENSE-MIT @@ -0,0 +1,22 @@ +Copyright (c) 2012 Niklas von Hertzen + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/base64-arraybuffer/README.md b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/base64-arraybuffer/README.md new file mode 100644 index 0000000..b841154 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/base64-arraybuffer/README.md @@ -0,0 +1,23 @@ +# base64-arraybuffer + +[![Build Status](https://travis-ci.org/niklasvh/base64-arraybuffer.png)](https://travis-ci.org/niklasvh/base64-arraybuffer) + +Encode/decode base64 data into ArrayBuffers + +## Getting Started +Install the module with: `npm install base64-arraybuffer` + +## API +The library encodes and decodes base64 to and from ArrayBuffers + + - __encode(buffer)__ - Encodes `ArrayBuffer` into base64 string + - __decode(str)__ - Decodes base64 string to `ArrayBuffer` + +## Release History + + - 0.1.2 - Fix old format of typed arrays + - 0.1.0 - Initial version, basic decode/encode base64 to and from ArrayBuffer + +## License +Copyright (c) 2012 Niklas von Hertzen +Licensed under the MIT license. diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/base64-arraybuffer/README.md~ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/base64-arraybuffer/README.md~ new file mode 100644 index 0000000..b841154 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/base64-arraybuffer/README.md~ @@ -0,0 +1,23 @@ +# base64-arraybuffer + +[![Build Status](https://travis-ci.org/niklasvh/base64-arraybuffer.png)](https://travis-ci.org/niklasvh/base64-arraybuffer) + +Encode/decode base64 data into ArrayBuffers + +## Getting Started +Install the module with: `npm install base64-arraybuffer` + +## API +The library encodes and decodes base64 to and from ArrayBuffers + + - __encode(buffer)__ - Encodes `ArrayBuffer` into base64 string + - __decode(str)__ - Decodes base64 string to `ArrayBuffer` + +## Release History + + - 0.1.2 - Fix old format of typed arrays + - 0.1.0 - Initial version, basic decode/encode base64 to and from ArrayBuffer + +## License +Copyright (c) 2012 Niklas von Hertzen +Licensed under the MIT license. diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/base64-arraybuffer/grunt.js b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/base64-arraybuffer/grunt.js new file mode 100644 index 0000000..73c4e7a --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/base64-arraybuffer/grunt.js @@ -0,0 +1,39 @@ +module.exports = function(grunt) { + "use strict"; + // Project configuration. + grunt.initConfig({ + pkg: '', + test: { + files: ['test/**/*.js'] + }, + lint: { + files: ['grunt.js', 'lib/**/*.js', 'test/**/*.js'] + }, + watch: { + files: '', + tasks: 'default' + }, + jshint: { + options: { + curly: true, + eqeqeq: true, + immed: true, + latedef: true, + newcap: true, + noarg: true, + sub: true, + undef: true, + boss: true, + eqnull: true, + node: true + }, + globals: { + exports: true + } + } + }); + + // Default task. + grunt.registerTask('default', 'test'); + +}; \ No newline at end of file diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/base64-arraybuffer/lib/base64-arraybuffer.js b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/base64-arraybuffer/lib/base64-arraybuffer.js new file mode 100644 index 0000000..362fbfa --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/base64-arraybuffer/lib/base64-arraybuffer.js @@ -0,0 +1,59 @@ +/* + * base64-arraybuffer + * https://github.com/niklasvh/base64-arraybuffer + * + * Copyright (c) 2012 Niklas von Hertzen + * Licensed under the MIT license. + */ +(function(chars){ + "use strict"; + + exports.encode = function(arraybuffer) { + var bytes = new Uint8Array(arraybuffer), + i, len = bytes.length, base64 = ""; + + for (i = 0; i < len; i+=3) { + base64 += chars[bytes[i] >> 2]; + base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)]; + base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)]; + base64 += chars[bytes[i + 2] & 63]; + } + + if ((len % 3) === 2) { + base64 = base64.substring(0, base64.length - 1) + "="; + } else if (len % 3 === 1) { + base64 = base64.substring(0, base64.length - 2) + "=="; + } + + return base64; + }; + + exports.decode = function(base64) { + var bufferLength = base64.length * 0.75, + len = base64.length, i, p = 0, + encoded1, encoded2, encoded3, encoded4; + + if (base64[base64.length - 1] === "=") { + bufferLength--; + if (base64[base64.length - 2] === "=") { + bufferLength--; + } + } + + var arraybuffer = new ArrayBuffer(bufferLength), + bytes = new Uint8Array(arraybuffer); + + for (i = 0; i < len; i+=4) { + encoded1 = chars.indexOf(base64[i]); + encoded2 = chars.indexOf(base64[i+1]); + encoded3 = chars.indexOf(base64[i+2]); + encoded4 = chars.indexOf(base64[i+3]); + + bytes[p++] = (encoded1 << 2) | (encoded2 >> 4); + bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2); + bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63); + } + + return arraybuffer; + }; +})("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"); diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/base64-arraybuffer/package.json b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/base64-arraybuffer/package.json new file mode 100644 index 0000000..6853aa5 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/base64-arraybuffer/package.json @@ -0,0 +1,55 @@ +{ + "name": "base64-arraybuffer", + "description": "Encode/decode base64 data into ArrayBuffers", + "version": "0.1.2", + "homepage": "https://github.com/niklasvh/base64-arraybuffer", + "author": { + "name": "Niklas von Hertzen", + "email": "niklasvh@gmail.com", + "url": "http://hertzen.com" + }, + "repository": { + "type": "git", + "url": "https://github.com/niklasvh/base64-arraybuffer" + }, + "bugs": { + "url": "https://github.com/niklasvh/base64-arraybuffer/issues" + }, + "licenses": [ + { + "type": "MIT", + "url": "https://github.com/niklasvh/base64-arraybuffer/blob/master/LICENSE-MIT" + } + ], + "main": "lib/base64-arraybuffer", + "engines": { + "node": ">= 0.6.0" + }, + "scripts": { + "test": "grunt test" + }, + "devDependencies": { + "grunt": "~0.3.17" + }, + "keywords": [], + "_id": "base64-arraybuffer@0.1.2", + "dist": { + "shasum": "474df4a9f2da24e05df3158c3b1db3c3cd46a154", + "tarball": "http://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.2.tgz" + }, + "_from": "base64-arraybuffer@0.1.2", + "_npmVersion": "1.3.21", + "_npmUser": { + "name": "niklasvh", + "email": "niklasvh@gmail.com" + }, + "maintainers": [ + { + "name": "niklasvh", + "email": "niklasvh@gmail.com" + } + ], + "directories": {}, + "_shasum": "474df4a9f2da24e05df3158c3b1db3c3cd46a154", + "_resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.2.tgz" +} diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/base64-arraybuffer/package.json~ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/base64-arraybuffer/package.json~ new file mode 100644 index 0000000..251031a --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/base64-arraybuffer/package.json~ @@ -0,0 +1,35 @@ +{ + "name": "base64-arraybuffer", + "description": "Encode/decode base64 data into ArrayBuffers", + "version": "0.1.1", + "homepage": "https://github.com/niklasvh/base64-arraybuffer", + "author": { + "name": "Niklas von Hertzen", + "email": "niklasvh@gmail.com", + "url": "http://hertzen.com" + }, + "repository": { + "type": "git", + "url": "https://github.com/niklasvh/base64-arraybuffer" + }, + "bugs": { + "url": "https://github.com/niklasvh/base64-arraybuffer/issues" + }, + "licenses": [ + { + "type": "MIT", + "url": "https://github.com/niklasvh/base64-arraybuffer/blob/master/LICENSE-MIT" + } + ], + "main": "lib/base64-arraybuffer", + "engines": { + "node": ">= 0.6.0" + }, + "scripts": { + "test": "grunt test" + }, + "devDependencies": { + "grunt": "~0.3.17" + }, + "keywords": [] +} diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/base64-arraybuffer/test/base64-arraybuffer_test.js b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/base64-arraybuffer/test/base64-arraybuffer_test.js new file mode 100644 index 0000000..fe89c22 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/base64-arraybuffer/test/base64-arraybuffer_test.js @@ -0,0 +1,72 @@ +(function(){ + "use strict"; + var base64_arraybuffer = require('../lib/base64-arraybuffer.js'); + + /* + ======== A Handy Little Nodeunit Reference ======== + https://github.com/caolan/nodeunit + + Test methods: + test.expect(numAssertions) + test.done() + Test assertions: + test.ok(value, [message]) + test.equal(actual, expected, [message]) + test.notEqual(actual, expected, [message]) + test.deepEqual(actual, expected, [message]) + test.notDeepEqual(actual, expected, [message]) + test.strictEqual(actual, expected, [message]) + test.notStrictEqual(actual, expected, [message]) + test.throws(block, [error], [message]) + test.doesNotThrow(block, [error], [message]) + test.ifError(value) +*/ + + + function stringArrayBuffer(str) { + var buffer = new ArrayBuffer(str.length); + var bytes = new Uint8Array(buffer); + + str.split('').forEach(function(str, i) { + bytes[i] = str.charCodeAt(0); + }); + + return buffer; + } + + function testArrayBuffers(buffer1, buffer2) { + var len1 = buffer1.byteLength, + len2 = buffer2.byteLength; + if (len1 !== len2) { + console.log(buffer1, buffer2); + return false; + } + + for (var i = 0; i < len1; i++) { + if (buffer1[i] !== buffer1[i]) { + console.log(i, buffer1, buffer2); + return false; + } + } + return true; + } + + exports['base64tests'] = { + 'encode': function(test) { + test.expect(4); + + test.equal(base64_arraybuffer.encode(stringArrayBuffer("Hello world")), "SGVsbG8gd29ybGQ=", 'encode "Hello world"'); + test.equal(base64_arraybuffer.encode(stringArrayBuffer("Man")), 'TWFu', 'encode "Man"'); + test.equal(base64_arraybuffer.encode(stringArrayBuffer("Ma")), "TWE=", 'encode "Ma"'); + test.equal(base64_arraybuffer.encode(stringArrayBuffer("Hello worlds!")), "SGVsbG8gd29ybGRzIQ==", 'encode "Hello worlds!"'); + test.done(); + }, + 'decode': function(test) { + test.expect(3); + test.ok(testArrayBuffers(base64_arraybuffer.decode("TWFu"), stringArrayBuffer("Man")), 'decode "Man"'); + test.ok(testArrayBuffers(base64_arraybuffer.decode("SGVsbG8gd29ybGQ="), stringArrayBuffer("Hello world")), 'decode "Hello world"'); + test.ok(testArrayBuffers(base64_arraybuffer.decode("SGVsbG8gd29ybGRzIQ=="), stringArrayBuffer("Hello worlds!")), 'decode "Hello worlds!"'); + test.done(); + } + }; +})(); diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/blob/.npmignore b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/blob/.npmignore new file mode 100644 index 0000000..548a368 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/blob/.npmignore @@ -0,0 +1,2 @@ +node_modules +blob.js diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/blob/.zuul.yml b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/blob/.zuul.yml new file mode 100644 index 0000000..9e206f3 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/blob/.zuul.yml @@ -0,0 +1,8 @@ +ui: mocha-bdd +browsers: + - name: chrome + version: [8, latest] + - name: ie + version: 10 + - name: android + version: latest diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/blob/Makefile b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/blob/Makefile new file mode 100644 index 0000000..7d9601a --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/blob/Makefile @@ -0,0 +1,14 @@ +REPORTER = dot + +build: blob.js + +blob.js: + @./node_modules/.bin/browserify --standalone blob index.js > blob.js + +test: + @./node_modules/.bin/zuul -- test/index.js + +clean: + rm blob.js + +.PHONY: test blob.js diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/blob/README.md b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/blob/README.md new file mode 100644 index 0000000..a799fb5 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/blob/README.md @@ -0,0 +1,11 @@ +Blob +==== + +A module that exports a constructor that uses window.Blob when available, and a BlobBuilder with any vendor prefix in other cases. If neither is available, it exports undefined. + +Usage: + +```javascript +var Blob = require('blob'); +var b = new Blob(['hi', 'constructing', 'a', 'blob']); +``` diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/blob/index.js b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/blob/index.js new file mode 100644 index 0000000..1de212e --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/blob/index.js @@ -0,0 +1,49 @@ +/** + * Create a blob builder even when vendor prefixes exist + */ + +var BlobBuilder = global.BlobBuilder + || global.WebKitBlobBuilder + || global.MSBlobBuilder + || global.MozBlobBuilder; + +/** + * Check if Blob constructor is supported + */ + +var blobSupported = (function() { + try { + var b = new Blob(['hi']); + return b.size == 2; + } catch(e) { + return false; + } +})(); + +/** + * Check if BlobBuilder is supported + */ + +var blobBuilderSupported = BlobBuilder + && BlobBuilder.prototype.append + && BlobBuilder.prototype.getBlob; + +function BlobBuilderConstructor(ary, options) { + options = options || {}; + + var bb = new BlobBuilder(); + for (var i = 0; i < ary.length; i++) { + bb.append(ary[i]); + } + return (options.type) ? bb.getBlob(options.type) : bb.getBlob(); +}; + +module.exports = (function() { + if (blobSupported) { + return global.Blob; + } else if (blobBuilderSupported) { + return BlobBuilderConstructor; + } else { + return undefined; + } +})(); diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/blob/package.json b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/blob/package.json new file mode 100644 index 0000000..11fb673 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/blob/package.json @@ -0,0 +1,43 @@ +{ + "name": "blob", + "description": "Abstracts out Blob and uses BlobBulder in cases where it is supported with any vendor prefix.", + "version": "0.0.2", + "homepage": "https://github.com/rase-/blob", + "dependencies": {}, + "devDependencies": { + "mocha": "1.17.1", + "expect.js": "0.2.0", + "zuul": "1.5.4", + "browserify": "3.30.1" + }, + "repository": { + "type": "git", + "url": "git@github.com:rase-/blob.git" + }, + "scripts": { + "test": "make test" + }, + "bugs": { + "url": "https://github.com/rase-/blob/issues" + }, + "_id": "blob@0.0.2", + "dist": { + "shasum": "b89562bd6994af95ba1e812155536333aa23cf24", + "tarball": "http://registry.npmjs.org/blob/-/blob-0.0.2.tgz" + }, + "_from": "blob@0.0.2", + "_npmVersion": "1.3.5", + "_npmUser": { + "name": "rase-", + "email": "tonykovanen@hotmail.com" + }, + "maintainers": [ + { + "name": "rase-", + "email": "tonykovanen@hotmail.com" + } + ], + "directories": {}, + "_shasum": "b89562bd6994af95ba1e812155536333aa23cf24", + "_resolved": "https://registry.npmjs.org/blob/-/blob-0.0.2.tgz" +} diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/blob/test/index.js b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/blob/test/index.js new file mode 100644 index 0000000..de5fd2e --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/blob/test/index.js @@ -0,0 +1,52 @@ +var Blob = require('../'); +var expect = require('expect.js'); + +if (!Blob) { + return; +} + +describe('blob', function() { + it('should encode a proper sized blob when given a string argument', function() { + var b = new Blob(['hi']); + expect(b.size).to.be(2); + }); + + it('should encode a blob with proper size when given two strings as arguments', function() { + var b = new Blob(['hi', 'hello']); + expect(b.size).to.be(7); + }); + + it('should encode arraybuffers with right content', function() { + var ary = new Uint8Array(5); + for (var i = 0; i < 5; i++) ary[i] = i; + var b = new Blob([ary.buffer]); + var fr = new FileReader(); + fr.onload = function() { + var newAry = new Uint8Array(this.result); + for (var i = 0; i < 5; i++) expect(newAry[i]).to.be(i); + }; + }); + + it('should encode with blobs', function() { + var ary = new Uint8Array(5); + for (var i = 0; i < 5; i++) ary[i] = i; + var b = new Blob([new Blob([ary.buffer])]); + var fr = new FileReader(); + fr.onload = function() { + var newAry = new Uint8Array(this.result); + for (var i = 0; i < 5; i++) expect(newAry[i]).to.be(i); + }; + }); + + it('should enode mixed contents to right size', function() { + var ary = new Uint8Array(5); + for (var i = 0; i < 5; i++) ary[i] = i; + var b = new Blob([ary.buffer, 'hello']); + expect(b.size).to.be(10); + }); + + it('should accept mime type', function() { + var b = new Blob(['hi', 'hello'], { type: 'text/html' }); + expect(b.type).to.be('text/html'); + }); +}); diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/.gitattributes b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/.gitattributes new file mode 100644 index 0000000..0a91f75 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/.gitattributes @@ -0,0 +1,2 @@ +# Automatically normalize line endings for all text-based files +* text=auto diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/.npmignore b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/.npmignore new file mode 100644 index 0000000..c4b384e --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/.npmignore @@ -0,0 +1,20 @@ +# Generated test data file (> 100 MB) +tests/data.json + +# JSON version of coverage report +coverage/coverage.json + +# Installed npm modules +node_modules + +# Folder view configuration files +.DS_Store +Desktop.ini + +# Thumbnail cache files +._* +Thumbs.db + +# Files that might appear on external disks +.Spotlight-V100 +.Trashes diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/.travis.yml b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/.travis.yml new file mode 100644 index 0000000..58fe013 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/.travis.yml @@ -0,0 +1,19 @@ +language: node_js +node_js: + - "0.10" + - "0.8" +before_script: + - "npm install -g grunt-cli" + # Narwhal uses a hardcoded path to openjdk v6, so use that version + - "sudo apt-get update -qq" + - "sudo apt-get install -qq openjdk-6-jre" + - "PACKAGE=rhino1_7R3; wget http://ftp.mozilla.org/pub/mozilla.org/js/$PACKAGE.zip && sudo unzip $PACKAGE -d /opt/ && rm $PACKAGE.zip" + - "PACKAGE=rhino1_7R3; echo -e '#!/bin/sh\\njava -jar /opt/'$PACKAGE'/js.jar $@' | sudo tee /usr/local/bin/rhino && sudo chmod +x /usr/local/bin/rhino" + - "PACKAGE=ringojs-0.9; wget http://ringojs.org/downloads/$PACKAGE.zip && sudo unzip $PACKAGE -d /opt/ && rm $PACKAGE.zip" + - "PACKAGE=ringojs-0.9; sudo ln -s /opt/$PACKAGE/bin/ringo /usr/local/bin/ringo && sudo chmod +x /usr/local/bin/ringo" + - "PACKAGE=v0.3.2; wget https://github.com/280north/narwhal/archive/$PACKAGE.zip && sudo unzip $PACKAGE -d /opt/ && rm $PACKAGE.zip" + - "PACKAGE=narwhal-0.3.2; sudo ln -s /opt/$PACKAGE/bin/narwhal /usr/local/bin/narwhal && sudo chmod +x /usr/local/bin/narwhal" + # If the enviroment stores rt.jar in a different directory, find it and symlink the directory + - "PREFIX=/usr/lib/jvm; if [ ! -d $PREFIX/java-6-openjdk ]; then for d in $PREFIX/java-6-openjdk-*; do if [ -e $d/jre/lib/rt.jar ]; then sudo ln -s $d $PREFIX/java-6-openjdk; break; fi; done; fi" +script: + "grunt ci" diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/Gruntfile.js b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/Gruntfile.js new file mode 100644 index 0000000..6d5a6d1 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/Gruntfile.js @@ -0,0 +1,72 @@ +module.exports = function(grunt) { + + grunt.initConfig({ + 'shell': { + 'options': { + 'stdout': true, + 'stderr': true, + 'failOnError': true + }, + 'generate-test-data': { // Only when needed + 'command': 'if [ ! -f data.json ]; then echo python generate-test-data.py; fi', + 'options': { + 'execOptions': { + 'cwd': 'tests' + } + } + }, + 'cover': { + 'command': 'istanbul cover --report "html" --verbose --dir "coverage" "tests/tests.js"; istanbul report --root "coverage" --format "html"' + }, + 'test-narwhal': { + 'command': 'echo "Testing in Narwhal..."; export NARWHAL_OPTIMIZATION=-1; narwhal "tests/tests.js"' + }, + 'test-phantomjs': { + 'command': 'echo "Testing in PhantomJS..."; phantomjs "tests/tests.js"' + }, + // Rhino 1.7R4 has a bug that makes it impossible to test in. + // https://bugzilla.mozilla.org/show_bug.cgi?id=775566 + // To test, use Rhino 1.7R3, or wait (heh) for the 1.7R5 release. + 'test-rhino': { + 'command': 'echo "Testing in Rhino..."; rhino -opt -1 "tests.js"', + 'options': { + 'execOptions': { + 'cwd': 'tests' + } + } + }, + 'test-ringo': { + 'command': 'echo "Testing in Ringo..."; ringo -o -1 "tests/tests.js"' + }, + 'test-node': { + 'command': 'echo "Testing in Node..."; node "tests/tests.js" --extended' + }, + 'test-browser': { + 'command': 'echo "Testing in a browser..."; open "tests/index.html"' + } + } + }); + + grunt.loadNpmTasks('grunt-shell'); + + grunt.registerTask('cover', 'shell:cover'); + grunt.registerTask('ci', [ + 'shell:generate-test-data', + 'shell:test-narwhal', + 'shell:test-phantomjs', + 'shell:test-rhino', + 'shell:test-ringo', + 'shell:test-node', + ]); + grunt.registerTask('test', [ + 'shell:generate-test-data', + 'ci', + 'shell:test-browser' + ]); + + grunt.registerTask('default', [ + 'shell:test-node', + 'cover' + ]); + +}; diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/LICENSE-GPL.txt b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/LICENSE-GPL.txt new file mode 100644 index 0000000..11dddd0 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/LICENSE-GPL.txt @@ -0,0 +1,278 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/LICENSE-MIT.txt b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/LICENSE-MIT.txt new file mode 100644 index 0000000..97067e5 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/LICENSE-MIT.txt @@ -0,0 +1,20 @@ +Copyright Mathias Bynens + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/README.md b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/README.md new file mode 100644 index 0000000..2362b66 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/README.md @@ -0,0 +1,119 @@ +# utf8.js [![Build status](https://travis-ci.org/mathiasbynens/utf8.js.png?branch=master)](https://travis-ci.org/mathiasbynens/utf8.js) [![Dependency status](https://gemnasium.com/mathiasbynens/utf8.js.png)](https://gemnasium.com/mathiasbynens/utf8.js) + +_utf8.js_ is a well-tested UTF-8 encoder/decoder written in JavaScript. Unlike many other JavaScript solutions, it is designed to be a _proper_ UTF-8 encoder/decoder: it can encode/decode any given Unicode code point, including astral symbols and unpaired surrogates. + +Feel free to fork if you see possible improvements! + +## Installation + +Via [npm](http://npmjs.org/): + +```bash +npm install utf8 +``` + +Via [Bower](http://bower.io/): + +```bash +bower install utf8 +``` + +Via [Component](https://github.com/component/component): + +```bash +component install mathiasbynens/utf8.js +``` + +In a browser: + +```html + +``` + +In [Narwhal](http://narwhaljs.org/), [Node.js](http://nodejs.org/), and [RingoJS ≥ v0.8.0](http://ringojs.org/): + +```js +var utf8 = require('utf8'); +``` + +In [Rhino](http://www.mozilla.org/rhino/): + +```js +load('utf8.js'); +``` + +Using an AMD loader like [RequireJS](http://requirejs.org/): + +```js +require( + { + 'paths': { + 'utf8': 'path/to/utf8' + } + }, + ['utf8'], + function(utf8) { + console.log(utf8); + } +); +``` + +## API + +### `utf8.encode(string)` + +Encodes any given JavaScript string (`string`) as UTF-8, and returns the UTF-8-encoded version of the string. + +```js +// U+00A9 COPYRIGHT SIGN; see http://codepoints.net/U+00A9 +utf8.encode('\xA9'); +// → '\xC2\xA9' +// U+10001 LINEAR B SYLLABLE B038 E; see http://codepoints.net/U+10001 +utf8.encode('\uD800\uDC01'); +// → '\xF0\x90\x80\x81' +``` + +### `utf8.decode(byteString)` + +Encodes any given UTF-8-encoded string (`byteString`) as UTF-8, and returns the UTF-8-decoded version of the string. It throws an error when malformed UTF-8 is detected. + +```js +utf8.decode('\xC2\xA9'); +// → '\xA9' + +utf8.decode('\xF0\x90\x80\x81'); +// → '\uD800\uDC01' +// → U+10001 LINEAR B SYLLABLE B038 E +``` + +### `utf8.version` + +A string representing the semantic version number. + +## Support + +utf8.js has been tested in at least Chrome 27-29, Firefox 3-22, Safari 4-6, Opera 10-12, IE 6-10, Node.js v0.10.0, Narwhal 0.3.2, RingoJS 0.8-0.9, PhantomJS 1.9.0, and Rhino 1.7RC4. + +## Unit tests & code coverage + +After cloning this repository, run `npm install` to install the dependencies needed for development and testing. You may want to install Istanbul _globally_ using `npm install istanbul -g`. + +Once that’s done, you can run the unit tests in Node using `npm test` or `node tests/tests.js`. To run the tests in Rhino, Ringo, Narwhal, PhantomJS, and web browsers as well, use `grunt test`. + +To generate [the code coverage report](http://rawgithub.com/mathiasbynens/utf8.js/master/coverage/utf8.js/utf8.js.html), use `grunt cover`. + +## FAQ + +### Why is the first release named v2.0.0? Haven’t you heard of [semantic versioning](http://semver.org/)? + +Long before utf8.js was created, the `utf8` module on npm was registered and used by another (slightly buggy) library. @ryanmcgrath was kind enough to give me access to the `utf8` package on npm when I told him about utf8.js. Since there has already been a v1.0.0 release of the old library, and to avoid breaking backwards compatibility with projects that rely on the `utf8` npm package, I decided the tag the first release of utf8.js as v2.0.0 and take it from there. + +## Author + +| [![twitter/mathias](http://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](http://twitter.com/mathias "Follow @mathias on Twitter") | +|---| +| [Mathias Bynens](http://mathiasbynens.be/) | + +## License + +utf8.js is dual licensed under the [MIT](http://mths.be/mit) and [GPL](http://mths.be/gpl) licenses. diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/bower.json b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/bower.json new file mode 100644 index 0000000..fe8fa72 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/bower.json @@ -0,0 +1,14 @@ +{ + "name": "utf8", + "version": "2.0.0", + "main": "utf8.js", + "ignore": [ + "coverage", + "tests", + ".*", + "component.json", + "Gruntfile.js", + "node_modules", + "package.json" + ] +} diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/component.json b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/component.json new file mode 100644 index 0000000..5165d4f --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/component.json @@ -0,0 +1,16 @@ +{ + "name": "utf8", + "version": "2.0.0", + "description": "A well-tested UTF-8 encoder/decoder written in JavaScript.", + "repo": "mathiasbynens/utf8.js", + "license": "MIT/GPL", + "scripts": [ + "utf8.js" + ], + "keywords": [ + "charset", + "encoding", + "unicode", + "utf8" + ] +} diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/coverage/index.html b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/coverage/index.html new file mode 100644 index 0000000..68f3574 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/coverage/index.html @@ -0,0 +1,333 @@ + + + + Code coverage report for All files + + + + + + + +
+

Code coverage report for All files

+

+ + Statements: 92.31% (120 / 130)      + + + Branches: 78.79% (52 / 66)      + + + Functions: 90% (9 / 10)      + + + Lines: 92.31% (120 / 130)      + +

+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
utf8.js/92.31%(120 / 130)78.79%(52 / 66)90%(9 / 10)92.31%(120 / 130)
+
+
+ + + + + + + + diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/coverage/prettify.css b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/coverage/prettify.css new file mode 100644 index 0000000..b317a7c --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/coverage/prettify.css @@ -0,0 +1 @@ +.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/coverage/prettify.js b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/coverage/prettify.js new file mode 100644 index 0000000..ef51e03 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/coverage/prettify.js @@ -0,0 +1 @@ +window.PR_SHOULD_USE_CONTINUATION=true;(function(){var h=["break,continue,do,else,for,if,return,while"];var u=[h,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"];var p=[u,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"];var l=[p,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"];var x=[p,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"];var R=[x,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"];var r="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes";var w=[p,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"];var s="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END";var I=[h,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"];var f=[h,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"];var H=[h,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"];var A=[l,R,w,s+I,f,H];var e=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/;var C="str";var z="kwd";var j="com";var O="typ";var G="lit";var L="pun";var F="pln";var m="tag";var E="dec";var J="src";var P="atn";var n="atv";var N="nocode";var M="(?:^^\\.?|[+-]|\\!|\\!=|\\!==|\\#|\\%|\\%=|&|&&|&&=|&=|\\(|\\*|\\*=|\\+=|\\,|\\-=|\\->|\\/|\\/=|:|::|\\;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\@|\\[|\\^|\\^=|\\^\\^|\\^\\^=|\\{|\\||\\|=|\\|\\||\\|\\|=|\\~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function k(Z){var ad=0;var S=false;var ac=false;for(var V=0,U=Z.length;V122)){if(!(al<65||ag>90)){af.push([Math.max(65,ag)|32,Math.min(al,90)|32])}if(!(al<97||ag>122)){af.push([Math.max(97,ag)&~32,Math.min(al,122)&~32])}}}}af.sort(function(av,au){return(av[0]-au[0])||(au[1]-av[1])});var ai=[];var ap=[NaN,NaN];for(var ar=0;arat[0]){if(at[1]+1>at[0]){an.push("-")}an.push(T(at[1]))}}an.push("]");return an.join("")}function W(al){var aj=al.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g"));var ah=aj.length;var an=[];for(var ak=0,am=0;ak=2&&ai==="["){aj[ak]=X(ag)}else{if(ai!=="\\"){aj[ak]=ag.replace(/[a-zA-Z]/g,function(ao){var ap=ao.charCodeAt(0);return"["+String.fromCharCode(ap&~32,ap|32)+"]"})}}}}return aj.join("")}var aa=[];for(var V=0,U=Z.length;V=0;){S[ac.charAt(ae)]=Y}}var af=Y[1];var aa=""+af;if(!ag.hasOwnProperty(aa)){ah.push(af);ag[aa]=null}}ah.push(/[\0-\uffff]/);V=k(ah)})();var X=T.length;var W=function(ah){var Z=ah.sourceCode,Y=ah.basePos;var ad=[Y,F];var af=0;var an=Z.match(V)||[];var aj={};for(var ae=0,aq=an.length;ae=5&&"lang-"===ap.substring(0,5);if(am&&!(ai&&typeof ai[1]==="string")){am=false;ap=J}if(!am){aj[ag]=ap}}var ab=af;af+=ag.length;if(!am){ad.push(Y+ab,ap)}else{var al=ai[1];var ak=ag.indexOf(al);var ac=ak+al.length;if(ai[2]){ac=ag.length-ai[2].length;ak=ac-al.length}var ar=ap.substring(5);B(Y+ab,ag.substring(0,ak),W,ad);B(Y+ab+ak,al,q(ar,al),ad);B(Y+ab+ac,ag.substring(ac),W,ad)}}ah.decorations=ad};return W}function i(T){var W=[],S=[];if(T.tripleQuotedStrings){W.push([C,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""])}else{if(T.multiLineStrings){W.push([C,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"])}else{W.push([C,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"])}}if(T.verbatimStrings){S.push([C,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null])}var Y=T.hashComments;if(Y){if(T.cStyleComments){if(Y>1){W.push([j,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"])}else{W.push([j,/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"])}S.push([C,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,null])}else{W.push([j,/^#[^\r\n]*/,null,"#"])}}if(T.cStyleComments){S.push([j,/^\/\/[^\r\n]*/,null]);S.push([j,/^\/\*[\s\S]*?(?:\*\/|$)/,null])}if(T.regexLiterals){var X=("/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/");S.push(["lang-regex",new RegExp("^"+M+"("+X+")")])}var V=T.types;if(V){S.push([O,V])}var U=(""+T.keywords).replace(/^ | $/g,"");if(U.length){S.push([z,new RegExp("^(?:"+U.replace(/[\s,]+/g,"|")+")\\b"),null])}W.push([F,/^\s+/,null," \r\n\t\xA0"]);S.push([G,/^@[a-z_$][a-z_$@0-9]*/i,null],[O,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[F,/^[a-z_$][a-z_$@0-9]*/i,null],[G,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[F,/^\\[\s\S]?/,null],[L,/^.[^\s\w\.$@\'\"\`\/\#\\]*/,null]);return g(W,S)}var K=i({keywords:A,hashComments:true,cStyleComments:true,multiLineStrings:true,regexLiterals:true});function Q(V,ag){var U=/(?:^|\s)nocode(?:\s|$)/;var ab=/\r\n?|\n/;var ac=V.ownerDocument;var S;if(V.currentStyle){S=V.currentStyle.whiteSpace}else{if(window.getComputedStyle){S=ac.defaultView.getComputedStyle(V,null).getPropertyValue("white-space")}}var Z=S&&"pre"===S.substring(0,3);var af=ac.createElement("LI");while(V.firstChild){af.appendChild(V.firstChild)}var W=[af];function ae(al){switch(al.nodeType){case 1:if(U.test(al.className)){break}if("BR"===al.nodeName){ad(al);if(al.parentNode){al.parentNode.removeChild(al)}}else{for(var an=al.firstChild;an;an=an.nextSibling){ae(an)}}break;case 3:case 4:if(Z){var am=al.nodeValue;var aj=am.match(ab);if(aj){var ai=am.substring(0,aj.index);al.nodeValue=ai;var ah=am.substring(aj.index+aj[0].length);if(ah){var ak=al.parentNode;ak.insertBefore(ac.createTextNode(ah),al.nextSibling)}ad(al);if(!ai){al.parentNode.removeChild(al)}}}break}}function ad(ak){while(!ak.nextSibling){ak=ak.parentNode;if(!ak){return}}function ai(al,ar){var aq=ar?al.cloneNode(false):al;var ao=al.parentNode;if(ao){var ap=ai(ao,1);var an=al.nextSibling;ap.appendChild(aq);for(var am=an;am;am=an){an=am.nextSibling;ap.appendChild(am)}}return aq}var ah=ai(ak.nextSibling,0);for(var aj;(aj=ah.parentNode)&&aj.nodeType===1;){ah=aj}W.push(ah)}for(var Y=0;Y=S){ah+=2}if(V>=ap){Z+=2}}}var t={};function c(U,V){for(var S=V.length;--S>=0;){var T=V[S];if(!t.hasOwnProperty(T)){t[T]=U}else{if(window.console){console.warn("cannot override language handler %s",T)}}}}function q(T,S){if(!(T&&t.hasOwnProperty(T))){T=/^\s*]*(?:>|$)/],[j,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[L,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);c(g([[F,/^[\s]+/,null," \t\r\n"],[n,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[[m,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[P,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[L,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]);c(g([],[[n,/^[\s\S]+/]]),["uq.val"]);c(i({keywords:l,hashComments:true,cStyleComments:true,types:e}),["c","cc","cpp","cxx","cyc","m"]);c(i({keywords:"null,true,false"}),["json"]);c(i({keywords:R,hashComments:true,cStyleComments:true,verbatimStrings:true,types:e}),["cs"]);c(i({keywords:x,cStyleComments:true}),["java"]);c(i({keywords:H,hashComments:true,multiLineStrings:true}),["bsh","csh","sh"]);c(i({keywords:I,hashComments:true,multiLineStrings:true,tripleQuotedStrings:true}),["cv","py"]);c(i({keywords:s,hashComments:true,multiLineStrings:true,regexLiterals:true}),["perl","pl","pm"]);c(i({keywords:f,hashComments:true,multiLineStrings:true,regexLiterals:true}),["rb"]);c(i({keywords:w,cStyleComments:true,regexLiterals:true}),["js"]);c(i({keywords:r,hashComments:3,cStyleComments:true,multilineStrings:true,tripleQuotedStrings:true,regexLiterals:true}),["coffee"]);c(g([],[[C,/^[\s\S]+/]]),["regex"]);function d(V){var U=V.langExtension;try{var S=a(V.sourceNode);var T=S.sourceCode;V.sourceCode=T;V.spans=S.spans;V.basePos=0;q(U,T)(V);D(V)}catch(W){if("console" in window){console.log(W&&W.stack?W.stack:W)}}}function y(W,V,U){var S=document.createElement("PRE");S.innerHTML=W;if(U){Q(S,U)}var T={langExtension:V,numberLines:U,sourceNode:S};d(T);return S.innerHTML}function b(ad){function Y(af){return document.getElementsByTagName(af)}var ac=[Y("pre"),Y("code"),Y("xmp")];var T=[];for(var aa=0;aa=0){var ah=ai.match(ab);var am;if(!ah&&(am=o(aj))&&"CODE"===am.tagName){ah=am.className.match(ab)}if(ah){ah=ah[1]}var al=false;for(var ak=aj.parentNode;ak;ak=ak.parentNode){if((ak.tagName==="pre"||ak.tagName==="code"||ak.tagName==="xmp")&&ak.className&&ak.className.indexOf("prettyprint")>=0){al=true;break}}if(!al){var af=aj.className.match(/\blinenums\b(?::(\d+))?/);af=af?af[1]&&af[1].length?+af[1]:true:false;if(af){Q(aj,af)}S={langExtension:ah,sourceNode:aj,numberLines:af};d(S)}}}if(X]*(?:>|$)/],[PR.PR_COMMENT,/^<\!--[\s\S]*?(?:-\->|$)/],[PR.PR_PUNCTUATION,/^(?:<[%?]|[%?]>)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-handlebars",/^]*type\s*=\s*['"]?text\/x-handlebars-template['"]?\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i],[PR.PR_DECLARATION,/^{{[#^>/]?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{&?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{{>?\s*[\w.][^}]*}}}/],[PR.PR_COMMENT,/^{{![^}]*}}/]]),["handlebars","hbs"]);PR.registerLangHandler(PR.createSimpleLexer([[PR.PR_PLAIN,/^[ \t\r\n\f]+/,null," \t\r\n\f"]],[[PR.PR_STRING,/^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/,null],[PR.PR_STRING,/^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/,null],["lang-css-str",/^url\(([^\)\"\']*)\)/i],[PR.PR_KEYWORD,/^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*)\s*:/i],[PR.PR_COMMENT,/^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//],[PR.PR_COMMENT,/^(?:)/],[PR.PR_LITERAL,/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],[PR.PR_LITERAL,/^#(?:[0-9a-f]{3}){1,2}/i],[PR.PR_PLAIN,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i],[PR.PR_PUNCTUATION,/^[^\s\w\'\"]+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_KEYWORD,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_STRING,/^[^\)\"\']+/]]),["css-str"]); diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/coverage/utf8.js/index.html b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/coverage/utf8.js/index.html new file mode 100644 index 0000000..926b3f6 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/coverage/utf8.js/index.html @@ -0,0 +1,333 @@ + + + + Code coverage report for utf8.js/ + + + + + + + +
+

Code coverage report for utf8.js/

+

+ + Statements: 92.31% (120 / 130)      + + + Branches: 78.79% (52 / 66)      + + + Functions: 90% (9 / 10)      + + + Lines: 92.31% (120 / 130)      + +

+
All files » utf8.js/
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
utf8.js92.31%(120 / 130)78.79%(52 / 66)90%(9 / 10)92.31%(120 / 130)
+
+
+ + + + + + + + diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/coverage/utf8.js/utf8.js.html b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/coverage/utf8.js/utf8.js.html new file mode 100644 index 0000000..8923045 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/coverage/utf8.js/utf8.js.html @@ -0,0 +1,1028 @@ + + + + Code coverage report for utf8.js/utf8.js + + + + + + + +
+

Code coverage report for utf8.js/utf8.js

+

+ + Statements: 92.31% (120 / 130)      + + + Branches: 78.79% (52 / 66)      + + + Functions: 90% (9 / 10)      + + + Lines: 92.31% (120 / 130)      + +

+
All files » utf8.js/ » utf8.js
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 +158 +159 +160 +161 +162 +163 +164 +165 +166 +167 +168 +169 +170 +171 +172 +173 +174 +175 +176 +177 +178 +179 +180 +181 +182 +183 +184 +185 +186 +187 +188 +189 +190 +191 +192 +193 +194 +195 +196 +197 +198 +199 +200 +201 +202 +203 +204 +205 +206 +207 +208 +209 +210 +211 +212 +213 +214 +215 +216 +217 +218 +219 +220 +221 +222 +223 +224 +225 +226 +227 +228 +229 +230 +231 +232 +233 +234 +235 +236 +237 +238 +239 +240 +241 +242  +1 +  +  +1 +  +  +1 +  +  +  +  +1 +1 +1 +  +  +  +  +1 +  +  +1 +52 +52 +52 +52 +52 +52 +128 +128 +  +8 +8 +5 +  +  +  +3 +3 +  +  +120 +  +  +52 +  +  +  +1 +24 +24 +24 +24 +24 +32 +32 +5 +5 +5 +  +32 +  +24 +  +  +  +  +  +1 +29 +  +  +1 +32 +5 +  +27 +27 +3 +  +24 +19 +19 +  +5 +5 +5 +5 +  +27 +27 +  +  +1 +24 +  +  +  +  +  +24 +24 +24 +24 +24 +32 +32 +  +24 +  +  +  +  +  +1 +60 +1 +  +  +59 +59 +  +59 +57 +  +  +  +2 +  +  +1 +60 +60 +60 +60 +60 +  +60 +  +  +  +60 +24 +  +  +  +36 +36 +  +  +36 +5 +  +  +  +31 +4 +3 +3 +3 +  +  +  +  +  +  +27 +20 +19 +19 +19 +19 +  +  +  +  +  +  +7 +6 +6 +5 +5 +  +5 +5 +  +  +  +1 +  +  +1 +1 +1 +1 +28 +28 +28 +28 +28 +28 +32 +  +24 +  +  +  +  +1 +  +  +  +  +  +  +  +1 +  +  +  +  +  +  +  +1 +1 +1 +  +  +  +  +  +  +  +  +  +  +  +  + 
/*! http://mths.be/utf8js v2.0.0 by @mathias */
+;(function(root) {
+ 
+	// Detect free variables `exports`
+	var freeExports = typeof exports == 'object' && exports;
+ 
+	// Detect free variable `module`
+	var freeModule = typeof module == 'object' && module &&
+		module.exports == freeExports && module;
+ 
+	// Detect free variable `global`, from Node.js or Browserified code,
+	// and use it as `root`
+	var freeGlobal = typeof global == 'object' && global;
+	Eif (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {
+		root = freeGlobal;
+	}
+ 
+	/*--------------------------------------------------------------------------*/
+ 
+	var stringFromCharCode = String.fromCharCode;
+ 
+	// Taken from http://mths.be/punycode
+	function ucs2decode(string) {
+		var output = [];
+		var counter = 0;
+		var length = string.length;
+		var value;
+		var extra;
+		while (counter < length) {
+			value = string.charCodeAt(counter++);
+			if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
+				// high surrogate, and there is a next character
+				extra = string.charCodeAt(counter++);
+				if ((extra & 0xFC00) == 0xDC00) { // low surrogate
+					output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
+				} else {
+					// unmatched surrogate; only append this code unit, in case the next
+					// code unit is the high surrogate of a surrogate pair
+					output.push(value);
+					counter--;
+				}
+			} else {
+				output.push(value);
+			}
+		}
+		return output;
+	}
+ 
+	// Taken from http://mths.be/punycode
+	function ucs2encode(array) {
+		var length = array.length;
+		var index = -1;
+		var value;
+		var output = '';
+		while (++index < length) {
+			value = array[index];
+			if (value > 0xFFFF) {
+				value -= 0x10000;
+				output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);
+				value = 0xDC00 | value & 0x3FF;
+			}
+			output += stringFromCharCode(value);
+		}
+		return output;
+	}
+ 
+	/*--------------------------------------------------------------------------*/
+ 
+	// https://github.com/php/php-src/blob/master/ext/mbstring/oniguruma/enc/utf8.c
+	function createByte(codePoint, shift) {
+		return stringFromCharCode(((codePoint >> shift) & 0x3F) | 0x80);
+	}
+ 
+	function encodeCodePoint(codePoint) {
+		if ((codePoint & 0xFFFFFF80) == 0) { // 1-byte sequence
+			return stringFromCharCode(codePoint);
+		}
+		var symbol = '';
+		if ((codePoint & 0xFFFFF800) == 0) { // 2-byte sequence
+			symbol = stringFromCharCode(((codePoint >> 6) & 0x1F) | 0xC0);
+		}
+		else if ((codePoint & 0xFFFF0000) == 0) { // 3-byte sequence
+			symbol = stringFromCharCode(((codePoint >> 12) & 0x0F) | 0xE0);
+			symbol += createByte(codePoint, 6);
+		}
+		else Eif ((codePoint & 0xFFE00000) == 0) { // 4-byte sequence
+			symbol = stringFromCharCode(((codePoint >> 18) & 0x07) | 0xF0);
+			symbol += createByte(codePoint, 12);
+			symbol += createByte(codePoint, 6);
+		}
+		symbol += stringFromCharCode((codePoint & 0x3F) | 0x80);
+		return symbol;
+	}
+ 
+	function utf8encode(string) {
+		var codePoints = ucs2decode(string);
+ 
+		// console.log(JSON.stringify(codePoints.map(function(x) {
+		// 	return 'U+' + x.toString(16).toUpperCase();
+		// })));
+ 
+		var length = codePoints.length;
+		var index = -1;
+		var codePoint;
+		var byteString = '';
+		while (++index < length) {
+			codePoint = codePoints[index];
+			byteString += encodeCodePoint(codePoint);
+		}
+		return byteString;
+	}
+ 
+	/*--------------------------------------------------------------------------*/
+ 
+	// https://github.com/php/php-src/blob/master/ext/json/utf8_decode.c
+	function readContinuationByte() {
+		if (byteIndex >= byteCount) {
+			throw Error('Invalid byte index');
+		}
+ 
+		var continuationByte = byteArray[byteIndex] & 0xFF;
+		byteIndex++;
+ 
+		if ((continuationByte & 0xC0) == 0x80) {
+			return continuationByte & 0x3F;
+		}
+ 
+		// If we end up here, it’s not a continuation byte
+		throw Error('Invalid continuation byte');
+	}
+ 
+	function decodeSymbol() {
+		var byte1;
+		var byte2;
+		var byte3;
+		var byte4;
+		var codePoint;
+ 
+		Iif (byteIndex > byteCount) {
+			throw Error('Invalid byte index');
+		}
+ 
+		if (byteIndex == byteCount) {
+			return false;
+		}
+ 
+		// Read first byte
+		byte1 = byteArray[byteIndex] & 0xFF;
+		byteIndex++;
+ 
+		// 1-byte sequence (no continuation bytes)
+		if ((byte1 & 0x80) == 0) {
+			return byte1;
+		}
+ 
+		// 2-byte sequence
+		if ((byte1 & 0xE0) == 0xC0) {
+			var byte2 = readContinuationByte();
+			codePoint = ((byte1 & 0x1F) << 6) | byte2;
+			Eif (codePoint >= 0x80) {
+				return codePoint;
+			} else {
+				throw Error('Invalid continuation byte');
+			}
+		}
+ 
+		// 3-byte sequence (may include unpaired surrogates)
+		if ((byte1 & 0xF0) == 0xE0) {
+			byte2 = readContinuationByte();
+			byte3 = readContinuationByte();
+			codePoint = ((byte1 & 0x0F) << 12) | (byte2 << 6) | byte3;
+			Eif (codePoint >= 0x0800) {
+				return codePoint;
+			} else {
+				throw Error('Invalid continuation byte');
+			}
+		}
+ 
+		// 4-byte sequence
+		if ((byte1 & 0xF8) == 0xF0) {
+			byte2 = readContinuationByte();
+			byte3 = readContinuationByte();
+			byte4 = readContinuationByte();
+			codePoint = ((byte1 & 0x0F) << 0x12) | (byte2 << 0x0C) |
+				(byte3 << 0x06) | byte4;
+			Eif (codePoint >= 0x010000 && codePoint <= 0x10FFFF) {
+				return codePoint;
+			}
+		}
+ 
+		throw Error('Invalid UTF-8 detected');
+	}
+ 
+	var byteArray;
+	var byteCount;
+	var byteIndex;
+	function utf8decode(byteString) {
+		byteArray = ucs2decode(byteString);
+		byteCount = byteArray.length;
+		byteIndex = 0;
+		var codePoints = [];
+		var tmp;
+		while ((tmp = decodeSymbol()) !== false) {
+			codePoints.push(tmp);
+		}
+		return ucs2encode(codePoints);
+	}
+ 
+	/*--------------------------------------------------------------------------*/
+ 
+	var utf8 = {
+		'version': '2.0.0',
+		'encode': utf8encode,
+		'decode': utf8decode
+	};
+ 
+	// Some AMD build optimizers, like r.js, check for specific condition patterns
+	// like the following:
+	Iif (
+		typeof define == 'function' &&
+		typeof define.amd == 'object' &&
+		define.amd
+	) {
+		define(function() {
+			return utf8;
+		});
+	}	else Eif (freeExports && !freeExports.nodeType) {
+		Eif (freeModule) { // in Node.js or RingoJS v0.8.0+
+			freeModule.exports = utf8;
+		} else { // in Narwhal or RingoJS v0.7.0-
+			var object = {};
+			var hasOwnProperty = object.hasOwnProperty;
+			for (var key in utf8) {
+				hasOwnProperty.call(utf8, key) && (freeExports[key] = utf8[key]);
+			}
+		}
+	} else { // in Rhino or a web browser
+		root.utf8 = utf8;
+	}
+ 
+}(this));
+ 
+ +
+ + + + + + + + diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/package.json b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/package.json new file mode 100644 index 0000000..0868533 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/package.json @@ -0,0 +1,74 @@ +{ + "name": "utf8", + "version": "2.0.0", + "description": "A well-tested UTF-8 encoder/decoder written in JavaScript.", + "homepage": "http://mths.be/utf8js", + "main": "utf8.js", + "keywords": [ + "charset", + "encoding", + "unicode", + "utf8" + ], + "licenses": [ + { + "type": "MIT", + "url": "http://mths.be/mit" + }, + { + "type": "GPL", + "url": "http://mths.be/gpl" + } + ], + "author": { + "name": "Mathias Bynens", + "url": "http://mathiasbynens.be/" + }, + "repository": { + "type": "git", + "url": "https://github.com/mathiasbynens/utf8.js.git" + }, + "bugs": { + "url": "https://github.com/mathiasbynens/utf8.js/issues" + }, + "directories": { + "test": "tests" + }, + "scripts": { + "test": "node tests/tests.js" + }, + "dependencies": {}, + "devDependencies": { + "grunt": "~0.4.1", + "grunt-shell": "~0.2.2", + "istanbul": "~0.1.36", + "qunit-clib": "~1.3.0", + "qunitjs": "~1.11.0", + "requirejs": "~2.1.6" + }, + "readme": "# utf8.js [![Build status](https://travis-ci.org/mathiasbynens/utf8.js.png?branch=master)](https://travis-ci.org/mathiasbynens/utf8.js) [![Dependency status](https://gemnasium.com/mathiasbynens/utf8.js.png)](https://gemnasium.com/mathiasbynens/utf8.js)\n\n_utf8.js_ is a well-tested UTF-8 encoder/decoder written in JavaScript. Unlike many other JavaScript solutions, it is designed to be a _proper_ UTF-8 encoder/decoder: it can encode/decode any given Unicode code point, including astral symbols and unpaired surrogates.\n\nFeel free to fork if you see possible improvements!\n\n## Installation\n\nVia [npm](http://npmjs.org/):\n\n```bash\nnpm install utf8\n```\n\nVia [Bower](http://bower.io/):\n\n```bash\nbower install utf8\n```\n\nVia [Component](https://github.com/component/component):\n\n```bash\ncomponent install mathiasbynens/utf8.js\n```\n\nIn a browser:\n\n```html\n\n```\n\nIn [Narwhal](http://narwhaljs.org/), [Node.js](http://nodejs.org/), and [RingoJS ≥ v0.8.0](http://ringojs.org/):\n\n```js\nvar utf8 = require('utf8');\n```\n\nIn [Rhino](http://www.mozilla.org/rhino/):\n\n```js\nload('utf8.js');\n```\n\nUsing an AMD loader like [RequireJS](http://requirejs.org/):\n\n```js\nrequire(\n {\n 'paths': {\n 'utf8': 'path/to/utf8'\n }\n },\n ['utf8'],\n function(utf8) {\n console.log(utf8);\n }\n);\n```\n\n## API\n\n### `utf8.encode(string)`\n\nEncodes any given JavaScript string (`string`) as UTF-8, and returns the UTF-8-encoded version of the string.\n\n```js\n// U+00A9 COPYRIGHT SIGN; see http://codepoints.net/U+00A9\nutf8.encode('\\xA9');\n// → '\\xC2\\xA9'\n// U+10001 LINEAR B SYLLABLE B038 E; see http://codepoints.net/U+10001\nutf8.encode('\\uD800\\uDC01');\n// → '\\xF0\\x90\\x80\\x81'\n```\n\n### `utf8.decode(byteString)`\n\nEncodes any given UTF-8-encoded string (`byteString`) as UTF-8, and returns the UTF-8-decoded version of the string. It throws an error when malformed UTF-8 is detected.\n\n```js\nutf8.decode('\\xC2\\xA9');\n// → '\\xA9'\n\nutf8.decode('\\xF0\\x90\\x80\\x81');\n// → '\\uD800\\uDC01'\n// → U+10001 LINEAR B SYLLABLE B038 E\n```\n\n### `utf8.version`\n\nA string representing the semantic version number.\n\n## Support\n\nutf8.js has been tested in at least Chrome 27-29, Firefox 3-22, Safari 4-6, Opera 10-12, IE 6-10, Node.js v0.10.0, Narwhal 0.3.2, RingoJS 0.8-0.9, PhantomJS 1.9.0, and Rhino 1.7RC4.\n\n## Unit tests & code coverage\n\nAfter cloning this repository, run `npm install` to install the dependencies needed for development and testing. You may want to install Istanbul _globally_ using `npm install istanbul -g`.\n\nOnce that’s done, you can run the unit tests in Node using `npm test` or `node tests/tests.js`. To run the tests in Rhino, Ringo, Narwhal, PhantomJS, and web browsers as well, use `grunt test`.\n\nTo generate [the code coverage report](http://rawgithub.com/mathiasbynens/utf8.js/master/coverage/utf8.js/utf8.js.html), use `grunt cover`.\n\n## FAQ\n\n### Why is the first release named v2.0.0? Haven’t you heard of [semantic versioning](http://semver.org/)?\n\nLong before utf8.js was created, the `utf8` module on npm was registered and used by another (slightly buggy) library. @ryanmcgrath was kind enough to give me access to the `utf8` package on npm when I told him about utf8.js. Since there has already been a v1.0.0 release of the old library, and to avoid breaking backwards compatibility with projects that rely on the `utf8` npm package, I decided the tag the first release of utf8.js as v2.0.0 and take it from there.\n\n## Author\n\n| [![twitter/mathias](http://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](http://twitter.com/mathias \"Follow @mathias on Twitter\") |\n|---|\n| [Mathias Bynens](http://mathiasbynens.be/) |\n\n## License\n\nutf8.js is dual licensed under the [MIT](http://mths.be/mit) and [GPL](http://mths.be/gpl) licenses.\n", + "readmeFilename": "README.md", + "_id": "utf8@2.0.0", + "dist": { + "shasum": "79ce59eced874809cab9a71fc7102c7d45d4118d", + "tarball": "http://registry.npmjs.org/utf8/-/utf8-2.0.0.tgz" + }, + "_from": "utf8@2.0.0", + "_npmVersion": "1.2.30", + "_npmUser": { + "name": "mathias", + "email": "mathias@qiwi.be" + }, + "maintainers": [ + { + "name": "ryanmcgrath", + "email": "ryan@venodesigns.net" + }, + { + "name": "mathias", + "email": "mathias@qiwi.be" + } + ], + "_shasum": "79ce59eced874809cab9a71fc7102c7d45d4118d", + "_resolved": "https://registry.npmjs.org/utf8/-/utf8-2.0.0.tgz" +} diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/tests/generate-test-data.py b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/tests/generate-test-data.py new file mode 100755 index 0000000..096b012 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/tests/generate-test-data.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python + +import re +import json + +# http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae +# http://stackoverflow.com/a/13436167/96656 +def unisymbol(codePoint): + if codePoint >= 0x0000 and codePoint <= 0xFFFF: + return unichr(codePoint) + elif codePoint >= 0x010000 and codePoint <= 0x10FFFF: + highSurrogate = int((codePoint - 0x10000) / 0x400) + 0xD800 + lowSurrogate = int((codePoint - 0x10000) % 0x400) + 0xDC00 + return unichr(highSurrogate) + unichr(lowSurrogate) + else: + return 'Error' + +def hexify(codePoint): + return 'U+' + hex(codePoint)[2:].upper().zfill(6) + +def writeFile(filename, contents): + print filename + with open(filename, 'w') as f: + f.write(contents.strip() + '\n') + +data = [] +for codePoint in range(0x000000, 0x10FFFF + 1): + symbol = unisymbol(codePoint) + # http://stackoverflow.com/a/17199950/96656 + bytes = symbol.encode('utf8').decode('latin1') + data.append({ + 'codePoint': codePoint, + 'decoded': symbol, + 'encoded': bytes + }); + +jsonData = json.dumps(data, sort_keys=False, indent=2, separators=(',', ': ')) +# Use tabs instead of double spaces for indentation +jsonData = jsonData.replace(' ', '\t') +# Escape hexadecimal digits in escape sequences +jsonData = re.sub( + r'\\u([a-fA-F0-9]{4})', + lambda match: r'\u{}'.format(match.group(1).upper()), + jsonData +) + +writeFile('data.json', jsonData) diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/tests/index.html b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/tests/index.html new file mode 100644 index 0000000..13cc04d --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/tests/index.html @@ -0,0 +1,35 @@ + + + + + utf8.js test suite + + + +
+ + + + + + diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/tests/tests.js b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/tests/tests.js new file mode 100644 index 0000000..cb01e10 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/tests/tests.js @@ -0,0 +1,242 @@ +;(function(root) { + 'use strict'; + + /** Use a single `load` function */ + var load = typeof require == 'function' ? require : root.load; + + /** The unit testing framework */ + var QUnit = (function() { + var noop = Function.prototype; + return root.QUnit || ( + root.addEventListener || (root.addEventListener = noop), + root.setTimeout || (root.setTimeout = noop), + root.QUnit = load('../node_modules/qunitjs/qunit/qunit.js') || root.QUnit, + (load('../node_modules/qunit-clib/qunit-clib.js') || { 'runInContext': noop }).runInContext(root), + addEventListener === noop && delete root.addEventListener, + root.QUnit + ); + }()); + + /** The `utf8` object to test */ + var utf8 = root.utf8 || (root.utf8 = ( + utf8 = load('../utf8.js') || root.utf8, + utf8 = utf8.utf8 || utf8 + )); + + /*--------------------------------------------------------------------------*/ + + function forEach(array, fn) { + var index = -1; + var length = array.length; + while (++index < length) { + fn(array[index]); + } + } + + // Quick and dirty test to see if we’re in Node & need extended tests + var runExtendedTests = (function() { + try { + return process.argv[0] == 'node' && process.argv[2] == '--extended'; + } catch(error) { } + }()); + + var data = [ + // 1-byte + { + 'codePoint': 0x0000, + 'decoded': '\0', + 'encoded': '\0' + }, + { + 'codePoint': 0x005C, + 'decoded': '\x5C', + 'encoded': '\x5C' + }, + { + 'codePoint': 0x007F, + 'decoded': '\x7F', + 'encoded': '\x7F' + }, + + // 2-byte + { + 'codePoint': 0x0080, + 'decoded': '\x80', + 'encoded': '\xC2\x80' + }, + { + 'codePoint': 0x05CA, + 'decoded': '\u05CA', + 'encoded': '\xD7\x8A' + }, + { + 'codePoint': 0x07FF, + 'decoded': '\u07FF', + 'encoded': '\xDF\xBF', + }, + + // 3-byte + { + 'codePoint': 0x0800, + 'decoded': '\u0800', + 'encoded': '\xE0\xA0\x80', + }, + { + 'codePoint': 0x2C3C, + 'decoded': '\u2C3C', + 'encoded': '\xE2\xB0\xBC' + }, + { + 'codePoint': 0xFFFF, + 'decoded': '\uFFFF', + 'encoded': '\xEF\xBF\xBF' + }, + // unmatched surrogate halves + // high surrogates: 0xD800 to 0xDBFF + { + 'codePoint': 0xD800, + 'decoded': '\uD800', + 'encoded': '\xED\xA0\x80' + }, + { + 'description': 'High surrogate followed by another high surrogate', + 'decoded': '\uD800\uD800', + 'encoded': '\xED\xA0\x80\xED\xA0\x80' + }, + { + 'description': 'High surrogate followed by a symbol that is not a surrogate', + 'decoded': '\uD800A', + 'encoded': '\xED\xA0\x80A' + }, + { + 'description': 'Unmatched high surrogate, followed by a surrogate pair, followed by an unmatched high surrogate', + 'decoded': '\uD800\uD834\uDF06\uD800', + 'encoded': '\xED\xA0\x80\xF0\x9D\x8C\x86\xED\xA0\x80' + }, + { + 'codePoint': 0xD9AF, + 'decoded': '\uD9AF', + 'encoded': '\xED\xA6\xAF' + }, + { + 'codePoint': 0xDBFF, + 'decoded': '\uDBFF', + 'encoded': '\xED\xAF\xBF' + }, + // low surrogates: 0xDC00 to 0xDFFF + { + 'codePoint': 0xDC00, + 'decoded': '\uDC00', + 'encoded': '\xED\xB0\x80' + }, + { + 'description': 'Low surrogate followed by another low surrogate', + 'decoded': '\uDC00\uDC00', + 'encoded': '\xED\xB0\x80\xED\xB0\x80' + }, + { + 'description': 'Low surrogate followed by a symbol that is not a surrogate', + 'decoded': '\uDC00A', + 'encoded': '\xED\xB0\x80A' + }, + { + 'description': 'Unmatched low surrogate, followed by a surrogate pair, followed by an unmatched low surrogate', + 'decoded': '\uDC00\uD834\uDF06\uDC00', + 'encoded': '\xED\xB0\x80\xF0\x9D\x8C\x86\xED\xB0\x80' + }, + { + 'codePoint': 0xDEEE, + 'decoded': '\uDEEE', + 'encoded': '\xED\xBB\xAE' + }, + { + 'codePoint': 0xDFFF, + 'decoded': '\uDFFF', + 'encoded': '\xED\xBF\xBF' + }, + + // 4-byte + { + 'codePoint': 0x010000, + 'decoded': '\uD800\uDC00', + 'encoded': '\xF0\x90\x80\x80' + }, + { + 'codePoint': 0x01D306, + 'decoded': '\uD834\uDF06', + 'encoded': '\xF0\x9D\x8C\x86' + }, + { + 'codePoint': 0x10FFF, + 'decoded': '\uDBFF\uDFFF', + 'encoded': '\xF4\x8F\xBF\xBF' + } + ]; + + if (runExtendedTests) { + data = data.concat(require('./data.json')); + } + + // `throws` is a reserved word in ES3; alias it to avoid errors + var raises = QUnit.assert['throws']; + + // explicitly call `QUnit.module()` instead of `module()` + // in case we are in a CLI environment + QUnit.module('utf8.js'); + + test('encode/decode', function() { + forEach(data, function(object) { + var description = object.description || 'U+' + object.codePoint.toString(16).toUpperCase(); + ; + equal( + object.encoded, + utf8.encode(object.decoded), + 'Encoding: ' + description + ); + equal( + object.decoded, + utf8.decode(object.encoded), + 'Decoding: ' + description + ); + }); + + // Error handling + raises( + function() { + utf8.decode('\uFFFF'); + }, + Error, + 'Error: invalid UTF-8 detected' + ); + raises( + function() { + utf8.decode('\xE9\x00\x00'); + }, + Error, + 'Error: invalid continuation byte (4-byte sequence expected)' + ); + raises( + function() { + utf8.decode('\xC2\uFFFF'); + }, + Error, + 'Error: invalid continuation byte' + ); + raises( + function() { + utf8.decode('\xF0\x9D'); + }, + Error, + 'Error: invalid byte index' + ); + }); + + /*--------------------------------------------------------------------------*/ + + // configure QUnit and call `QUnit.start()` for + // Narwhal, Node.js, PhantomJS, Rhino, and RingoJS + if (!root.document || root.phantom) { + QUnit.config.noglobals = true; + QUnit.start(); + } +}(typeof global == 'object' && global || this)); diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/utf8.js b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/utf8.js new file mode 100644 index 0000000..8f99bb1 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/utf8.js @@ -0,0 +1,239 @@ +/*! http://mths.be/utf8js v2.0.0 by @mathias */ +;(function(root) { + + // Detect free variables `exports` + var freeExports = typeof exports == 'object' && exports; + + // Detect free variable `module` + var freeModule = typeof module == 'object' && module && + module.exports == freeExports && module; + + // Detect free variable `global`, from Node.js or Browserified code, + // and use it as `root` + var freeGlobal = typeof global == 'object' && global; + if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) { + root = freeGlobal; + } + + /*--------------------------------------------------------------------------*/ + + var stringFromCharCode = String.fromCharCode; + + // Taken from http://mths.be/punycode + function ucs2decode(string) { + var output = []; + var counter = 0; + var length = string.length; + var value; + var extra; + while (counter < length) { + value = string.charCodeAt(counter++); + if (value >= 0xD800 && value <= 0xDBFF && counter < length) { + // high surrogate, and there is a next character + extra = string.charCodeAt(counter++); + if ((extra & 0xFC00) == 0xDC00) { // low surrogate + output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); + } else { + // unmatched surrogate; only append this code unit, in case the next + // code unit is the high surrogate of a surrogate pair + output.push(value); + counter--; + } + } else { + output.push(value); + } + } + return output; + } + + // Taken from http://mths.be/punycode + function ucs2encode(array) { + var length = array.length; + var index = -1; + var value; + var output = ''; + while (++index < length) { + value = array[index]; + if (value > 0xFFFF) { + value -= 0x10000; + output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800); + value = 0xDC00 | value & 0x3FF; + } + output += stringFromCharCode(value); + } + return output; + } + + /*--------------------------------------------------------------------------*/ + + function createByte(codePoint, shift) { + return stringFromCharCode(((codePoint >> shift) & 0x3F) | 0x80); + } + + function encodeCodePoint(codePoint) { + if ((codePoint & 0xFFFFFF80) == 0) { // 1-byte sequence + return stringFromCharCode(codePoint); + } + var symbol = ''; + if ((codePoint & 0xFFFFF800) == 0) { // 2-byte sequence + symbol = stringFromCharCode(((codePoint >> 6) & 0x1F) | 0xC0); + } + else if ((codePoint & 0xFFFF0000) == 0) { // 3-byte sequence + symbol = stringFromCharCode(((codePoint >> 12) & 0x0F) | 0xE0); + symbol += createByte(codePoint, 6); + } + else if ((codePoint & 0xFFE00000) == 0) { // 4-byte sequence + symbol = stringFromCharCode(((codePoint >> 18) & 0x07) | 0xF0); + symbol += createByte(codePoint, 12); + symbol += createByte(codePoint, 6); + } + symbol += stringFromCharCode((codePoint & 0x3F) | 0x80); + return symbol; + } + + function utf8encode(string) { + var codePoints = ucs2decode(string); + + // console.log(JSON.stringify(codePoints.map(function(x) { + // return 'U+' + x.toString(16).toUpperCase(); + // }))); + + var length = codePoints.length; + var index = -1; + var codePoint; + var byteString = ''; + while (++index < length) { + codePoint = codePoints[index]; + byteString += encodeCodePoint(codePoint); + } + return byteString; + } + + /*--------------------------------------------------------------------------*/ + + function readContinuationByte() { + if (byteIndex >= byteCount) { + throw Error('Invalid byte index'); + } + + var continuationByte = byteArray[byteIndex] & 0xFF; + byteIndex++; + + if ((continuationByte & 0xC0) == 0x80) { + return continuationByte & 0x3F; + } + + // If we end up here, it’s not a continuation byte + throw Error('Invalid continuation byte'); + } + + function decodeSymbol() { + var byte1; + var byte2; + var byte3; + var byte4; + var codePoint; + + if (byteIndex > byteCount) { + throw Error('Invalid byte index'); + } + + if (byteIndex == byteCount) { + return false; + } + + // Read first byte + byte1 = byteArray[byteIndex] & 0xFF; + byteIndex++; + + // 1-byte sequence (no continuation bytes) + if ((byte1 & 0x80) == 0) { + return byte1; + } + + // 2-byte sequence + if ((byte1 & 0xE0) == 0xC0) { + var byte2 = readContinuationByte(); + codePoint = ((byte1 & 0x1F) << 6) | byte2; + if (codePoint >= 0x80) { + return codePoint; + } else { + throw Error('Invalid continuation byte'); + } + } + + // 3-byte sequence (may include unpaired surrogates) + if ((byte1 & 0xF0) == 0xE0) { + byte2 = readContinuationByte(); + byte3 = readContinuationByte(); + codePoint = ((byte1 & 0x0F) << 12) | (byte2 << 6) | byte3; + if (codePoint >= 0x0800) { + return codePoint; + } else { + throw Error('Invalid continuation byte'); + } + } + + // 4-byte sequence + if ((byte1 & 0xF8) == 0xF0) { + byte2 = readContinuationByte(); + byte3 = readContinuationByte(); + byte4 = readContinuationByte(); + codePoint = ((byte1 & 0x0F) << 0x12) | (byte2 << 0x0C) | + (byte3 << 0x06) | byte4; + if (codePoint >= 0x010000 && codePoint <= 0x10FFFF) { + return codePoint; + } + } + + throw Error('Invalid UTF-8 detected'); + } + + var byteArray; + var byteCount; + var byteIndex; + function utf8decode(byteString) { + byteArray = ucs2decode(byteString); + byteCount = byteArray.length; + byteIndex = 0; + var codePoints = []; + var tmp; + while ((tmp = decodeSymbol()) !== false) { + codePoints.push(tmp); + } + return ucs2encode(codePoints); + } + + /*--------------------------------------------------------------------------*/ + + var utf8 = { + 'version': '2.0.0', + 'encode': utf8encode, + 'decode': utf8decode + }; + + // Some AMD build optimizers, like r.js, check for specific condition patterns + // like the following: + if ( + typeof define == 'function' && + typeof define.amd == 'object' && + define.amd + ) { + define(function() { + return utf8; + }); + } else if (freeExports && !freeExports.nodeType) { + if (freeModule) { // in Node.js or RingoJS v0.8.0+ + freeModule.exports = utf8; + } else { // in Narwhal or RingoJS v0.7.0- + var object = {}; + var hasOwnProperty = object.hasOwnProperty; + for (var key in utf8) { + hasOwnProperty.call(utf8, key) && (freeExports[key] = utf8[key]); + } + } + } else { // in Rhino or a web browser + root.utf8 = utf8; + } + +}(this)); diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/x.js b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/x.js new file mode 100644 index 0000000..2a23211 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/x.js @@ -0,0 +1,46 @@ +var utf8 = require('./utf8.js'); +var stringEscape = require('string-escape'); + +utf8.encode('\xA9'); +// console.log( +// utf8.encode('\uD800\uDC01'), +// '\xF0\x90\x80\x81', +// utf8.encode('\uD800\uDC01') == '\xF0\x90\x80\x81' +// ); + +var obj = { + 'description': 'Low surrogate followed by another low surrogate', + // 'decoded': '\uDC00\uDC00', + // 'encoded': '\xED\xB0\x80\xED\xB0\x80' + 'decoded': '\xA9', + 'encoded': '\xED\xB0\x80' +}; + +// Encoding +actual = utf8.encode(obj.decoded); +expected = obj.encoded; + +if (actual != expected) { + console.log( + 'fail\n', + 'actual ', stringEscape(actual), '\n', + 'expected', stringEscape(expected) + ); +} else { + console.log('encoding successsssss') +} + + +// // Decoding +// actual = utf8.decode(obj.encoded); +// expected = obj.decoded; + +// if (actual != expected) { +// console.log( +// 'fail\n', +// 'actual ', actual, '\n', +// 'expected', expected +// ); +// } else { +// console.log('decoding successsssss') +// } \ No newline at end of file diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/package.json b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/package.json new file mode 100644 index 0000000..4e9fa10 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/package.json @@ -0,0 +1,55 @@ +{ + "name": "engine.io-parser", + "description": "Parser for the client for the realtime Engine", + "version": "1.0.6", + "homepage": "https://github.com/LearnBoost/engine.io-protocol", + "devDependencies": { + "mocha": "*", + "expect.js": "*", + "zuul": "1.6.3" + }, + "dependencies": { + "base64-arraybuffer": "0.1.2", + "after": "0.8.1", + "arraybuffer.slice": "0.0.6", + "blob": "0.0.2", + "utf8": "2.0.0" + }, + "scripts": { + "test": "make test" + }, + "component": { + "scripts": { + "engine.io-parser/index.js": "lib/index.js", + "engine.io-parser/keys.js": "lib/keys.js" + } + }, + "repository": { + "type": "git", + "url": "git@github.com:LearnBoost/engine.io-parser.git" + }, + "browser": "./lib/browser.js", + "bugs": { + "url": "https://github.com/LearnBoost/engine.io-parser/issues" + }, + "_id": "engine.io-parser@1.0.6", + "_shasum": "d38813143a411cb3b914132ab05bf99e6f7a248e", + "_from": "engine.io-parser@1.0.6", + "_npmVersion": "1.4.7", + "_npmUser": { + "name": "rauchg", + "email": "rauchg@gmail.com" + }, + "maintainers": [ + { + "name": "rauchg", + "email": "rauchg@gmail.com" + } + ], + "dist": { + "shasum": "d38813143a411cb3b914132ab05bf99e6f7a248e", + "tarball": "http://registry.npmjs.org/engine.io-parser/-/engine.io-parser-1.0.6.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-1.0.6.tgz" +} diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/.npmignore b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/.npmignore new file mode 100644 index 0000000..8233793 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/.npmignore @@ -0,0 +1,6 @@ +npm-debug.log +node_modules +.*.swp +.lock-* +build + diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/.travis.yml b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/.travis.yml new file mode 100644 index 0000000..08e4dad --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/.travis.yml @@ -0,0 +1,6 @@ +language: node_js +npm_args: --ws:native +node_js: + - "0.6" + - "0.8" + - "0.10" diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/History.md b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/History.md new file mode 100644 index 0000000..63cf0ea --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/History.md @@ -0,0 +1,312 @@ +v0.4.31 - September 23th, 2013 +===================== + +* Component support + +v0.4.30 - August 30th, 2013 +===================== + +* BufferedAmount could be undefined, default to 0 [TooTallNate] +* Support protocols as second argument and options as third [TooTallNate] +* Proper browserify shim [mcollina] +* Broadcasting example in README [stefanocudini] + +v0.4.29 - August 23th, 2013 +===================== +* Small clean up of the Node 0.11 support by using NAN from the NPM registry [kkoopa] +* Support for custom `Agent`'s through the options. [gramakri] & [TooTallNate] +* Support for custom headers through the options [3rd-Eden] +* Added a `gypfile` flag to the package.json for compiled module discovery [wolfeidau] + +v0.4.28 - August 16th, 2013 +===================== +* Node 0.11 support. [kkoopa] +* Authorization headers are sent when basic auth is used in the url [jcrugzz] +* Origin header will now include the port number [Jason Plum] +* Race condition fixed where data was received before the readyState was updated. [saschagehlich] + +v0.4.27 - June 27th, 2013 +===================== +* Frames are no longer masked in `wscat`. [slaskis] +* Don't retrain reference to large slab buffers. [jmatthewsr-msi] +* Don't use Buffer.byteLength for ArrayBuffer's. [Anthony Pesch] +* Fix browser field in package.json. [shtylman] +* Client-side certificate support & documentation improvements. [Lukas Berns] +* WebSocket readyState's is added to the prototype for spec compatiblity. [BallBearing] +* Use Object.defineProperty. [arlolra] +* Autodetect ArrayBuffers as binary when sending. [BallBearing] +* Check instanceof Buffer for binary data. [arlolra] +* Emit the close event before destroying the internal socket. [3rd-Eden] +* Don't setup multiply timeouts for one connection. [AndreasMadsen] +* Allow support for binding to ethereal port. [wpreul] +* Fix broken terminate reference. [3rd-Eden] +* Misc node 0.10 test fixes and documentation improvements. [3rd-Eden] +* Ensure ssl options are propagated to request. [einaros] +* Add 'Host' and 'Origin' to request header. [Lars-Magnus Skog] +* Subprotocol support. [kanaka] +* Honor ArrayBufferView's byteOffset when sending. [Anthony Pesch] +* Added target attribute for events. [arlolra] + +v0.4.26 - Skipped +===================== + +v0.4.25 - December 17th, 2012 +===================== +* Removed install.js. [shtylman] +* Added browser field to package.json. [shtylman] +* Support overwriting host header. [Raynos] +* Emit 'listening' also with custom http server. [sebiq] + +v0.4.24 - December 6th, 2012 +===================== +* Yet another intermediate release, to not delay minor features any longer. +* Native support installation issues further circumvented. [einaros] + +v0.4.23 - November 19th, 2012 +===================== +* Service release - last before major upgrade. +* Changes default host from 127.0.0.1 to 0.0.0.0. [einaros] + +v0.4.22 - October 3rd, 2012 +===================== +* clear failsafe cleanup timeout once cleanup is called [AndreasMadsen] +* added w3c compatible CloseEvent for onclose / addEventListener("close", ...). [einaros] +* fix the sub protocol header handler [sonnyp] +* fix unhandled exception if socket closes and 'error' is emitted [jmatthewsr-ms] + +v0.4.21 - July 14th, 2012 +===================== +* Emit error if server reponds with anything other than status code 101. [einaros] +* Added 'headers' event to server. [rauchg] +* path.exists moved to fs.exists. [blakmatrix] + +v0.4.20 - June 26th, 2012 +===================== +* node v0.8.0 compatibility release. + +v0.4.19 - June 19th, 2012 +===================== +* Change sender to merge buffers for relatively small payloads, may improve perf in some cases [einaros] +* Avoid EventEmitter for Receiver classes. As above this may improve perf. [einaros] +* Renamed fallback files from the somewhat misleading '*Windows'. [einaros] + +v0.4.18 - June 14th 2012 +===================== +* Fixed incorrect md5 digest encoding in Hixie handshake [nicokaiser] +* Added example of use with Express 3 [einaros] +* Change installation procedure to not require --ws:native to build native extensions. They will now build if a compiler is available. [einaros] + +v0.4.17 - June 13th 2012 +===================== +* Improve error handling during connection handshaking [einaros] +* Ensure that errors are caught also after connection teardown [nicokaiser] +* Update 'mocha' version to 1.1.0. [einaros] +* Stop showing 'undefined' for some error logs. [tricknotes] +* Update 'should' version to 0.6.3 [tricknotes] + +v0.4.16 - June 1st 2012 +===================== +* Build fix for Windows. [einaros] + +v0.4.15 - May 20th 2012 +===================== +* Enable fauxe streaming for hixie tansport. [einaros] +* Allow hixie sender to deal with buffers. [einaros/pigne] +* Allow error code 1011. [einaros] +* Fix framing for empty packets (empty pings and pongs might break). [einaros] +* Improve error and close handling, to avoid connections lingering in CLOSING state. [einaros] + +v0.4.14 - Apr 30th 2012 +===================== +* use node-gyp instead of node-waf [TooTallNate] +* remove old windows compatibility makefile, and silently fall back to native modules [einaros] +* ensure connection status [nicokaiser] +* websocket client updated to use port 443 by default for wss:// connections [einaros] +* support unix sockets [kschzt] + +v0.4.13 - Apr 12th 2012 +===================== + +* circumvent node 0.6+ related memory leak caused by Object.defineProperty [nicokaiser] +* improved error handling, improving stability in massive load use cases [nicokaiser] + +v0.4.12 - Mar 30th 2012 +===================== + +* various memory leak / possible memory leak cleanups [einaros] +* api documentation [nicokaiser] +* add option to disable client tracking [nicokaiser] + +v0.4.11 - Mar 24th 2012 +===================== + +* node v0.7 compatibillity release +* gyp support [TooTallNate] +* commander dependency update [jwueller] +* loadbalancer support [nicokaiser] + +v0.4.10 - Mar 22th 2012 +===================== + +* Final hixie close frame fixes. [nicokaiser] + +v0.4.9 - Mar 21st 2012 +===================== + +* Various hixie bugfixes (such as proper close frame handling). [einaros] + +v0.4.8 - Feb 29th 2012 +===================== + +* Allow verifyClient to run asynchronously [karlsequin] +* Various bugfixes and cleanups. [einaros] + +v0.4.7 - Feb 21st 2012 +===================== + +* Exposed bytesReceived from websocket client object, which makes it possible to implement bandwidth sampling. [einaros] +* Updated browser based file upload example to include and output per websocket channel bandwidth sampling. [einaros] +* Changed build scripts to check which architecture is currently in use. Required after the node.js changes to have prebuilt packages target ia32 by default. [einaros] + +v0.4.6 - Feb 9th 2012 +===================== + +* Added browser based file upload example. [einaros] +* Added server-to-browser status push example. [einaros] +* Exposed pause() and resume() on WebSocket object, to enable client stream shaping. [einaros] + +v0.4.5 - Feb 7th 2012 +===================== + +* Corrected regression bug in handling of connections with the initial frame delivered across both http upgrade head and a standalone packet. This would lead to a race condition, which in some cases could cause message corruption. [einaros] + +v0.4.4 - Feb 6th 2012 +===================== + +* Pass original request object to verifyClient, for cookie or authentication verifications. [einaros] +* Implemented addEventListener and slightly improved the emulation API by adding a MessageEvent with a readonly data attribute. [aslakhellesoy] +* Rewrite parts of hybi receiver to avoid stack overflows for large amounts of packets bundled in the same buffer / packet. [einaros] + +v0.4.3 - Feb 4th 2012 +===================== + +* Prioritized update: Corrected issue which would cause sockets to stay open longer than necessary, and resource leakage because of this. [einaros] + +v0.4.2 - Feb 4th 2012 +===================== + +* Breaking change: WebSocketServer's verifyOrigin option has been renamed to verifyClient. [einaros] +* verifyClient now receives { origin: 'origin header', secure: true/false }, where 'secure' will be true for ssl connections. [einaros] +* Split benchmark, in preparation for more thorough case. [einaros] +* Introduced hixie-76 draft support for server, since Safari (iPhone / iPad / OS X) and Opera still aren't updated to use Hybi. [einaros] +* Expose 'supports' object from WebSocket, to indicate e.g. the underlying transport's support for binary data. [einaros] +* Test and code cleanups. [einaros] + +v0.4.1 - Jan 25th 2012 +===================== + +* Use readline in wscat [tricknotes] +* Refactor _state away, in favor of the new _readyState [tricknotes] +* travis-ci integration [einaros] +* Fixed race condition in testsuite, causing a few tests to fail (without actually indicating errors) on travis [einaros] +* Expose pong event [paddybyers] +* Enabled running of WebSocketServer in noServer-mode, meaning that upgrades are passed in manually. [einaros] +* Reworked connection procedure for WebSocketServer, and cleaned up tests. [einaros] + +v0.4.0 - Jan 2nd 2012 +===================== + +* Windows compatibility [einaros] +* Windows compatible test script [einaros] + +v0.3.9 - Jan 1st 2012 +====================== + +* Improved protocol framing performance [einaros] +* WSS support [kazuyukitanimura] +* WSS tests [einaros] +* readyState exposed [justinlatimer, tricknotes] +* url property exposed [justinlatimer] +* Removed old 'state' property [einaros] +* Test cleanups [einaros] + +v0.3.8 - Dec 27th 2011 +====================== + +* Made it possible to listen on specific paths, which is especially good to have for precreated http servers [einaros] +* Extensive WebSocket / WebSocketServer cleanup, including changing all internal properties to unconfigurable, unenumerable properties [einaros] +* Receiver modifications to ensure even better performance with fragmented sends [einaros] +* Fixed issue in sender.js, which would cause SlowBuffer instances (such as returned from the crypto library's randomBytes) to be copied (and thus be dead slow) [einaros] +* Removed redundant buffer copy in sender.js, which should improve server performance [einaros] + +v0.3.7 - Dec 25nd 2011 +====================== + +* Added a browser based API which uses EventEmitters internally [3rd-Eden] +* Expose request information from upgrade event for websocket server clients [mmalecki] + +v0.3.6 - Dec 19th 2011 +====================== + +* Added option to let WebSocket.Server use an already existing http server [mmalecki] +* Migrating various option structures to use options.js module [einaros] +* Added a few more tests, options and handshake verifications to ensure that faulty connections are dealt with [einaros] +* Code cleanups in Sender and Receiver, to ensure even faster parsing [einaros] + +v0.3.5 - Dec 13th 2011 +====================== + +* Optimized Sender.js, Receiver.js and bufferutil.cc: + * Apply loop-unrolling-like small block copies rather than use node.js Buffer#copy() (which is slow). + * Mask blocks of data using combination of 32bit xor and loop-unrolling, instead of single bytes. + * Keep pre-made send buffer for small transfers. +* Leak fixes and code cleanups. + +v0.3.3 - Dec 12th 2011 +====================== + +* Compile fix for Linux. +* Rewrote parts of WebSocket.js, to avoid try/catch and thus avoid optimizer bailouts. + +v0.3.2 - Dec 11th 2011 +====================== + +* Further performance updates, including the additions of a native BufferUtil module, which deals with several of the cpu intensive WebSocket operations. + +v0.3.1 - Dec 8th 2011 +====================== + +* Service release, fixing broken tests. + +v0.3.0 - Dec 8th 2011 +====================== + +* Node.js v0.4.x compatibility. +* Code cleanups and efficiency improvements. +* WebSocket server added, although this will still mainly be a client library. +* WebSocket server certified to pass the Autobahn test suite. +* Protocol improvements and corrections - such as handling (redundant) masks for empty fragments. +* 'wscat' command line utility added, which can act as either client or server. + +v0.2.6 - Dec 3rd 2011 +====================== + +* Renamed to 'ws'. Big woop, right -- but easy-websocket really just doesn't cut it anymore! + +v0.2.5 - Dec 3rd 2011 +====================== + + * Rewrote much of the WebSocket parser, to ensure high speed for highly fragmented messages. + * Added a BufferPool, as a start to more efficiently deal with allocations for WebSocket connections. More work to come, in that area. + * Updated the Autobahn report, at http://einaros.github.com/easy-websocket, with comparisons against WebSocket-Node 1.0.2 and Chrome 16. + +v0.2.0 - Nov 25th 2011 +====================== + + * Major rework to make sure all the Autobahn test cases pass. Also updated the internal tests to cover more corner cases. + +v0.1.2 - Nov 14th 2011 +====================== + + * Back and forth, back and forth: now settled on keeping the api (event names, methods) closer to the websocket browser api. This will stick now. + * Started keeping this history record. Better late than never, right? diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/Makefile b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/Makefile new file mode 100644 index 0000000..151aa2b --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/Makefile @@ -0,0 +1,40 @@ +ALL_TESTS = $(shell find test/ -name '*.test.js') +ALL_INTEGRATION = $(shell find test/ -name '*.integration.js') + +all: + node-gyp configure build + +clean: + node-gyp clean + +run-tests: + @./node_modules/.bin/mocha \ + -t 2000 \ + -s 2400 \ + $(TESTFLAGS) \ + $(TESTS) + +run-integrationtests: + @./node_modules/.bin/mocha \ + -t 5000 \ + -s 6000 \ + $(TESTFLAGS) \ + $(TESTS) + +test: + @$(MAKE) NODE_TLS_REJECT_UNAUTHORIZED=0 NODE_PATH=lib TESTS="$(ALL_TESTS)" run-tests + +integrationtest: + @$(MAKE) NODE_TLS_REJECT_UNAUTHORIZED=0 NODE_PATH=lib TESTS="$(ALL_INTEGRATION)" run-integrationtests + +benchmark: + @node bench/sender.benchmark.js + @node bench/parser.benchmark.js + +autobahn: + @NODE_PATH=lib node test/autobahn.js + +autobahn-server: + @NODE_PATH=lib node test/autobahn-server.js + +.PHONY: test diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/README.md b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/README.md new file mode 100644 index 0000000..e6646e7 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/README.md @@ -0,0 +1,171 @@ +[![Build Status](https://secure.travis-ci.org/einaros/ws.png)](http://travis-ci.org/einaros/ws) + +# ws: a node.js websocket library # + +`ws` is a simple to use websocket implementation, up-to-date against RFC-6455, and [probably the fastest WebSocket library for node.js](http://web.archive.org/web/20130314230536/http://hobbycoding.posterous.com/the-fastest-websocket-module-for-nodejs). + +Passes the quite extensive Autobahn test suite. See http://einaros.github.com/ws for the full reports. + +Comes with a command line utility, `wscat`, which can either act as a server (--listen), or client (--connect); Use it to debug simple websocket services. + +## Protocol support ## + +* **Hixie draft 76** (Old and deprecated, but still in use by Safari and Opera. Added to ws version 0.4.2, but server only. Can be disabled by setting the `disableHixie` option to true.) +* **HyBi drafts 07-12** (Use the option `protocolVersion: 8`, or argument `-p 8` for wscat) +* **HyBi drafts 13-17** (Current default, alternatively option `protocolVersion: 13`, or argument `-p 13` for wscat) + +_See the echo.websocket.org example below for how to use the `protocolVersion` option._ + +## Usage ## + +### Installing ### + +`npm install ws` + +### Sending and receiving text data ### + +```js +var WebSocket = require('ws'); +var ws = new WebSocket('ws://www.host.com/path'); +ws.on('open', function() { + ws.send('something'); +}); +ws.on('message', function(data, flags) { + // flags.binary will be set if a binary data is received + // flags.masked will be set if the data was masked +}); +``` + +### Sending binary data ### + +```js +var WebSocket = require('ws'); +var ws = new WebSocket('ws://www.host.com/path'); +ws.on('open', function() { + var array = new Float32Array(5); + for (var i = 0; i < array.length; ++i) array[i] = i / 2; + ws.send(array, {binary: true, mask: true}); +}); +``` + +Setting `mask`, as done for the send options above, will cause the data to be masked according to the websocket protocol. The same option applies for text data. + +### Server example ### + +```js +var WebSocketServer = require('ws').Server + , wss = new WebSocketServer({port: 8080}); +wss.on('connection', function(ws) { + ws.on('message', function(message) { + console.log('received: %s', message); + }); + ws.send('something'); +}); +``` + +### Server sending broadcast data ### + +```js +var WebSocketServer = require('ws').Server + , wss = new WebSocketServer({port: 8080}); + +wss.broadcast = function(data) { + for(var i in this.clients) + this.clients[i].send(data); +}; +``` + +### Error handling best practices ### + +```js +// If the WebSocket is closed before the following send is attempted +ws.send('something'); + +// Errors (both immediate and async write errors) can be detected in an optional callback. +// The callback is also the only way of being notified that data has actually been sent. +ws.send('something', function(error) { + // if error is null, the send has been completed, + // otherwise the error object will indicate what failed. +}); + +// Immediate errors can also be handled with try/catch-blocks, but **note** +// that since sends are inherently asynchronous, socket write failures will *not* +// be captured when this technique is used. +try { + ws.send('something'); +} +catch (e) { + // handle error +} +``` + +### echo.websocket.org demo ### + +```js +var WebSocket = require('ws'); +var ws = new WebSocket('ws://echo.websocket.org/', {protocolVersion: 8, origin: 'http://websocket.org'}); +ws.on('open', function() { + console.log('connected'); + ws.send(Date.now().toString(), {mask: true}); +}); +ws.on('close', function() { + console.log('disconnected'); +}); +ws.on('message', function(data, flags) { + console.log('Roundtrip time: ' + (Date.now() - parseInt(data)) + 'ms', flags); + setTimeout(function() { + ws.send(Date.now().toString(), {mask: true}); + }, 500); +}); +``` + +### wscat against echo.websocket.org ### + + $ npm install -g ws + $ wscat -c ws://echo.websocket.org -p 8 + connected (press CTRL+C to quit) + > hi there + < hi there + > are you a happy parrot? + < are you a happy parrot? + +### Other examples ### + +For a full example with a browser client communicating with a ws server, see the examples folder. + +Note that the usage together with Express 3.0 is quite different from Express 2.x. The difference is expressed in the two different serverstats-examples. + +Otherwise, see the test cases. + +### Running the tests ### + +`make test` + +## API Docs ## + +See the doc/ directory for Node.js-like docs for the ws classes. + +## License ## + +(The MIT License) + +Copyright (c) 2011 Einar Otto Stangvik <einaros@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/bench/parser.benchmark.js b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/bench/parser.benchmark.js new file mode 100644 index 0000000..ff5f737 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/bench/parser.benchmark.js @@ -0,0 +1,115 @@ +/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ + +/** + * Benchmark dependencies. + */ + +var benchmark = require('benchmark') + , Receiver = require('../').Receiver + , suite = new benchmark.Suite('Receiver'); +require('tinycolor'); +require('./util'); + +/** + * Setup receiver. + */ + +suite.on('start', function () { + receiver = new Receiver(); +}); + +suite.on('cycle', function () { + receiver = new Receiver(); +}); + +/** + * Benchmarks. + */ + +var pingMessage = 'Hello' + , pingPacket1 = getBufferFromHexString('89 ' + (pack(2, 0x80 | pingMessage.length)) + + ' 34 83 a8 68 '+ getHexStringFromBuffer(mask(pingMessage, '34 83 a8 68'))); +suite.add('ping message', function () { + receiver.add(pingPacket1); +}); + +var pingPacket2 = getBufferFromHexString('89 00') +suite.add('ping with no data', function () { + receiver.add(pingPacket2); +}); + +var closePacket = getBufferFromHexString('88 00'); +suite.add('close message', function () { + receiver.add(closePacket); + receiver.endPacket(); +}); + +var maskedTextPacket = getBufferFromHexString('81 93 34 83 a8 68 01 b9 92 52 4f a1 c6 09 59 e6 8a 52 16 e6 cb 00 5b a1 d5'); +suite.add('masked text message', function () { + receiver.add(maskedTextPacket); +}); + +binaryDataPacket = (function() { + var length = 125 + , message = new Buffer(length) + for (var i = 0; i < length; ++i) message[i] = i % 10; + return getBufferFromHexString('82 ' + getHybiLengthAsHexString(length, true) + ' 34 83 a8 68 ' + + getHexStringFromBuffer(mask(message), '34 83 a8 68')); +})(); +suite.add('binary data (125 bytes)', function () { + try { + receiver.add(binaryDataPacket); + + } + catch(e) {console.log(e)} +}); + +binaryDataPacket2 = (function() { + var length = 65535 + , message = new Buffer(length) + for (var i = 0; i < length; ++i) message[i] = i % 10; + return getBufferFromHexString('82 ' + getHybiLengthAsHexString(length, true) + ' 34 83 a8 68 ' + + getHexStringFromBuffer(mask(message), '34 83 a8 68')); +})(); +suite.add('binary data (65535 bytes)', function () { + receiver.add(binaryDataPacket2); +}); + +binaryDataPacket3 = (function() { + var length = 200*1024 + , message = new Buffer(length) + for (var i = 0; i < length; ++i) message[i] = i % 10; + return getBufferFromHexString('82 ' + getHybiLengthAsHexString(length, true) + ' 34 83 a8 68 ' + + getHexStringFromBuffer(mask(message), '34 83 a8 68')); +})(); +suite.add('binary data (200 kB)', function () { + receiver.add(binaryDataPacket3); +}); + +/** + * Output progress. + */ + +suite.on('cycle', function (bench, details) { + console.log('\n ' + suite.name.grey, details.name.white.bold); + console.log(' ' + [ + details.hz.toFixed(2).cyan + ' ops/sec'.grey + , details.count.toString().white + ' times executed'.grey + , 'benchmark took '.grey + details.times.elapsed.toString().white + ' sec.'.grey + , + ].join(', '.grey)); +}); + +/** + * Run/export benchmarks. + */ + +if (!module.parent) { + suite.run(); +} else { + module.exports = suite; +} diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/bench/sender.benchmark.js b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/bench/sender.benchmark.js new file mode 100644 index 0000000..20c171a --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/bench/sender.benchmark.js @@ -0,0 +1,66 @@ +/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ + +/** + * Benchmark dependencies. + */ + +var benchmark = require('benchmark') + , Sender = require('../').Sender + , suite = new benchmark.Suite('Sender'); +require('tinycolor'); +require('./util'); + +/** + * Setup sender. + */ + +suite.on('start', function () { + sender = new Sender(); + sender._socket = { write: function() {} }; +}); + +suite.on('cycle', function () { + sender = new Sender(); + sender._socket = { write: function() {} }; +}); + +/** + * Benchmarks + */ + +framePacket = new Buffer(200*1024); +framePacket.fill(99); +suite.add('frameAndSend, unmasked (200 kB)', function () { + sender.frameAndSend(0x2, framePacket, true, false); +}); +suite.add('frameAndSend, masked (200 kB)', function () { + sender.frameAndSend(0x2, framePacket, true, true); +}); + +/** + * Output progress. + */ + +suite.on('cycle', function (bench, details) { + console.log('\n ' + suite.name.grey, details.name.white.bold); + console.log(' ' + [ + details.hz.toFixed(2).cyan + ' ops/sec'.grey + , details.count.toString().white + ' times executed'.grey + , 'benchmark took '.grey + details.times.elapsed.toString().white + ' sec.'.grey + , + ].join(', '.grey)); +}); + +/** + * Run/export benchmarks. + */ + +if (!module.parent) { + suite.run(); +} else { + module.exports = suite; +} diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/bench/speed.js b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/bench/speed.js new file mode 100644 index 0000000..3ce6414 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/bench/speed.js @@ -0,0 +1,105 @@ +var cluster = require('cluster') + , WebSocket = require('../') + , WebSocketServer = WebSocket.Server + , crypto = require('crypto') + , util = require('util') + , ansi = require('ansi'); +require('tinycolor'); + +function roundPrec(num, prec) { + var mul = Math.pow(10, prec); + return Math.round(num * mul) / mul; +} + +function humanSize(bytes) { + if (bytes >= 1048576) return roundPrec(bytes / 1048576, 2) + ' MB'; + if (bytes >= 1024) return roundPrec(bytes / 1024, 2) + ' kB'; + return roundPrec(bytes, 2) + ' B'; +} + +function generateRandomData(size) { + var buffer = new Buffer(size); + for (var i = 0; i < size; ++i) { + buffer[i] = ~~(Math.random() * 127); + } + return buffer; +} + +if (cluster.isMaster) { + var wss = new WebSocketServer({port: 8181}, function() { + cluster.fork(); + }); + wss.on('connection', function(ws) { + ws.on('message', function(data, flags) { + ws.send(data, {binary: flags&&flags.binary}); + }); + ws.on('close', function() {}); + }); + cluster.on('death', function(worker) { + wss.close(); + }); +} +else { + var cursor = ansi(process.stdout); + + var configs = [ + [true, 10000, 64], + [true, 5000, 16*1024], + [true, 1000, 128*1024], + [true, 100, 1024*1024], + [true, 1, 500*1024*1024], + [false, 10000, 64], + [false, 5000, 16*1024], + [false, 1000, 128*1024], + [false, 100, 1024*1024], + ]; + + var largest = configs[0][1]; + for (var i = 0, l = configs.length; i < l; ++i) { + if (configs[i][2] > largest) largest = configs[i][2]; + } + + console.log('Generating %s of test data ...', humanSize(largest)); + var randomBytes = generateRandomData(largest); + + function roundtrip(useBinary, roundtrips, size, cb) { + var data = randomBytes.slice(0, size); + var prefix = util.format('Running %d roundtrips of %s %s data', roundtrips, humanSize(size), useBinary ? 'binary' : 'text'); + console.log(prefix); + var client = new WebSocket('ws://localhost:' + '8181'); + var dt; + var roundtrip = 0; + function send() { + client.send(data, {binary: useBinary}); + } + client.on('error', function(e) { + console.error(e); + process.exit(); + }); + client.on('open', function() { + dt = Date.now(); + send(); + }); + client.on('message', function(data, flags) { + if (++roundtrip == roundtrips) { + var elapsed = Date.now() - dt; + cursor.up(); + console.log('%s:\t%ss\t%s' + , useBinary ? prefix.green : prefix.cyan + , roundPrec(elapsed / 1000, 1).toString().green.bold + , (humanSize((size * roundtrips) / elapsed * 1000) + '/s').blue.bold); + client.close(); + cb(); + return; + } + process.nextTick(send); + }); + } + + (function run() { + if (configs.length == 0) process.exit(); + var config = configs.shift(); + config.push(run); + roundtrip.apply(null, config); + })(); +} \ No newline at end of file diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/bench/util.js b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/bench/util.js new file mode 100644 index 0000000..5f01281 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/bench/util.js @@ -0,0 +1,105 @@ +/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ + +/** + * Returns a Buffer from a "ff 00 ff"-type hex string. + */ + +getBufferFromHexString = function(byteStr) { + var bytes = byteStr.split(' '); + var buf = new Buffer(bytes.length); + for (var i = 0; i < bytes.length; ++i) { + buf[i] = parseInt(bytes[i], 16); + } + return buf; +} + +/** + * Returns a hex string from a Buffer. + */ + +getHexStringFromBuffer = function(data) { + var s = ''; + for (var i = 0; i < data.length; ++i) { + s += padl(data[i].toString(16), 2, '0') + ' '; + } + return s.trim(); +} + +/** + * Splits a buffer in two parts. + */ + +splitBuffer = function(buffer) { + var b1 = new Buffer(Math.ceil(buffer.length / 2)); + buffer.copy(b1, 0, 0, b1.length); + var b2 = new Buffer(Math.floor(buffer.length / 2)); + buffer.copy(b2, 0, b1.length, b1.length + b2.length); + return [b1, b2]; +} + +/** + * Performs hybi07+ type masking on a hex string or buffer. + */ + +mask = function(buf, maskString) { + if (typeof buf == 'string') buf = new Buffer(buf); + var mask = getBufferFromHexString(maskString || '34 83 a8 68'); + for (var i = 0; i < buf.length; ++i) { + buf[i] ^= mask[i % 4]; + } + return buf; +} + +/** + * Returns a hex string representing the length of a message + */ + +getHybiLengthAsHexString = function(len, masked) { + if (len < 126) { + var buf = new Buffer(1); + buf[0] = (masked ? 0x80 : 0) | len; + } + else if (len < 65536) { + var buf = new Buffer(3); + buf[0] = (masked ? 0x80 : 0) | 126; + getBufferFromHexString(pack(4, len)).copy(buf, 1); + } + else { + var buf = new Buffer(9); + buf[0] = (masked ? 0x80 : 0) | 127; + getBufferFromHexString(pack(16, len)).copy(buf, 1); + } + return getHexStringFromBuffer(buf); +} + +/** + * Unpacks a Buffer into a number. + */ + +unpack = function(buffer) { + var n = 0; + for (var i = 0; i < buffer.length; ++i) { + n = (i == 0) ? buffer[i] : (n * 256) + buffer[i]; + } + return n; +} + +/** + * Returns a hex string, representing a specific byte count 'length', from a number. + */ + +pack = function(length, number) { + return padl(number.toString(16), length, '0').replace(/([0-9a-f][0-9a-f])/gi, '$1 ').trim(); +} + +/** + * Left pads the string 's' to a total length of 'n' with char 'c'. + */ + +padl = function(s, n, c) { + return new Array(1 + n - s.length).join(c) + s; +} diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/bin/wscat b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/bin/wscat new file mode 100755 index 0000000..0ec894d --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/bin/wscat @@ -0,0 +1,190 @@ +#!/usr/bin/env node + +/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var WebSocket = require('../') + , fs = require('fs') + , program = require('commander') + , util = require('util') + , events = require('events') + , readline = require('readline'); + +/** + * InputReader - processes console input + */ + +function Console() { + this.stdin = process.stdin; + this.stdout = process.stdout; + + this.readlineInterface = readline.createInterface(this.stdin, this.stdout); + + var self = this; + this.readlineInterface.on('line', function(data) { + self.emit('line', data); + }); + this.readlineInterface.on('close', function() { + self.emit('close'); + }); + + this._resetInput = function() { + self.clear(); + } +} +util.inherits(Console, events.EventEmitter); + +Console.Colors = { + Red: '\033[31m', + Green: '\033[32m', + Yellow: '\033[33m', + Blue: '\033[34m', + Default: '\033[39m' +}; + +Console.prototype.prompt = function() { + this.readlineInterface.prompt(); +} + +Console.prototype.print = function(msg, color) { + this.clear(); + color = color || Console.Colors.Default; + this.stdout.write(color + msg + Console.Colors.Default + '\n'); + this.prompt(); +} + +Console.prototype.clear = function() { + this.stdout.write('\033[2K\033[E'); +} + +Console.prototype.pause = function() { + this.stdin.on('keypress', this._resetInput); +} + +Console.prototype.resume = function() { + this.stdin.removeListener('keypress', this._resetInput); +} + +/** + * The actual application + */ + +var version = JSON.parse(fs.readFileSync(__dirname + '/../package.json', 'utf8')).version; +program + .version(version) + .usage('[options] ') + .option('-l, --listen ', 'listen on port') + .option('-c, --connect ', 'connect to a websocket server') + .option('-p, --protocol ', 'optional protocol version') + .option('-o, --origin ', 'optional origin') + .option('--host ', 'optional host') + .option('-s, --subprotocol ', 'optional subprotocol') + .parse(process.argv); + +if (program.listen && program.connect) { + console.error('\033[33merror: use either --listen or --connect\033[39m'); + process.exit(-1); +} +else if (program.listen) { + var wsConsole = new Console(); + wsConsole.pause(); + var options = {}; + if (program.protocol) options.protocolVersion = program.protocol; + if (program.origin) options.origin = program.origin; + if (program.subprotocol) options.protocol = program.subprotocol; + var ws = null; + var wss = new WebSocket.Server({port: program.listen}, function() { + wsConsole.print('listening on port ' + program.listen + ' (press CTRL+C to quit)', Console.Colors.Green); + wsConsole.clear(); + }); + wsConsole.on('close', function() { + if (ws) { + try { + ws.close(); + } + catch (e) {} + } + process.exit(0); + }); + wsConsole.on('line', function(data) { + if (ws) { + ws.send(data, {mask: false}); + wsConsole.prompt(); + } + }); + wss.on('connection', function(newClient) { + if (ws) { + // limit to one client + newClient.terminate(); + return; + }; + ws = newClient; + wsConsole.resume(); + wsConsole.prompt(); + wsConsole.print('client connected', Console.Colors.Green); + ws.on('close', function() { + wsConsole.print('disconnected', Console.Colors.Green); + wsConsole.clear(); + wsConsole.pause(); + ws = null; + }); + ws.on('error', function(code, description) { + wsConsole.print('error: ' + code + (description ? ' ' + description : ''), Console.Colors.Yellow); + }); + ws.on('message', function(data, flags) { + wsConsole.print('< ' + data, Console.Colors.Blue); + }); + }); + wss.on('error', function(error) { + wsConsole.print('error: ' + error.toString(), Console.Colors.Yellow); + process.exit(-1); + }); +} +else if (program.connect) { + var wsConsole = new Console(); + var options = {}; + if (program.protocol) options.protocolVersion = program.protocol; + if (program.origin) options.origin = program.origin; + if (program.subprotocol) options.protocol = program.subprotocol; + if (program.host) options.host = program.host; + var ws = new WebSocket(program.connect, options); + ws.on('open', function() { + wsConsole.print('connected (press CTRL+C to quit)', Console.Colors.Green); + wsConsole.on('line', function(data) { + ws.send(data, {mask: true}); + wsConsole.prompt(); + }); + }); + ws.on('close', function() { + wsConsole.print('disconnected', Console.Colors.Green); + wsConsole.clear(); + process.exit(); + }); + ws.on('error', function(code, description) { + wsConsole.print('error: ' + code + (description ? ' ' + description : ''), Console.Colors.Yellow); + process.exit(-1); + }); + ws.on('message', function(data, flags) { + wsConsole.print('< ' + data, Console.Colors.Blue); + }); + wsConsole.on('close', function() { + if (ws) { + try { + ws.close(); + } + catch(e) {} + process.exit(); + } + }); +} +else { + console.error('\033[33merror: use either --listen or --connect\033[39m'); + process.exit(-1); +} diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/binding.gyp b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/binding.gyp new file mode 100644 index 0000000..c9b4d1a --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/binding.gyp @@ -0,0 +1,16 @@ +{ + 'targets': [ + { + 'target_name': 'validation', + 'include_dirs': ["> $(depfile) +# Add extra rules as in (2). +# We remove slashes and replace spaces with new lines; +# remove blank lines; +# delete the first line and append a colon to the remaining lines. +sed -e 's|\\||' -e 'y| |\n|' $(depfile).raw |\ + grep -v '^$$' |\ + sed -e 1d -e 's|$$|:|' \ + >> $(depfile) +rm $(depfile).raw +endef + +# Command definitions: +# - cmd_foo is the actual command to run; +# - quiet_cmd_foo is the brief-output summary of the command. + +quiet_cmd_cc = CC($(TOOLSET)) $@ +cmd_cc = $(CC.$(TOOLSET)) $(GYP_CFLAGS) $(DEPFLAGS) $(CFLAGS.$(TOOLSET)) -c -o $@ $< + +quiet_cmd_cxx = CXX($(TOOLSET)) $@ +cmd_cxx = $(CXX.$(TOOLSET)) $(GYP_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $< + +quiet_cmd_objc = CXX($(TOOLSET)) $@ +cmd_objc = $(CC.$(TOOLSET)) $(GYP_OBJCFLAGS) $(DEPFLAGS) -c -o $@ $< + +quiet_cmd_objcxx = CXX($(TOOLSET)) $@ +cmd_objcxx = $(CXX.$(TOOLSET)) $(GYP_OBJCXXFLAGS) $(DEPFLAGS) -c -o $@ $< + +# Commands for precompiled header files. +quiet_cmd_pch_c = CXX($(TOOLSET)) $@ +cmd_pch_c = $(CC.$(TOOLSET)) $(GYP_PCH_CFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $< +quiet_cmd_pch_cc = CXX($(TOOLSET)) $@ +cmd_pch_cc = $(CC.$(TOOLSET)) $(GYP_PCH_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $< +quiet_cmd_pch_m = CXX($(TOOLSET)) $@ +cmd_pch_m = $(CC.$(TOOLSET)) $(GYP_PCH_OBJCFLAGS) $(DEPFLAGS) -c -o $@ $< +quiet_cmd_pch_mm = CXX($(TOOLSET)) $@ +cmd_pch_mm = $(CC.$(TOOLSET)) $(GYP_PCH_OBJCXXFLAGS) $(DEPFLAGS) -c -o $@ $< + +# gyp-mac-tool is written next to the root Makefile by gyp. +# Use $(4) for the command, since $(2) and $(3) are used as flag by do_cmd +# already. +quiet_cmd_mac_tool = MACTOOL $(4) $< +cmd_mac_tool = ./gyp-mac-tool $(4) $< "$@" + +quiet_cmd_mac_package_framework = PACKAGE FRAMEWORK $@ +cmd_mac_package_framework = ./gyp-mac-tool package-framework "$@" $(4) + +quiet_cmd_infoplist = INFOPLIST $@ +cmd_infoplist = $(CC.$(TOOLSET)) -E -P -Wno-trigraphs -x c $(INFOPLIST_DEFINES) "$<" -o "$@" + +quiet_cmd_touch = TOUCH $@ +cmd_touch = touch $@ + +quiet_cmd_copy = COPY $@ +# send stderr to /dev/null to ignore messages when linking directories. +cmd_copy = rm -rf "$@" && cp -af "$<" "$@" + +quiet_cmd_alink = LIBTOOL-STATIC $@ +cmd_alink = rm -f $@ && ./gyp-mac-tool filter-libtool libtool $(GYP_LIBTOOLFLAGS) -static -o $@ $(filter %.o,$^) + +quiet_cmd_link = LINK($(TOOLSET)) $@ +cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o "$@" $(LD_INPUTS) $(LIBS) + +quiet_cmd_solink = SOLINK($(TOOLSET)) $@ +cmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o "$@" $(LD_INPUTS) $(LIBS) + +quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@ +cmd_solink_module = $(LINK.$(TOOLSET)) -bundle $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS) + + +# Define an escape_quotes function to escape single quotes. +# This allows us to handle quotes properly as long as we always use +# use single quotes and escape_quotes. +escape_quotes = $(subst ','\'',$(1)) +# This comment is here just to include a ' to unconfuse syntax highlighting. +# Define an escape_vars function to escape '$' variable syntax. +# This allows us to read/write command lines with shell variables (e.g. +# $LD_LIBRARY_PATH), without triggering make substitution. +escape_vars = $(subst $$,$$$$,$(1)) +# Helper that expands to a shell command to echo a string exactly as it is in +# make. This uses printf instead of echo because printf's behaviour with respect +# to escape sequences is more portable than echo's across different shells +# (e.g., dash, bash). +exact_echo = printf '%s\n' '$(call escape_quotes,$(1))' + +# Helper to compare the command we're about to run against the command +# we logged the last time we ran the command. Produces an empty +# string (false) when the commands match. +# Tricky point: Make has no string-equality test function. +# The kernel uses the following, but it seems like it would have false +# positives, where one string reordered its arguments. +# arg_check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \ +# $(filter-out $(cmd_$@), $(cmd_$(1)))) +# We instead substitute each for the empty string into the other, and +# say they're equal if both substitutions produce the empty string. +# .d files contain ? instead of spaces, take that into account. +command_changed = $(or $(subst $(cmd_$(1)),,$(cmd_$(call replace_spaces,$@))),\ + $(subst $(cmd_$(call replace_spaces,$@)),,$(cmd_$(1)))) + +# Helper that is non-empty when a prerequisite changes. +# Normally make does this implicitly, but we force rules to always run +# so we can check their command lines. +# $? -- new prerequisites +# $| -- order-only dependencies +prereq_changed = $(filter-out FORCE_DO_CMD,$(filter-out $|,$?)) + +# Helper that executes all postbuilds until one fails. +define do_postbuilds + @E=0;\ + for p in $(POSTBUILDS); do\ + eval $$p;\ + E=$$?;\ + if [ $$E -ne 0 ]; then\ + break;\ + fi;\ + done;\ + if [ $$E -ne 0 ]; then\ + rm -rf "$@";\ + exit $$E;\ + fi +endef + +# do_cmd: run a command via the above cmd_foo names, if necessary. +# Should always run for a given target to handle command-line changes. +# Second argument, if non-zero, makes it do asm/C/C++ dependency munging. +# Third argument, if non-zero, makes it do POSTBUILDS processing. +# Note: We intentionally do NOT call dirx for depfile, since it contains ? for +# spaces already and dirx strips the ? characters. +define do_cmd +$(if $(or $(command_changed),$(prereq_changed)), + @$(call exact_echo, $($(quiet)cmd_$(1))) + @mkdir -p "$(call dirx,$@)" "$(dir $(depfile))" + $(if $(findstring flock,$(word 2,$(cmd_$1))), + @$(cmd_$(1)) + @echo " $(quiet_cmd_$(1)): Finished", + @$(cmd_$(1)) + ) + @$(call exact_echo,$(call escape_vars,cmd_$(call replace_spaces,$@) := $(cmd_$(1)))) > $(depfile) + @$(if $(2),$(fixup_dep)) + $(if $(and $(3), $(POSTBUILDS)), + $(call do_postbuilds) + ) +) +endef + +# Declare the "all" target first so it is the default, +# even though we don't have the deps yet. +.PHONY: all +all: + +# make looks for ways to re-generate included makefiles, but in our case, we +# don't have a direct way. Explicitly telling make that it has nothing to do +# for them makes it go faster. +%.d: ; + +# Use FORCE_DO_CMD to force a target to run. Should be coupled with +# do_cmd. +.PHONY: FORCE_DO_CMD +FORCE_DO_CMD: + +TOOLSET := target +# Suffix rules, putting all outputs into $(obj). +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.c FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cpp FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cxx FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.m FORCE_DO_CMD + @$(call do_cmd,objc,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.mm FORCE_DO_CMD + @$(call do_cmd,objcxx,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.S FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.s FORCE_DO_CMD + @$(call do_cmd,cc,1) + +# Try building from generated source, too. +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.c FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cpp FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cxx FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.m FORCE_DO_CMD + @$(call do_cmd,objc,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.mm FORCE_DO_CMD + @$(call do_cmd,objcxx,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.S FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.s FORCE_DO_CMD + @$(call do_cmd,cc,1) + +$(obj).$(TOOLSET)/%.o: $(obj)/%.c FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.cc FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.cpp FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.cxx FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.m FORCE_DO_CMD + @$(call do_cmd,objc,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.mm FORCE_DO_CMD + @$(call do_cmd,objcxx,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.S FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.s FORCE_DO_CMD + @$(call do_cmd,cc,1) + + +ifeq ($(strip $(foreach prefix,$(NO_LOAD),\ + $(findstring $(join ^,$(prefix)),\ + $(join ^,bufferutil.target.mk)))),) + include bufferutil.target.mk +endif +ifeq ($(strip $(foreach prefix,$(NO_LOAD),\ + $(findstring $(join ^,$(prefix)),\ + $(join ^,validation.target.mk)))),) + include validation.target.mk +endif + +quiet_cmd_regen_makefile = ACTION Regenerating $@ +cmd_regen_makefile = cd $(srcdir); /usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py -fmake --ignore-environment "--toplevel-dir=." -I/Users/ambrosechua/Documents/School/EL/drama/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/config.gypi -I/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi -I/Users/ambrosechua/.node-gyp/0.10.28/common.gypi "--depth=." "-Goutput_dir=." "--generator-output=build" "-Dlibrary=shared_library" "-Dvisibility=default" "-Dnode_root_dir=/Users/ambrosechua/.node-gyp/0.10.28" "-Dmodule_root_dir=/Users/ambrosechua/Documents/School/EL/drama/node_modules/socket.io/node_modules/engine.io/node_modules/ws" binding.gyp +Makefile: $(srcdir)/../../../../../../../../../../.node-gyp/0.10.28/common.gypi $(srcdir)/build/config.gypi $(srcdir)/binding.gyp $(srcdir)/../../../../../../../../../../../../usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi + $(call do_cmd,regen_makefile) + +# "all" is a concatenation of the "all" targets from all the included +# sub-makefiles. This is just here to clarify. +all: + +# Add in dependency-tracking rules. $(all_deps) is the list of every single +# target in our tree. Only consider the ones with .d (dependency) info: +d_files := $(wildcard $(foreach f,$(all_deps),$(depsdir)/$(f).d)) +ifneq ($(d_files),) + include $(d_files) +endif diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/.deps/Release/bufferutil.node.d b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/.deps/Release/bufferutil.node.d new file mode 100644 index 0000000..70d0a06 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/.deps/Release/bufferutil.node.d @@ -0,0 +1 @@ +cmd_Release/bufferutil.node := ./gyp-mac-tool flock ./Release/linker.lock c++ -bundle -Wl,-search_paths_first -mmacosx-version-min=10.5 -arch x86_64 -L./Release -o Release/bufferutil.node Release/obj.target/bufferutil/src/bufferutil.o -undefined dynamic_lookup diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/.deps/Release/obj.target/bufferutil/src/bufferutil.o.d b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/.deps/Release/obj.target/bufferutil/src/bufferutil.o.d new file mode 100644 index 0000000..79a0dc1 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/.deps/Release/obj.target/bufferutil/src/bufferutil.o.d @@ -0,0 +1,23 @@ +cmd_Release/obj.target/bufferutil/src/bufferutil.o := c++ '-D_DARWIN_USE_64_BIT_INODE=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DBUILDING_NODE_EXTENSION' -I/Users/ambrosechua/.node-gyp/0.10.28/src -I/Users/ambrosechua/.node-gyp/0.10.28/deps/uv/include -I/Users/ambrosechua/.node-gyp/0.10.28/deps/v8/include -I/Users/ambrosechua/Documents/School/EL/drama/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan -Os -gdwarf-2 -mmacosx-version-min=10.5 -arch x86_64 -Wall -Wendif-labels -W -Wno-unused-parameter -fno-rtti -fno-exceptions -fno-threadsafe-statics -fno-strict-aliasing -MMD -MF ./Release/.deps/Release/obj.target/bufferutil/src/bufferutil.o.d.raw -c -o Release/obj.target/bufferutil/src/bufferutil.o ../src/bufferutil.cc +Release/obj.target/bufferutil/src/bufferutil.o: ../src/bufferutil.cc \ + /Users/ambrosechua/.node-gyp/0.10.28/deps/v8/include/v8.h \ + /Users/ambrosechua/.node-gyp/0.10.28/deps/v8/include/v8stdint.h \ + /Users/ambrosechua/.node-gyp/0.10.28/src/node.h \ + /Users/ambrosechua/.node-gyp/0.10.28/deps/uv/include/uv.h \ + /Users/ambrosechua/.node-gyp/0.10.28/deps/uv/include/uv-private/uv-unix.h \ + /Users/ambrosechua/.node-gyp/0.10.28/deps/uv/include/uv-private/ngx-queue.h \ + /Users/ambrosechua/.node-gyp/0.10.28/deps/uv/include/uv-private/uv-darwin.h \ + /Users/ambrosechua/.node-gyp/0.10.28/src/node_object_wrap.h \ + /Users/ambrosechua/.node-gyp/0.10.28/src/node_buffer.h \ + /Users/ambrosechua/Documents/School/EL/drama/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan/nan.h +../src/bufferutil.cc: +/Users/ambrosechua/.node-gyp/0.10.28/deps/v8/include/v8.h: +/Users/ambrosechua/.node-gyp/0.10.28/deps/v8/include/v8stdint.h: +/Users/ambrosechua/.node-gyp/0.10.28/src/node.h: +/Users/ambrosechua/.node-gyp/0.10.28/deps/uv/include/uv.h: +/Users/ambrosechua/.node-gyp/0.10.28/deps/uv/include/uv-private/uv-unix.h: +/Users/ambrosechua/.node-gyp/0.10.28/deps/uv/include/uv-private/ngx-queue.h: +/Users/ambrosechua/.node-gyp/0.10.28/deps/uv/include/uv-private/uv-darwin.h: +/Users/ambrosechua/.node-gyp/0.10.28/src/node_object_wrap.h: +/Users/ambrosechua/.node-gyp/0.10.28/src/node_buffer.h: +/Users/ambrosechua/Documents/School/EL/drama/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan/nan.h: diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/.deps/Release/obj.target/validation/src/validation.o.d b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/.deps/Release/obj.target/validation/src/validation.o.d new file mode 100644 index 0000000..5cbd64a --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/.deps/Release/obj.target/validation/src/validation.o.d @@ -0,0 +1,23 @@ +cmd_Release/obj.target/validation/src/validation.o := c++ '-D_DARWIN_USE_64_BIT_INODE=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DBUILDING_NODE_EXTENSION' -I/Users/ambrosechua/.node-gyp/0.10.28/src -I/Users/ambrosechua/.node-gyp/0.10.28/deps/uv/include -I/Users/ambrosechua/.node-gyp/0.10.28/deps/v8/include -I/Users/ambrosechua/Documents/School/EL/drama/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan -Os -gdwarf-2 -mmacosx-version-min=10.5 -arch x86_64 -Wall -Wendif-labels -W -Wno-unused-parameter -fno-rtti -fno-exceptions -fno-threadsafe-statics -fno-strict-aliasing -MMD -MF ./Release/.deps/Release/obj.target/validation/src/validation.o.d.raw -c -o Release/obj.target/validation/src/validation.o ../src/validation.cc +Release/obj.target/validation/src/validation.o: ../src/validation.cc \ + /Users/ambrosechua/.node-gyp/0.10.28/deps/v8/include/v8.h \ + /Users/ambrosechua/.node-gyp/0.10.28/deps/v8/include/v8stdint.h \ + /Users/ambrosechua/.node-gyp/0.10.28/src/node.h \ + /Users/ambrosechua/.node-gyp/0.10.28/deps/uv/include/uv.h \ + /Users/ambrosechua/.node-gyp/0.10.28/deps/uv/include/uv-private/uv-unix.h \ + /Users/ambrosechua/.node-gyp/0.10.28/deps/uv/include/uv-private/ngx-queue.h \ + /Users/ambrosechua/.node-gyp/0.10.28/deps/uv/include/uv-private/uv-darwin.h \ + /Users/ambrosechua/.node-gyp/0.10.28/src/node_object_wrap.h \ + /Users/ambrosechua/.node-gyp/0.10.28/src/node_buffer.h \ + /Users/ambrosechua/Documents/School/EL/drama/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan/nan.h +../src/validation.cc: +/Users/ambrosechua/.node-gyp/0.10.28/deps/v8/include/v8.h: +/Users/ambrosechua/.node-gyp/0.10.28/deps/v8/include/v8stdint.h: +/Users/ambrosechua/.node-gyp/0.10.28/src/node.h: +/Users/ambrosechua/.node-gyp/0.10.28/deps/uv/include/uv.h: +/Users/ambrosechua/.node-gyp/0.10.28/deps/uv/include/uv-private/uv-unix.h: +/Users/ambrosechua/.node-gyp/0.10.28/deps/uv/include/uv-private/ngx-queue.h: +/Users/ambrosechua/.node-gyp/0.10.28/deps/uv/include/uv-private/uv-darwin.h: +/Users/ambrosechua/.node-gyp/0.10.28/src/node_object_wrap.h: +/Users/ambrosechua/.node-gyp/0.10.28/src/node_buffer.h: +/Users/ambrosechua/Documents/School/EL/drama/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan/nan.h: diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/.deps/Release/validation.node.d b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/.deps/Release/validation.node.d new file mode 100644 index 0000000..2f13adc --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/.deps/Release/validation.node.d @@ -0,0 +1 @@ +cmd_Release/validation.node := ./gyp-mac-tool flock ./Release/linker.lock c++ -bundle -Wl,-search_paths_first -mmacosx-version-min=10.5 -arch x86_64 -L./Release -o Release/validation.node Release/obj.target/validation/src/validation.o -undefined dynamic_lookup diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/bufferutil.node b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/bufferutil.node new file mode 100755 index 0000000..0a3fa56 Binary files /dev/null and b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/bufferutil.node differ diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/linker.lock b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/linker.lock new file mode 100644 index 0000000..e69de29 diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/obj.target/bufferutil/src/bufferutil.o b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/obj.target/bufferutil/src/bufferutil.o new file mode 100644 index 0000000..03167d6 Binary files /dev/null and b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/obj.target/bufferutil/src/bufferutil.o differ diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/obj.target/validation/src/validation.o b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/obj.target/validation/src/validation.o new file mode 100644 index 0000000..39ff5cb Binary files /dev/null and b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/obj.target/validation/src/validation.o differ diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/validation.node b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/validation.node new file mode 100755 index 0000000..7bea67a Binary files /dev/null and b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/validation.node differ diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/binding.Makefile b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/binding.Makefile new file mode 100644 index 0000000..5d26a45 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/binding.Makefile @@ -0,0 +1,6 @@ +# This file is generated by gyp; do not edit. + +export builddir_name ?= ./build/. +.PHONY: all +all: + $(MAKE) validation bufferutil diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/bufferutil.target.mk b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/bufferutil.target.mk new file mode 100644 index 0000000..5f7969b --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/bufferutil.target.mk @@ -0,0 +1,156 @@ +# This file is generated by gyp; do not edit. + +TOOLSET := target +TARGET := bufferutil +DEFS_Debug := \ + '-D_DARWIN_USE_64_BIT_INODE=1' \ + '-D_LARGEFILE_SOURCE' \ + '-D_FILE_OFFSET_BITS=64' \ + '-DBUILDING_NODE_EXTENSION' \ + '-DDEBUG' \ + '-D_DEBUG' + +# Flags passed to all source files. +CFLAGS_Debug := \ + -O0 \ + -gdwarf-2 \ + -mmacosx-version-min=10.5 \ + -arch x86_64 \ + -Wall \ + -Wendif-labels \ + -W \ + -Wno-unused-parameter + +# Flags passed to only C files. +CFLAGS_C_Debug := \ + -fno-strict-aliasing + +# Flags passed to only C++ files. +CFLAGS_CC_Debug := \ + -fno-rtti \ + -fno-exceptions \ + -fno-threadsafe-statics \ + -fno-strict-aliasing + +# Flags passed to only ObjC files. +CFLAGS_OBJC_Debug := + +# Flags passed to only ObjC++ files. +CFLAGS_OBJCC_Debug := + +INCS_Debug := \ + -I/Users/ambrosechua/.node-gyp/0.10.28/src \ + -I/Users/ambrosechua/.node-gyp/0.10.28/deps/uv/include \ + -I/Users/ambrosechua/.node-gyp/0.10.28/deps/v8/include \ + -I/Users/ambrosechua/Documents/School/EL/drama/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan + +DEFS_Release := \ + '-D_DARWIN_USE_64_BIT_INODE=1' \ + '-D_LARGEFILE_SOURCE' \ + '-D_FILE_OFFSET_BITS=64' \ + '-DBUILDING_NODE_EXTENSION' + +# Flags passed to all source files. +CFLAGS_Release := \ + -Os \ + -gdwarf-2 \ + -mmacosx-version-min=10.5 \ + -arch x86_64 \ + -Wall \ + -Wendif-labels \ + -W \ + -Wno-unused-parameter + +# Flags passed to only C files. +CFLAGS_C_Release := \ + -fno-strict-aliasing + +# Flags passed to only C++ files. +CFLAGS_CC_Release := \ + -fno-rtti \ + -fno-exceptions \ + -fno-threadsafe-statics \ + -fno-strict-aliasing + +# Flags passed to only ObjC files. +CFLAGS_OBJC_Release := + +# Flags passed to only ObjC++ files. +CFLAGS_OBJCC_Release := + +INCS_Release := \ + -I/Users/ambrosechua/.node-gyp/0.10.28/src \ + -I/Users/ambrosechua/.node-gyp/0.10.28/deps/uv/include \ + -I/Users/ambrosechua/.node-gyp/0.10.28/deps/v8/include \ + -I/Users/ambrosechua/Documents/School/EL/drama/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan + +OBJS := \ + $(obj).target/$(TARGET)/src/bufferutil.o + +# Add to the list of files we specially track dependencies for. +all_deps += $(OBJS) + +# CFLAGS et al overrides must be target-local. +# See "Target-specific Variable Values" in the GNU Make manual. +$(OBJS): TOOLSET := $(TOOLSET) +$(OBJS): GYP_CFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE)) +$(OBJS): GYP_CXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE)) +$(OBJS): GYP_OBJCFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE)) $(CFLAGS_OBJC_$(BUILDTYPE)) +$(OBJS): GYP_OBJCXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE)) $(CFLAGS_OBJCC_$(BUILDTYPE)) + +# Suffix rules, putting all outputs into $(obj). + +$(obj).$(TOOLSET)/$(TARGET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD + @$(call do_cmd,cxx,1) + +# Try building from generated source, too. + +$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD + @$(call do_cmd,cxx,1) + +$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj)/%.cc FORCE_DO_CMD + @$(call do_cmd,cxx,1) + +# End of this set of suffix rules +### Rules for final target. +LDFLAGS_Debug := \ + -Wl,-search_paths_first \ + -mmacosx-version-min=10.5 \ + -arch x86_64 \ + -L$(builddir) + +LIBTOOLFLAGS_Debug := \ + -Wl,-search_paths_first + +LDFLAGS_Release := \ + -Wl,-search_paths_first \ + -mmacosx-version-min=10.5 \ + -arch x86_64 \ + -L$(builddir) + +LIBTOOLFLAGS_Release := \ + -Wl,-search_paths_first + +LIBS := \ + -undefined dynamic_lookup + +$(builddir)/bufferutil.node: GYP_LDFLAGS := $(LDFLAGS_$(BUILDTYPE)) +$(builddir)/bufferutil.node: LIBS := $(LIBS) +$(builddir)/bufferutil.node: GYP_LIBTOOLFLAGS := $(LIBTOOLFLAGS_$(BUILDTYPE)) +$(builddir)/bufferutil.node: TOOLSET := $(TOOLSET) +$(builddir)/bufferutil.node: $(OBJS) FORCE_DO_CMD + $(call do_cmd,solink_module) + +all_deps += $(builddir)/bufferutil.node +# Add target alias +.PHONY: bufferutil +bufferutil: $(builddir)/bufferutil.node + +# Short alias for building this executable. +.PHONY: bufferutil.node +bufferutil.node: $(builddir)/bufferutil.node + +# Add executable to "all" target. +.PHONY: all +all: $(builddir)/bufferutil.node + diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/config.gypi b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/config.gypi new file mode 100644 index 0000000..c95986a --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/config.gypi @@ -0,0 +1,118 @@ +# Do not edit. File was generated by node-gyp's "configure" step +{ + "target_defaults": { + "cflags": [], + "default_configuration": "Release", + "defines": [], + "include_dirs": [], + "libraries": [] + }, + "variables": { + "clang": 1, + "host_arch": "x64", + "node_install_npm": "true", + "node_prefix": "", + "node_shared_cares": "false", + "node_shared_http_parser": "false", + "node_shared_libuv": "false", + "node_shared_openssl": "false", + "node_shared_v8": "false", + "node_shared_zlib": "false", + "node_tag": "", + "node_unsafe_optimizations": 0, + "node_use_dtrace": "true", + "node_use_etw": "false", + "node_use_openssl": "true", + "node_use_perfctr": "false", + "python": "/usr/bin/python", + "target_arch": "x64", + "v8_enable_gdbjit": 0, + "v8_no_strict_aliasing": 1, + "v8_use_snapshot": "false", + "nodedir": "/Users/ambrosechua/.node-gyp/0.10.28", + "copy_dev_lib": "true", + "standalone_static_library": 1, + "save_dev": "", + "browser": "", + "viewer": "man", + "rollback": "true", + "usage": "", + "globalignorefile": "/usr/local/etc/npmignore", + "init_author_url": "", + "shell": "/bin/zsh", + "parseable": "", + "shrinkwrap": "true", + "init_license": "ISC", + "cache_max": "Infinity", + "init_author_email": "", + "sign_git_tag": "", + "cert": "", + "git_tag_version": "true", + "local_address": "", + "long": "", + "registry": "https://registry.npmjs.org/", + "fetch_retries": "2", + "npat": "", + "key": "", + "message": "%s", + "versions": "", + "globalconfig": "/usr/local/etc/npmrc", + "always_auth": "", + "spin": "true", + "cache_lock_retries": "10", + "cafile": "", + "heading": "npm", + "fetch_retry_mintimeout": "10000", + "proprietary_attribs": "true", + "json": "", + "description": "true", + "engine_strict": "", + "https_proxy": "", + "init_module": "/Users/ambrosechua/.npm-init.js", + "userconfig": "/Users/ambrosechua/.npmrc", + "node_version": "0.10.28", + "user": "", + "editor": "st", + "save": "", + "tag": "latest", + "global": "", + "optional": "true", + "bin_links": "true", + "force": "", + "searchopts": "", + "depth": "Infinity", + "rebuild_bundle": "true", + "searchsort": "name", + "unicode": "true", + "fetch_retry_maxtimeout": "60000", + "ca": "", + "save_prefix": "^", + "strict_ssl": "true", + "dev": "", + "fetch_retry_factor": "10", + "group": "20", + "save_exact": "", + "cache_lock_stale": "60000", + "version": "", + "cache_min": "10", + "cache": "/Users/ambrosechua/.npm", + "searchexclude": "", + "color": "true", + "save_optional": "", + "user_agent": "npm/2.0.0-alpha-5 node/v0.10.28 darwin x64", + "ignore_scripts": "", + "cache_lock_wait": "10000", + "production": "", + "save_bundle": "", + "init_version": "0.0.0", + "umask": "18", + "git": "git", + "init_author_name": "", + "scope": "", + "onload_script": "", + "tmp": "/var/folders/3r/qppn0rs14qgdsxlvn5t_lhtm0000gp/T", + "unsafe_perm": "true", + "link": "", + "prefix": "/usr/local" + } +} diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/gyp-mac-tool b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/gyp-mac-tool new file mode 100755 index 0000000..7abfed5 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/gyp-mac-tool @@ -0,0 +1,512 @@ +#!/usr/bin/env python +# Generated by gyp. Do not edit. +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Utility functions to perform Xcode-style build steps. + +These functions are executed via gyp-mac-tool when using the Makefile generator. +""" + +import fcntl +import fnmatch +import glob +import json +import os +import plistlib +import re +import shutil +import string +import subprocess +import sys +import tempfile + + +def main(args): + executor = MacTool() + exit_code = executor.Dispatch(args) + if exit_code is not None: + sys.exit(exit_code) + + +class MacTool(object): + """This class performs all the Mac tooling steps. The methods can either be + executed directly, or dispatched from an argument list.""" + + def Dispatch(self, args): + """Dispatches a string command to a method.""" + if len(args) < 1: + raise Exception("Not enough arguments") + + method = "Exec%s" % self._CommandifyName(args[0]) + return getattr(self, method)(*args[1:]) + + def _CommandifyName(self, name_string): + """Transforms a tool name like copy-info-plist to CopyInfoPlist""" + return name_string.title().replace('-', '') + + def ExecCopyBundleResource(self, source, dest): + """Copies a resource file to the bundle/Resources directory, performing any + necessary compilation on each resource.""" + extension = os.path.splitext(source)[1].lower() + if os.path.isdir(source): + # Copy tree. + # TODO(thakis): This copies file attributes like mtime, while the + # single-file branch below doesn't. This should probably be changed to + # be consistent with the single-file branch. + if os.path.exists(dest): + shutil.rmtree(dest) + shutil.copytree(source, dest) + elif extension == '.xib': + return self._CopyXIBFile(source, dest) + elif extension == '.storyboard': + return self._CopyXIBFile(source, dest) + elif extension == '.strings': + self._CopyStringsFile(source, dest) + else: + shutil.copy(source, dest) + + def _CopyXIBFile(self, source, dest): + """Compiles a XIB file with ibtool into a binary plist in the bundle.""" + + # ibtool sometimes crashes with relative paths. See crbug.com/314728. + base = os.path.dirname(os.path.realpath(__file__)) + if os.path.relpath(source): + source = os.path.join(base, source) + if os.path.relpath(dest): + dest = os.path.join(base, dest) + + args = ['xcrun', 'ibtool', '--errors', '--warnings', '--notices', + '--output-format', 'human-readable-text', '--compile', dest, source] + ibtool_section_re = re.compile(r'/\*.*\*/') + ibtool_re = re.compile(r'.*note:.*is clipping its content') + ibtoolout = subprocess.Popen(args, stdout=subprocess.PIPE) + current_section_header = None + for line in ibtoolout.stdout: + if ibtool_section_re.match(line): + current_section_header = line + elif not ibtool_re.match(line): + if current_section_header: + sys.stdout.write(current_section_header) + current_section_header = None + sys.stdout.write(line) + return ibtoolout.returncode + + def _CopyStringsFile(self, source, dest): + """Copies a .strings file using iconv to reconvert the input into UTF-16.""" + input_code = self._DetectInputEncoding(source) or "UTF-8" + + # Xcode's CpyCopyStringsFile / builtin-copyStrings seems to call + # CFPropertyListCreateFromXMLData() behind the scenes; at least it prints + # CFPropertyListCreateFromXMLData(): Old-style plist parser: missing + # semicolon in dictionary. + # on invalid files. Do the same kind of validation. + import CoreFoundation + s = open(source, 'rb').read() + d = CoreFoundation.CFDataCreate(None, s, len(s)) + _, error = CoreFoundation.CFPropertyListCreateFromXMLData(None, d, 0, None) + if error: + return + + fp = open(dest, 'wb') + fp.write(s.decode(input_code).encode('UTF-16')) + fp.close() + + def _DetectInputEncoding(self, file_name): + """Reads the first few bytes from file_name and tries to guess the text + encoding. Returns None as a guess if it can't detect it.""" + fp = open(file_name, 'rb') + try: + header = fp.read(3) + except e: + fp.close() + return None + fp.close() + if header.startswith("\xFE\xFF"): + return "UTF-16" + elif header.startswith("\xFF\xFE"): + return "UTF-16" + elif header.startswith("\xEF\xBB\xBF"): + return "UTF-8" + else: + return None + + def ExecCopyInfoPlist(self, source, dest, *keys): + """Copies the |source| Info.plist to the destination directory |dest|.""" + # Read the source Info.plist into memory. + fd = open(source, 'r') + lines = fd.read() + fd.close() + + # Insert synthesized key/value pairs (e.g. BuildMachineOSBuild). + plist = plistlib.readPlistFromString(lines) + if keys: + plist = dict(plist.items() + json.loads(keys[0]).items()) + lines = plistlib.writePlistToString(plist) + + # Go through all the environment variables and replace them as variables in + # the file. + IDENT_RE = re.compile('[/\s]') + for key in os.environ: + if key.startswith('_'): + continue + evar = '${%s}' % key + evalue = os.environ[key] + lines = string.replace(lines, evar, evalue) + + # Xcode supports various suffices on environment variables, which are + # all undocumented. :rfc1034identifier is used in the standard project + # template these days, and :identifier was used earlier. They are used to + # convert non-url characters into things that look like valid urls -- + # except that the replacement character for :identifier, '_' isn't valid + # in a URL either -- oops, hence :rfc1034identifier was born. + evar = '${%s:identifier}' % key + evalue = IDENT_RE.sub('_', os.environ[key]) + lines = string.replace(lines, evar, evalue) + + evar = '${%s:rfc1034identifier}' % key + evalue = IDENT_RE.sub('-', os.environ[key]) + lines = string.replace(lines, evar, evalue) + + # Remove any keys with values that haven't been replaced. + lines = lines.split('\n') + for i in range(len(lines)): + if lines[i].strip().startswith("${"): + lines[i] = None + lines[i - 1] = None + lines = '\n'.join(filter(lambda x: x is not None, lines)) + + # Write out the file with variables replaced. + fd = open(dest, 'w') + fd.write(lines) + fd.close() + + # Now write out PkgInfo file now that the Info.plist file has been + # "compiled". + self._WritePkgInfo(dest) + + def _WritePkgInfo(self, info_plist): + """This writes the PkgInfo file from the data stored in Info.plist.""" + plist = plistlib.readPlist(info_plist) + if not plist: + return + + # Only create PkgInfo for executable types. + package_type = plist['CFBundlePackageType'] + if package_type != 'APPL': + return + + # The format of PkgInfo is eight characters, representing the bundle type + # and bundle signature, each four characters. If that is missing, four + # '?' characters are used instead. + signature_code = plist.get('CFBundleSignature', '????') + if len(signature_code) != 4: # Wrong length resets everything, too. + signature_code = '?' * 4 + + dest = os.path.join(os.path.dirname(info_plist), 'PkgInfo') + fp = open(dest, 'w') + fp.write('%s%s' % (package_type, signature_code)) + fp.close() + + def ExecFlock(self, lockfile, *cmd_list): + """Emulates the most basic behavior of Linux's flock(1).""" + # Rely on exception handling to report errors. + fd = os.open(lockfile, os.O_RDONLY|os.O_NOCTTY|os.O_CREAT, 0o666) + fcntl.flock(fd, fcntl.LOCK_EX) + return subprocess.call(cmd_list) + + def ExecFilterLibtool(self, *cmd_list): + """Calls libtool and filters out '/path/to/libtool: file: foo.o has no + symbols'.""" + libtool_re = re.compile(r'^.*libtool: file: .* has no symbols$') + libtoolout = subprocess.Popen(cmd_list, stderr=subprocess.PIPE) + _, err = libtoolout.communicate() + for line in err.splitlines(): + if not libtool_re.match(line): + print >>sys.stderr, line + return libtoolout.returncode + + def ExecPackageFramework(self, framework, version): + """Takes a path to Something.framework and the Current version of that and + sets up all the symlinks.""" + # Find the name of the binary based on the part before the ".framework". + binary = os.path.basename(framework).split('.')[0] + + CURRENT = 'Current' + RESOURCES = 'Resources' + VERSIONS = 'Versions' + + if not os.path.exists(os.path.join(framework, VERSIONS, version, binary)): + # Binary-less frameworks don't seem to contain symlinks (see e.g. + # chromium's out/Debug/org.chromium.Chromium.manifest/ bundle). + return + + # Move into the framework directory to set the symlinks correctly. + pwd = os.getcwd() + os.chdir(framework) + + # Set up the Current version. + self._Relink(version, os.path.join(VERSIONS, CURRENT)) + + # Set up the root symlinks. + self._Relink(os.path.join(VERSIONS, CURRENT, binary), binary) + self._Relink(os.path.join(VERSIONS, CURRENT, RESOURCES), RESOURCES) + + # Back to where we were before! + os.chdir(pwd) + + def _Relink(self, dest, link): + """Creates a symlink to |dest| named |link|. If |link| already exists, + it is overwritten.""" + if os.path.lexists(link): + os.remove(link) + os.symlink(dest, link) + + def ExecCodeSignBundle(self, key, resource_rules, entitlements, provisioning): + """Code sign a bundle. + + This function tries to code sign an iOS bundle, following the same + algorithm as Xcode: + 1. copy ResourceRules.plist from the user or the SDK into the bundle, + 2. pick the provisioning profile that best match the bundle identifier, + and copy it into the bundle as embedded.mobileprovision, + 3. copy Entitlements.plist from user or SDK next to the bundle, + 4. code sign the bundle. + """ + resource_rules_path = self._InstallResourceRules(resource_rules) + substitutions, overrides = self._InstallProvisioningProfile( + provisioning, self._GetCFBundleIdentifier()) + entitlements_path = self._InstallEntitlements( + entitlements, substitutions, overrides) + subprocess.check_call([ + 'codesign', '--force', '--sign', key, '--resource-rules', + resource_rules_path, '--entitlements', entitlements_path, + os.path.join( + os.environ['TARGET_BUILD_DIR'], + os.environ['FULL_PRODUCT_NAME'])]) + + def _InstallResourceRules(self, resource_rules): + """Installs ResourceRules.plist from user or SDK into the bundle. + + Args: + resource_rules: string, optional, path to the ResourceRules.plist file + to use, default to "${SDKROOT}/ResourceRules.plist" + + Returns: + Path to the copy of ResourceRules.plist into the bundle. + """ + source_path = resource_rules + target_path = os.path.join( + os.environ['BUILT_PRODUCTS_DIR'], + os.environ['CONTENTS_FOLDER_PATH'], + 'ResourceRules.plist') + if not source_path: + source_path = os.path.join( + os.environ['SDKROOT'], 'ResourceRules.plist') + shutil.copy2(source_path, target_path) + return target_path + + def _InstallProvisioningProfile(self, profile, bundle_identifier): + """Installs embedded.mobileprovision into the bundle. + + Args: + profile: string, optional, short name of the .mobileprovision file + to use, if empty or the file is missing, the best file installed + will be used + bundle_identifier: string, value of CFBundleIdentifier from Info.plist + + Returns: + A tuple containing two dictionary: variables substitutions and values + to overrides when generating the entitlements file. + """ + source_path, provisioning_data, team_id = self._FindProvisioningProfile( + profile, bundle_identifier) + target_path = os.path.join( + os.environ['BUILT_PRODUCTS_DIR'], + os.environ['CONTENTS_FOLDER_PATH'], + 'embedded.mobileprovision') + shutil.copy2(source_path, target_path) + substitutions = self._GetSubstitutions(bundle_identifier, team_id + '.') + return substitutions, provisioning_data['Entitlements'] + + def _FindProvisioningProfile(self, profile, bundle_identifier): + """Finds the .mobileprovision file to use for signing the bundle. + + Checks all the installed provisioning profiles (or if the user specified + the PROVISIONING_PROFILE variable, only consult it) and select the most + specific that correspond to the bundle identifier. + + Args: + profile: string, optional, short name of the .mobileprovision file + to use, if empty or the file is missing, the best file installed + will be used + bundle_identifier: string, value of CFBundleIdentifier from Info.plist + + Returns: + A tuple of the path to the selected provisioning profile, the data of + the embedded plist in the provisioning profile and the team identifier + to use for code signing. + + Raises: + SystemExit: if no .mobileprovision can be used to sign the bundle. + """ + profiles_dir = os.path.join( + os.environ['HOME'], 'Library', 'MobileDevice', 'Provisioning Profiles') + if not os.path.isdir(profiles_dir): + print >>sys.stderr, ( + 'cannot find mobile provisioning for %s' % bundle_identifier) + sys.exit(1) + provisioning_profiles = None + if profile: + profile_path = os.path.join(profiles_dir, profile + '.mobileprovision') + if os.path.exists(profile_path): + provisioning_profiles = [profile_path] + if not provisioning_profiles: + provisioning_profiles = glob.glob( + os.path.join(profiles_dir, '*.mobileprovision')) + valid_provisioning_profiles = {} + for profile_path in provisioning_profiles: + profile_data = self._LoadProvisioningProfile(profile_path) + app_id_pattern = profile_data.get( + 'Entitlements', {}).get('application-identifier', '') + for team_identifier in profile_data.get('TeamIdentifier', []): + app_id = '%s.%s' % (team_identifier, bundle_identifier) + if fnmatch.fnmatch(app_id, app_id_pattern): + valid_provisioning_profiles[app_id_pattern] = ( + profile_path, profile_data, team_identifier) + if not valid_provisioning_profiles: + print >>sys.stderr, ( + 'cannot find mobile provisioning for %s' % bundle_identifier) + sys.exit(1) + # If the user has multiple provisioning profiles installed that can be + # used for ${bundle_identifier}, pick the most specific one (ie. the + # provisioning profile whose pattern is the longest). + selected_key = max(valid_provisioning_profiles, key=lambda v: len(v)) + return valid_provisioning_profiles[selected_key] + + def _LoadProvisioningProfile(self, profile_path): + """Extracts the plist embedded in a provisioning profile. + + Args: + profile_path: string, path to the .mobileprovision file + + Returns: + Content of the plist embedded in the provisioning profile as a dictionary. + """ + with tempfile.NamedTemporaryFile() as temp: + subprocess.check_call([ + 'security', 'cms', '-D', '-i', profile_path, '-o', temp.name]) + return self._LoadPlistMaybeBinary(temp.name) + + def _LoadPlistMaybeBinary(self, plist_path): + """Loads into a memory a plist possibly encoded in binary format. + + This is a wrapper around plistlib.readPlist that tries to convert the + plist to the XML format if it can't be parsed (assuming that it is in + the binary format). + + Args: + plist_path: string, path to a plist file, in XML or binary format + + Returns: + Content of the plist as a dictionary. + """ + try: + # First, try to read the file using plistlib that only supports XML, + # and if an exception is raised, convert a temporary copy to XML and + # load that copy. + return plistlib.readPlist(plist_path) + except: + pass + with tempfile.NamedTemporaryFile() as temp: + shutil.copy2(plist_path, temp.name) + subprocess.check_call(['plutil', '-convert', 'xml1', temp.name]) + return plistlib.readPlist(temp.name) + + def _GetSubstitutions(self, bundle_identifier, app_identifier_prefix): + """Constructs a dictionary of variable substitutions for Entitlements.plist. + + Args: + bundle_identifier: string, value of CFBundleIdentifier from Info.plist + app_identifier_prefix: string, value for AppIdentifierPrefix + + Returns: + Dictionary of substitutions to apply when generating Entitlements.plist. + """ + return { + 'CFBundleIdentifier': bundle_identifier, + 'AppIdentifierPrefix': app_identifier_prefix, + } + + def _GetCFBundleIdentifier(self): + """Extracts CFBundleIdentifier value from Info.plist in the bundle. + + Returns: + Value of CFBundleIdentifier in the Info.plist located in the bundle. + """ + info_plist_path = os.path.join( + os.environ['TARGET_BUILD_DIR'], + os.environ['INFOPLIST_PATH']) + info_plist_data = self._LoadPlistMaybeBinary(info_plist_path) + return info_plist_data['CFBundleIdentifier'] + + def _InstallEntitlements(self, entitlements, substitutions, overrides): + """Generates and install the ${BundleName}.xcent entitlements file. + + Expands variables "$(variable)" pattern in the source entitlements file, + add extra entitlements defined in the .mobileprovision file and the copy + the generated plist to "${BundlePath}.xcent". + + Args: + entitlements: string, optional, path to the Entitlements.plist template + to use, defaults to "${SDKROOT}/Entitlements.plist" + substitutions: dictionary, variable substitutions + overrides: dictionary, values to add to the entitlements + + Returns: + Path to the generated entitlements file. + """ + source_path = entitlements + target_path = os.path.join( + os.environ['BUILT_PRODUCTS_DIR'], + os.environ['PRODUCT_NAME'] + '.xcent') + if not source_path: + source_path = os.path.join( + os.environ['SDKROOT'], + 'Entitlements.plist') + shutil.copy2(source_path, target_path) + data = self._LoadPlistMaybeBinary(target_path) + data = self._ExpandVariables(data, substitutions) + if overrides: + for key in overrides: + if key not in data: + data[key] = overrides[key] + plistlib.writePlist(data, target_path) + return target_path + + def _ExpandVariables(self, data, substitutions): + """Expands variables "$(variable)" in data. + + Args: + data: object, can be either string, list or dictionary + substitutions: dictionary, variable substitutions to perform + + Returns: + Copy of data where each references to "$(variable)" has been replaced + by the corresponding value found in substitutions, or left intact if + the key was not found. + """ + if isinstance(data, str): + for key, value in substitutions.iteritems(): + data = data.replace('$(%s)' % key, value) + return data + if isinstance(data, list): + return [self._ExpandVariables(v, substitutions) for v in data] + if isinstance(data, dict): + return dict((k, self._ExpandVariables(data[k], + substitutions)) for k in data) + return data + +if __name__ == '__main__': + sys.exit(main(sys.argv[1:])) diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/validation.target.mk b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/validation.target.mk new file mode 100644 index 0000000..c4071c0 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/validation.target.mk @@ -0,0 +1,156 @@ +# This file is generated by gyp; do not edit. + +TOOLSET := target +TARGET := validation +DEFS_Debug := \ + '-D_DARWIN_USE_64_BIT_INODE=1' \ + '-D_LARGEFILE_SOURCE' \ + '-D_FILE_OFFSET_BITS=64' \ + '-DBUILDING_NODE_EXTENSION' \ + '-DDEBUG' \ + '-D_DEBUG' + +# Flags passed to all source files. +CFLAGS_Debug := \ + -O0 \ + -gdwarf-2 \ + -mmacosx-version-min=10.5 \ + -arch x86_64 \ + -Wall \ + -Wendif-labels \ + -W \ + -Wno-unused-parameter + +# Flags passed to only C files. +CFLAGS_C_Debug := \ + -fno-strict-aliasing + +# Flags passed to only C++ files. +CFLAGS_CC_Debug := \ + -fno-rtti \ + -fno-exceptions \ + -fno-threadsafe-statics \ + -fno-strict-aliasing + +# Flags passed to only ObjC files. +CFLAGS_OBJC_Debug := + +# Flags passed to only ObjC++ files. +CFLAGS_OBJCC_Debug := + +INCS_Debug := \ + -I/Users/ambrosechua/.node-gyp/0.10.28/src \ + -I/Users/ambrosechua/.node-gyp/0.10.28/deps/uv/include \ + -I/Users/ambrosechua/.node-gyp/0.10.28/deps/v8/include \ + -I/Users/ambrosechua/Documents/School/EL/drama/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan + +DEFS_Release := \ + '-D_DARWIN_USE_64_BIT_INODE=1' \ + '-D_LARGEFILE_SOURCE' \ + '-D_FILE_OFFSET_BITS=64' \ + '-DBUILDING_NODE_EXTENSION' + +# Flags passed to all source files. +CFLAGS_Release := \ + -Os \ + -gdwarf-2 \ + -mmacosx-version-min=10.5 \ + -arch x86_64 \ + -Wall \ + -Wendif-labels \ + -W \ + -Wno-unused-parameter + +# Flags passed to only C files. +CFLAGS_C_Release := \ + -fno-strict-aliasing + +# Flags passed to only C++ files. +CFLAGS_CC_Release := \ + -fno-rtti \ + -fno-exceptions \ + -fno-threadsafe-statics \ + -fno-strict-aliasing + +# Flags passed to only ObjC files. +CFLAGS_OBJC_Release := + +# Flags passed to only ObjC++ files. +CFLAGS_OBJCC_Release := + +INCS_Release := \ + -I/Users/ambrosechua/.node-gyp/0.10.28/src \ + -I/Users/ambrosechua/.node-gyp/0.10.28/deps/uv/include \ + -I/Users/ambrosechua/.node-gyp/0.10.28/deps/v8/include \ + -I/Users/ambrosechua/Documents/School/EL/drama/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan + +OBJS := \ + $(obj).target/$(TARGET)/src/validation.o + +# Add to the list of files we specially track dependencies for. +all_deps += $(OBJS) + +# CFLAGS et al overrides must be target-local. +# See "Target-specific Variable Values" in the GNU Make manual. +$(OBJS): TOOLSET := $(TOOLSET) +$(OBJS): GYP_CFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE)) +$(OBJS): GYP_CXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE)) +$(OBJS): GYP_OBJCFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE)) $(CFLAGS_OBJC_$(BUILDTYPE)) +$(OBJS): GYP_OBJCXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE)) $(CFLAGS_OBJCC_$(BUILDTYPE)) + +# Suffix rules, putting all outputs into $(obj). + +$(obj).$(TOOLSET)/$(TARGET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD + @$(call do_cmd,cxx,1) + +# Try building from generated source, too. + +$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD + @$(call do_cmd,cxx,1) + +$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj)/%.cc FORCE_DO_CMD + @$(call do_cmd,cxx,1) + +# End of this set of suffix rules +### Rules for final target. +LDFLAGS_Debug := \ + -Wl,-search_paths_first \ + -mmacosx-version-min=10.5 \ + -arch x86_64 \ + -L$(builddir) + +LIBTOOLFLAGS_Debug := \ + -Wl,-search_paths_first + +LDFLAGS_Release := \ + -Wl,-search_paths_first \ + -mmacosx-version-min=10.5 \ + -arch x86_64 \ + -L$(builddir) + +LIBTOOLFLAGS_Release := \ + -Wl,-search_paths_first + +LIBS := \ + -undefined dynamic_lookup + +$(builddir)/validation.node: GYP_LDFLAGS := $(LDFLAGS_$(BUILDTYPE)) +$(builddir)/validation.node: LIBS := $(LIBS) +$(builddir)/validation.node: GYP_LIBTOOLFLAGS := $(LIBTOOLFLAGS_$(BUILDTYPE)) +$(builddir)/validation.node: TOOLSET := $(TOOLSET) +$(builddir)/validation.node: $(OBJS) FORCE_DO_CMD + $(call do_cmd,solink_module) + +all_deps += $(builddir)/validation.node +# Add target alias +.PHONY: validation +validation: $(builddir)/validation.node + +# Short alias for building this executable. +.PHONY: validation.node +validation.node: $(builddir)/validation.node + +# Add executable to "all" target. +.PHONY: all +all: $(builddir)/validation.node + diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/builderror.log b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/builderror.log new file mode 100644 index 0000000..e69de29 diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/doc/ws.md b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/doc/ws.md new file mode 100644 index 0000000..d84fd62 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/doc/ws.md @@ -0,0 +1,181 @@ +# ws + +## Class: ws.Server + +This class is a WebSocket server. It is an `EventEmitter`. + +### new ws.Server([options], [callback]) + +* `options` Object + * `host` String + * `port` Number + * `server` http.Server + * `verifyClient` Function + * `path` String + * `noServer` Boolean + * `disableHixie` Boolean + * `clientTracking` Boolean +* `callback` Function + +Construct a new server object. + +Either `port` or `server` must be provided, otherwise you might enable +`noServer` if you want to pass the requests directly. Please note that the +`callback` is only used when you supply the a `port` number in the options. + +### server.close([code], [data]) + +Close the server and terminate all clients + +### server.handleUpgrade(request, socket, upgradeHead, callback) + +Handles a HTTP Upgrade request. `request` is an instance of `http.ServerRequest`, `socket` is an instance of `net.Socket`. + +When the Upgrade was successfully, the `callback` will be called with a `ws.WebSocket` object as parameter. + +### Event: 'error' + +`function (error) { }` + +If the underlying server emits an error, it will be forwarded here. + +### Event: 'headers' + +`function (headers) { }` + +Emitted with the object of HTTP headers that are going to be written to the `Stream` as part of the handshake. + +### Event: 'connection' + +`function (socket) { }` + +When a new WebSocket connection is established. `socket` is an object of type `ws.WebSocket`. + + +## Class: ws.WebSocket + +This class represents a WebSocket connection. It is an `EventEmitter`. + +### new ws.WebSocket(address, [options]) + +* `address` String|Array +* `options` Object + * `protocol` String + * `agent` Agent + * `headers` Object + * `protocolVersion` Number|String + -- the following only apply if `address` is a String + * `host` String + * `origin` String + * `pfx` String|Buffer + * `key` String|Buffer + * `passphrase` String + * `cert` String|Buffer + * `ca` Array + * `ciphers` String + * `rejectUnauthorized` Boolean + +Instantiating with an `address` creates a new WebSocket client object. If `address` is an Array (request, socket, rest), it is instantiated as a Server client (e.g. called from the `ws.Server`). + +### websocket.bytesReceived + +Received bytes count. + +### websocket.readyState + +Possible states are `WebSocket.CONNECTING`, `WebSocket.OPEN`, `WebSocket.CLOSING`, `WebSocket.CLOSED`. + +### websocket.protocolVersion + +The WebSocket protocol version used for this connection, `8`, `13` or `hixie-76` (the latter only for server clients). + +### websocket.url + +The URL of the WebSocket server (only for clients) + +### websocket.supports + +Describes the feature of the used protocol version. E.g. `supports.binary` is a boolean that describes if the connection supports binary messages. + +### websocket.close([code], [data]) + +Gracefully closes the connection, after sending a description message + +### websocket.pause() + +Pause the client stream + +### websocket.ping([data], [options], [dontFailWhenClosed]) + +Sends a ping. `data` is sent, `options` is an object with members `mask` and `binary`. `dontFailWhenClosed` indicates whether or not to throw if the connection isnt open. + +### websocket.pong([data], [options], [dontFailWhenClosed]) + +Sends a pong. `data` is sent, `options` is an object with members `mask` and `binary`. `dontFailWhenClosed` indicates whether or not to throw if the connection isnt open. + + +### websocket.resume() + +Resume the client stream + +### websocket.send(data, [options], [callback]) + +Sends `data` through the connection. `options` can be an object with members `mask` and `binary`. The optional `callback` is executed after the send completes. + +### websocket.stream([options], callback) + +Streams data through calls to a user supplied function. `options` can be an object with members `mask` and `binary`. `callback` is executed on successive ticks of which send is `function (data, final)`. + +### websocket.terminate() + +Immediately shuts down the connection + +### websocket.onopen +### websocket.onerror +### websocket.onclose +### websocket.onmessage + +Emulates the W3C Browser based WebSocket interface using function members. + +### websocket.addEventListener(method, listener) + +Emulates the W3C Browser based WebSocket interface using addEventListener. + +### Event: 'error' + +`function (error) { }` + +If the client emits an error, this event is emitted (errors from the underlying `net.Socket` are forwarded here). + +### Event: 'close' + +`function (code, message) { }` + +Is emitted when the connection is closed. `code` is defined in the WebSocket specification. + +The `close` event is also emitted when then underlying `net.Socket` closes the connection (`end` or `close`). + +### Event: 'message' + +`function (data, flags) { }` + +Is emitted when data is received. `flags` is an object with member `binary`. + +### Event: 'ping' + +`function (data, flags) { }` + +Is emitted when a ping is received. `flags` is an object with member `binary`. + +### Event: 'pong' + +`function (data, flags) { }` + +Is emitted when a pong is received. `flags` is an object with member `binary`. + +### Event: 'open' + +`function () { }` + +Emitted when the connection is established. + diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/examples/fileapi/.npmignore b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/examples/fileapi/.npmignore new file mode 100644 index 0000000..dcd5756 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/examples/fileapi/.npmignore @@ -0,0 +1 @@ +uploaded diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/examples/fileapi/package.json b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/examples/fileapi/package.json new file mode 100644 index 0000000..7816f27 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/examples/fileapi/package.json @@ -0,0 +1,18 @@ +{ + "author": "", + "name": "fileapi", + "version": "0.0.0", + "repository": { + "type": "git", + "url": "git://github.com/einaros/ws.git" + }, + "engines": { + "node": "~0.6.8" + }, + "dependencies": { + "express": "latest", + "ansi": "https://github.com/einaros/ansi.js/tarball/master" + }, + "devDependencies": {}, + "optionalDependencies": {} +} diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/examples/fileapi/public/app.js b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/examples/fileapi/public/app.js new file mode 100644 index 0000000..e812cc3 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/examples/fileapi/public/app.js @@ -0,0 +1,39 @@ +function onFilesSelected(e) { + var button = e.srcElement; + button.disabled = true; + var progress = document.querySelector('div#progress'); + progress.innerHTML = '0%'; + var files = e.target.files; + var totalFiles = files.length; + var filesSent = 0; + if (totalFiles) { + var uploader = new Uploader('ws://localhost:8080', function () { + Array.prototype.slice.call(files, 0).forEach(function(file) { + if (file.name == '.') { + --totalFiles; + return; + } + uploader.sendFile(file, function(error) { + if (error) { + console.log(error); + return; + } + ++filesSent; + progress.innerHTML = ~~(filesSent / totalFiles * 100) + '%'; + console.log('Sent: ' + file.name); + }); + }); + }); + } + uploader.ondone = function() { + uploader.close(); + progress.innerHTML = '100% done, ' + totalFiles + ' files sent.'; + } +} + +window.onload = function() { + var importButtons = document.querySelectorAll('[type="file"]'); + Array.prototype.slice.call(importButtons, 0).forEach(function(importButton) { + importButton.addEventListener('change', onFilesSelected, false); + }); +} diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/examples/fileapi/public/index.html b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/examples/fileapi/public/index.html new file mode 100644 index 0000000..0d463dd --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/examples/fileapi/public/index.html @@ -0,0 +1,22 @@ + + + + + + + + +

This example will upload an entire directory tree to the node.js server via a fast and persistent WebSocket connection.

+

Note that the example is Chrome only for now.

+

+ Upload status: +
Please select a directory to upload.
+ + diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/examples/fileapi/public/uploader.js b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/examples/fileapi/public/uploader.js new file mode 100644 index 0000000..0c34a7f --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/examples/fileapi/public/uploader.js @@ -0,0 +1,55 @@ +function Uploader(url, cb) { + this.ws = new WebSocket(url); + if (cb) this.ws.onopen = cb; + this.sendQueue = []; + this.sending = null; + this.sendCallback = null; + this.ondone = null; + var self = this; + this.ws.onmessage = function(event) { + var data = JSON.parse(event.data); + if (data.event == 'complete') { + if (data.path != self.sending.path) { + self.sendQueue = []; + self.sending = null; + self.sendCallback = null; + throw new Error('Got message for wrong file!'); + } + self.sending = null; + var callback = self.sendCallback; + self.sendCallback = null; + if (callback) callback(); + if (self.sendQueue.length === 0 && self.ondone) self.ondone(null); + if (self.sendQueue.length > 0) { + var args = self.sendQueue.pop(); + setTimeout(function() { self.sendFile.apply(self, args); }, 0); + } + } + else if (data.event == 'error') { + self.sendQueue = []; + self.sending = null; + var callback = self.sendCallback; + self.sendCallback = null; + var error = new Error('Server reported send error for file ' + data.path); + if (callback) callback(error); + if (self.ondone) self.ondone(error); + } + } +} + +Uploader.prototype.sendFile = function(file, cb) { + if (this.ws.readyState != WebSocket.OPEN) throw new Error('Not connected'); + if (this.sending) { + this.sendQueue.push(arguments); + return; + } + var fileData = { name: file.name, path: file.webkitRelativePath }; + this.sending = fileData; + this.sendCallback = cb; + this.ws.send(JSON.stringify(fileData)); + this.ws.send(file); +} + +Uploader.prototype.close = function() { + this.ws.close(); +} diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/examples/fileapi/server.js b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/examples/fileapi/server.js new file mode 100644 index 0000000..badfeba --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/examples/fileapi/server.js @@ -0,0 +1,103 @@ +var WebSocketServer = require('../../').Server + , express = require('express') + , fs = require('fs') + , http = require('http') + , util = require('util') + , path = require('path') + , app = express.createServer() + , events = require('events') + , ansi = require('ansi') + , cursor = ansi(process.stdout); + +function BandwidthSampler(ws, interval) { + interval = interval || 2000; + var previousByteCount = 0; + var self = this; + var intervalId = setInterval(function() { + var byteCount = ws.bytesReceived; + var bytesPerSec = (byteCount - previousByteCount) / (interval / 1000); + previousByteCount = byteCount; + self.emit('sample', bytesPerSec); + }, interval); + ws.on('close', function() { + clearInterval(intervalId); + }); +} +util.inherits(BandwidthSampler, events.EventEmitter); + +function makePathForFile(filePath, prefix, cb) { + if (typeof cb !== 'function') throw new Error('callback is required'); + filePath = path.dirname(path.normalize(filePath)).replace(/^(\/|\\)+/, ''); + var pieces = filePath.split(/(\\|\/)/); + var incrementalPath = prefix; + function step(error) { + if (error) return cb(error); + if (pieces.length == 0) return cb(null, incrementalPath); + incrementalPath += '/' + pieces.shift(); + fs.exists(incrementalPath, function(exists) { + if (!exists) fs.mkdir(incrementalPath, step); + else process.nextTick(step); + }); + } + step(); +} + +cursor.eraseData(2).goto(1, 1); +app.use(express.static(__dirname + '/public')); + +var clientId = 0; +var wss = new WebSocketServer({server: app}); +wss.on('connection', function(ws) { + var thisId = ++clientId; + cursor.goto(1, 4 + thisId).eraseLine(); + console.log('Client #%d connected', thisId); + + var sampler = new BandwidthSampler(ws); + sampler.on('sample', function(bps) { + cursor.goto(1, 4 + thisId).eraseLine(); + console.log('WebSocket #%d incoming bandwidth: %d MB/s', thisId, Math.round(bps / (1024*1024))); + }); + + var filesReceived = 0; + var currentFile = null; + ws.on('message', function(data, flags) { + if (!flags.binary) { + currentFile = JSON.parse(data); + // note: a real-world app would want to sanity check the data + } + else { + if (currentFile == null) return; + makePathForFile(currentFile.path, __dirname + '/uploaded', function(error, path) { + if (error) { + console.log(error); + ws.send(JSON.stringify({event: 'error', path: currentFile.path, message: error.message})); + return; + } + fs.writeFile(path + '/' + currentFile.name, data, function(error) { + ++filesReceived; + // console.log('received %d bytes long file, %s', data.length, currentFile.path); + ws.send(JSON.stringify({event: 'complete', path: currentFile.path})); + currentFile = null; + }); + }); + } + }); + + ws.on('close', function() { + cursor.goto(1, 4 + thisId).eraseLine(); + console.log('Client #%d disconnected. %d files received.', thisId, filesReceived); + }); + + ws.on('error', function(e) { + cursor.goto(1, 4 + thisId).eraseLine(); + console.log('Client #%d error: %s', thisId, e.message); + }); +}); + +fs.mkdir(__dirname + '/uploaded', function(error) { + // ignore errors, most likely means directory exists + console.log('Uploaded files will be saved to %s/uploaded.', __dirname); + console.log('Remember to wipe this directory if you upload lots and lots.'); + app.listen(8080); + console.log('Listening on http://localhost:8080'); +}); diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/examples/serverstats-express_3/package.json b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/examples/serverstats-express_3/package.json new file mode 100644 index 0000000..99722c4 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/examples/serverstats-express_3/package.json @@ -0,0 +1,17 @@ +{ + "author": "", + "name": "serverstats", + "version": "0.0.0", + "repository": { + "type": "git", + "url": "git://github.com/einaros/ws.git" + }, + "engines": { + "node": ">0.4.0" + }, + "dependencies": { + "express": "~3.0.0" + }, + "devDependencies": {}, + "optionalDependencies": {} +} diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/examples/serverstats-express_3/public/index.html b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/examples/serverstats-express_3/public/index.html new file mode 100644 index 0000000..24d84e1 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/examples/serverstats-express_3/public/index.html @@ -0,0 +1,33 @@ + + + + + + + + Server Stats
+ RSS:

+ Heap total:

+ Heap used:

+ + diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/examples/serverstats-express_3/server.js b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/examples/serverstats-express_3/server.js new file mode 100644 index 0000000..88bbc9e --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/examples/serverstats-express_3/server.js @@ -0,0 +1,21 @@ +var WebSocketServer = require('../../').Server + , http = require('http') + , express = require('express') + , app = express(); + +app.use(express.static(__dirname + '/public')); + +var server = http.createServer(app); +server.listen(8080); + +var wss = new WebSocketServer({server: server}); +wss.on('connection', function(ws) { + var id = setInterval(function() { + ws.send(JSON.stringify(process.memoryUsage()), function() { /* ignore errors */ }); + }, 100); + console.log('started client interval'); + ws.on('close', function() { + console.log('stopping client interval'); + clearInterval(id); + }); +}); diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/examples/serverstats/package.json b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/examples/serverstats/package.json new file mode 100644 index 0000000..65c900a --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/examples/serverstats/package.json @@ -0,0 +1,17 @@ +{ + "author": "", + "name": "serverstats", + "version": "0.0.0", + "repository": { + "type": "git", + "url": "git://github.com/einaros/ws.git" + }, + "engines": { + "node": ">0.4.0" + }, + "dependencies": { + "express": "2.x" + }, + "devDependencies": {}, + "optionalDependencies": {} +} diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/examples/serverstats/public/index.html b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/examples/serverstats/public/index.html new file mode 100644 index 0000000..24d84e1 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/examples/serverstats/public/index.html @@ -0,0 +1,33 @@ + + + + + + + + Server Stats
+ RSS:

+ Heap total:

+ Heap used:

+ + diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/examples/serverstats/server.js b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/examples/serverstats/server.js new file mode 100644 index 0000000..0bbce36 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/examples/serverstats/server.js @@ -0,0 +1,19 @@ +var WebSocketServer = require('../../').Server + , http = require('http') + , express = require('express') + , app = express.createServer(); + +app.use(express.static(__dirname + '/public')); +app.listen(8080); + +var wss = new WebSocketServer({server: app}); +wss.on('connection', function(ws) { + var id = setInterval(function() { + ws.send(JSON.stringify(process.memoryUsage()), function() { /* ignore errors */ }); + }, 100); + console.log('started client interval'); + ws.on('close', function() { + console.log('stopping client interval'); + clearInterval(id); + }) +}); diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/examples/ssl.js b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/examples/ssl.js new file mode 100644 index 0000000..bf1bf53 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/examples/ssl.js @@ -0,0 +1,59 @@ + +(function(){ + + "use strict"; + + var fs = require('fs'); + + // you'll probably load configuration from config + var cfg = { + ssl: true, + port: 8080, + ssl_key: '/path/to/you/ssl.key', + ssl_cert: '/path/to/you/ssl.crt' + }; + + var httpServ = ( cfg.ssl ) ? require('https') : require('http'); + + var WebSocketServer = require('../').Server; + + var app = null; + + // dummy request processing + var processRequest = function( req, res ) { + + res.writeHead(200); + res.end("All glory to WebSockets!\n"); + }; + + if ( cfg.ssl ) { + + app = httpServ.createServer({ + + // providing server with SSL key/cert + key: fs.readFileSync( cfg.ssl_key ), + cert: fs.readFileSync( cfg.ssl_cert ) + + }, processRequest ).listen( cfg.port ); + + } else { + + app = httpServ.createServer( processRequest ).listen( cfg.port ); + } + + // passing or reference to web server so WS would knew port and SSL capabilities + var wss = new WebSocketServer( { server: app } ); + + + wss.on( 'connection', function ( wsConnect ) { + + wsConnect.on( 'message', function ( message ) { + + console.log( message ); + + }); + + }); + + +}()); \ No newline at end of file diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/index.js b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/index.js new file mode 100644 index 0000000..3423ff2 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/index.js @@ -0,0 +1,26 @@ +/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ + +module.exports = require('./lib/WebSocket'); +module.exports.Server = require('./lib/WebSocketServer'); +module.exports.Sender = require('./lib/Sender'); +module.exports.Receiver = require('./lib/Receiver'); + +module.exports.createServer = function (options, connectionListener) { + var server = new module.exports.Server(options); + if (typeof connectionListener === 'function') { + server.on('connection', connectionListener); + } + return server; +}; + +module.exports.connect = module.exports.createConnection = function (address, openListener) { + var client = new module.exports(address); + if (typeof openListener === 'function') { + client.on('open', openListener); + } + return client; +}; diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/BufferPool.js b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/BufferPool.js new file mode 100644 index 0000000..faf8637 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/BufferPool.js @@ -0,0 +1,59 @@ +/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ + +var util = require('util'); + +function BufferPool(initialSize, growStrategy, shrinkStrategy) { + if (typeof initialSize === 'function') { + shrinkStrategy = growStrategy; + growStrategy = initialSize; + initialSize = 0; + } + else if (typeof initialSize === 'undefined') { + initialSize = 0; + } + this._growStrategy = (growStrategy || function(db, size) { + return db.used + size; + }).bind(null, this); + this._shrinkStrategy = (shrinkStrategy || function(db) { + return initialSize; + }).bind(null, this); + this._buffer = initialSize ? new Buffer(initialSize) : null; + this._offset = 0; + this._used = 0; + this._changeFactor = 0; + this.__defineGetter__('size', function(){ + return this._buffer == null ? 0 : this._buffer.length; + }); + this.__defineGetter__('used', function(){ + return this._used; + }); +} + +BufferPool.prototype.get = function(length) { + if (this._buffer == null || this._offset + length > this._buffer.length) { + var newBuf = new Buffer(this._growStrategy(length)); + this._buffer = newBuf; + this._offset = 0; + } + this._used += length; + var buf = this._buffer.slice(this._offset, this._offset + length); + this._offset += length; + return buf; +} + +BufferPool.prototype.reset = function(forceNewBuffer) { + var len = this._shrinkStrategy(); + if (len < this.size) this._changeFactor -= 1; + if (forceNewBuffer || this._changeFactor < -2) { + this._changeFactor = 0; + this._buffer = len ? new Buffer(len) : null; + } + this._offset = 0; + this._used = 0; +} + +module.exports = BufferPool; diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/BufferUtil.fallback.js b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/BufferUtil.fallback.js new file mode 100644 index 0000000..508542c --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/BufferUtil.fallback.js @@ -0,0 +1,47 @@ +/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ + +module.exports.BufferUtil = { + merge: function(mergedBuffer, buffers) { + var offset = 0; + for (var i = 0, l = buffers.length; i < l; ++i) { + var buf = buffers[i]; + buf.copy(mergedBuffer, offset); + offset += buf.length; + } + }, + mask: function(source, mask, output, offset, length) { + var maskNum = mask.readUInt32LE(0, true); + var i = 0; + for (; i < length - 3; i += 4) { + var num = maskNum ^ source.readUInt32LE(i, true); + if (num < 0) num = 4294967296 + num; + output.writeUInt32LE(num, offset + i, true); + } + switch (length % 4) { + case 3: output[offset + i + 2] = source[i + 2] ^ mask[2]; + case 2: output[offset + i + 1] = source[i + 1] ^ mask[1]; + case 1: output[offset + i] = source[i] ^ mask[0]; + case 0:; + } + }, + unmask: function(data, mask) { + var maskNum = mask.readUInt32LE(0, true); + var length = data.length; + var i = 0; + for (; i < length - 3; i += 4) { + var num = maskNum ^ data.readUInt32LE(i, true); + if (num < 0) num = 4294967296 + num; + data.writeUInt32LE(num, i, true); + } + switch (length % 4) { + case 3: data[i + 2] = data[i + 2] ^ mask[2]; + case 2: data[i + 1] = data[i + 1] ^ mask[1]; + case 1: data[i] = data[i] ^ mask[0]; + case 0:; + } + } +} diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/BufferUtil.js b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/BufferUtil.js new file mode 100644 index 0000000..15d35b9 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/BufferUtil.js @@ -0,0 +1,16 @@ +/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ + +try { + module.exports = require('../build/Release/bufferutil'); +} catch (e) { try { + module.exports = require('../build/default/bufferutil'); +} catch (e) { try { + module.exports = require('./BufferUtil.fallback'); +} catch (e) { + console.error('bufferutil.node seems to not have been built. Run npm install.'); + throw e; +}}} diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/ErrorCodes.js b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/ErrorCodes.js new file mode 100644 index 0000000..55ebd52 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/ErrorCodes.js @@ -0,0 +1,24 @@ +/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ + +module.exports = { + isValidErrorCode: function(code) { + return (code >= 1000 && code <= 1011 && code != 1004 && code != 1005 && code != 1006) || + (code >= 3000 && code <= 4999); + }, + 1000: 'normal', + 1001: 'going away', + 1002: 'protocol error', + 1003: 'unsupported data', + 1004: 'reserved', + 1005: 'reserved for extensions', + 1006: 'reserved for extensions', + 1007: 'inconsistent or invalid data', + 1008: 'policy violation', + 1009: 'message too big', + 1010: 'extension handshake missing', + 1011: 'an unexpected condition prevented the request from being fulfilled', +}; \ No newline at end of file diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/Receiver.hixie.js b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/Receiver.hixie.js new file mode 100644 index 0000000..f54ad96 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/Receiver.hixie.js @@ -0,0 +1,180 @@ +/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ + +var util = require('util'); + +/** + * State constants + */ + +var EMPTY = 0 + , BODY = 1; +var BINARYLENGTH = 2 + , BINARYBODY = 3; + +/** + * Hixie Receiver implementation + */ + +function Receiver () { + this.state = EMPTY; + this.buffers = []; + this.messageEnd = -1; + this.spanLength = 0; + this.dead = false; + + this.onerror = function() {}; + this.ontext = function() {}; + this.onbinary = function() {}; + this.onclose = function() {}; + this.onping = function() {}; + this.onpong = function() {}; +} + +module.exports = Receiver; + +/** + * Add new data to the parser. + * + * @api public + */ + +Receiver.prototype.add = function(data) { + var self = this; + function doAdd() { + if (self.state === EMPTY) { + if (data.length == 2 && data[0] == 0xFF && data[1] == 0x00) { + self.reset(); + self.onclose(); + return; + } + if (data[0] === 0x80) { + self.messageEnd = 0; + self.state = BINARYLENGTH; + data = data.slice(1); + } else { + + if (data[0] !== 0x00) { + self.error('payload must start with 0x00 byte', true); + return; + } + data = data.slice(1); + self.state = BODY; + + } + } + if (self.state === BINARYLENGTH) { + var i = 0; + while ((i < data.length) && (data[i] & 0x80)) { + self.messageEnd = 128 * self.messageEnd + (data[i] & 0x7f); + ++i; + } + if (i < data.length) { + self.messageEnd = 128 * self.messageEnd + (data[i] & 0x7f); + self.state = BINARYBODY; + ++i; + } + if (i > 0) + data = data.slice(i); + } + if (self.state === BINARYBODY) { + var dataleft = self.messageEnd - self.spanLength; + if (data.length >= dataleft) { + // consume the whole buffer to finish the frame + self.buffers.push(data); + self.spanLength += dataleft; + self.messageEnd = dataleft; + return self.parse(); + } + // frame's not done even if we consume it all + self.buffers.push(data); + self.spanLength += data.length; + return; + } + self.buffers.push(data); + if ((self.messageEnd = bufferIndex(data, 0xFF)) != -1) { + self.spanLength += self.messageEnd; + return self.parse(); + } + else self.spanLength += data.length; + } + while(data) data = doAdd(); +} + +/** + * Releases all resources used by the receiver. + * + * @api public + */ + +Receiver.prototype.cleanup = function() { + this.dead = true; + this.state = EMPTY; + this.buffers = []; +} + +/** + * Process buffered data. + * + * @api public + */ + +Receiver.prototype.parse = function() { + var output = new Buffer(this.spanLength); + var outputIndex = 0; + for (var bi = 0, bl = this.buffers.length; bi < bl - 1; ++bi) { + var buffer = this.buffers[bi]; + buffer.copy(output, outputIndex); + outputIndex += buffer.length; + } + var lastBuffer = this.buffers[this.buffers.length - 1]; + if (this.messageEnd > 0) lastBuffer.copy(output, outputIndex, 0, this.messageEnd); + if (this.state !== BODY) --this.messageEnd; + var tail = null; + if (this.messageEnd < lastBuffer.length - 1) { + tail = lastBuffer.slice(this.messageEnd + 1); + } + this.reset(); + this.ontext(output.toString('utf8')); + return tail; +} + +/** + * Handles an error + * + * @api private + */ + +Receiver.prototype.error = function (reason, terminate) { + this.reset(); + this.onerror(reason, terminate); + return this; +} + +/** + * Reset parser state + * + * @api private + */ + +Receiver.prototype.reset = function (reason) { + if (this.dead) return; + this.state = EMPTY; + this.buffers = []; + this.messageEnd = -1; + this.spanLength = 0; +} + +/** + * Internal api + */ + +function bufferIndex(buffer, byte) { + for (var i = 0, l = buffer.length; i < l; ++i) { + if (buffer[i] === byte) return i; + } + return -1; +} diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/Receiver.js b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/Receiver.js new file mode 100644 index 0000000..2752726 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/Receiver.js @@ -0,0 +1,591 @@ +/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ + +var util = require('util') + , Validation = require('./Validation').Validation + , ErrorCodes = require('./ErrorCodes') + , BufferPool = require('./BufferPool') + , bufferUtil = require('./BufferUtil').BufferUtil; + +/** + * Node version 0.4 and 0.6 compatibility + */ + +var isNodeV4 = /^v0\.4/.test(process.version); + +/** + * HyBi Receiver implementation + */ + +function Receiver () { + // memory pool for fragmented messages + var fragmentedPoolPrevUsed = -1; + this.fragmentedBufferPool = new BufferPool(1024, function(db, length) { + return db.used + length; + }, function(db) { + return fragmentedPoolPrevUsed = fragmentedPoolPrevUsed >= 0 ? + (fragmentedPoolPrevUsed + db.used) / 2 : + db.used; + }); + + // memory pool for unfragmented messages + var unfragmentedPoolPrevUsed = -1; + this.unfragmentedBufferPool = new BufferPool(1024, function(db, length) { + return db.used + length; + }, function(db) { + return unfragmentedPoolPrevUsed = unfragmentedPoolPrevUsed >= 0 ? + (unfragmentedPoolPrevUsed + db.used) / 2 : + db.used; + }); + + this.state = { + activeFragmentedOperation: null, + lastFragment: false, + masked: false, + opcode: 0, + fragmentedOperation: false + }; + this.overflow = []; + this.headerBuffer = new Buffer(10); + this.expectOffset = 0; + this.expectBuffer = null; + this.expectHandler = null; + this.currentMessage = []; + this.expectHeader(2, this.processPacket); + this.dead = false; + + this.onerror = function() {}; + this.ontext = function() {}; + this.onbinary = function() {}; + this.onclose = function() {}; + this.onping = function() {}; + this.onpong = function() {}; +}; + +module.exports = Receiver; + +/** + * Add new data to the parser. + * + * @api public + */ + +Receiver.prototype.add = function(data) { + var dataLength = data.length; + if (dataLength == 0) return; + if (this.expectBuffer == null) { + this.overflow.push(data); + return; + } + var toRead = Math.min(dataLength, this.expectBuffer.length - this.expectOffset); + fastCopy(toRead, data, this.expectBuffer, this.expectOffset); + this.expectOffset += toRead; + if (toRead < dataLength) { + this.overflow.push(data.slice(toRead)); + } + while (this.expectBuffer && this.expectOffset == this.expectBuffer.length) { + var bufferForHandler = this.expectBuffer; + this.expectBuffer = null; + this.expectOffset = 0; + this.expectHandler.call(this, bufferForHandler); + } +} + +/** + * Releases all resources used by the receiver. + * + * @api public + */ + +Receiver.prototype.cleanup = function() { + this.dead = true; + this.overflow = null; + this.headerBuffer = null; + this.expectBuffer = null; + this.expectHandler = null; + this.unfragmentedBufferPool = null; + this.fragmentedBufferPool = null; + this.state = null; + this.currentMessage = null; + this.onerror = null; + this.ontext = null; + this.onbinary = null; + this.onclose = null; + this.onping = null; + this.onpong = null; +} + +/** + * Waits for a certain amount of header bytes to be available, then fires a callback. + * + * @api private + */ + +Receiver.prototype.expectHeader = function(length, handler) { + if (length == 0) { + handler(null); + return; + } + this.expectBuffer = this.headerBuffer.slice(this.expectOffset, this.expectOffset + length); + this.expectHandler = handler; + var toRead = length; + while (toRead > 0 && this.overflow.length > 0) { + var fromOverflow = this.overflow.pop(); + if (toRead < fromOverflow.length) this.overflow.push(fromOverflow.slice(toRead)); + var read = Math.min(fromOverflow.length, toRead); + fastCopy(read, fromOverflow, this.expectBuffer, this.expectOffset); + this.expectOffset += read; + toRead -= read; + } +} + +/** + * Waits for a certain amount of data bytes to be available, then fires a callback. + * + * @api private + */ + +Receiver.prototype.expectData = function(length, handler) { + if (length == 0) { + handler(null); + return; + } + this.expectBuffer = this.allocateFromPool(length, this.state.fragmentedOperation); + this.expectHandler = handler; + var toRead = length; + while (toRead > 0 && this.overflow.length > 0) { + var fromOverflow = this.overflow.pop(); + if (toRead < fromOverflow.length) this.overflow.push(fromOverflow.slice(toRead)); + var read = Math.min(fromOverflow.length, toRead); + fastCopy(read, fromOverflow, this.expectBuffer, this.expectOffset); + this.expectOffset += read; + toRead -= read; + } +} + +/** + * Allocates memory from the buffer pool. + * + * @api private + */ + +Receiver.prototype.allocateFromPool = !isNodeV4 + ? function(length, isFragmented) { return (isFragmented ? this.fragmentedBufferPool : this.unfragmentedBufferPool).get(length); } + : function(length) { return new Buffer(length); }; + +/** + * Start processing a new packet. + * + * @api private + */ + +Receiver.prototype.processPacket = function (data) { + if ((data[0] & 0x70) != 0) { + this.error('reserved fields must be empty', 1002); + return; + } + this.state.lastFragment = (data[0] & 0x80) == 0x80; + this.state.masked = (data[1] & 0x80) == 0x80; + var opcode = data[0] & 0xf; + if (opcode === 0) { + // continuation frame + this.state.fragmentedOperation = true; + this.state.opcode = this.state.activeFragmentedOperation; + if (!(this.state.opcode == 1 || this.state.opcode == 2)) { + this.error('continuation frame cannot follow current opcode', 1002); + return; + } + } + else { + if (opcode < 3 && this.state.activeFragmentedOperation != null) { + this.error('data frames after the initial data frame must have opcode 0', 1002); + return; + } + this.state.opcode = opcode; + if (this.state.lastFragment === false) { + this.state.fragmentedOperation = true; + this.state.activeFragmentedOperation = opcode; + } + else this.state.fragmentedOperation = false; + } + var handler = opcodes[this.state.opcode]; + if (typeof handler == 'undefined') this.error('no handler for opcode ' + this.state.opcode, 1002); + else { + handler.start.call(this, data); + } +} + +/** + * Endprocessing a packet. + * + * @api private + */ + +Receiver.prototype.endPacket = function() { + if (!this.state.fragmentedOperation) this.unfragmentedBufferPool.reset(true); + else if (this.state.lastFragment) this.fragmentedBufferPool.reset(false); + this.expectOffset = 0; + this.expectBuffer = null; + this.expectHandler = null; + if (this.state.lastFragment && this.state.opcode === this.state.activeFragmentedOperation) { + // end current fragmented operation + this.state.activeFragmentedOperation = null; + } + this.state.lastFragment = false; + this.state.opcode = this.state.activeFragmentedOperation != null ? this.state.activeFragmentedOperation : 0; + this.state.masked = false; + this.expectHeader(2, this.processPacket); +} + +/** + * Reset the parser state. + * + * @api private + */ + +Receiver.prototype.reset = function() { + if (this.dead) return; + this.state = { + activeFragmentedOperation: null, + lastFragment: false, + masked: false, + opcode: 0, + fragmentedOperation: false + }; + this.fragmentedBufferPool.reset(true); + this.unfragmentedBufferPool.reset(true); + this.expectOffset = 0; + this.expectBuffer = null; + this.expectHandler = null; + this.overflow = []; + this.currentMessage = []; +} + +/** + * Unmask received data. + * + * @api private + */ + +Receiver.prototype.unmask = function (mask, buf, binary) { + if (mask != null && buf != null) bufferUtil.unmask(buf, mask); + if (binary) return buf; + return buf != null ? buf.toString('utf8') : ''; +} + +/** + * Concatenates a list of buffers. + * + * @api private + */ + +Receiver.prototype.concatBuffers = function(buffers) { + var length = 0; + for (var i = 0, l = buffers.length; i < l; ++i) length += buffers[i].length; + var mergedBuffer = new Buffer(length); + bufferUtil.merge(mergedBuffer, buffers); + return mergedBuffer; +} + +/** + * Handles an error + * + * @api private + */ + +Receiver.prototype.error = function (reason, protocolErrorCode) { + this.reset(); + this.onerror(reason, protocolErrorCode); + return this; +} + +/** + * Buffer utilities + */ + +function readUInt16BE(start) { + return (this[start]<<8) + + this[start+1]; +} + +function readUInt32BE(start) { + return (this[start]<<24) + + (this[start+1]<<16) + + (this[start+2]<<8) + + this[start+3]; +} + +function fastCopy(length, srcBuffer, dstBuffer, dstOffset) { + switch (length) { + default: srcBuffer.copy(dstBuffer, dstOffset, 0, length); break; + case 16: dstBuffer[dstOffset+15] = srcBuffer[15]; + case 15: dstBuffer[dstOffset+14] = srcBuffer[14]; + case 14: dstBuffer[dstOffset+13] = srcBuffer[13]; + case 13: dstBuffer[dstOffset+12] = srcBuffer[12]; + case 12: dstBuffer[dstOffset+11] = srcBuffer[11]; + case 11: dstBuffer[dstOffset+10] = srcBuffer[10]; + case 10: dstBuffer[dstOffset+9] = srcBuffer[9]; + case 9: dstBuffer[dstOffset+8] = srcBuffer[8]; + case 8: dstBuffer[dstOffset+7] = srcBuffer[7]; + case 7: dstBuffer[dstOffset+6] = srcBuffer[6]; + case 6: dstBuffer[dstOffset+5] = srcBuffer[5]; + case 5: dstBuffer[dstOffset+4] = srcBuffer[4]; + case 4: dstBuffer[dstOffset+3] = srcBuffer[3]; + case 3: dstBuffer[dstOffset+2] = srcBuffer[2]; + case 2: dstBuffer[dstOffset+1] = srcBuffer[1]; + case 1: dstBuffer[dstOffset] = srcBuffer[0]; + } +} + +/** + * Opcode handlers + */ + +var opcodes = { + // text + '1': { + start: function(data) { + var self = this; + // decode length + var firstLength = data[1] & 0x7f; + if (firstLength < 126) { + opcodes['1'].getData.call(self, firstLength); + } + else if (firstLength == 126) { + self.expectHeader(2, function(data) { + opcodes['1'].getData.call(self, readUInt16BE.call(data, 0)); + }); + } + else if (firstLength == 127) { + self.expectHeader(8, function(data) { + if (readUInt32BE.call(data, 0) != 0) { + self.error('packets with length spanning more than 32 bit is currently not supported', 1008); + return; + } + opcodes['1'].getData.call(self, readUInt32BE.call(data, 4)); + }); + } + }, + getData: function(length) { + var self = this; + if (self.state.masked) { + self.expectHeader(4, function(data) { + var mask = data; + self.expectData(length, function(data) { + opcodes['1'].finish.call(self, mask, data); + }); + }); + } + else { + self.expectData(length, function(data) { + opcodes['1'].finish.call(self, null, data); + }); + } + }, + finish: function(mask, data) { + var packet = this.unmask(mask, data, true); + if (packet != null) this.currentMessage.push(packet); + if (this.state.lastFragment) { + var messageBuffer = this.concatBuffers(this.currentMessage); + if (!Validation.isValidUTF8(messageBuffer)) { + this.error('invalid utf8 sequence', 1007); + return; + } + this.ontext(messageBuffer.toString('utf8'), {masked: this.state.masked, buffer: messageBuffer}); + this.currentMessage = []; + } + this.endPacket(); + } + }, + // binary + '2': { + start: function(data) { + var self = this; + // decode length + var firstLength = data[1] & 0x7f; + if (firstLength < 126) { + opcodes['2'].getData.call(self, firstLength); + } + else if (firstLength == 126) { + self.expectHeader(2, function(data) { + opcodes['2'].getData.call(self, readUInt16BE.call(data, 0)); + }); + } + else if (firstLength == 127) { + self.expectHeader(8, function(data) { + if (readUInt32BE.call(data, 0) != 0) { + self.error('packets with length spanning more than 32 bit is currently not supported', 1008); + return; + } + opcodes['2'].getData.call(self, readUInt32BE.call(data, 4, true)); + }); + } + }, + getData: function(length) { + var self = this; + if (self.state.masked) { + self.expectHeader(4, function(data) { + var mask = data; + self.expectData(length, function(data) { + opcodes['2'].finish.call(self, mask, data); + }); + }); + } + else { + self.expectData(length, function(data) { + opcodes['2'].finish.call(self, null, data); + }); + } + }, + finish: function(mask, data) { + var packet = this.unmask(mask, data, true); + if (packet != null) this.currentMessage.push(packet); + if (this.state.lastFragment) { + var messageBuffer = this.concatBuffers(this.currentMessage); + this.onbinary(messageBuffer, {masked: this.state.masked, buffer: messageBuffer}); + this.currentMessage = []; + } + this.endPacket(); + } + }, + // close + '8': { + start: function(data) { + var self = this; + if (self.state.lastFragment == false) { + self.error('fragmented close is not supported', 1002); + return; + } + + // decode length + var firstLength = data[1] & 0x7f; + if (firstLength < 126) { + opcodes['8'].getData.call(self, firstLength); + } + else { + self.error('control frames cannot have more than 125 bytes of data', 1002); + } + }, + getData: function(length) { + var self = this; + if (self.state.masked) { + self.expectHeader(4, function(data) { + var mask = data; + self.expectData(length, function(data) { + opcodes['8'].finish.call(self, mask, data); + }); + }); + } + else { + self.expectData(length, function(data) { + opcodes['8'].finish.call(self, null, data); + }); + } + }, + finish: function(mask, data) { + var self = this; + data = self.unmask(mask, data, true); + if (data && data.length == 1) { + self.error('close packets with data must be at least two bytes long', 1002); + return; + } + var code = data && data.length > 1 ? readUInt16BE.call(data, 0) : 1000; + if (!ErrorCodes.isValidErrorCode(code)) { + self.error('invalid error code', 1002); + return; + } + var message = ''; + if (data && data.length > 2) { + var messageBuffer = data.slice(2); + if (!Validation.isValidUTF8(messageBuffer)) { + self.error('invalid utf8 sequence', 1007); + return; + } + message = messageBuffer.toString('utf8'); + } + this.onclose(code, message, {masked: self.state.masked}); + this.reset(); + }, + }, + // ping + '9': { + start: function(data) { + var self = this; + if (self.state.lastFragment == false) { + self.error('fragmented ping is not supported', 1002); + return; + } + + // decode length + var firstLength = data[1] & 0x7f; + if (firstLength < 126) { + opcodes['9'].getData.call(self, firstLength); + } + else { + self.error('control frames cannot have more than 125 bytes of data', 1002); + } + }, + getData: function(length) { + var self = this; + if (self.state.masked) { + self.expectHeader(4, function(data) { + var mask = data; + self.expectData(length, function(data) { + opcodes['9'].finish.call(self, mask, data); + }); + }); + } + else { + self.expectData(length, function(data) { + opcodes['9'].finish.call(self, null, data); + }); + } + }, + finish: function(mask, data) { + this.onping(this.unmask(mask, data, true), {masked: this.state.masked, binary: true}); + this.endPacket(); + } + }, + // pong + '10': { + start: function(data) { + var self = this; + if (self.state.lastFragment == false) { + self.error('fragmented pong is not supported', 1002); + return; + } + + // decode length + var firstLength = data[1] & 0x7f; + if (firstLength < 126) { + opcodes['10'].getData.call(self, firstLength); + } + else { + self.error('control frames cannot have more than 125 bytes of data', 1002); + } + }, + getData: function(length) { + var self = this; + if (this.state.masked) { + this.expectHeader(4, function(data) { + var mask = data; + self.expectData(length, function(data) { + opcodes['10'].finish.call(self, mask, data); + }); + }); + } + else { + this.expectData(length, function(data) { + opcodes['10'].finish.call(self, null, data); + }); + } + }, + finish: function(mask, data) { + this.onpong(this.unmask(mask, data, true), {masked: this.state.masked, binary: true}); + this.endPacket(); + } + } +} diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/Sender.hixie.js b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/Sender.hixie.js new file mode 100644 index 0000000..1754afb --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/Sender.hixie.js @@ -0,0 +1,123 @@ +/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ + +var events = require('events') + , util = require('util') + , EventEmitter = events.EventEmitter; + +/** + * Hixie Sender implementation + */ + +function Sender(socket) { + this.socket = socket; + this.continuationFrame = false; + this.isClosed = false; +} + +module.exports = Sender; + +/** + * Inherits from EventEmitter. + */ + +util.inherits(Sender, events.EventEmitter); + +/** + * Frames and writes data. + * + * @api public + */ + +Sender.prototype.send = function(data, options, cb) { + if (this.isClosed) return; +/* + if (options && options.binary) { + this.error('hixie websockets do not support binary'); + return; + } +*/ + var isString = typeof data == 'string' + , length = isString ? Buffer.byteLength(data) : data.length + , lengthbytes = (length > 127) ? 2 : 1 // assume less than 2**14 bytes + , writeStartMarker = this.continuationFrame == false + , writeEndMarker = !options || !(typeof options.fin != 'undefined' && !options.fin) + , buffer = new Buffer((writeStartMarker ? ((options && options.binary) ? (1 + lengthbytes) : 1) : 0) + length + ((writeEndMarker && !(options && options.binary)) ? 1 : 0)) + , offset = writeStartMarker ? 1 : 0; + + if (writeStartMarker) { + if (options && options.binary) { + buffer.write('\x80', 'binary'); + // assume length less than 2**14 bytes + if (lengthbytes > 1) + buffer.write(String.fromCharCode(128+length/128), offset++, 'binary'); + buffer.write(String.fromCharCode(length&0x7f), offset++, 'binary'); + } else + buffer.write('\x00', 'binary'); + } + + if (isString) buffer.write(data, offset, 'utf8'); + else data.copy(buffer, offset, 0); + + if (writeEndMarker) { + if (options && options.binary) { + // sending binary, not writing end marker + } else + buffer.write('\xff', offset + length, 'binary'); + this.continuationFrame = false; + } + else this.continuationFrame = true; + + try { + this.socket.write(buffer, 'binary', cb); + } catch (e) { + this.error(e.toString()); + } +} + +/** + * Sends a close instruction to the remote party. + * + * @api public + */ + +Sender.prototype.close = function(code, data, mask, cb) { + if (this.isClosed) return; + this.isClosed = true; + try { + if (this.continuationFrame) this.socket.write(new Buffer([0xff], 'binary')); + this.socket.write(new Buffer([0xff, 0x00]), 'binary', cb); + } catch (e) { + this.error(e.toString()); + } +} + +/** + * Sends a ping message to the remote party. Not available for hixie. + * + * @api public + */ + +Sender.prototype.ping = function(data, options) {} + +/** + * Sends a pong message to the remote party. Not available for hixie. + * + * @api public + */ + +Sender.prototype.pong = function(data, options) {} + +/** + * Handles an error + * + * @api private + */ + +Sender.prototype.error = function (reason) { + this.emit('error', reason); + return this; +} diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/Sender.js b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/Sender.js new file mode 100644 index 0000000..fc3b437 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/Sender.js @@ -0,0 +1,227 @@ +/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ + +var events = require('events') + , util = require('util') + , EventEmitter = events.EventEmitter + , ErrorCodes = require('./ErrorCodes') + , bufferUtil = require('./BufferUtil').BufferUtil; + +/** + * HyBi Sender implementation + */ + +function Sender(socket) { + this._socket = socket; + this.firstFragment = true; +} + +/** + * Inherits from EventEmitter. + */ + +util.inherits(Sender, events.EventEmitter); + +/** + * Sends a close instruction to the remote party. + * + * @api public + */ + +Sender.prototype.close = function(code, data, mask) { + if (typeof code !== 'undefined') { + if (typeof code !== 'number' || + !ErrorCodes.isValidErrorCode(code)) throw new Error('first argument must be a valid error code number'); + } + code = code || 1000; + var dataBuffer = new Buffer(2 + (data ? Buffer.byteLength(data) : 0)); + writeUInt16BE.call(dataBuffer, code, 0); + if (dataBuffer.length > 2) dataBuffer.write(data, 2); + this.frameAndSend(0x8, dataBuffer, true, mask); +} + +/** + * Sends a ping message to the remote party. + * + * @api public + */ + +Sender.prototype.ping = function(data, options) { + var mask = options && options.mask; + this.frameAndSend(0x9, data || '', true, mask); +} + +/** + * Sends a pong message to the remote party. + * + * @api public + */ + +Sender.prototype.pong = function(data, options) { + var mask = options && options.mask; + this.frameAndSend(0xa, data || '', true, mask); +} + +/** + * Sends text or binary data to the remote party. + * + * @api public + */ + +Sender.prototype.send = function(data, options, cb) { + var finalFragment = options && options.fin === false ? false : true; + var mask = options && options.mask; + var opcode = options && options.binary ? 2 : 1; + if (this.firstFragment === false) opcode = 0; + else this.firstFragment = false; + if (finalFragment) this.firstFragment = true + this.frameAndSend(opcode, data, finalFragment, mask, cb); +} + +/** + * Frames and sends a piece of data according to the HyBi WebSocket protocol. + * + * @api private + */ + +Sender.prototype.frameAndSend = function(opcode, data, finalFragment, maskData, cb) { + var canModifyData = false; + + if (!data) { + try { + this._socket.write(new Buffer([opcode | (finalFragment ? 0x80 : 0), 0 | (maskData ? 0x80 : 0)].concat(maskData ? [0, 0, 0, 0] : [])), 'binary', cb); + } + catch (e) { + if (typeof cb == 'function') cb(e); + else this.emit('error', e); + } + return; + } + + if (!Buffer.isBuffer(data)) { + canModifyData = true; + if (data && (typeof data.byteLength !== 'undefined' || typeof data.buffer !== 'undefined')) { + data = getArrayBuffer(data); + } else { + data = new Buffer(data); + } + } + + var dataLength = data.length + , dataOffset = maskData ? 6 : 2 + , secondByte = dataLength; + + if (dataLength >= 65536) { + dataOffset += 8; + secondByte = 127; + } + else if (dataLength > 125) { + dataOffset += 2; + secondByte = 126; + } + + var mergeBuffers = dataLength < 32768 || (maskData && !canModifyData); + var totalLength = mergeBuffers ? dataLength + dataOffset : dataOffset; + var outputBuffer = new Buffer(totalLength); + outputBuffer[0] = finalFragment ? opcode | 0x80 : opcode; + + switch (secondByte) { + case 126: + writeUInt16BE.call(outputBuffer, dataLength, 2); + break; + case 127: + writeUInt32BE.call(outputBuffer, 0, 2); + writeUInt32BE.call(outputBuffer, dataLength, 6); + } + + if (maskData) { + outputBuffer[1] = secondByte | 0x80; + var mask = this._randomMask || (this._randomMask = getRandomMask()); + outputBuffer[dataOffset - 4] = mask[0]; + outputBuffer[dataOffset - 3] = mask[1]; + outputBuffer[dataOffset - 2] = mask[2]; + outputBuffer[dataOffset - 1] = mask[3]; + if (mergeBuffers) { + bufferUtil.mask(data, mask, outputBuffer, dataOffset, dataLength); + try { + this._socket.write(outputBuffer, 'binary', cb); + } + catch (e) { + if (typeof cb == 'function') cb(e); + else this.emit('error', e); + } + } + else { + bufferUtil.mask(data, mask, data, 0, dataLength); + try { + this._socket.write(outputBuffer, 'binary'); + this._socket.write(data, 'binary', cb); + } + catch (e) { + if (typeof cb == 'function') cb(e); + else this.emit('error', e); + } + } + } + else { + outputBuffer[1] = secondByte; + if (mergeBuffers) { + data.copy(outputBuffer, dataOffset); + try { + this._socket.write(outputBuffer, 'binary', cb); + } + catch (e) { + if (typeof cb == 'function') cb(e); + else this.emit('error', e); + } + } + else { + try { + this._socket.write(outputBuffer, 'binary'); + this._socket.write(data, 'binary', cb); + } + catch (e) { + if (typeof cb == 'function') cb(e); + else this.emit('error', e); + } + } + } +} + +module.exports = Sender; + +function writeUInt16BE(value, offset) { + this[offset] = (value & 0xff00)>>8; + this[offset+1] = value & 0xff; +} + +function writeUInt32BE(value, offset) { + this[offset] = (value & 0xff000000)>>24; + this[offset+1] = (value & 0xff0000)>>16; + this[offset+2] = (value & 0xff00)>>8; + this[offset+3] = value & 0xff; +} + +function getArrayBuffer(data) { + // data is either an ArrayBuffer or ArrayBufferView. + var array = new Uint8Array(data.buffer || data) + , l = data.byteLength || data.length + , o = data.byteOffset || 0 + , buffer = new Buffer(l); + for (var i = 0; i < l; ++i) { + buffer[i] = array[o+i]; + } + return buffer; +} + +function getRandomMask() { + return new Buffer([ + ~~(Math.random() * 255), + ~~(Math.random() * 255), + ~~(Math.random() * 255), + ~~(Math.random() * 255) + ]); +} diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/Validation.fallback.js b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/Validation.fallback.js new file mode 100644 index 0000000..2c7c4fd --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/Validation.fallback.js @@ -0,0 +1,12 @@ +/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ + +module.exports.Validation = { + isValidUTF8: function(buffer) { + return true; + } +}; + diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/Validation.js b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/Validation.js new file mode 100644 index 0000000..0f3109a --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/Validation.js @@ -0,0 +1,16 @@ +/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ + +try { + module.exports = require('../build/Release/validation'); +} catch (e) { try { + module.exports = require('../build/default/validation'); +} catch (e) { try { + module.exports = require('./Validation.fallback'); +} catch (e) { + console.error('validation.node seems to not have been built. Run npm install.'); + throw e; +}}} diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/WebSocket.js b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/WebSocket.js new file mode 100644 index 0000000..cce3cb4 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/WebSocket.js @@ -0,0 +1,818 @@ +/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ + +var util = require('util') + , events = require('events') + , http = require('http') + , https = require('https') + , crypto = require('crypto') + , url = require('url') + , fs = require('fs') + , Options = require('options') + , Sender = require('./Sender') + , Receiver = require('./Receiver') + , SenderHixie = require('./Sender.hixie') + , ReceiverHixie = require('./Receiver.hixie'); + +/** + * Constants + */ + +// Default protocol version + +var protocolVersion = 13; + +// Close timeout + +var closeTimeout = 30000; // Allow 5 seconds to terminate the connection cleanly + +/** + * Node version 0.4 and 0.6 compatibility + */ + +var isNodeV4 = /^v0\.4/.test(process.version); + +/** + * WebSocket implementation + */ + +function WebSocket(address, protocols, options) { + + if (protocols && !Array.isArray(protocols) && 'object' == typeof protocols) { + // accept the "options" Object as the 2nd argument + options = protocols; + protocols = null; + } + if ('string' == typeof protocols) { + protocols = [ protocols ]; + } + if (!Array.isArray(protocols)) { + protocols = []; + } + // TODO: actually handle the `Sub-Protocols` part of the WebSocket client + + this._socket = null; + this.bytesReceived = 0; + this.readyState = null; + this.supports = {}; + + if (Array.isArray(address)) { + initAsServerClient.apply(this, address.concat(options)); + } else { + initAsClient.apply(this, [address, protocols, options]); + } +} + +/** + * Inherits from EventEmitter. + */ + +util.inherits(WebSocket, events.EventEmitter); + +/** + * Ready States + */ + +["CONNECTING", "OPEN", "CLOSING", "CLOSED"].forEach(function (state, index) { + WebSocket.prototype[state] = WebSocket[state] = index; +}); + +/** + * Gracefully closes the connection, after sending a description message to the server + * + * @param {Object} data to be sent to the server + * @api public + */ + +WebSocket.prototype.close = function(code, data) { + if (this.readyState == WebSocket.CLOSING || this.readyState == WebSocket.CLOSED) return; + if (this.readyState == WebSocket.CONNECTING) { + this.readyState = WebSocket.CLOSED; + return; + } + try { + this.readyState = WebSocket.CLOSING; + this._closeCode = code; + this._closeMessage = data; + var mask = !this._isServer; + this._sender.close(code, data, mask); + } + catch (e) { + this.emit('error', e); + } + finally { + this.terminate(); + } +} + +/** + * Pause the client stream + * + * @api public + */ + +WebSocket.prototype.pause = function() { + if (this.readyState != WebSocket.OPEN) throw new Error('not opened'); + return this._socket.pause(); +} + +/** + * Sends a ping + * + * @param {Object} data to be sent to the server + * @param {Object} Members - mask: boolean, binary: boolean + * @param {boolean} dontFailWhenClosed indicates whether or not to throw if the connection isnt open + * @api public + */ + +WebSocket.prototype.ping = function(data, options, dontFailWhenClosed) { + if (this.readyState != WebSocket.OPEN) { + if (dontFailWhenClosed === true) return; + throw new Error('not opened'); + } + options = options || {}; + if (typeof options.mask == 'undefined') options.mask = !this._isServer; + this._sender.ping(data, options); +} + +/** + * Sends a pong + * + * @param {Object} data to be sent to the server + * @param {Object} Members - mask: boolean, binary: boolean + * @param {boolean} dontFailWhenClosed indicates whether or not to throw if the connection isnt open + * @api public + */ + +WebSocket.prototype.pong = function(data, options, dontFailWhenClosed) { + if (this.readyState != WebSocket.OPEN) { + if (dontFailWhenClosed === true) return; + throw new Error('not opened'); + } + options = options || {}; + if (typeof options.mask == 'undefined') options.mask = !this._isServer; + this._sender.pong(data, options); +} + +/** + * Resume the client stream + * + * @api public + */ + +WebSocket.prototype.resume = function() { + if (this.readyState != WebSocket.OPEN) throw new Error('not opened'); + return this._socket.resume(); +} + +/** + * Sends a piece of data + * + * @param {Object} data to be sent to the server + * @param {Object} Members - mask: boolean, binary: boolean + * @param {function} Optional callback which is executed after the send completes + * @api public + */ + +WebSocket.prototype.send = function(data, options, cb) { + if (typeof options == 'function') { + cb = options; + options = {}; + } + if (this.readyState != WebSocket.OPEN) { + if (typeof cb == 'function') cb(new Error('not opened')); + else throw new Error('not opened'); + return; + } + if (!data) data = ''; + if (this._queue) { + var self = this; + this._queue.push(function() { self.send(data, options, cb); }); + return; + } + options = options || {}; + options.fin = true; + if (typeof options.binary == 'undefined') { + options.binary = (data instanceof ArrayBuffer || data instanceof Buffer || + data instanceof Uint8Array || + data instanceof Uint16Array || + data instanceof Uint32Array || + data instanceof Int8Array || + data instanceof Int16Array || + data instanceof Int32Array || + data instanceof Float32Array || + data instanceof Float64Array); + } + if (typeof options.mask == 'undefined') options.mask = !this._isServer; + if (data instanceof fs.ReadStream) { + startQueue(this); + var self = this; + sendStream(this, data, options, function(error) { + process.nextTick(function() { executeQueueSends(self); }); + if (typeof cb == 'function') cb(error); + }); + } + else this._sender.send(data, options, cb); +} + +/** + * Streams data through calls to a user supplied function + * + * @param {Object} Members - mask: boolean, binary: boolean + * @param {function} 'function (error, send)' which is executed on successive ticks of which send is 'function (data, final)'. + * @api public + */ + +WebSocket.prototype.stream = function(options, cb) { + if (typeof options == 'function') { + cb = options; + options = {}; + } + var self = this; + if (typeof cb != 'function') throw new Error('callback must be provided'); + if (this.readyState != WebSocket.OPEN) { + if (typeof cb == 'function') cb(new Error('not opened')); + else throw new Error('not opened'); + return; + } + if (this._queue) { + this._queue.push(function() { self.stream(options, cb); }); + return; + } + options = options || {}; + if (typeof options.mask == 'undefined') options.mask = !this._isServer; + startQueue(this); + var send = function(data, final) { + try { + if (self.readyState != WebSocket.OPEN) throw new Error('not opened'); + options.fin = final === true; + self._sender.send(data, options); + if (!final) process.nextTick(cb.bind(null, null, send)); + else executeQueueSends(self); + } + catch (e) { + if (typeof cb == 'function') cb(e); + else { + delete self._queue; + self.emit('error', e); + } + } + } + process.nextTick(cb.bind(null, null, send)); +} + +/** + * Immediately shuts down the connection + * + * @api public + */ + +WebSocket.prototype.terminate = function() { + if (this.readyState == WebSocket.CLOSED) return; + if (this._socket) { + try { + // End the connection + this._socket.end(); + } + catch (e) { + // Socket error during end() call, so just destroy it right now + cleanupWebsocketResources.call(this, true); + return; + } + + // Add a timeout to ensure that the connection is completely + // cleaned up within 30 seconds, even if the clean close procedure + // fails for whatever reason + this._closeTimer = setTimeout(cleanupWebsocketResources.bind(this, true), closeTimeout); + } + else if (this.readyState == WebSocket.CONNECTING) { + cleanupWebsocketResources.call(this, true); + } +}; + +/** + * Expose bufferedAmount + * + * @api public + */ + +Object.defineProperty(WebSocket.prototype, 'bufferedAmount', { + get: function get() { + var amount = 0; + if (this._socket) { + amount = this._socket.bufferSize || 0; + } + return amount; + } +}); + +/** + * Emulates the W3C Browser based WebSocket interface using function members. + * + * @see http://dev.w3.org/html5/websockets/#the-websocket-interface + * @api public + */ + +['open', 'error', 'close', 'message'].forEach(function(method) { + Object.defineProperty(WebSocket.prototype, 'on' + method, { + /** + * Returns the current listener + * + * @returns {Mixed} the set function or undefined + * @api public + */ + + get: function get() { + var listener = this.listeners(method)[0]; + return listener ? (listener._listener ? listener._listener : listener) : undefined; + }, + + /** + * Start listening for events + * + * @param {Function} listener the listener + * @returns {Mixed} the set function or undefined + * @api public + */ + + set: function set(listener) { + this.removeAllListeners(method); + this.addEventListener(method, listener); + } + }); +}); + +/** + * Emulates the W3C Browser based WebSocket interface using addEventListener. + * + * @see https://developer.mozilla.org/en/DOM/element.addEventListener + * @see http://dev.w3.org/html5/websockets/#the-websocket-interface + * @api public + */ +WebSocket.prototype.addEventListener = function(method, listener) { + var target = this; + if (typeof listener === 'function') { + if (method === 'message') { + function onMessage (data, flags) { + listener.call(this, new MessageEvent(data, flags.binary ? 'Binary' : 'Text', target)); + } + // store a reference so we can return the original function from the addEventListener hook + onMessage._listener = listener; + this.on(method, onMessage); + } else if (method === 'close') { + function onClose (code, message) { + listener.call(this, new CloseEvent(code, message, target)); + } + // store a reference so we can return the original function from the addEventListener hook + onClose._listener = listener; + this.on(method, onClose); + } else if (method === 'error') { + function onError (event) { + event.target = target; + listener.call(this, event); + } + // store a reference so we can return the original function from the addEventListener hook + onError._listener = listener; + this.on(method, onError); + } else if (method === 'open') { + function onOpen () { + listener.call(this, new OpenEvent(target)); + } + // store a reference so we can return the original function from the addEventListener hook + onOpen._listener = listener; + this.on(method, onOpen); + } else { + this.on(method, listener); + } + } +} + +module.exports = WebSocket; + +/** + * W3C MessageEvent + * + * @see http://www.w3.org/TR/html5/comms.html + * @api private + */ + +function MessageEvent(dataArg, typeArg, target) { + this.data = dataArg; + this.type = typeArg; + this.target = target; +} + +/** + * W3C CloseEvent + * + * @see http://www.w3.org/TR/html5/comms.html + * @api private + */ + +function CloseEvent(code, reason, target) { + this.wasClean = (typeof code == 'undefined' || code == 1000); + this.code = code; + this.reason = reason; + this.target = target; +} + +/** + * W3C OpenEvent + * + * @see http://www.w3.org/TR/html5/comms.html + * @api private + */ + +function OpenEvent(target) { + this.target = target; +} + +/** + * Entirely private apis, + * which may or may not be bound to a sepcific WebSocket instance. + */ + +function initAsServerClient(req, socket, upgradeHead, options) { + options = new Options({ + protocolVersion: protocolVersion, + protocol: null + }).merge(options); + + // expose state properties + this.protocol = options.value.protocol; + this.protocolVersion = options.value.protocolVersion; + this.supports.binary = (this.protocolVersion != 'hixie-76'); + this.upgradeReq = req; + this.readyState = WebSocket.CONNECTING; + this._isServer = true; + + // establish connection + if (options.value.protocolVersion == 'hixie-76') establishConnection.call(this, ReceiverHixie, SenderHixie, socket, upgradeHead); + else establishConnection.call(this, Receiver, Sender, socket, upgradeHead); +} + +function initAsClient(address, protocols, options) { + options = new Options({ + origin: null, + protocolVersion: protocolVersion, + host: null, + headers: null, + protocol: null, + agent: null, + + // ssl-related options + pfx: null, + key: null, + passphrase: null, + cert: null, + ca: null, + ciphers: null, + rejectUnauthorized: null + }).merge(options); + if (options.value.protocolVersion != 8 && options.value.protocolVersion != 13) { + throw new Error('unsupported protocol version'); + } + + // verify url and establish http class + var serverUrl = url.parse(address); + var isUnixSocket = serverUrl.protocol === 'ws+unix:'; + if (!serverUrl.host && !isUnixSocket) throw new Error('invalid url'); + var isSecure = serverUrl.protocol === 'wss:' || serverUrl.protocol === 'https:'; + var httpObj = isSecure ? https : http; + var port = serverUrl.port || (isSecure ? 443 : 80); + var auth = serverUrl.auth; + + // expose state properties + this._isServer = false; + this.url = address; + this.protocolVersion = options.value.protocolVersion; + this.supports.binary = (this.protocolVersion != 'hixie-76'); + + // begin handshake + var key = new Buffer(options.value.protocolVersion + '-' + Date.now()).toString('base64'); + var shasum = crypto.createHash('sha1'); + shasum.update(key + '258EAFA5-E914-47DA-95CA-C5AB0DC85B11'); + var expectedServerKey = shasum.digest('base64'); + + var agent = options.value.agent; + // node<=v0.4.x compatibility + if (!agent && isNodeV4) { + isNodeV4 = true; + agent = new httpObj.Agent({ + host: serverUrl.hostname, + port: port + }); + } + + var headerHost = serverUrl.hostname; + // Append port number to Host and Origin header, only if specified in the url and non-default + if(serverUrl.port) { + if((isSecure && (port != 443)) || (!isSecure && (port != 80))){ + headerHost = headerHost + ':' + port; + } + } + + var requestOptions = { + port: port, + host: serverUrl.hostname, + headers: { + 'Connection': 'Upgrade', + 'Upgrade': 'websocket', + 'Host': headerHost, + 'Origin': headerHost, + 'Sec-WebSocket-Version': options.value.protocolVersion, + 'Sec-WebSocket-Key': key + } + }; + + // If we have basic auth. + if (auth) { + requestOptions.headers['Authorization'] = 'Basic ' + new Buffer(auth).toString('base64'); + } + + if (options.value.protocol) { + requestOptions.headers['Sec-WebSocket-Protocol'] = options.value.protocol; + } + + if (options.value.host) { + requestOptions.headers['Host'] = options.value.host; + } + + if (options.value.headers) { + for (var header in options.value.headers) { + if (options.value.headers.hasOwnProperty(header)) { + requestOptions.headers[header] = options.value.headers[header]; + } + } + } + + if (options.isDefinedAndNonNull('pfx') + || options.isDefinedAndNonNull('key') + || options.isDefinedAndNonNull('passphrase') + || options.isDefinedAndNonNull('cert') + || options.isDefinedAndNonNull('ca') + || options.isDefinedAndNonNull('ciphers') + || options.isDefinedAndNonNull('rejectUnauthorized')) { + + if (isNodeV4) { + throw new Error('Client side certificates are not supported on Node 0.4.x'); + } + + if (options.isDefinedAndNonNull('pfx')) requestOptions.pfx = options.value.pfx; + if (options.isDefinedAndNonNull('key')) requestOptions.key = options.value.key; + if (options.isDefinedAndNonNull('passphrase')) requestOptions.passphrase = options.value.passphrase; + if (options.isDefinedAndNonNull('cert')) requestOptions.cert = options.value.cert; + if (options.isDefinedAndNonNull('ca')) requestOptions.ca = options.value.ca; + if (options.isDefinedAndNonNull('ciphers')) requestOptions.ciphers = options.value.ciphers; + if (options.isDefinedAndNonNull('rejectUnauthorized')) requestOptions.rejectUnauthorized = options.value.rejectUnauthorized; + + if (!agent) { + // global agent ignores client side certificates + agent = new httpObj.Agent(requestOptions); + } + } + + if (isNodeV4) { + requestOptions.path = (serverUrl.pathname || '/') + (serverUrl.search || ''); + } + else requestOptions.path = serverUrl.path || '/'; + + if (agent) { + requestOptions.agent = agent; + } + + if (isUnixSocket) { + requestOptions.socketPath = serverUrl.pathname; + } + if (options.value.origin) { + if (options.value.protocolVersion < 13) requestOptions.headers['Sec-WebSocket-Origin'] = options.value.origin; + else requestOptions.headers['Origin'] = options.value.origin; + } + + var self = this; + var req = httpObj.request(requestOptions); + + (isNodeV4 ? agent : req).on('error', function(error) { + self.emit('error', error); + cleanupWebsocketResources.call(this, error); + }); + (isNodeV4 ? agent : req).once('response', function(res) { + var error = new Error('unexpected server response (' + res.statusCode + ')'); + self.emit('error', error); + cleanupWebsocketResources.call(this, error); + }); + (isNodeV4 ? agent : req).once('upgrade', function(res, socket, upgradeHead) { + if (self.readyState == WebSocket.CLOSED) { + // client closed before server accepted connection + self.emit('close'); + removeAllListeners(self); + socket.end(); + return; + } + var serverKey = res.headers['sec-websocket-accept']; + if (typeof serverKey == 'undefined' || serverKey !== expectedServerKey) { + self.emit('error', 'invalid server key'); + removeAllListeners(self); + socket.end(); + return; + } + + var serverProt = res.headers['sec-websocket-protocol']; + var protList = (options.value.protocol || "").split(/, */); + var protError = null; + if (!options.value.protocol && serverProt) { + protError = 'server sent a subprotocol even though none requested'; + } else if (options.value.protocol && !serverProt) { + protError = 'server sent no subprotocol even though requested'; + } else if (serverProt && protList.indexOf(serverProt) === -1) { + protError = 'server responded with an invalid protocol'; + } + if (protError) { + self.emit('error', protError); + removeAllListeners(self); + socket.end(); + return; + } else if (serverProt) { + self.protocol = serverProt; + } + + establishConnection.call(self, Receiver, Sender, socket, upgradeHead); + + // perform cleanup on http resources + removeAllListeners(isNodeV4 ? agent : req); + req = null; + agent = null; + }); + + req.end(); + this.readyState = WebSocket.CONNECTING; +} + +function establishConnection(ReceiverClass, SenderClass, socket, upgradeHead) { + this._socket = socket; + socket.setTimeout(0); + socket.setNoDelay(true); + var self = this; + this._receiver = new ReceiverClass(); + + // socket cleanup handlers + socket.on('end', cleanupWebsocketResources.bind(this)); + socket.on('close', cleanupWebsocketResources.bind(this)); + socket.on('error', cleanupWebsocketResources.bind(this)); + + // ensure that the upgradeHead is added to the receiver + function firstHandler(data) { + if (self.readyState != WebSocket.OPEN) return; + if (upgradeHead && upgradeHead.length > 0) { + self.bytesReceived += upgradeHead.length; + var head = upgradeHead; + upgradeHead = null; + self._receiver.add(head); + } + dataHandler = realHandler; + if (data) { + self.bytesReceived += data.length; + self._receiver.add(data); + } + } + // subsequent packets are pushed straight to the receiver + function realHandler(data) { + if (data) self.bytesReceived += data.length; + self._receiver.add(data); + } + var dataHandler = firstHandler; + // if data was passed along with the http upgrade, + // this will schedule a push of that on to the receiver. + // this has to be done on next tick, since the caller + // hasn't had a chance to set event handlers on this client + // object yet. + process.nextTick(firstHandler); + + // receiver event handlers + self._receiver.ontext = function (data, flags) { + flags = flags || {}; + self.emit('message', data, flags); + }; + self._receiver.onbinary = function (data, flags) { + flags = flags || {}; + flags.binary = true; + self.emit('message', data, flags); + }; + self._receiver.onping = function(data, flags) { + flags = flags || {}; + self.pong(data, {mask: !self._isServer, binary: flags.binary === true}, true); + self.emit('ping', data, flags); + }; + self._receiver.onpong = function(data, flags) { + self.emit('pong', data, flags); + }; + self._receiver.onclose = function(code, data, flags) { + flags = flags || {}; + self.close(code, data); + }; + self._receiver.onerror = function(reason, errorCode) { + // close the connection when the receiver reports a HyBi error code + self.close(typeof errorCode != 'undefined' ? errorCode : 1002, ''); + self.emit('error', reason, errorCode); + }; + + // finalize the client + this._sender = new SenderClass(socket); + this._sender.on('error', function(error) { + self.close(1002, ''); + self.emit('error', error); + }); + this.readyState = WebSocket.OPEN; + this.emit('open'); + + socket.on('data', dataHandler); +} + +function startQueue(instance) { + instance._queue = instance._queue || []; +} + +function executeQueueSends(instance) { + var queue = instance._queue; + if (typeof queue == 'undefined') return; + delete instance._queue; + for (var i = 0, l = queue.length; i < l; ++i) { + queue[i](); + } +} + +function sendStream(instance, stream, options, cb) { + stream.on('data', function(data) { + if (instance.readyState != WebSocket.OPEN) { + if (typeof cb == 'function') cb(new Error('not opened')); + else { + delete instance._queue; + instance.emit('error', new Error('not opened')); + } + return; + } + options.fin = false; + instance._sender.send(data, options); + }); + stream.on('end', function() { + if (instance.readyState != WebSocket.OPEN) { + if (typeof cb == 'function') cb(new Error('not opened')); + else { + delete instance._queue; + instance.emit('error', new Error('not opened')); + } + return; + } + options.fin = true; + instance._sender.send(null, options); + if (typeof cb == 'function') cb(null); + }); +} + +function cleanupWebsocketResources(error) { + if (this.readyState == WebSocket.CLOSED) return; + var emitClose = this.readyState != WebSocket.CONNECTING; + this.readyState = WebSocket.CLOSED; + + clearTimeout(this._closeTimer); + this._closeTimer = null; + if (emitClose) this.emit('close', this._closeCode || 1000, this._closeMessage || ''); + + if (this._socket) { + removeAllListeners(this._socket); + // catch all socket error after removing all standard handlers + var socket = this._socket; + this._socket.on('error', function() { + try { socket.destroy(); } catch (e) {} + }); + try { + if (!error) this._socket.end(); + else this._socket.destroy(); + } + catch (e) { /* Ignore termination errors */ } + this._socket = null; + } + if (this._sender) { + removeAllListeners(this._sender); + this._sender = null; + } + if (this._receiver) { + this._receiver.cleanup(); + this._receiver = null; + } + removeAllListeners(this); + this.on('error', function() {}); // catch all errors after this + delete this._queue; +} + +function removeAllListeners(instance) { + if (isNodeV4) { + // node v4 doesn't *actually* remove all listeners globally, + // so we do that instead + instance._events = {}; + } + else instance.removeAllListeners(); +} diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/WebSocketServer.js b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/WebSocketServer.js new file mode 100644 index 0000000..da759f8 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/WebSocketServer.js @@ -0,0 +1,460 @@ +/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ + +var util = require('util') + , events = require('events') + , http = require('http') + , crypto = require('crypto') + , url = require('url') + , Options = require('options') + , WebSocket = require('./WebSocket') + , tls = require('tls') + , url = require('url'); + +/** + * WebSocket Server implementation + */ + +function WebSocketServer(options, callback) { + options = new Options({ + host: '0.0.0.0', + port: null, + server: null, + verifyClient: null, + handleProtocols: null, + path: null, + noServer: false, + disableHixie: false, + clientTracking: true + }).merge(options); + + if (!options.isDefinedAndNonNull('port') && !options.isDefinedAndNonNull('server') && !options.value.noServer) { + throw new TypeError('`port` or a `server` must be provided'); + } + + var self = this; + + if (options.isDefinedAndNonNull('port')) { + this._server = http.createServer(function (req, res) { + res.writeHead(200, {'Content-Type': 'text/plain'}); + res.end('Not implemented'); + }); + this._server.listen(options.value.port, options.value.host, callback); + this._closeServer = function() { self._server.close(); }; + } + else if (options.value.server) { + this._server = options.value.server; + if (options.value.path) { + // take note of the path, to avoid collisions when multiple websocket servers are + // listening on the same http server + if (this._server._webSocketPaths && options.value.server._webSocketPaths[options.value.path]) { + throw new Error('two instances of WebSocketServer cannot listen on the same http server path'); + } + if (typeof this._server._webSocketPaths !== 'object') { + this._server._webSocketPaths = {}; + } + this._server._webSocketPaths[options.value.path] = 1; + } + } + if (this._server) this._server.once('listening', function() { self.emit('listening'); }); + + if (typeof this._server != 'undefined') { + this._server.on('error', function(error) { + self.emit('error', error) + }); + this._server.on('upgrade', function(req, socket, upgradeHead) { + //copy upgradeHead to avoid retention of large slab buffers used in node core + var head = new Buffer(upgradeHead.length); + upgradeHead.copy(head); + + self.handleUpgrade(req, socket, head, function(client) { + self.emit('connection'+req.url, client); + self.emit('connection', client); + }); + }); + } + + this.options = options.value; + this.path = options.value.path; + this.clients = []; +} + +/** + * Inherits from EventEmitter. + */ + +util.inherits(WebSocketServer, events.EventEmitter); + +/** + * Immediately shuts down the connection. + * + * @api public + */ + +WebSocketServer.prototype.close = function() { + // terminate all associated clients + var error = null; + try { + for (var i = 0, l = this.clients.length; i < l; ++i) { + this.clients[i].terminate(); + } + } + catch (e) { + error = e; + } + + // remove path descriptor, if any + if (this.path && this._server._webSocketPaths) { + delete this._server._webSocketPaths[this.path]; + if (Object.keys(this._server._webSocketPaths).length == 0) { + delete this._server._webSocketPaths; + } + } + + // close the http server if it was internally created + try { + if (typeof this._closeServer !== 'undefined') { + this._closeServer(); + } + } + finally { + delete this._server; + } + if (error) throw error; +} + +/** + * Handle a HTTP Upgrade request. + * + * @api public + */ + +WebSocketServer.prototype.handleUpgrade = function(req, socket, upgradeHead, cb) { + // check for wrong path + if (this.options.path) { + var u = url.parse(req.url); + if (u && u.pathname !== this.options.path) return; + } + + if (typeof req.headers.upgrade === 'undefined' || req.headers.upgrade.toLowerCase() !== 'websocket') { + abortConnection(socket, 400, 'Bad Request'); + return; + } + + if (req.headers['sec-websocket-key1']) handleHixieUpgrade.apply(this, arguments); + else handleHybiUpgrade.apply(this, arguments); +} + +module.exports = WebSocketServer; + +/** + * Entirely private apis, + * which may or may not be bound to a sepcific WebSocket instance. + */ + +function handleHybiUpgrade(req, socket, upgradeHead, cb) { + // handle premature socket errors + var errorHandler = function() { + try { socket.destroy(); } catch (e) {} + } + socket.on('error', errorHandler); + + // verify key presence + if (!req.headers['sec-websocket-key']) { + abortConnection(socket, 400, 'Bad Request'); + return; + } + + // verify version + var version = parseInt(req.headers['sec-websocket-version']); + if ([8, 13].indexOf(version) === -1) { + abortConnection(socket, 400, 'Bad Request'); + return; + } + + // verify protocol + var protocols = req.headers['sec-websocket-protocol']; + + // verify client + var origin = version < 13 ? + req.headers['sec-websocket-origin'] : + req.headers['origin']; + + // handler to call when the connection sequence completes + var self = this; + var completeHybiUpgrade2 = function(protocol) { + + // calc key + var key = req.headers['sec-websocket-key']; + var shasum = crypto.createHash('sha1'); + shasum.update(key + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"); + key = shasum.digest('base64'); + + var headers = [ + 'HTTP/1.1 101 Switching Protocols' + , 'Upgrade: websocket' + , 'Connection: Upgrade' + , 'Sec-WebSocket-Accept: ' + key + ]; + + if (typeof protocol != 'undefined') { + headers.push('Sec-WebSocket-Protocol: ' + protocol); + } + + // allows external modification/inspection of handshake headers + self.emit('headers', headers); + + socket.setTimeout(0); + socket.setNoDelay(true); + try { + socket.write(headers.concat('', '').join('\r\n')); + } + catch (e) { + // if the upgrade write fails, shut the connection down hard + try { socket.destroy(); } catch (e) {} + return; + } + + var client = new WebSocket([req, socket, upgradeHead], { + protocolVersion: version, + protocol: protocol + }); + + if (self.options.clientTracking) { + self.clients.push(client); + client.on('close', function() { + var index = self.clients.indexOf(client); + if (index != -1) { + self.clients.splice(index, 1); + } + }); + } + + // signal upgrade complete + socket.removeListener('error', errorHandler); + cb(client); + } + + // optionally call external protocol selection handler before + // calling completeHybiUpgrade2 + var completeHybiUpgrade1 = function() { + // choose from the sub-protocols + if (typeof self.options.handleProtocols == 'function') { + var protList = (protocols || "").split(/, */); + var callbackCalled = false; + var res = self.options.handleProtocols(protList, function(result, protocol) { + callbackCalled = true; + if (!result) abortConnection(socket, 404, 'Unauthorized') + else completeHybiUpgrade2(protocol); + }); + if (!callbackCalled) { + // the handleProtocols handler never called our callback + abortConnection(socket, 501, 'Could not process protocols'); + } + return; + } else { + if (typeof protocols !== 'undefined') { + completeHybiUpgrade2(protocols.split(/, */)[0]); + } + else { + completeHybiUpgrade2(); + } + } + } + + // optionally call external client verification handler + if (typeof this.options.verifyClient == 'function') { + var info = { + origin: origin, + secure: typeof req.connection.authorized !== 'undefined' || typeof req.connection.encrypted !== 'undefined', + req: req + }; + if (this.options.verifyClient.length == 2) { + this.options.verifyClient(info, function(result) { + if (!result) abortConnection(socket, 401, 'Unauthorized') + else completeHybiUpgrade1(); + }); + return; + } + else if (!this.options.verifyClient(info)) { + abortConnection(socket, 401, 'Unauthorized'); + return; + } + } + + completeHybiUpgrade1(); +} + +function handleHixieUpgrade(req, socket, upgradeHead, cb) { + // handle premature socket errors + var errorHandler = function() { + try { socket.destroy(); } catch (e) {} + } + socket.on('error', errorHandler); + + // bail if options prevent hixie + if (this.options.disableHixie) { + abortConnection(socket, 401, 'Hixie support disabled'); + return; + } + + // verify key presence + if (!req.headers['sec-websocket-key2']) { + abortConnection(socket, 400, 'Bad Request'); + return; + } + + var origin = req.headers['origin'] + , self = this; + + // setup handshake completion to run after client has been verified + var onClientVerified = function() { + var wshost; + if (!req.headers['x-forwarded-host']) + wshost = req.headers.host; + else + wshost = req.headers['x-forwarded-host']; + var location = ((req.headers['x-forwarded-proto'] === 'https' || socket.encrypted) ? 'wss' : 'ws') + '://' + wshost + req.url + , protocol = req.headers['sec-websocket-protocol']; + + // handshake completion code to run once nonce has been successfully retrieved + var completeHandshake = function(nonce, rest) { + // calculate key + var k1 = req.headers['sec-websocket-key1'] + , k2 = req.headers['sec-websocket-key2'] + , md5 = crypto.createHash('md5'); + + [k1, k2].forEach(function (k) { + var n = parseInt(k.replace(/[^\d]/g, '')) + , spaces = k.replace(/[^ ]/g, '').length; + if (spaces === 0 || n % spaces !== 0){ + abortConnection(socket, 400, 'Bad Request'); + return; + } + n /= spaces; + md5.update(String.fromCharCode( + n >> 24 & 0xFF, + n >> 16 & 0xFF, + n >> 8 & 0xFF, + n & 0xFF)); + }); + md5.update(nonce.toString('binary')); + + var headers = [ + 'HTTP/1.1 101 Switching Protocols' + , 'Upgrade: WebSocket' + , 'Connection: Upgrade' + , 'Sec-WebSocket-Location: ' + location + ]; + if (typeof protocol != 'undefined') headers.push('Sec-WebSocket-Protocol: ' + protocol); + if (typeof origin != 'undefined') headers.push('Sec-WebSocket-Origin: ' + origin); + + socket.setTimeout(0); + socket.setNoDelay(true); + try { + // merge header and hash buffer + var headerBuffer = new Buffer(headers.concat('', '').join('\r\n')); + var hashBuffer = new Buffer(md5.digest('binary'), 'binary'); + var handshakeBuffer = new Buffer(headerBuffer.length + hashBuffer.length); + headerBuffer.copy(handshakeBuffer, 0); + hashBuffer.copy(handshakeBuffer, headerBuffer.length); + + // do a single write, which - upon success - causes a new client websocket to be setup + socket.write(handshakeBuffer, 'binary', function(err) { + if (err) return; // do not create client if an error happens + var client = new WebSocket([req, socket, rest], { + protocolVersion: 'hixie-76', + protocol: protocol + }); + if (self.options.clientTracking) { + self.clients.push(client); + client.on('close', function() { + var index = self.clients.indexOf(client); + if (index != -1) { + self.clients.splice(index, 1); + } + }); + } + + // signal upgrade complete + socket.removeListener('error', errorHandler); + cb(client); + }); + } + catch (e) { + try { socket.destroy(); } catch (e) {} + return; + } + } + + // retrieve nonce + var nonceLength = 8; + if (upgradeHead && upgradeHead.length >= nonceLength) { + var nonce = upgradeHead.slice(0, nonceLength); + var rest = upgradeHead.length > nonceLength ? upgradeHead.slice(nonceLength) : null; + completeHandshake.call(self, nonce, rest); + } + else { + // nonce not present in upgradeHead, so we must wait for enough data + // data to arrive before continuing + var nonce = new Buffer(nonceLength); + upgradeHead.copy(nonce, 0); + var received = upgradeHead.length; + var rest = null; + var handler = function (data) { + var toRead = Math.min(data.length, nonceLength - received); + if (toRead === 0) return; + data.copy(nonce, received, 0, toRead); + received += toRead; + if (received == nonceLength) { + socket.removeListener('data', handler); + if (toRead < data.length) rest = data.slice(toRead); + completeHandshake.call(self, nonce, rest); + } + } + socket.on('data', handler); + } + } + + // verify client + if (typeof this.options.verifyClient == 'function') { + var info = { + origin: origin, + secure: typeof req.connection.authorized !== 'undefined' || typeof req.connection.encrypted !== 'undefined', + req: req + }; + if (this.options.verifyClient.length == 2) { + var self = this; + this.options.verifyClient(info, function(result) { + if (!result) abortConnection(socket, 401, 'Unauthorized') + else onClientVerified.apply(self); + }); + return; + } + else if (!this.options.verifyClient(info)) { + abortConnection(socket, 401, 'Unauthorized'); + return; + } + } + + // no client verification required + onClientVerified(); +} + +function abortConnection(socket, code, name) { + try { + var response = [ + 'HTTP/1.1 ' + code + ' ' + name, + 'Content-type: text/html' + ]; + socket.write(response.concat('', '').join('\r\n')); + } + catch (e) { /* ignore errors - we've aborted this connection */ } + finally { + // ensure that an early aborted connection is shut down completely + try { socket.destroy(); } catch (e) {} + } +} diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/browser.js b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/browser.js new file mode 100644 index 0000000..8d3a755 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/browser.js @@ -0,0 +1,43 @@ + +/** + * Module dependencies. + */ + +var global = (function() { return this; })(); + +/** + * WebSocket constructor. + */ + +var WebSocket = global.WebSocket || global.MozWebSocket; + +/** + * Module exports. + */ + +module.exports = WebSocket ? ws : null; + +/** + * WebSocket constructor. + * + * The third `opts` options object gets ignored in web browsers, since it's + * non-standard, and throws a TypeError if passed to the constructor. + * See: https://github.com/einaros/ws/issues/227 + * + * @param {String} uri + * @param {Array} protocols (optional) + * @param {Object) opts (optional) + * @api public + */ + +function ws(uri, protocols, opts) { + var instance; + if (protocols) { + instance = new WebSocket(uri, protocols); + } else { + instance = new WebSocket(uri); + } + return instance; +} + +if (WebSocket) ws.prototype = WebSocket.prototype; diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/commander/.npmignore b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/commander/.npmignore new file mode 100644 index 0000000..f1250e5 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/commander/.npmignore @@ -0,0 +1,4 @@ +support +test +examples +*.sock diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/commander/.travis.yml b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/commander/.travis.yml new file mode 100644 index 0000000..f1d0f13 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/commander/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - 0.4 + - 0.6 diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/commander/History.md b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/commander/History.md new file mode 100644 index 0000000..4961d2e --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/commander/History.md @@ -0,0 +1,107 @@ + +0.6.1 / 2012-06-01 +================== + + * Added: append (yes or no) on confirmation + * Added: allow node.js v0.7.x + +0.6.0 / 2012-04-10 +================== + + * Added `.prompt(obj, callback)` support. Closes #49 + * Added default support to .choose(). Closes #41 + * Fixed the choice example + +0.5.1 / 2011-12-20 +================== + + * Fixed `password()` for recent nodes. Closes #36 + +0.5.0 / 2011-12-04 +================== + + * Added sub-command option support [itay] + +0.4.3 / 2011-12-04 +================== + + * Fixed custom help ordering. Closes #32 + +0.4.2 / 2011-11-24 +================== + + * Added travis support + * Fixed: line-buffered input automatically trimmed. Closes #31 + +0.4.1 / 2011-11-18 +================== + + * Removed listening for "close" on --help + +0.4.0 / 2011-11-15 +================== + + * Added support for `--`. Closes #24 + +0.3.3 / 2011-11-14 +================== + + * Fixed: wait for close event when writing help info [Jerry Hamlet] + +0.3.2 / 2011-11-01 +================== + + * Fixed long flag definitions with values [felixge] + +0.3.1 / 2011-10-31 +================== + + * Changed `--version` short flag to `-V` from `-v` + * Changed `.version()` so it's configurable [felixge] + +0.3.0 / 2011-10-31 +================== + + * Added support for long flags only. Closes #18 + +0.2.1 / 2011-10-24 +================== + + * "node": ">= 0.4.x < 0.7.0". Closes #20 + +0.2.0 / 2011-09-26 +================== + + * Allow for defaults that are not just boolean. Default peassignment only occurs for --no-*, optional, and required arguments. [Jim Isaacs] + +0.1.0 / 2011-08-24 +================== + + * Added support for custom `--help` output + +0.0.5 / 2011-08-18 +================== + + * Changed: when the user enters nothing prompt for password again + * Fixed issue with passwords beginning with numbers [NuckChorris] + +0.0.4 / 2011-08-15 +================== + + * Fixed `Commander#args` + +0.0.3 / 2011-08-15 +================== + + * Added default option value support + +0.0.2 / 2011-08-15 +================== + + * Added mask support to `Command#password(str[, mask], fn)` + * Added `Command#password(str, fn)` + +0.0.1 / 2010-01-03 +================== + + * Initial release diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/commander/Makefile b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/commander/Makefile new file mode 100644 index 0000000..0074625 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/commander/Makefile @@ -0,0 +1,7 @@ + +TESTS = $(shell find test/test.*.js) + +test: + @./test/run $(TESTS) + +.PHONY: test \ No newline at end of file diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/commander/Readme.md b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/commander/Readme.md new file mode 100644 index 0000000..b8328c3 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/commander/Readme.md @@ -0,0 +1,262 @@ +# Commander.js + + The complete solution for [node.js](http://nodejs.org) command-line interfaces, inspired by Ruby's [commander](https://github.com/visionmedia/commander). + + [![Build Status](https://secure.travis-ci.org/visionmedia/commander.js.png)](http://travis-ci.org/visionmedia/commander.js) + +## Installation + + $ npm install commander + +## Option parsing + + Options with commander are defined with the `.option()` method, also serving as documentation for the options. The example below parses args and options from `process.argv`, leaving remaining args as the `program.args` array which were not consumed by options. + +```js +#!/usr/bin/env node + +/** + * Module dependencies. + */ + +var program = require('commander'); + +program + .version('0.0.1') + .option('-p, --peppers', 'Add peppers') + .option('-P, --pineapple', 'Add pineapple') + .option('-b, --bbq', 'Add bbq sauce') + .option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble') + .parse(process.argv); + +console.log('you ordered a pizza with:'); +if (program.peppers) console.log(' - peppers'); +if (program.pineapple) console.log(' - pineappe'); +if (program.bbq) console.log(' - bbq'); +console.log(' - %s cheese', program.cheese); +``` + + Short flags may be passed as a single arg, for example `-abc` is equivalent to `-a -b -c`. Multi-word options such as "--template-engine" are camel-cased, becoming `program.templateEngine` etc. + +## Automated --help + + The help information is auto-generated based on the information commander already knows about your program, so the following `--help` info is for free: + +``` + $ ./examples/pizza --help + + Usage: pizza [options] + + Options: + + -V, --version output the version number + -p, --peppers Add peppers + -P, --pineapple Add pineappe + -b, --bbq Add bbq sauce + -c, --cheese Add the specified type of cheese [marble] + -h, --help output usage information + +``` + +## Coercion + +```js +function range(val) { + return val.split('..').map(Number); +} + +function list(val) { + return val.split(','); +} + +program + .version('0.0.1') + .usage('[options] ') + .option('-i, --integer ', 'An integer argument', parseInt) + .option('-f, --float ', 'A float argument', parseFloat) + .option('-r, --range ..', 'A range', range) + .option('-l, --list ', 'A list', list) + .option('-o, --optional [value]', 'An optional value') + .parse(process.argv); + +console.log(' int: %j', program.integer); +console.log(' float: %j', program.float); +console.log(' optional: %j', program.optional); +program.range = program.range || []; +console.log(' range: %j..%j', program.range[0], program.range[1]); +console.log(' list: %j', program.list); +console.log(' args: %j', program.args); +``` + +## Custom help + + You can display arbitrary `-h, --help` information + by listening for "--help". Commander will automatically + exit once you are done so that the remainder of your program + does not execute causing undesired behaviours, for example + in the following executable "stuff" will not output when + `--help` is used. + +```js +#!/usr/bin/env node + +/** + * Module dependencies. + */ + +var program = require('../'); + +function list(val) { + return val.split(',').map(Number); +} + +program + .version('0.0.1') + .option('-f, --foo', 'enable some foo') + .option('-b, --bar', 'enable some bar') + .option('-B, --baz', 'enable some baz'); + +// must be before .parse() since +// node's emit() is immediate + +program.on('--help', function(){ + console.log(' Examples:'); + console.log(''); + console.log(' $ custom-help --help'); + console.log(' $ custom-help -h'); + console.log(''); +}); + +program.parse(process.argv); + +console.log('stuff'); +``` + +yielding the following help output: + +``` + +Usage: custom-help [options] + +Options: + + -h, --help output usage information + -V, --version output the version number + -f, --foo enable some foo + -b, --bar enable some bar + -B, --baz enable some baz + +Examples: + + $ custom-help --help + $ custom-help -h + +``` + +## .prompt(msg, fn) + + Single-line prompt: + +```js +program.prompt('name: ', function(name){ + console.log('hi %s', name); +}); +``` + + Multi-line prompt: + +```js +program.prompt('description:', function(name){ + console.log('hi %s', name); +}); +``` + + Coercion: + +```js +program.prompt('Age: ', Number, function(age){ + console.log('age: %j', age); +}); +``` + +```js +program.prompt('Birthdate: ', Date, function(date){ + console.log('date: %s', date); +}); +``` + +## .password(msg[, mask], fn) + +Prompt for password without echoing: + +```js +program.password('Password: ', function(pass){ + console.log('got "%s"', pass); + process.stdin.destroy(); +}); +``` + +Prompt for password with mask char "*": + +```js +program.password('Password: ', '*', function(pass){ + console.log('got "%s"', pass); + process.stdin.destroy(); +}); +``` + +## .confirm(msg, fn) + + Confirm with the given `msg`: + +```js +program.confirm('continue? ', function(ok){ + console.log(' got %j', ok); +}); +``` + +## .choose(list, fn) + + Let the user choose from a `list`: + +```js +var list = ['tobi', 'loki', 'jane', 'manny', 'luna']; + +console.log('Choose the coolest pet:'); +program.choose(list, function(i){ + console.log('you chose %d "%s"', i, list[i]); +}); +``` + +## Links + + - [API documentation](http://visionmedia.github.com/commander.js/) + - [ascii tables](https://github.com/LearnBoost/cli-table) + - [progress bars](https://github.com/visionmedia/node-progress) + - [more progress bars](https://github.com/substack/node-multimeter) + - [examples](https://github.com/visionmedia/commander.js/tree/master/examples) + +## License + +(The MIT License) + +Copyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/commander/index.js b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/commander/index.js new file mode 100644 index 0000000..06ec1e4 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/commander/index.js @@ -0,0 +1,2 @@ + +module.exports = require('./lib/commander'); \ No newline at end of file diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/commander/lib/commander.js b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/commander/lib/commander.js new file mode 100644 index 0000000..5ba87eb --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/commander/lib/commander.js @@ -0,0 +1,1026 @@ + +/*! + * commander + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var EventEmitter = require('events').EventEmitter + , path = require('path') + , tty = require('tty') + , basename = path.basename; + +/** + * Expose the root command. + */ + +exports = module.exports = new Command; + +/** + * Expose `Command`. + */ + +exports.Command = Command; + +/** + * Expose `Option`. + */ + +exports.Option = Option; + +/** + * Initialize a new `Option` with the given `flags` and `description`. + * + * @param {String} flags + * @param {String} description + * @api public + */ + +function Option(flags, description) { + this.flags = flags; + this.required = ~flags.indexOf('<'); + this.optional = ~flags.indexOf('['); + this.bool = !~flags.indexOf('-no-'); + flags = flags.split(/[ ,|]+/); + if (flags.length > 1 && !/^[[<]/.test(flags[1])) this.short = flags.shift(); + this.long = flags.shift(); + this.description = description; +} + +/** + * Return option name. + * + * @return {String} + * @api private + */ + +Option.prototype.name = function(){ + return this.long + .replace('--', '') + .replace('no-', ''); +}; + +/** + * Check if `arg` matches the short or long flag. + * + * @param {String} arg + * @return {Boolean} + * @api private + */ + +Option.prototype.is = function(arg){ + return arg == this.short + || arg == this.long; +}; + +/** + * Initialize a new `Command`. + * + * @param {String} name + * @api public + */ + +function Command(name) { + this.commands = []; + this.options = []; + this.args = []; + this.name = name; +} + +/** + * Inherit from `EventEmitter.prototype`. + */ + +Command.prototype.__proto__ = EventEmitter.prototype; + +/** + * Add command `name`. + * + * The `.action()` callback is invoked when the + * command `name` is specified via __ARGV__, + * and the remaining arguments are applied to the + * function for access. + * + * When the `name` is "*" an un-matched command + * will be passed as the first arg, followed by + * the rest of __ARGV__ remaining. + * + * Examples: + * + * program + * .version('0.0.1') + * .option('-C, --chdir ', 'change the working directory') + * .option('-c, --config ', 'set config path. defaults to ./deploy.conf') + * .option('-T, --no-tests', 'ignore test hook') + * + * program + * .command('setup') + * .description('run remote setup commands') + * .action(function(){ + * console.log('setup'); + * }); + * + * program + * .command('exec ') + * .description('run the given remote command') + * .action(function(cmd){ + * console.log('exec "%s"', cmd); + * }); + * + * program + * .command('*') + * .description('deploy the given env') + * .action(function(env){ + * console.log('deploying "%s"', env); + * }); + * + * program.parse(process.argv); + * + * @param {String} name + * @return {Command} the new command + * @api public + */ + +Command.prototype.command = function(name){ + var args = name.split(/ +/); + var cmd = new Command(args.shift()); + this.commands.push(cmd); + cmd.parseExpectedArgs(args); + cmd.parent = this; + return cmd; +}; + +/** + * Parse expected `args`. + * + * For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`. + * + * @param {Array} args + * @return {Command} for chaining + * @api public + */ + +Command.prototype.parseExpectedArgs = function(args){ + if (!args.length) return; + var self = this; + args.forEach(function(arg){ + switch (arg[0]) { + case '<': + self.args.push({ required: true, name: arg.slice(1, -1) }); + break; + case '[': + self.args.push({ required: false, name: arg.slice(1, -1) }); + break; + } + }); + return this; +}; + +/** + * Register callback `fn` for the command. + * + * Examples: + * + * program + * .command('help') + * .description('display verbose help') + * .action(function(){ + * // output help here + * }); + * + * @param {Function} fn + * @return {Command} for chaining + * @api public + */ + +Command.prototype.action = function(fn){ + var self = this; + this.parent.on(this.name, function(args, unknown){ + // Parse any so-far unknown options + unknown = unknown || []; + var parsed = self.parseOptions(unknown); + + // Output help if necessary + outputHelpIfNecessary(self, parsed.unknown); + + // If there are still any unknown options, then we simply + // die, unless someone asked for help, in which case we give it + // to them, and then we die. + if (parsed.unknown.length > 0) { + self.unknownOption(parsed.unknown[0]); + } + + self.args.forEach(function(arg, i){ + if (arg.required && null == args[i]) { + self.missingArgument(arg.name); + } + }); + + // Always append ourselves to the end of the arguments, + // to make sure we match the number of arguments the user + // expects + if (self.args.length) { + args[self.args.length] = self; + } else { + args.push(self); + } + + fn.apply(this, args); + }); + return this; +}; + +/** + * Define option with `flags`, `description` and optional + * coercion `fn`. + * + * The `flags` string should contain both the short and long flags, + * separated by comma, a pipe or space. The following are all valid + * all will output this way when `--help` is used. + * + * "-p, --pepper" + * "-p|--pepper" + * "-p --pepper" + * + * Examples: + * + * // simple boolean defaulting to false + * program.option('-p, --pepper', 'add pepper'); + * + * --pepper + * program.pepper + * // => Boolean + * + * // simple boolean defaulting to false + * program.option('-C, --no-cheese', 'remove cheese'); + * + * program.cheese + * // => true + * + * --no-cheese + * program.cheese + * // => true + * + * // required argument + * program.option('-C, --chdir ', 'change the working directory'); + * + * --chdir /tmp + * program.chdir + * // => "/tmp" + * + * // optional argument + * program.option('-c, --cheese [type]', 'add cheese [marble]'); + * + * @param {String} flags + * @param {String} description + * @param {Function|Mixed} fn or default + * @param {Mixed} defaultValue + * @return {Command} for chaining + * @api public + */ + +Command.prototype.option = function(flags, description, fn, defaultValue){ + var self = this + , option = new Option(flags, description) + , oname = option.name() + , name = camelcase(oname); + + // default as 3rd arg + if ('function' != typeof fn) defaultValue = fn, fn = null; + + // preassign default value only for --no-*, [optional], or + if (false == option.bool || option.optional || option.required) { + // when --no-* we make sure default is true + if (false == option.bool) defaultValue = true; + // preassign only if we have a default + if (undefined !== defaultValue) self[name] = defaultValue; + } + + // register the option + this.options.push(option); + + // when it's passed assign the value + // and conditionally invoke the callback + this.on(oname, function(val){ + // coercion + if (null != val && fn) val = fn(val); + + // unassigned or bool + if ('boolean' == typeof self[name] || 'undefined' == typeof self[name]) { + // if no value, bool true, and we have a default, then use it! + if (null == val) { + self[name] = option.bool + ? defaultValue || true + : false; + } else { + self[name] = val; + } + } else if (null !== val) { + // reassign + self[name] = val; + } + }); + + return this; +}; + +/** + * Parse `argv`, settings options and invoking commands when defined. + * + * @param {Array} argv + * @return {Command} for chaining + * @api public + */ + +Command.prototype.parse = function(argv){ + // store raw args + this.rawArgs = argv; + + // guess name + if (!this.name) this.name = basename(argv[1]); + + // process argv + var parsed = this.parseOptions(this.normalize(argv.slice(2))); + this.args = parsed.args; + return this.parseArgs(this.args, parsed.unknown); +}; + +/** + * Normalize `args`, splitting joined short flags. For example + * the arg "-abc" is equivalent to "-a -b -c". + * + * @param {Array} args + * @return {Array} + * @api private + */ + +Command.prototype.normalize = function(args){ + var ret = [] + , arg; + + for (var i = 0, len = args.length; i < len; ++i) { + arg = args[i]; + if (arg.length > 1 && '-' == arg[0] && '-' != arg[1]) { + arg.slice(1).split('').forEach(function(c){ + ret.push('-' + c); + }); + } else { + ret.push(arg); + } + } + + return ret; +}; + +/** + * Parse command `args`. + * + * When listener(s) are available those + * callbacks are invoked, otherwise the "*" + * event is emitted and those actions are invoked. + * + * @param {Array} args + * @return {Command} for chaining + * @api private + */ + +Command.prototype.parseArgs = function(args, unknown){ + var cmds = this.commands + , len = cmds.length + , name; + + if (args.length) { + name = args[0]; + if (this.listeners(name).length) { + this.emit(args.shift(), args, unknown); + } else { + this.emit('*', args); + } + } else { + outputHelpIfNecessary(this, unknown); + + // If there were no args and we have unknown options, + // then they are extraneous and we need to error. + if (unknown.length > 0) { + this.unknownOption(unknown[0]); + } + } + + return this; +}; + +/** + * Return an option matching `arg` if any. + * + * @param {String} arg + * @return {Option} + * @api private + */ + +Command.prototype.optionFor = function(arg){ + for (var i = 0, len = this.options.length; i < len; ++i) { + if (this.options[i].is(arg)) { + return this.options[i]; + } + } +}; + +/** + * Parse options from `argv` returning `argv` + * void of these options. + * + * @param {Array} argv + * @return {Array} + * @api public + */ + +Command.prototype.parseOptions = function(argv){ + var args = [] + , len = argv.length + , literal + , option + , arg; + + var unknownOptions = []; + + // parse options + for (var i = 0; i < len; ++i) { + arg = argv[i]; + + // literal args after -- + if ('--' == arg) { + literal = true; + continue; + } + + if (literal) { + args.push(arg); + continue; + } + + // find matching Option + option = this.optionFor(arg); + + // option is defined + if (option) { + // requires arg + if (option.required) { + arg = argv[++i]; + if (null == arg) return this.optionMissingArgument(option); + if ('-' == arg[0]) return this.optionMissingArgument(option, arg); + this.emit(option.name(), arg); + // optional arg + } else if (option.optional) { + arg = argv[i+1]; + if (null == arg || '-' == arg[0]) { + arg = null; + } else { + ++i; + } + this.emit(option.name(), arg); + // bool + } else { + this.emit(option.name()); + } + continue; + } + + // looks like an option + if (arg.length > 1 && '-' == arg[0]) { + unknownOptions.push(arg); + + // If the next argument looks like it might be + // an argument for this option, we pass it on. + // If it isn't, then it'll simply be ignored + if (argv[i+1] && '-' != argv[i+1][0]) { + unknownOptions.push(argv[++i]); + } + continue; + } + + // arg + args.push(arg); + } + + return { args: args, unknown: unknownOptions }; +}; + +/** + * Argument `name` is missing. + * + * @param {String} name + * @api private + */ + +Command.prototype.missingArgument = function(name){ + console.error(); + console.error(" error: missing required argument `%s'", name); + console.error(); + process.exit(1); +}; + +/** + * `Option` is missing an argument, but received `flag` or nothing. + * + * @param {String} option + * @param {String} flag + * @api private + */ + +Command.prototype.optionMissingArgument = function(option, flag){ + console.error(); + if (flag) { + console.error(" error: option `%s' argument missing, got `%s'", option.flags, flag); + } else { + console.error(" error: option `%s' argument missing", option.flags); + } + console.error(); + process.exit(1); +}; + +/** + * Unknown option `flag`. + * + * @param {String} flag + * @api private + */ + +Command.prototype.unknownOption = function(flag){ + console.error(); + console.error(" error: unknown option `%s'", flag); + console.error(); + process.exit(1); +}; + +/** + * Set the program version to `str`. + * + * This method auto-registers the "-V, --version" flag + * which will print the version number when passed. + * + * @param {String} str + * @param {String} flags + * @return {Command} for chaining + * @api public + */ + +Command.prototype.version = function(str, flags){ + if (0 == arguments.length) return this._version; + this._version = str; + flags = flags || '-V, --version'; + this.option(flags, 'output the version number'); + this.on('version', function(){ + console.log(str); + process.exit(0); + }); + return this; +}; + +/** + * Set the description `str`. + * + * @param {String} str + * @return {String|Command} + * @api public + */ + +Command.prototype.description = function(str){ + if (0 == arguments.length) return this._description; + this._description = str; + return this; +}; + +/** + * Set / get the command usage `str`. + * + * @param {String} str + * @return {String|Command} + * @api public + */ + +Command.prototype.usage = function(str){ + var args = this.args.map(function(arg){ + return arg.required + ? '<' + arg.name + '>' + : '[' + arg.name + ']'; + }); + + var usage = '[options' + + (this.commands.length ? '] [command' : '') + + ']' + + (this.args.length ? ' ' + args : ''); + if (0 == arguments.length) return this._usage || usage; + this._usage = str; + + return this; +}; + +/** + * Return the largest option length. + * + * @return {Number} + * @api private + */ + +Command.prototype.largestOptionLength = function(){ + return this.options.reduce(function(max, option){ + return Math.max(max, option.flags.length); + }, 0); +}; + +/** + * Return help for options. + * + * @return {String} + * @api private + */ + +Command.prototype.optionHelp = function(){ + var width = this.largestOptionLength(); + + // Prepend the help information + return [pad('-h, --help', width) + ' ' + 'output usage information'] + .concat(this.options.map(function(option){ + return pad(option.flags, width) + + ' ' + option.description; + })) + .join('\n'); +}; + +/** + * Return command help documentation. + * + * @return {String} + * @api private + */ + +Command.prototype.commandHelp = function(){ + if (!this.commands.length) return ''; + return [ + '' + , ' Commands:' + , '' + , this.commands.map(function(cmd){ + var args = cmd.args.map(function(arg){ + return arg.required + ? '<' + arg.name + '>' + : '[' + arg.name + ']'; + }).join(' '); + + return cmd.name + + (cmd.options.length + ? ' [options]' + : '') + ' ' + args + + (cmd.description() + ? '\n' + cmd.description() + : ''); + }).join('\n\n').replace(/^/gm, ' ') + , '' + ].join('\n'); +}; + +/** + * Return program help documentation. + * + * @return {String} + * @api private + */ + +Command.prototype.helpInformation = function(){ + return [ + '' + , ' Usage: ' + this.name + ' ' + this.usage() + , '' + this.commandHelp() + , ' Options:' + , '' + , '' + this.optionHelp().replace(/^/gm, ' ') + , '' + , '' + ].join('\n'); +}; + +/** + * Prompt for a `Number`. + * + * @param {String} str + * @param {Function} fn + * @api private + */ + +Command.prototype.promptForNumber = function(str, fn){ + var self = this; + this.promptSingleLine(str, function parseNumber(val){ + val = Number(val); + if (isNaN(val)) return self.promptSingleLine(str + '(must be a number) ', parseNumber); + fn(val); + }); +}; + +/** + * Prompt for a `Date`. + * + * @param {String} str + * @param {Function} fn + * @api private + */ + +Command.prototype.promptForDate = function(str, fn){ + var self = this; + this.promptSingleLine(str, function parseDate(val){ + val = new Date(val); + if (isNaN(val.getTime())) return self.promptSingleLine(str + '(must be a date) ', parseDate); + fn(val); + }); +}; + +/** + * Single-line prompt. + * + * @param {String} str + * @param {Function} fn + * @api private + */ + +Command.prototype.promptSingleLine = function(str, fn){ + if ('function' == typeof arguments[2]) { + return this['promptFor' + (fn.name || fn)](str, arguments[2]); + } + + process.stdout.write(str); + process.stdin.setEncoding('utf8'); + process.stdin.once('data', function(val){ + fn(val.trim()); + }).resume(); +}; + +/** + * Multi-line prompt. + * + * @param {String} str + * @param {Function} fn + * @api private + */ + +Command.prototype.promptMultiLine = function(str, fn){ + var buf = []; + console.log(str); + process.stdin.setEncoding('utf8'); + process.stdin.on('data', function(val){ + if ('\n' == val || '\r\n' == val) { + process.stdin.removeAllListeners('data'); + fn(buf.join('\n')); + } else { + buf.push(val.trimRight()); + } + }).resume(); +}; + +/** + * Prompt `str` and callback `fn(val)` + * + * Commander supports single-line and multi-line prompts. + * To issue a single-line prompt simply add white-space + * to the end of `str`, something like "name: ", whereas + * for a multi-line prompt omit this "description:". + * + * + * Examples: + * + * program.prompt('Username: ', function(name){ + * console.log('hi %s', name); + * }); + * + * program.prompt('Description:', function(desc){ + * console.log('description was "%s"', desc.trim()); + * }); + * + * @param {String|Object} str + * @param {Function} fn + * @api public + */ + +Command.prototype.prompt = function(str, fn){ + var self = this; + + if ('string' == typeof str) { + if (/ $/.test(str)) return this.promptSingleLine.apply(this, arguments); + this.promptMultiLine(str, fn); + } else { + var keys = Object.keys(str) + , obj = {}; + + function next() { + var key = keys.shift() + , label = str[key]; + + if (!key) return fn(obj); + self.prompt(label, function(val){ + obj[key] = val; + next(); + }); + } + + next(); + } +}; + +/** + * Prompt for password with `str`, `mask` char and callback `fn(val)`. + * + * The mask string defaults to '', aka no output is + * written while typing, you may want to use "*" etc. + * + * Examples: + * + * program.password('Password: ', function(pass){ + * console.log('got "%s"', pass); + * process.stdin.destroy(); + * }); + * + * program.password('Password: ', '*', function(pass){ + * console.log('got "%s"', pass); + * process.stdin.destroy(); + * }); + * + * @param {String} str + * @param {String} mask + * @param {Function} fn + * @api public + */ + +Command.prototype.password = function(str, mask, fn){ + var self = this + , buf = ''; + + // default mask + if ('function' == typeof mask) { + fn = mask; + mask = ''; + } + + process.stdin.resume(); + tty.setRawMode(true); + process.stdout.write(str); + + // keypress + process.stdin.on('keypress', function(c, key){ + if (key && 'enter' == key.name) { + console.log(); + process.stdin.removeAllListeners('keypress'); + tty.setRawMode(false); + if (!buf.trim().length) return self.password(str, mask, fn); + fn(buf); + return; + } + + if (key && key.ctrl && 'c' == key.name) { + console.log('%s', buf); + process.exit(); + } + + process.stdout.write(mask); + buf += c; + }).resume(); +}; + +/** + * Confirmation prompt with `str` and callback `fn(bool)` + * + * Examples: + * + * program.confirm('continue? ', function(ok){ + * console.log(' got %j', ok); + * process.stdin.destroy(); + * }); + * + * @param {String} str + * @param {Function} fn + * @api public + */ + + +Command.prototype.confirm = function(str, fn, verbose){ + var self = this; + this.prompt(str, function(ok){ + if (!ok.trim()) { + if (!verbose) str += '(yes or no) '; + return self.confirm(str, fn, true); + } + fn(parseBool(ok)); + }); +}; + +/** + * Choice prompt with `list` of items and callback `fn(index, item)` + * + * Examples: + * + * var list = ['tobi', 'loki', 'jane', 'manny', 'luna']; + * + * console.log('Choose the coolest pet:'); + * program.choose(list, function(i){ + * console.log('you chose %d "%s"', i, list[i]); + * process.stdin.destroy(); + * }); + * + * @param {Array} list + * @param {Number|Function} index or fn + * @param {Function} fn + * @api public + */ + +Command.prototype.choose = function(list, index, fn){ + var self = this + , hasDefault = 'number' == typeof index; + + if (!hasDefault) { + fn = index; + index = null; + } + + list.forEach(function(item, i){ + if (hasDefault && i == index) { + console.log('* %d) %s', i + 1, item); + } else { + console.log(' %d) %s', i + 1, item); + } + }); + + function again() { + self.prompt(' : ', function(val){ + val = parseInt(val, 10) - 1; + if (hasDefault && isNaN(val)) val = index; + + if (null == list[val]) { + again(); + } else { + fn(val, list[val]); + } + }); + } + + again(); +}; + +/** + * Camel-case the given `flag` + * + * @param {String} flag + * @return {String} + * @api private + */ + +function camelcase(flag) { + return flag.split('-').reduce(function(str, word){ + return str + word[0].toUpperCase() + word.slice(1); + }); +} + +/** + * Parse a boolean `str`. + * + * @param {String} str + * @return {Boolean} + * @api private + */ + +function parseBool(str) { + return /^y|yes|ok|true$/i.test(str); +} + +/** + * Pad `str` to `width`. + * + * @param {String} str + * @param {Number} width + * @return {String} + * @api private + */ + +function pad(str, width) { + var len = Math.max(0, width - str.length); + return str + Array(len + 1).join(' '); +} + +/** + * Output help information if necessary + * + * @param {Command} command to output help for + * @param {Array} array of options to search for -h or --help + * @api private + */ + +function outputHelpIfNecessary(cmd, options) { + options = options || []; + for (var i = 0; i < options.length; i++) { + if (options[i] == '--help' || options[i] == '-h') { + process.stdout.write(cmd.helpInformation()); + cmd.emit('--help'); + process.exit(0); + } + } +} diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/commander/package.json b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/commander/package.json new file mode 100644 index 0000000..12ae9fe --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/commander/package.json @@ -0,0 +1,41 @@ +{ + "name": "commander", + "version": "0.6.1", + "description": "the complete solution for node.js command-line programs", + "keywords": [ + "command", + "option", + "parser", + "prompt", + "stdin" + ], + "author": { + "name": "TJ Holowaychuk", + "email": "tj@vision-media.ca" + }, + "repository": { + "type": "git", + "url": "https://github.com/visionmedia/commander.js.git" + }, + "dependencies": {}, + "devDependencies": { + "should": ">= 0.0.1" + }, + "scripts": { + "test": "make test" + }, + "main": "index", + "engines": { + "node": ">= 0.4.x" + }, + "readme": "# Commander.js\n\n The complete solution for [node.js](http://nodejs.org) command-line interfaces, inspired by Ruby's [commander](https://github.com/visionmedia/commander).\n\n [![Build Status](https://secure.travis-ci.org/visionmedia/commander.js.png)](http://travis-ci.org/visionmedia/commander.js)\n\n## Installation\n\n $ npm install commander\n\n## Option parsing\n\n Options with commander are defined with the `.option()` method, also serving as documentation for the options. The example below parses args and options from `process.argv`, leaving remaining args as the `program.args` array which were not consumed by options.\n\n```js\n#!/usr/bin/env node\n\n/**\n * Module dependencies.\n */\n\nvar program = require('commander');\n\nprogram\n .version('0.0.1')\n .option('-p, --peppers', 'Add peppers')\n .option('-P, --pineapple', 'Add pineapple')\n .option('-b, --bbq', 'Add bbq sauce')\n .option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble')\n .parse(process.argv);\n\nconsole.log('you ordered a pizza with:');\nif (program.peppers) console.log(' - peppers');\nif (program.pineapple) console.log(' - pineappe');\nif (program.bbq) console.log(' - bbq');\nconsole.log(' - %s cheese', program.cheese);\n```\n\n Short flags may be passed as a single arg, for example `-abc` is equivalent to `-a -b -c`. Multi-word options such as \"--template-engine\" are camel-cased, becoming `program.templateEngine` etc.\n\n## Automated --help\n\n The help information is auto-generated based on the information commander already knows about your program, so the following `--help` info is for free:\n\n``` \n $ ./examples/pizza --help\n\n Usage: pizza [options]\n\n Options:\n\n -V, --version output the version number\n -p, --peppers Add peppers\n -P, --pineapple Add pineappe\n -b, --bbq Add bbq sauce\n -c, --cheese Add the specified type of cheese [marble]\n -h, --help output usage information\n\n```\n\n## Coercion\n\n```js\nfunction range(val) {\n return val.split('..').map(Number);\n}\n\nfunction list(val) {\n return val.split(',');\n}\n\nprogram\n .version('0.0.1')\n .usage('[options] ')\n .option('-i, --integer ', 'An integer argument', parseInt)\n .option('-f, --float ', 'A float argument', parseFloat)\n .option('-r, --range ..', 'A range', range)\n .option('-l, --list ', 'A list', list)\n .option('-o, --optional [value]', 'An optional value')\n .parse(process.argv);\n\nconsole.log(' int: %j', program.integer);\nconsole.log(' float: %j', program.float);\nconsole.log(' optional: %j', program.optional);\nprogram.range = program.range || [];\nconsole.log(' range: %j..%j', program.range[0], program.range[1]);\nconsole.log(' list: %j', program.list);\nconsole.log(' args: %j', program.args);\n```\n\n## Custom help\n\n You can display arbitrary `-h, --help` information\n by listening for \"--help\". Commander will automatically\n exit once you are done so that the remainder of your program\n does not execute causing undesired behaviours, for example\n in the following executable \"stuff\" will not output when\n `--help` is used.\n\n```js\n#!/usr/bin/env node\n\n/**\n * Module dependencies.\n */\n\nvar program = require('../');\n\nfunction list(val) {\n return val.split(',').map(Number);\n}\n\nprogram\n .version('0.0.1')\n .option('-f, --foo', 'enable some foo')\n .option('-b, --bar', 'enable some bar')\n .option('-B, --baz', 'enable some baz');\n\n// must be before .parse() since\n// node's emit() is immediate\n\nprogram.on('--help', function(){\n console.log(' Examples:');\n console.log('');\n console.log(' $ custom-help --help');\n console.log(' $ custom-help -h');\n console.log('');\n});\n\nprogram.parse(process.argv);\n\nconsole.log('stuff');\n```\n\nyielding the following help output:\n\n```\n\nUsage: custom-help [options]\n\nOptions:\n\n -h, --help output usage information\n -V, --version output the version number\n -f, --foo enable some foo\n -b, --bar enable some bar\n -B, --baz enable some baz\n\nExamples:\n\n $ custom-help --help\n $ custom-help -h\n\n```\n\n## .prompt(msg, fn)\n\n Single-line prompt:\n\n```js\nprogram.prompt('name: ', function(name){\n console.log('hi %s', name);\n});\n```\n\n Multi-line prompt:\n\n```js\nprogram.prompt('description:', function(name){\n console.log('hi %s', name);\n});\n```\n\n Coercion:\n\n```js\nprogram.prompt('Age: ', Number, function(age){\n console.log('age: %j', age);\n});\n```\n\n```js\nprogram.prompt('Birthdate: ', Date, function(date){\n console.log('date: %s', date);\n});\n```\n\n## .password(msg[, mask], fn)\n\nPrompt for password without echoing:\n\n```js\nprogram.password('Password: ', function(pass){\n console.log('got \"%s\"', pass);\n process.stdin.destroy();\n});\n```\n\nPrompt for password with mask char \"*\":\n\n```js\nprogram.password('Password: ', '*', function(pass){\n console.log('got \"%s\"', pass);\n process.stdin.destroy();\n});\n```\n\n## .confirm(msg, fn)\n\n Confirm with the given `msg`:\n\n```js\nprogram.confirm('continue? ', function(ok){\n console.log(' got %j', ok);\n});\n```\n\n## .choose(list, fn)\n\n Let the user choose from a `list`:\n\n```js\nvar list = ['tobi', 'loki', 'jane', 'manny', 'luna'];\n\nconsole.log('Choose the coolest pet:');\nprogram.choose(list, function(i){\n console.log('you chose %d \"%s\"', i, list[i]);\n});\n```\n\n## Links\n\n - [API documentation](http://visionmedia.github.com/commander.js/)\n - [ascii tables](https://github.com/LearnBoost/cli-table)\n - [progress bars](https://github.com/visionmedia/node-progress)\n - [more progress bars](https://github.com/substack/node-multimeter)\n - [examples](https://github.com/visionmedia/commander.js/tree/master/examples)\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.", + "readmeFilename": "Readme.md", + "bugs": { + "url": "https://github.com/visionmedia/commander.js/issues" + }, + "homepage": "https://github.com/visionmedia/commander.js", + "_id": "commander@0.6.1", + "_shasum": "fa68a14f6a945d54dbbe50d8cdb3320e9e3b1a06", + "_from": "commander@>=0.6.1-0 <0.7.0-0", + "_resolved": "https://registry.npmjs.org/commander/-/commander-0.6.1.tgz" +} diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan/.index.js b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan/.index.js new file mode 100644 index 0000000..68da1f3 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan/.index.js @@ -0,0 +1 @@ +//noop \ No newline at end of file diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan/LICENSE b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan/LICENSE new file mode 100644 index 0000000..352c287 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan/LICENSE @@ -0,0 +1,43 @@ +Copyright 2013, NAN contributors: + - Rod Vagg + - Benjamin Byholm + - Trevor Norris +(the "Original Author") +All rights reserved. + +MIT +no-false-attribs License + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +Distributions of all or part of the Software intended to be used +by the recipients as they would use the unmodified Software, +containing modifications that substantially alter, remove, or +disable functionality of the Software, outside of the documented +configuration mechanisms provided by the Software, shall be +modified such that the Original Author's bug reporting email +addresses and urls are either replaced with the contact information +of the parties responsible for the changes, or removed entirely. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + + +Except where noted, this license applies to any and all software +programs and associated documentation files created by the +Original Author, when distributed with the Software. diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan/README.md b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan/README.md new file mode 100644 index 0000000..6ba57f7 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan/README.md @@ -0,0 +1,705 @@ +Native Abstractions for Node.js +=============================== + +**A header file filled with macro and utility goodness for making addon development for Node.js easier across versions 0.8, 0.10 and 0.11, and eventually 0.12.** + +***Current version: 0.3.2*** *(See [nan.h](https://github.com/rvagg/nan/blob/master/nan.h) for changelog)* + +[![NPM](https://nodei.co/npm/nan.png?downloads=true&stars=true)](https://nodei.co/npm/nan/) [![NPM](https://nodei.co/npm-dl/nan.png?months=6)](https://nodei.co/npm/nan/) + +Thanks to the crazy changes in V8 (and some in Node core), keeping native addons compiling happily across versions, particularly 0.10 to 0.11/0.12, is a minor nightmare. The goal of this project is to store all logic necessary to develop native Node.js addons without having to inspect `NODE_MODULE_VERSION` and get yourself into a macro-tangle. + +This project also contains some helper utilities that make addon development a bit more pleasant. + + * **[Usage](#usage)** + * **[Example](#example)** + * **[API](#api)** + + +## Usage + +Simply add **NAN** as a dependency in the *package.json* of your Node addon: + +```js +"dependencies": { + ... + "nan" : "~0.3.1" + ... +} +``` + +Pull in the path to **NAN** in your *binding.gyp* so that you can use `#include "nan.h"` in your *.cpp*: + +```js +"include_dirs" : [ + ... + "` when compiling your addon. + + +## Example + +See **[LevelDOWN](https://github.com/rvagg/node-leveldown/pull/48)** for a full example of **NAN** in use. + +For a simpler example, see the **[async pi estimation example](https://github.com/rvagg/nan/tree/master/examples/async_pi_estimate)** in the examples directory for full code and an explanation of what this Monte Carlo Pi estimation example does. Below are just some parts of the full example that illustrate the use of **NAN**. + +Compare to the current 0.10 version of this example, found in the [node-addon-examples](https://github.com/rvagg/node-addon-examples/tree/master/9_async_work) repository and also a 0.11 version of the same found [here](https://github.com/kkoopa/node-addon-examples/tree/5c01f58fc993377a567812597e54a83af69686d7/9_async_work). + +Note that there is no embedded version sniffing going on here and also the async work is made much simpler, see below for details on the `NanAsyncWorker` class. + +```c++ +// addon.cc +#include +#include "nan.h" +// ... + +using namespace v8; + +void InitAll(Handle exports) { + exports->Set(NanSymbol("calculateSync"), + FunctionTemplate::New(CalculateSync)->GetFunction()); + + exports->Set(NanSymbol("calculateAsync"), + FunctionTemplate::New(CalculateAsync)->GetFunction()); +} + +NODE_MODULE(addon, InitAll) +``` + +```c++ +// sync.h +#include +#include "nan.h" + +NAN_METHOD(CalculateSync); +``` + +```c++ +// sync.cc +#include +#include "nan.h" +#include "sync.h" +// ... + +using namespace v8; + +// Simple synchronous access to the `Estimate()` function +NAN_METHOD(CalculateSync) { + NanScope(); + + // expect a number as the first argument + int points = args[0]->Uint32Value(); + double est = Estimate(points); + + NanReturnValue(Number::New(est)); +} +``` + +```c++ +// async.cc +#include +#include "nan.h" +#include "async.h" + +// ... + +using namespace v8; + +class PiWorker : public NanAsyncWorker { + public: + PiWorker(NanCallback *callback, int points) + : NanAsyncWorker(callback), points(points) {} + ~PiWorker() {} + + // Executed inside the worker-thread. + // It is not safe to access V8, or V8 data structures + // here, so everything we need for input and output + // should go on `this`. + void Execute () { + estimate = Estimate(points); + } + + // Executed when the async work is complete + // this function will be run inside the main event loop + // so it is safe to use V8 again + void HandleOKCallback () { + NanScope(); + + Local argv[] = { + Local::New(Null()) + , Number::New(estimate) + }; + + callback->Call(2, argv); + }; + + private: + int points; + double estimate; +}; + +// Asynchronous access to the `Estimate()` function +NAN_METHOD(CalculateAsync) { + NanScope(); + + int points = args[0]->Uint32Value(); + NanCallback *callback = new NanCallback(args[1].As()); + + NanAsyncQueueWorker(new PiWorker(callback, points)); + NanReturnUndefined(); +} +``` + + +## API + + * NAN_METHOD + * NAN_GETTER + * NAN_SETTER + * NAN_PROPERTY_GETTER + * NAN_PROPERTY_SETTER + * NAN_PROPERTY_ENUMERATOR + * NAN_PROPERTY_DELETER + * NAN_PROPERTY_QUERY + * NAN_WEAK_CALLBACK + * NanReturnValue + * NanReturnUndefined + * NanReturnNull + * NanReturnEmptyString + * NanScope + * NanLocker + * NanUnlocker + * NanGetInternalFieldPointer + * NanSetInternalFieldPointer + * NanObjectWrapHandle + * NanMakeWeak + * NanSymbol + * NanGetPointerSafe + * NanSetPointerSafe + * NanFromV8String + * NanBooleanOptionValue + * NanUInt32OptionValue + * NanThrowError, NanThrowTypeError, NanThrowRangeError, NanThrowError(Handle), NanThrowError(Handle, int) + * NanNewBufferHandle(char *, size_t, FreeCallback, void *), NanNewBufferHandle(char *, uint32_t), NanNewBufferHandle(uint32_t) + * NanBufferUse(char *, uint32_t) + * NanNewContextHandle + * NanHasInstance + * NanPersistentToLocal + * NanDispose + * NanAssignPersistent + * NanInitPersistent + * NanCallback + * NanAsyncWorker + * NanAsyncQueueWorker + + +### NAN_METHOD(methodname) + +Use `NAN_METHOD` to define your V8 accessible methods: + +```c++ +// .h: +class Foo : public node::ObjectWrap { + ... + + static NAN_METHOD(Bar); + static NAN_METHOD(Baz); +} + + +// .cc: +NAN_METHOD(Foo::Bar) { + ... +} + +NAN_METHOD(Foo::Baz) { + ... +} +``` + +The reason for this macro is because of the method signature change in 0.11: + +```c++ +// 0.10 and below: +Handle name(const Arguments& args) + +// 0.11 and above +void name(const FunctionCallbackInfo& args) +``` + +The introduction of `FunctionCallbackInfo` brings additional complications: + + +### NAN_GETTER(methodname) + +Use `NAN_GETTER` to declare your V8 accessible getters. You get a `Local` `property` and an appropriately typed `args` object that can act like the `args` argument to a `NAN_METHOD` call. + +You can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_GETTER`. + + +### NAN_SETTER(methodname) + +Use `NAN_SETTER` to declare your V8 accessible setters. Same as `NAN_GETTER` but you also get a `Local` `value` object to work with. + +You can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_SETTER`. + + +### NAN_PROPERTY_GETTER(cbname) +Use `NAN_PROPERTY_GETTER` to declare your V8 accessible property getters. You get a `Local` `property` and an appropriately typed `args` object that can act similar to the `args` argument to a `NAN_METHOD` call. + +You can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_PROPERTY_GETTER`. + + +### NAN_PROPERTY_SETTER(cbname) +Use `NAN_PROPERTY_SETTER` to declare your V8 accessible property setters. Same as `NAN_PROPERTY_GETTER` but you also get a `Local` `value` object to work with. + +You can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_PROPERTY_SETTER`. + + +### NAN_PROPERTY_ENUMERATOR(cbname) +Use `NAN_PROPERTY_ENUMERATOR` to declare your V8 accessible property enumerators. You get an appropriately typed `args` object like the `args` argument to a `NAN_PROPERTY_GETTER` call. + +You can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_PROPERTY_ENUMERATOR`. + + +### NAN_PROPERTY_DELETER(cbname) +Use `NAN_PROPERTY_DELETER` to declare your V8 accessible property deleters. Same as `NAN_PROPERTY_GETTER`. + +You can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_PROPERTY_DELETER`. + + +### NAN_PROPERTY_QUERY(cbname) +Use `NAN_PROPERTY_QUERY` to declare your V8 accessible property queries. Same as `NAN_PROPERTY_GETTER`. + +You can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_PROPERTY_QUERY`. + + +### NAN_WEAK_CALLBACK(type, cbname) + +Use `NAN_WEAK_CALLBACK` to declare your V8 WeakReference callbacks. There is an object argument accessible through `NAN_WEAK_CALLBACK_OBJECT`. The `type` argument gives the type of the `data` argument, accessible through `NAN_WEAK_CALLBACK_DATA(type)`. + +```c++ +static NAN_WEAK_CALLBACK(BufferReference*, WeakCheck) { + if (NAN_WEAK_CALLBACK_DATA(BufferReference*)->noLongerNeeded_) { + delete NAN_WEAK_CALLBACK_DATA(BufferReference*); + } else { + // Still in use, revive, prevent GC + NanMakeWeak(NAN_WEAK_CALLBACK_OBJECT, NAN_WEAK_CALLBACK_DATA(BufferReference*), &WeakCheck); + } +} + +``` + +### NanReturnValue(Handle<Value>) + +Use `NanReturnValue` when you want to return a value from your V8 accessible method: + +```c++ +NAN_METHOD(Foo::Bar) { + ... + + NanReturnValue(String::New("FooBar!")); +} +``` + +No `return` statement required. + + +### NanReturnUndefined() + +Use `NanReturnUndefined` when you don't want to return anything from your V8 accessible method: + +```c++ +NAN_METHOD(Foo::Baz) { + ... + + NanReturnUndefined(); +} +``` + + +### NanReturnNull() + +Use `NanReturnNull` when you want to return `Null` from your V8 accessible method: + +```c++ +NAN_METHOD(Foo::Baz) { + ... + + NanReturnNull(); +} +``` + + +### NanReturnEmptyString() + +Use `NanReturnEmptyString` when you want to return an empty `String` from your V8 accessible method: + +```c++ +NAN_METHOD(Foo::Baz) { + ... + + NanReturnEmptyString(); +} +``` + + +### NanScope() + +The introduction of `isolate` references for many V8 calls in Node 0.11 makes `NanScope()` necessary, use it in place of `HandleScope scope`: + +```c++ +NAN_METHOD(Foo::Bar) { + NanScope(); + + NanReturnValue(String::New("FooBar!")); +} +``` + + +### NanLocker() + +The introduction of `isolate` references for many V8 calls in Node 0.11 makes `NanLocker()` necessary, use it in place of `Locker locker`: + +```c++ +NAN_METHOD(Foo::Bar) { + NanLocker(); + ... + NanUnlocker(); +} +``` + + +### NanUnlocker() + +The introduction of `isolate` references for many V8 calls in Node 0.11 makes `NanUnlocker()` necessary, use it in place of `Unlocker unlocker`: + +```c++ +NAN_METHOD(Foo::Bar) { + NanLocker(); + ... + NanUnlocker(); +} +``` + + +### void * NanGetInternalFieldPointer(Handle<Object>, int) + +Gets a pointer to the internal field with at `index` from a V8 `Object` handle. + +```c++ +Local obj; +... +NanGetInternalFieldPointer(obj, 0); +``` + +### void NanSetInternalFieldPointer(Handle<Object>, int, void *) + +Sets the value of the internal field at `index` on a V8 `Object` handle. + +```c++ +static Persistent dataWrapperCtor; +... +Local wrapper = NanPersistentToLocal(dataWrapperCtor)->NewInstance(); +NanSetInternalFieldPointer(wrapper, 0, this); +``` + + +### Local<Object> NanObjectWrapHandle(Object) + +When you want to fetch the V8 object handle from a native object you've wrapped with Node's `ObjectWrap`, you should use `NanObjectWrapHandle`: + +```c++ +NanObjectWrapHandle(iterator)->Get(String::NewSymbol("end")) +``` + + +### NanMakeWeak(Persistent<T>, parameter, callback) + +Make a persistent reference weak. + + +### String NanSymbol(char *) + +This isn't strictly about compatibility, it's just an easier way to create string symbol objects (i.e. `String::NewSymbol(x)`), for getting and setting object properties, or names of objects. + +```c++ +bool foo = false; +if (obj->Has(NanSymbol("foo"))) + foo = optionsObj->Get(NanSymbol("foo"))->BooleanValue() +``` + + +### Type NanGetPointerSafe(Type *[, Type]) + +A helper for getting values from optional pointers. If the pointer is `NULL`, the function returns the optional default value, which defaults to `0`. Otherwise, the function returns the value the pointer points to. + +```c++ +char *plugh(uint32_t *optional) { + char res[] = "xyzzy"; + uint32_t param = NanGetPointerSafe(optional, 0x1337); + switch (param) { + ... + } + NanSetPointerSafe(optional, 0xDEADBEEF); +} +``` + + +### bool NanSetPointerSafe(Type *, Type) + +A helper for setting optional argument pointers. If the pointer is `NULL`, the function simply return `false`. Otherwise, the value is assigned to the variable the pointer points to. + +```c++ +const char *plugh(size_t *outputsize) { + char res[] = "xyzzy"; + if !(NanSetPointerSafe(outputsize, strlen(res) + 1)) { + ... + } + + ... +} +``` + + +### char* NanFromV8String(Handle<Value>[, enum Nan::Encoding, size_t *, char *, size_t, int]) + +When you want to convert a V8 `String` to a `char*` use `NanFromV8String`. It is possible to define an encoding that defaults to `Nan::UTF8` as well as a pointer to a variable that will be assigned the number of bytes in the returned string. It is also possible to supply a buffer and its length to the function in order not to have a new buffer allocated. The final argument allows optionally setting `String::WriteOptions`, which default to `String::HINT_MANY_WRITES_EXPECTED | String::NO_NULL_TERMINATION`. +Just remember that you'll end up with an object that you'll need to `delete[]` at some point unless you supply your own buffer: + +```c++ +size_t count; +char* name = NanFromV8String(args[0]); +char* decoded = NanFromV8String(args[1], Nan::BASE64, &count, NULL, 0, String::HINT_MANY_WRITES_EXPECTED); +char param_copy[count]; +memcpy(param_copy, decoded, count); +delete[] decoded; +``` + + +### bool NanBooleanOptionValue(Handle<Value>, Handle<String>[, bool]) + +When you have an "options" object that you need to fetch properties from, boolean options can be fetched with this pair. They check first if the object exists (`IsEmpty`), then if the object has the given property (`Has`) then they get and convert/coerce the property to a `bool`. + +The optional last parameter is the *default* value, which is `false` if left off: + +```c++ +// `foo` is false unless the user supplies a truthy value for it +bool foo = NanBooleanOptionValue(optionsObj, NanSymbol("foo")); +// `bar` is true unless the user supplies a falsy value for it +bool bar = NanBooleanOptionValueDefTrue(optionsObj, NanSymbol("bar"), true); +``` + + +### uint32_t NanUInt32OptionValue(Handle<Value>, Handle<String>, uint32_t) + +Similar to `NanBooleanOptionValue`, use `NanUInt32OptionValue` to fetch an integer option from your options object. Can be any kind of JavaScript `Number` and it will be coerced to an unsigned 32-bit integer. + +Requires all 3 arguments as a default is not optional: + +```c++ +uint32_t count = NanUInt32OptionValue(optionsObj, NanSymbol("count"), 1024); +``` + + +### NanThrowError(message), NanThrowTypeError(message), NanThrowRangeError(message), NanThrowError(Local<Value>), NanThrowError(Local<Value>, int) + +For throwing `Error`, `TypeError` and `RangeError` objects. You should `return` this call: + +```c++ +return NanThrowError("you must supply a callback argument"); +``` + +Can also handle any custom object you may want to throw. If used with the error code argument, it will add the supplied error code to the error object as a property called `code`. + + +### Local<Object> NanNewBufferHandle(char *, uint32_t), Local<Object> NanNewBufferHandle(uint32_t) + +The `Buffer` API has changed a little in Node 0.11, this helper provides consistent access to `Buffer` creation: + +```c++ +NanNewBufferHandle((char*)value.data(), value.size()); +``` + +Can also be used to initialize a `Buffer` with just a `size` argument. + +Can also be supplied with a `NAN_WEAK_CALLBACK` and a hint for the garbage collector, when dealing with weak references. + + +### Local<Object> NanBufferUse(char*, uint32_t) + +`Buffer::New(char*, uint32_t)` prior to 0.11 would make a copy of the data. +While it was possible to get around this, it required a shim by passing a +callback. So the new API `Buffer::Use(char*, uint32_t)` was introduced to remove +needing to use this shim. + +`NanBufferUse` uses the `char*` passed as the backing data, and will free the +memory automatically when the weak callback is called. Keep this in mind, as +careless use can lead to "double free or corruption" and other cryptic failures. + + +### bool NanHasInstance(Persistent<FunctionTemplate>&, Handle<Value>) + +Can be used to check the type of an object to determine it is of a particular class you have already defined and have a `Persistent` handle for. + + +### Local<Type> NanPersistentToLocal(Persistent<Type>&) + +Aside from `FunctionCallbackInfo`, the biggest and most painful change to V8 in Node 0.11 is the many restrictions now placed on `Persistent` handles. They are difficult to assign and difficult to fetch the original value out of. + +Use `NanPersistentToLocal` to convert a `Persistent` handle back to a `Local` handle. + +```c++ +Local handle = NanPersistentToLocal(persistentHandle); +``` + + +### Local<Context> NanNewContextHandle([ExtensionConfiguration*, Handle<ObjectTemplate>, Handle<Value>]) +Creates a new `Local` handle. + +```c++ +Local ftmpl = FunctionTemplate::New(); +Local otmpl = ftmpl->InstanceTemplate(); +Local ctx = NanNewContextHandle(NULL, otmpl); +``` + + +### void NanDispose(Persistent<T> &) + +Use `NanDispose` to dispose a `Persistent` handle. + +```c++ +NanDispose(persistentHandle); +``` + + +### NanAssignPersistent(type, handle, object) + +Use `NanAssignPersistent` to assign a non-`Persistent` handle to a `Persistent` one. You can no longer just declare a `Persistent` handle and assign directly to it later, you have to `Reset` it in Node 0.11, so this makes it easier. + +In general it is now better to place anything you want to protect from V8's garbage collector as properties of a generic `Object` and then assign that to a `Persistent`. This works in older versions of Node also if you use `NanAssignPersistent`: + +```c++ +Persistent persistentHandle; + +... + +Local obj = Object::New(); +obj->Set(NanSymbol("key"), keyHandle); // where keyHandle might be a Local +NanAssignPersistent(Object, persistentHandle, obj) +``` + + +### NanInitPersistent(type, name, object) + +User `NanInitPersistent` to declare and initialize a new `Persistent` with the supplied object. The assignment operator for `Persistent` is no longer public in Node 0.11, so this macro makes it easier to declare and initializing a new `Persistent`. See NanAssignPersistent for more information. + +```c++ +Local obj = Object::New(); +obj->Set(NanSymbol("key"), keyHandle); // where keyHandle might be a Local +NanInitPersistent(Object, persistentHandle, obj); +``` + + +### NanCallback + +Because of the difficulties imposed by the changes to `Persistent` handles in V8 in Node 0.11, creating `Persistent` versions of your `Local` handles is annoyingly tricky. `NanCallback` makes it easier by taking your `Local` handle, making it persistent until the `NanCallback` is deleted and even providing a handy `Call()` method to fetch and execute the callback `Function`. + +```c++ +Local callbackHandle = callback = args[0].As(); +NanCallback *callback = new NanCallback(callbackHandle); +// pass `callback` around and it's safe from GC until you: +delete callback; +``` + +You can execute the callback like so: + +```c++ +// no arguments: +callback->Call(0, NULL); + +// an error argument: +Local argv[] = { + Exception::Error(String::New("fail!")) +}; +callback->Call(1, argv); + +// a success argument: +Local argv[] = { + Local::New(Null()), + String::New("w00t!") +}; +callback->Call(2, argv); +``` + +`NanCallback` also has a `Local GetCallback()` method that you can use to fetch a local handle to the underlying callback function if you need it. + + +### NanAsyncWorker + +`NanAsyncWorker` is an abstract class that you can subclass to have much of the annoying async queuing and handling taken care of for you. It can even store arbitrary V8 objects for you and have them persist while the async work is in progress. + +See a rough outline of the implementation: + +```c++ +class NanAsyncWorker { +public: + NanAsyncWorker (NanCallback *callback); + + // Clean up persistent handles and delete the *callback + virtual ~NanAsyncWorker (); + + // Check the `char *errmsg` property and call HandleOKCallback() + // or HandleErrorCallback depending on whether it has been set or not + virtual void WorkComplete (); + + // You must implement this to do some async work. If there is an + // error then allocate `errmsg` to to a message and the callback will + // be passed that string in an Error object + virtual void Execute (); + +protected: + // Set this if there is an error, otherwise it's NULL + const char *errmsg; + + // Save a V8 object in a Persistent handle to protect it from GC + void SavePersistent(const char *key, Local &obj); + + // Fetch a stored V8 object (don't call from within `Execute()`) + Local GetFromPersistent(const char *key); + + // Default implementation calls the callback function with no arguments. + // Override this to return meaningful data + virtual void HandleOKCallback (); + + // Default implementation calls the callback function with an Error object + // wrapping the `errmsg` string + virtual void HandleErrorCallback (); +}; +``` + + +### NanAsyncQueueWorker(NanAsyncWorker *) + +`NanAsyncQueueWorker` will run a `NanAsyncWorker` asynchronously via libuv. Both the *execute* and *after_work* steps are taken care of for you—most of the logic for this is embedded in `NanAsyncWorker`. + +### Contributors + +NAN is only possible due to the excellent work of the following contributors: + + + + + +
Rod VaggGitHub/rvaggTwitter/@rvagg
Benjamin ByholmGitHub/kkoopa
Trevor NorrisGitHub/trevnorrisTwitter/@trevnorris
+ +Licence & copyright +----------------------- + +Copyright (c) 2013 Rod Vagg & NAN contributors (listed above). + +Native Abstractions for Node.js is licensed under an MIT +no-false-attribs license. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details. diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan/nan.h b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan/nan.h new file mode 100644 index 0000000..b3eb02d --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan/nan.h @@ -0,0 +1,884 @@ +/********************************************************************************** + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2013 NAN contributors: + * - Rod Vagg + * - Benjamin Byholm + * - Trevor Norris + * + * MIT +no-false-attribs License + * + * Version 0.3.2 (current Node unstable: 0.11.6, Node stable: 0.10.17) + * + * ChangeLog: + * * 0.3.2 Aug 30 2013 + * - Fix missing scope declaration in GetFromPersistent() and SaveToPersistent + * in NanAsyncWorker + * + * * 0.3.1 Aug 20 2013 + * - fix "not all control paths return a value" compile warning on some platforms + * + * * 0.3.0 Aug 19 2013 + * - Made NAN work with NPM + * - Lots of fixes to NanFromV8String, pulling in features from new Node core + * - Changed node::encoding to Nan::Encoding in NanFromV8String to unify the API + * - Added optional error number argument for NanThrowError() + * - Added NanInitPersistent() + * - Added NanReturnNull() and NanReturnEmptyString() + * - Added NanLocker and NanUnlocker + * - Added missing scopes + * - Made sure to clear disposed Persistent handles + * - Changed NanAsyncWorker to allocate error messages on the heap + * - Changed NanThrowError(Local) to NanThrowError(Handle) + * - Fixed leak in NanAsyncWorker when errmsg is used + * + * * 0.2.2 Aug 5 2013 + * - Fixed usage of undefined variable with node::BASE64 in NanFromV8String() + * + * * 0.2.1 Aug 5 2013 + * - Fixed 0.8 breakage, node::BUFFER encoding type not available in 0.8 for + * NanFromV8String() + * + * * 0.2.0 Aug 5 2013 + * - Added NAN_PROPERTY_GETTER, NAN_PROPERTY_SETTER, NAN_PROPERTY_ENUMERATOR, + * NAN_PROPERTY_DELETER, NAN_PROPERTY_QUERY + * - Extracted _NAN_METHOD_ARGS, _NAN_GETTER_ARGS, _NAN_SETTER_ARGS, + * _NAN_PROPERTY_GETTER_ARGS, _NAN_PROPERTY_SETTER_ARGS, + * _NAN_PROPERTY_ENUMERATOR_ARGS, _NAN_PROPERTY_DELETER_ARGS, + * _NAN_PROPERTY_QUERY_ARGS + * - Added NanGetInternalFieldPointer, NanSetInternalFieldPointer + * - Added NAN_WEAK_CALLBACK, NAN_WEAK_CALLBACK_OBJECT, + * NAN_WEAK_CALLBACK_DATA, NanMakeWeak + * - Renamed THROW_ERROR to _NAN_THROW_ERROR + * - Added NanNewBufferHandle(char*, size_t, node::smalloc::FreeCallback, void*) + * - Added NanBufferUse(char*, uint32_t) + * - Added NanNewContextHandle(v8::ExtensionConfiguration*, + * v8::Handle, v8::Handle) + * - Fixed broken NanCallback#GetFunction() + * - Added optional encoding and size arguments to NanFromV8String() + * - Added NanGetPointerSafe() and NanSetPointerSafe() + * - Added initial test suite (to be expanded) + * - Allow NanUInt32OptionValue to convert any Number object + * + * * 0.1.0 Jul 21 2013 + * - Added `NAN_GETTER`, `NAN_SETTER` + * - Added `NanThrowError` with single Local argument + * - Added `NanNewBufferHandle` with single uint32_t argument + * - Added `NanHasInstance(Persistent&, Handle)` + * - Added `Local NanCallback#GetFunction()` + * - Added `NanCallback#Call(int, Local[])` + * - Deprecated `NanCallback#Run(int, Local[])` in favour of Call + * + * See https://github.com/rvagg/nan for the latest update to this file + **********************************************************************************/ + +#ifndef NAN_H +#define NAN_H + +#include +#include +#include + +// some generic helpers + +template static inline bool NanSetPointerSafe(T *var, T val) { + if (var) { + *var = val; + return true; + } else { + return false; + } +} + +template static inline T NanGetPointerSafe( + T *var, + T fallback = reinterpret_cast(0)) { + if (var) { + return *var; + } else { + return fallback; + } +} + +#define NanSymbol(value) v8::String::NewSymbol(value) + +static inline bool NanBooleanOptionValue( + v8::Local optionsObj + , v8::Handle opt, bool def) { + + if (def) { + return optionsObj.IsEmpty() + || !optionsObj->Has(opt) + || optionsObj->Get(opt)->BooleanValue(); + } else { + return !optionsObj.IsEmpty() + && optionsObj->Has(opt) + && optionsObj->Get(opt)->BooleanValue(); + } +} + +static inline bool NanBooleanOptionValue( + v8::Local optionsObj + , v8::Handle opt) { + return NanBooleanOptionValue(optionsObj, opt, false); +} + +static inline uint32_t NanUInt32OptionValue( + v8::Local optionsObj + , v8::Handle opt + , uint32_t def) { + + return !optionsObj.IsEmpty() + && optionsObj->Has(opt) + && optionsObj->Get(opt)->IsNumber() + ? optionsObj->Get(opt)->Uint32Value() + : def; +} + +#if (NODE_MODULE_VERSION > 0x000B) +// Node 0.11+ (0.11.3 and below won't compile with these) + +static v8::Isolate* nan_isolate = v8::Isolate::GetCurrent(); + +# define _NAN_METHOD_ARGS const v8::FunctionCallbackInfo& args +# define NAN_METHOD(name) void name(_NAN_METHOD_ARGS) +# define _NAN_GETTER_ARGS const v8::PropertyCallbackInfo& args +# define NAN_GETTER(name) \ + void name(v8::Local property, _NAN_GETTER_ARGS) +# define _NAN_SETTER_ARGS const v8::PropertyCallbackInfo& args +# define NAN_SETTER(name) \ + void name( \ + v8::Local property \ + , v8::Local value \ + , _NAN_SETTER_ARGS) +# define _NAN_PROPERTY_GETTER_ARGS \ + const v8::PropertyCallbackInfo& args +# define NAN_PROPERTY_GETTER(name) \ + void name(v8::Local property \ + , _NAN_PROPERTY_GETTER_ARGS) +# define _NAN_PROPERTY_SETTER_ARGS \ + const v8::PropertyCallbackInfo& args +# define NAN_PROPERTY_SETTER(name) \ + void name(v8::Local property \ + , v8::Local value \ + , _NAN_PROPERTY_SETTER_ARGS) +# define _NAN_PROPERTY_ENUMERATOR_ARGS \ + const v8::PropertyCallbackInfo& args +# define NAN_PROPERTY_ENUMERATOR(name) \ + void name(_NAN_PROPERTY_ENUMERATOR_ARGS) +# define _NAN_PROPERTY_DELETER_ARGS \ + const v8::PropertyCallbackInfo& args +# define NAN_PROPERTY_DELETER(name) \ + void name( \ + v8::Local property \ + , _NAN_PROPERTY_DELETER_ARGS) +# define _NAN_PROPERTY_QUERY_ARGS \ + const v8::PropertyCallbackInfo& args +# define NAN_PROPERTY_QUERY(name) \ + void name(v8::Local property, _NAN_PROPERTY_QUERY_ARGS) +# define NanGetInternalFieldPointer(object, index) \ + object->GetAlignedPointerFromInternalField(index) +# define NanSetInternalFieldPointer(object, index, value) \ + object->SetAlignedPointerInInternalField(index, value) + +# define NAN_WEAK_CALLBACK(type, name) \ + void name( \ + v8::Isolate* isolate, \ + v8::Persistent* object, \ + type data) +# define NAN_WEAK_CALLBACK_OBJECT (*object) +# define NAN_WEAK_CALLBACK_DATA(type) ((type) data) + +# define NanScope() v8::HandleScope scope(nan_isolate) +# define NanLocker() v8::Locker locker(nan_isolate) +# define NanUnlocker() v8::Unlocker unlocker(nan_isolate) +# define NanReturnValue(value) return args.GetReturnValue().Set(value) +# define NanReturnUndefined() return +# define NanReturnNull() return args.GetReturnValue().SetNull() +# define NanReturnEmptyString() return args.GetReturnValue().SetEmptyString() +# define NanAssignPersistent(type, handle, obj) handle.Reset(nan_isolate, obj) +# define NanInitPersistent(type, name, obj) \ + v8::Persistent name(nan_isolate, obj) +# define NanObjectWrapHandle(obj) obj->handle() +# define NanMakeWeak(handle, parameter, callback) \ + handle.MakeWeak(nan_isolate, parameter, callback) + +# define _NAN_THROW_ERROR(fun, errmsg) \ + do { \ + NanScope(); \ + v8::ThrowException(fun(v8::String::New(errmsg))); \ + } while (0); + + inline static void NanThrowError(const char* errmsg) { + _NAN_THROW_ERROR(v8::Exception::Error, errmsg); + } + + inline static void NanThrowError(v8::Handle error) { + NanScope(); + v8::ThrowException(error); + } + + inline static void NanThrowError(const char *msg, const int errorNumber) { + v8::Local err = v8::Exception::Error(v8::String::New(msg)); + v8::Local obj = err.As(); + obj->Set(v8::String::New("code"), v8::Int32::New(errorNumber)); + NanThrowError(err); + } + + inline static void NanThrowTypeError(const char* errmsg) { + _NAN_THROW_ERROR(v8::Exception::TypeError, errmsg); + } + + inline static void NanThrowRangeError(const char* errmsg) { + _NAN_THROW_ERROR(v8::Exception::RangeError, errmsg); + } + + template static inline void NanDispose(v8::Persistent &handle) { + handle.Dispose(nan_isolate); + handle.Clear(); + } + + static inline v8::Local NanNewBufferHandle ( + char *data, + size_t length, + node::smalloc::FreeCallback callback, + void *hint) { + return node::Buffer::New(data, length, callback, hint); + } + + static inline v8::Local NanNewBufferHandle ( + char *data, uint32_t size) { + return node::Buffer::New(data, size); + } + + static inline v8::Local NanNewBufferHandle (uint32_t size) { + return node::Buffer::New(size); + } + + static inline v8::Local NanBufferUse(char* data, uint32_t size) { + return node::Buffer::Use(data, size); + } + + template + inline v8::Local NanPersistentToLocal( + const v8::Persistent& persistent) { + if (persistent.IsWeak()) { + return v8::Local::New(nan_isolate, persistent); + } else { + return *reinterpret_cast*>( + const_cast*>(&persistent)); + } + } + + inline bool NanHasInstance( + v8::Persistent& function_template + , v8::Handle value) { + return NanPersistentToLocal(function_template)->HasInstance(value); + } + + static inline v8::Local NanNewContextHandle( + v8::ExtensionConfiguration* extensions = NULL, + v8::Handle tmpl = v8::Handle(), + v8::Handle obj = v8::Handle()) { + return v8::Local::New(nan_isolate, v8::Context::New( + nan_isolate, extensions, tmpl, obj)); + } + +#else +// Node 0.8 and 0.10 + +# define _NAN_METHOD_ARGS const v8::Arguments& args +# define NAN_METHOD(name) v8::Handle name(_NAN_METHOD_ARGS) +# define _NAN_GETTER_ARGS const v8::AccessorInfo &args +# define NAN_GETTER(name) \ + v8::Handle name(v8::Local property, _NAN_GETTER_ARGS) +# define _NAN_SETTER_ARGS const v8::AccessorInfo &args +# define NAN_SETTER(name) \ + void name( \ + v8::Local property \ + , v8::Local value \ + , _NAN_SETTER_ARGS) +# define _NAN_PROPERTY_GETTER_ARGS const v8::AccessorInfo& args +# define NAN_PROPERTY_GETTER(name) \ + v8::Handle name(v8::Local property \ + , _NAN_PROPERTY_GETTER_ARGS) +# define _NAN_PROPERTY_SETTER_ARGS const v8::AccessorInfo& args +# define NAN_PROPERTY_SETTER(name) \ + v8::Handle name(v8::Local property \ + , v8::Local value \ + , _NAN_PROPERTY_SETTER_ARGS) +# define _NAN_PROPERTY_ENUMERATOR_ARGS const v8::AccessorInfo& args +# define NAN_PROPERTY_ENUMERATOR(name) \ + v8::Handle name(_NAN_PROPERTY_ENUMERATOR_ARGS) +# define _NAN_PROPERTY_DELETER_ARGS const v8::AccessorInfo& args +# define NAN_PROPERTY_DELETER(name) \ + v8::Handle name( \ + v8::Local property \ + , _NAN_PROPERTY_DELETER_ARGS) +# define _NAN_PROPERTY_QUERY_ARGS const v8::AccessorInfo& args +# define NAN_PROPERTY_QUERY(name) \ + v8::Handle name( \ + v8::Local property \ + , _NAN_PROPERTY_QUERY_ARGS) + +# define NanGetInternalFieldPointer(object, index) \ + object->GetPointerFromInternalField(index) +# define NanSetInternalFieldPointer(object, index, value) \ + object->SetPointerInInternalField(index, value) +# define NAN_WEAK_CALLBACK(type, name) void name( \ + v8::Persistent object, \ + void *data) +# define NAN_WEAK_CALLBACK_OBJECT object +# define NAN_WEAK_CALLBACK_DATA(type) ((type) data) + +# define NanScope() v8::HandleScope scope +# define NanLocker() v8::Locker locker +# define NanUnlocker() v8::Unlocker unlocker +# define NanReturnValue(value) return scope.Close(value) +# define NanReturnUndefined() return v8::Undefined() +# define NanReturnNull() return v8::Null() +# define NanReturnEmptyString() return v8::String::Empty() +# define NanInitPersistent(type, name, obj) \ + v8::Persistent name = v8::Persistent::New(obj) +# define NanAssignPersistent(type, handle, obj) \ + handle = v8::Persistent::New(obj) +# define NanObjectWrapHandle(obj) obj->handle_ +# define NanMakeWeak(handle, parameters, callback) \ + handle.MakeWeak(parameters, callback) + +# define _NAN_THROW_ERROR(fun, errmsg) \ + do { \ + NanScope(); \ + return v8::ThrowException(fun(v8::String::New(errmsg))); \ + } while (0); + + inline static v8::Handle NanThrowError(const char* errmsg) { + _NAN_THROW_ERROR(v8::Exception::Error, errmsg); + } + + inline static v8::Handle NanThrowError( + v8::Handle error) { + NanScope(); + return v8::ThrowException(error); + } + + inline static v8::Handle NanThrowError( + const char *msg, + const int errorNumber) { + v8::Local err = v8::Exception::Error(v8::String::New(msg)); + v8::Local obj = err.As(); + obj->Set(v8::String::New("code"), v8::Int32::New(errorNumber)); + return NanThrowError(err); + } + + inline static v8::Handle NanThrowTypeError(const char* errmsg) { + _NAN_THROW_ERROR(v8::Exception::TypeError, errmsg); + } + + inline static v8::Handle NanThrowRangeError(const char* errmsg) { + _NAN_THROW_ERROR(v8::Exception::RangeError, errmsg); + } + + template static inline void NanDispose(v8::Persistent &handle) { + handle.Dispose(); + handle.Clear(); + } + + static inline v8::Local NanNewBufferHandle ( + char *data, + size_t length, + node::Buffer::free_callback callback, + void *hint) { + return v8::Local::New( + node::Buffer::New(data, length, callback, hint)->handle_); + } + + static inline v8::Local NanNewBufferHandle ( + char *data, uint32_t size) { + return v8::Local::New(node::Buffer::New(data, size)->handle_); + } + + static inline v8::Local NanNewBufferHandle (uint32_t size) { + return v8::Local::New(node::Buffer::New(size)->handle_); + } + + static inline void FreeData(char *data, void *hint) { + delete[] data; + } + + static inline v8::Local NanBufferUse(char* data, uint32_t size) { + return v8::Local::New( + node::Buffer::New(data, size, FreeData, NULL)->handle_); + } + + template + inline v8::Local NanPersistentToLocal( + const v8::Persistent& persistent) { + if (persistent.IsWeak()) { + return v8::Local::New(persistent); + } else { + return *reinterpret_cast*>( + const_cast*>(&persistent)); + } + } + + inline bool NanHasInstance( + v8::Persistent& function_template + , v8::Handle value) { + return function_template->HasInstance(value); + } + + static inline v8::Local NanNewContextHandle( + v8::ExtensionConfiguration* extensions = NULL + , v8::Handle tmpl = + v8::Handle() + , v8::Handle obj = v8::Handle() + ) { + v8::Persistent ctx = + v8::Context::New(extensions, tmpl, obj); + v8::Local lctx = v8::Local::New(ctx); + ctx.Dispose(); + return lctx; + } + +#endif // node version + +class NanCallback { + public: + NanCallback(const v8::Local &fn) { + NanScope(); + v8::Local obj = v8::Object::New(); + obj->Set(NanSymbol("callback"), fn); + NanAssignPersistent(v8::Object, handle, obj); + } + + ~NanCallback() { + if (handle.IsEmpty()) return; + handle.Dispose(); + handle.Clear(); + } + + inline v8::Local GetFunction () { + return NanPersistentToLocal(handle)->Get(NanSymbol("callback")) + .As(); + } + + // deprecated + void Run(int argc, v8::Local argv[]) { + Call(argc, argv); + } + + void Call(int argc, v8::Local argv[]) { + NanScope(); + + v8::Local callback = NanPersistentToLocal(handle)-> + Get(NanSymbol("callback")).As(); + v8::TryCatch try_catch; + callback->Call(v8::Context::GetCurrent()->Global(), argc, argv); + if (try_catch.HasCaught()) { + node::FatalException(try_catch); + } + } + + private: + v8::Persistent handle; +}; + +/* abstract */ class NanAsyncWorker { +public: + NanAsyncWorker (NanCallback *callback) : callback(callback) { + request.data = this; + errmsg = NULL; + } + + virtual ~NanAsyncWorker () { + NanScope(); + + if (!persistentHandle.IsEmpty()) + NanDispose(persistentHandle); + if (callback) + delete callback; + if (errmsg) + delete errmsg; + } + + virtual void WorkComplete () { + NanScope(); + + if (errmsg == NULL) + HandleOKCallback(); + else + HandleErrorCallback(); + delete callback; + callback = NULL; + } + + virtual void Execute () =0; + + uv_work_t request; + +protected: + v8::Persistent persistentHandle; + NanCallback *callback; + const char *errmsg; + + void SavePersistent(const char *key, v8::Local &obj) { + NanScope(); + + v8::Local handle = NanPersistentToLocal(persistentHandle); + handle->Set(NanSymbol(key), obj); + } + + v8::Local GetFromPersistent(const char *key) { + NanScope(); + + v8::Local handle = NanPersistentToLocal(persistentHandle); + return handle->Get(NanSymbol(key)).As(); + } + + virtual void HandleOKCallback () { + NanScope(); + + callback->Call(0, NULL); + }; + + virtual void HandleErrorCallback () { + NanScope(); + + v8::Local argv[] = { + v8::Exception::Error(v8::String::New(errmsg)) + }; + callback->Call(1, argv); + } +}; + +inline void NanAsyncExecute (uv_work_t* req) { + NanAsyncWorker *worker = static_cast(req->data); + worker->Execute(); +} + +inline void NanAsyncExecuteComplete (uv_work_t* req) { + NanAsyncWorker* worker = static_cast(req->data); + worker->WorkComplete(); + delete worker; +} + +inline void NanAsyncQueueWorker (NanAsyncWorker* worker) { + uv_queue_work( + uv_default_loop() + , &worker->request + , NanAsyncExecute + , (uv_after_work_cb)NanAsyncExecuteComplete + ); +} + +//// Base 64 //// + +#define _nan_base64_encoded_size(size) ((size + 2 - ((size + 2) % 3)) / 3 * 4) + + +// Doesn't check for padding at the end. Can be 1-2 bytes over. +static inline size_t _nan_base64_decoded_size_fast(size_t size) { + size_t remainder = size % 4; + + size = (size / 4) * 3; + if (remainder) { + if (size == 0 && remainder == 1) { + // special case: 1-byte input cannot be decoded + size = 0; + } else { + // non-padded input, add 1 or 2 extra bytes + size += 1 + (remainder == 3); + } + } + + return size; +} + +template +static size_t _nan_base64_decoded_size(const TypeName* src, size_t size) { + if (size == 0) + return 0; + + if (src[size - 1] == '=') + size--; + if (size > 0 && src[size - 1] == '=') + size--; + + return _nan_base64_decoded_size_fast(size); +} + + +// supports regular and URL-safe base64 +static const int _nan_unbase64_table[] = + { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -1, -1, -2, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, 62, -1, 63, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, + -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, 63, + -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 + }; + +#define _nan_unbase64(x) _nan_unbase64_table[(uint8_t)(x)] + + +template +static size_t _nan_base64_decode(char* buf, + size_t len, + const TypeName* src, + const size_t srcLen) { + char a, b, c, d; + char* dst = buf; + char* dstEnd = buf + len; + const TypeName* srcEnd = src + srcLen; + + while (src < srcEnd && dst < dstEnd) { + int remaining = srcEnd - src; + + while (_nan_unbase64(*src) < 0 && src < srcEnd) src++, remaining--; + if (remaining == 0 || *src == '=') break; + a = _nan_unbase64(*src++); + + while (_nan_unbase64(*src) < 0 && src < srcEnd) src++, remaining--; + if (remaining <= 1 || *src == '=') break; + b = _nan_unbase64(*src++); + + *dst++ = (a << 2) | ((b & 0x30) >> 4); + if (dst == dstEnd) break; + + while (_nan_unbase64(*src) < 0 && src < srcEnd) src++, remaining--; + if (remaining <= 2 || *src == '=') break; + c = _nan_unbase64(*src++); + + *dst++ = ((b & 0x0F) << 4) | ((c & 0x3C) >> 2); + if (dst == dstEnd) break; + + while (_nan_unbase64(*src) < 0 && src < srcEnd) src++, remaining--; + if (remaining <= 3 || *src == '=') break; + d = _nan_unbase64(*src++); + + *dst++ = ((c & 0x03) << 6) | (d & 0x3F); + } + + return dst - buf; +} + +//// HEX //// + +template +unsigned _nan_hex2bin(TypeName c) { + if (c >= '0' && c <= '9') return c - '0'; + if (c >= 'A' && c <= 'F') return 10 + (c - 'A'); + if (c >= 'a' && c <= 'f') return 10 + (c - 'a'); + return static_cast(-1); +} + + +template +static size_t _nan_hex_decode(char* buf, + size_t len, + const TypeName* src, + const size_t srcLen) { + size_t i; + for (i = 0; i < len && i * 2 + 1 < srcLen; ++i) { + unsigned a = _nan_hex2bin(src[i * 2 + 0]); + unsigned b = _nan_hex2bin(src[i * 2 + 1]); + if (!~a || !~b) return i; + buf[i] = a * 16 + b; + } + + return i; +} + +static bool _NanGetExternalParts( + v8::Handle val + , const char** data + , size_t* len) { + + if (node::Buffer::HasInstance(val)) { + *data = node::Buffer::Data(val.As()); + *len = node::Buffer::Length(val.As()); + return true; + + } + + assert(val->IsString()); + v8::Local str = v8::Local::New(val.As()); + + if (str->IsExternalAscii()) { + const v8::String::ExternalAsciiStringResource* ext; + ext = str->GetExternalAsciiStringResource(); + *data = ext->data(); + *len = ext->length(); + return true; + + } else if (str->IsExternal()) { + const v8::String::ExternalStringResource* ext; + ext = str->GetExternalStringResource(); + *data = reinterpret_cast(ext->data()); + *len = ext->length(); + return true; + } + + return false; +} + +namespace Nan { + enum Encoding {ASCII, UTF8, BASE64, UCS2, BINARY, HEX, BUFFER}; +} + +static inline char* NanFromV8String( + v8::Handle from + , enum Nan::Encoding encoding = Nan::UTF8 + , size_t *datalen = NULL + , char *buf = NULL + , size_t buflen = 0 + , int flags = v8::String::NO_NULL_TERMINATION + | v8::String::HINT_MANY_WRITES_EXPECTED) { + + NanScope(); + + size_t sz_; + size_t term_len = !(flags & v8::String::NO_NULL_TERMINATION); + char *data = NULL; + size_t len; + bool is_extern = _NanGetExternalParts( + from + , const_cast(&data) + , &len); + + if (is_extern && !term_len) { + NanSetPointerSafe(datalen, len); + return data; + } + + v8::Local toStr = from->ToString(); + + char *to = buf; + + v8::String::AsciiValue value(toStr); + switch(encoding) { + case Nan::ASCII: +#if NODE_MODULE_VERSION < 0x0C + sz_ = toStr->Length(); + if (to == NULL) { + to = new char[sz_ + term_len]; + } else { + assert(buflen >= sz_ + term_len && "too small buffer"); + } + NanSetPointerSafe( + datalen + , toStr->WriteAscii(to, 0, sz_ + term_len, flags)); + return to; +#endif + case Nan::BINARY: + case Nan::BUFFER: + sz_ = toStr->Length(); + if (to == NULL) { + to = new char[sz_ + term_len]; + } else { + assert(buflen >= sz_ + term_len && "too small buffer"); + } +#if NODE_MODULE_VERSION < 0x0C + // TODO(isaacs): THIS IS AWFUL!!! + // AGREE(kkoopa) + { + uint16_t* twobytebuf = new uint16_t[sz_ + term_len]; + + size_t len = toStr->Write(twobytebuf, 0, sz_ + term_len, flags); + + for (size_t i = 0; i < sz_ + term_len && i < len + term_len; i++) { + unsigned char *b = reinterpret_cast(&twobytebuf[i]); + to[i] = *b; + } + + NanSetPointerSafe(datalen, len); + + delete[] twobytebuf; + return to; + } +#else + NanSetPointerSafe( + datalen, + toStr->WriteOneByte( + reinterpret_cast(to) + , 0 + , sz_ + term_len + , flags)); + return to; +#endif + case Nan::UTF8: + sz_ = toStr->Utf8Length(); + if (to == NULL) { + to = new char[sz_ + term_len]; + } else { + assert(buflen >= sz_ + term_len && "too small buffer"); + } + NanSetPointerSafe( + datalen + , toStr->WriteUtf8(to, sz_ + term_len, NULL, flags) - term_len); + return to; + case Nan::BASE64: + sz_ = _nan_base64_decoded_size(*value, toStr->Length()); + if (to == NULL) { + to = new char[sz_ + term_len]; + } else { + assert(buflen >= sz_ + term_len); + } + NanSetPointerSafe( + datalen + , _nan_base64_decode(to, sz_, *value, value.length())); + if (term_len) { + to[sz_] = '\0'; + } + return to; + case Nan::UCS2: + { + sz_ = toStr->Length(); + if (to == NULL) { + to = new char[(sz_ + term_len) * 2]; + } else { + assert(buflen >= (sz_ + term_len) * 2 && "too small buffer"); + } + + int bc = 2 * toStr->Write( + reinterpret_cast(to) + , 0 + , sz_ + term_len + , flags); + NanSetPointerSafe(datalen, bc); + return to; + } + case Nan::HEX: + sz_ = toStr->Length(); + assert(!(sz_ & 1) && "bad hex data"); + if (to == NULL) { + to = new char[sz_ / 2 + term_len]; + } else { + assert(buflen >= sz_ / 2 + term_len && "too small buffer"); + } + + NanSetPointerSafe( + datalen + , _nan_hex_decode(to, sz_ / 2, *value, value.length())); + if (term_len) { + to[sz_ / 2] = '\0'; + } + return to; + default: + assert(0 && "unknown encoding"); + } + return to; +} + +#endif diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan/package.json b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan/package.json new file mode 100644 index 0000000..1af2669 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan/package.json @@ -0,0 +1,37 @@ +{ + "name": "nan", + "version": "0.3.2", + "description": "Native Abstractions for Node.js: C++ header for Node 0.8->0.12 compatibility", + "main": ".index.js", + "repository": { + "type": "git", + "url": "git://github.com/rvagg/nan.git" + }, + "contributors": [ + { + "name": "Rod Vagg", + "email": "r@va.gg", + "url": "https://github.com/rvagg" + }, + { + "name": "Benjamin Byholm", + "email": "bbyholm@abo.fi", + "url": "https://github.com/kkoopa/" + }, + { + "name": "Trevor Norris", + "email": "trev.norris@gmail.com", + "url": "https://github.com/trevnorris" + } + ], + "license": "MIT", + "readme": "Native Abstractions for Node.js\n===============================\n\n**A header file filled with macro and utility goodness for making addon development for Node.js easier across versions 0.8, 0.10 and 0.11, and eventually 0.12.**\n\n***Current version: 0.3.2*** *(See [nan.h](https://github.com/rvagg/nan/blob/master/nan.h) for changelog)*\n\n[![NPM](https://nodei.co/npm/nan.png?downloads=true&stars=true)](https://nodei.co/npm/nan/) [![NPM](https://nodei.co/npm-dl/nan.png?months=6)](https://nodei.co/npm/nan/)\n\nThanks to the crazy changes in V8 (and some in Node core), keeping native addons compiling happily across versions, particularly 0.10 to 0.11/0.12, is a minor nightmare. The goal of this project is to store all logic necessary to develop native Node.js addons without having to inspect `NODE_MODULE_VERSION` and get yourself into a macro-tangle.\n\nThis project also contains some helper utilities that make addon development a bit more pleasant.\n\n * **[Usage](#usage)**\n * **[Example](#example)**\n * **[API](#api)**\n\n\n## Usage\n\nSimply add **NAN** as a dependency in the *package.json* of your Node addon:\n\n```js\n\"dependencies\": {\n ...\n \"nan\" : \"~0.3.1\"\n ...\n}\n```\n\nPull in the path to **NAN** in your *binding.gyp* so that you can use `#include \"nan.h\"` in your *.cpp*:\n\n```js\n\"include_dirs\" : [\n ...\n \"` when compiling your addon.\n\n\n## Example\n\nSee **[LevelDOWN](https://github.com/rvagg/node-leveldown/pull/48)** for a full example of **NAN** in use.\n\nFor a simpler example, see the **[async pi estimation example](https://github.com/rvagg/nan/tree/master/examples/async_pi_estimate)** in the examples directory for full code and an explanation of what this Monte Carlo Pi estimation example does. Below are just some parts of the full example that illustrate the use of **NAN**.\n\nCompare to the current 0.10 version of this example, found in the [node-addon-examples](https://github.com/rvagg/node-addon-examples/tree/master/9_async_work) repository and also a 0.11 version of the same found [here](https://github.com/kkoopa/node-addon-examples/tree/5c01f58fc993377a567812597e54a83af69686d7/9_async_work).\n\nNote that there is no embedded version sniffing going on here and also the async work is made much simpler, see below for details on the `NanAsyncWorker` class.\n\n```c++\n// addon.cc\n#include \n#include \"nan.h\"\n// ...\n\nusing namespace v8;\n\nvoid InitAll(Handle exports) {\n exports->Set(NanSymbol(\"calculateSync\"),\n FunctionTemplate::New(CalculateSync)->GetFunction());\n\n exports->Set(NanSymbol(\"calculateAsync\"),\n FunctionTemplate::New(CalculateAsync)->GetFunction());\n}\n\nNODE_MODULE(addon, InitAll)\n```\n\n```c++\n// sync.h\n#include \n#include \"nan.h\"\n\nNAN_METHOD(CalculateSync);\n```\n\n```c++\n// sync.cc\n#include \n#include \"nan.h\"\n#include \"sync.h\"\n// ...\n\nusing namespace v8;\n\n// Simple synchronous access to the `Estimate()` function\nNAN_METHOD(CalculateSync) {\n NanScope();\n\n // expect a number as the first argument\n int points = args[0]->Uint32Value();\n double est = Estimate(points);\n\n NanReturnValue(Number::New(est));\n}\n```\n\n```c++\n// async.cc\n#include \n#include \"nan.h\"\n#include \"async.h\"\n\n// ...\n\nusing namespace v8;\n\nclass PiWorker : public NanAsyncWorker {\n public:\n PiWorker(NanCallback *callback, int points)\n : NanAsyncWorker(callback), points(points) {}\n ~PiWorker() {}\n\n // Executed inside the worker-thread.\n // It is not safe to access V8, or V8 data structures\n // here, so everything we need for input and output\n // should go on `this`.\n void Execute () {\n estimate = Estimate(points);\n }\n\n // Executed when the async work is complete\n // this function will be run inside the main event loop\n // so it is safe to use V8 again\n void HandleOKCallback () {\n NanScope();\n\n Local argv[] = {\n Local::New(Null())\n , Number::New(estimate)\n };\n\n callback->Call(2, argv);\n };\n\n private:\n int points;\n double estimate;\n};\n\n// Asynchronous access to the `Estimate()` function\nNAN_METHOD(CalculateAsync) {\n NanScope();\n\n int points = args[0]->Uint32Value();\n NanCallback *callback = new NanCallback(args[1].As());\n\n NanAsyncQueueWorker(new PiWorker(callback, points));\n NanReturnUndefined();\n}\n```\n\n\n## API\n\n * NAN_METHOD\n * NAN_GETTER\n * NAN_SETTER\n * NAN_PROPERTY_GETTER\n * NAN_PROPERTY_SETTER\n * NAN_PROPERTY_ENUMERATOR\n * NAN_PROPERTY_DELETER\n * NAN_PROPERTY_QUERY\n * NAN_WEAK_CALLBACK\n * NanReturnValue\n * NanReturnUndefined\n * NanReturnNull\n * NanReturnEmptyString\n * NanScope\n * NanLocker\n * NanUnlocker\n * NanGetInternalFieldPointer\n * NanSetInternalFieldPointer\n * NanObjectWrapHandle\n * NanMakeWeak\n * NanSymbol\n * NanGetPointerSafe\n * NanSetPointerSafe\n * NanFromV8String\n * NanBooleanOptionValue\n * NanUInt32OptionValue\n * NanThrowError, NanThrowTypeError, NanThrowRangeError, NanThrowError(Handle), NanThrowError(Handle, int)\n * NanNewBufferHandle(char *, size_t, FreeCallback, void *), NanNewBufferHandle(char *, uint32_t), NanNewBufferHandle(uint32_t)\n * NanBufferUse(char *, uint32_t)\n * NanNewContextHandle\n * NanHasInstance\n * NanPersistentToLocal\n * NanDispose\n * NanAssignPersistent\n * NanInitPersistent\n * NanCallback\n * NanAsyncWorker\n * NanAsyncQueueWorker\n\n\n### NAN_METHOD(methodname)\n\nUse `NAN_METHOD` to define your V8 accessible methods:\n\n```c++\n// .h:\nclass Foo : public node::ObjectWrap {\n ...\n\n static NAN_METHOD(Bar);\n static NAN_METHOD(Baz);\n}\n\n\n// .cc:\nNAN_METHOD(Foo::Bar) {\n ...\n}\n\nNAN_METHOD(Foo::Baz) {\n ...\n}\n```\n\nThe reason for this macro is because of the method signature change in 0.11:\n\n```c++\n// 0.10 and below:\nHandle name(const Arguments& args)\n\n// 0.11 and above\nvoid name(const FunctionCallbackInfo& args)\n```\n\nThe introduction of `FunctionCallbackInfo` brings additional complications:\n\n\n### NAN_GETTER(methodname)\n\nUse `NAN_GETTER` to declare your V8 accessible getters. You get a `Local` `property` and an appropriately typed `args` object that can act like the `args` argument to a `NAN_METHOD` call.\n\nYou can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_GETTER`.\n\n\n### NAN_SETTER(methodname)\n\nUse `NAN_SETTER` to declare your V8 accessible setters. Same as `NAN_GETTER` but you also get a `Local` `value` object to work with.\n\nYou can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_SETTER`.\n\n\n### NAN_PROPERTY_GETTER(cbname)\nUse `NAN_PROPERTY_GETTER` to declare your V8 accessible property getters. You get a `Local` `property` and an appropriately typed `args` object that can act similar to the `args` argument to a `NAN_METHOD` call.\n\nYou can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_PROPERTY_GETTER`.\n\n\n### NAN_PROPERTY_SETTER(cbname)\nUse `NAN_PROPERTY_SETTER` to declare your V8 accessible property setters. Same as `NAN_PROPERTY_GETTER` but you also get a `Local` `value` object to work with.\n\nYou can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_PROPERTY_SETTER`.\n\n\n### NAN_PROPERTY_ENUMERATOR(cbname)\nUse `NAN_PROPERTY_ENUMERATOR` to declare your V8 accessible property enumerators. You get an appropriately typed `args` object like the `args` argument to a `NAN_PROPERTY_GETTER` call.\n\nYou can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_PROPERTY_ENUMERATOR`.\n\n\n### NAN_PROPERTY_DELETER(cbname)\nUse `NAN_PROPERTY_DELETER` to declare your V8 accessible property deleters. Same as `NAN_PROPERTY_GETTER`.\n\nYou can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_PROPERTY_DELETER`.\n\n\n### NAN_PROPERTY_QUERY(cbname)\nUse `NAN_PROPERTY_QUERY` to declare your V8 accessible property queries. Same as `NAN_PROPERTY_GETTER`.\n\nYou can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_PROPERTY_QUERY`.\n\n\n### NAN_WEAK_CALLBACK(type, cbname)\n\nUse `NAN_WEAK_CALLBACK` to declare your V8 WeakReference callbacks. There is an object argument accessible through `NAN_WEAK_CALLBACK_OBJECT`. The `type` argument gives the type of the `data` argument, accessible through `NAN_WEAK_CALLBACK_DATA(type)`.\n\n```c++\nstatic NAN_WEAK_CALLBACK(BufferReference*, WeakCheck) {\n if (NAN_WEAK_CALLBACK_DATA(BufferReference*)->noLongerNeeded_) {\n delete NAN_WEAK_CALLBACK_DATA(BufferReference*);\n } else {\n // Still in use, revive, prevent GC\n NanMakeWeak(NAN_WEAK_CALLBACK_OBJECT, NAN_WEAK_CALLBACK_DATA(BufferReference*), &WeakCheck);\n }\n}\n\n```\n\n### NanReturnValue(Handle<Value>)\n\nUse `NanReturnValue` when you want to return a value from your V8 accessible method:\n\n```c++\nNAN_METHOD(Foo::Bar) {\n ...\n\n NanReturnValue(String::New(\"FooBar!\"));\n}\n```\n\nNo `return` statement required.\n\n\n### NanReturnUndefined()\n\nUse `NanReturnUndefined` when you don't want to return anything from your V8 accessible method:\n\n```c++\nNAN_METHOD(Foo::Baz) {\n ...\n\n NanReturnUndefined();\n}\n```\n\n\n### NanReturnNull()\n\nUse `NanReturnNull` when you want to return `Null` from your V8 accessible method:\n\n```c++\nNAN_METHOD(Foo::Baz) {\n ...\n\n NanReturnNull();\n}\n```\n\n\n### NanReturnEmptyString()\n\nUse `NanReturnEmptyString` when you want to return an empty `String` from your V8 accessible method:\n\n```c++\nNAN_METHOD(Foo::Baz) {\n ...\n\n NanReturnEmptyString();\n}\n```\n\n\n### NanScope()\n\nThe introduction of `isolate` references for many V8 calls in Node 0.11 makes `NanScope()` necessary, use it in place of `HandleScope scope`:\n\n```c++\nNAN_METHOD(Foo::Bar) {\n NanScope();\n\n NanReturnValue(String::New(\"FooBar!\"));\n}\n```\n\n\n### NanLocker()\n\nThe introduction of `isolate` references for many V8 calls in Node 0.11 makes `NanLocker()` necessary, use it in place of `Locker locker`:\n\n```c++\nNAN_METHOD(Foo::Bar) {\n NanLocker();\n ...\n NanUnlocker();\n}\n```\n\n\n### NanUnlocker()\n\nThe introduction of `isolate` references for many V8 calls in Node 0.11 makes `NanUnlocker()` necessary, use it in place of `Unlocker unlocker`:\n\n```c++\nNAN_METHOD(Foo::Bar) {\n NanLocker();\n ...\n NanUnlocker();\n}\n```\n\n\n### void * NanGetInternalFieldPointer(Handle<Object>, int)\n\nGets a pointer to the internal field with at `index` from a V8 `Object` handle.\n\n```c++\nLocal obj;\n...\nNanGetInternalFieldPointer(obj, 0);\n```\n\n### void NanSetInternalFieldPointer(Handle<Object>, int, void *)\n\nSets the value of the internal field at `index` on a V8 `Object` handle.\n\n```c++\nstatic Persistent dataWrapperCtor;\n...\nLocal wrapper = NanPersistentToLocal(dataWrapperCtor)->NewInstance();\nNanSetInternalFieldPointer(wrapper, 0, this);\n```\n\n\n### Local<Object> NanObjectWrapHandle(Object)\n\nWhen you want to fetch the V8 object handle from a native object you've wrapped with Node's `ObjectWrap`, you should use `NanObjectWrapHandle`:\n\n```c++\nNanObjectWrapHandle(iterator)->Get(String::NewSymbol(\"end\"))\n```\n\n\n### NanMakeWeak(Persistent<T>, parameter, callback)\n\nMake a persistent reference weak.\n\n\n### String NanSymbol(char *)\n\nThis isn't strictly about compatibility, it's just an easier way to create string symbol objects (i.e. `String::NewSymbol(x)`), for getting and setting object properties, or names of objects.\n\n```c++\nbool foo = false;\nif (obj->Has(NanSymbol(\"foo\")))\n foo = optionsObj->Get(NanSymbol(\"foo\"))->BooleanValue()\n```\n\n\n### Type NanGetPointerSafe(Type *[, Type])\n\nA helper for getting values from optional pointers. If the pointer is `NULL`, the function returns the optional default value, which defaults to `0`. Otherwise, the function returns the value the pointer points to.\n\n```c++\nchar *plugh(uint32_t *optional) {\n char res[] = \"xyzzy\";\n uint32_t param = NanGetPointerSafe(optional, 0x1337);\n switch (param) {\n ...\n }\n NanSetPointerSafe(optional, 0xDEADBEEF);\n} \n```\n\n\n### bool NanSetPointerSafe(Type *, Type)\n\nA helper for setting optional argument pointers. If the pointer is `NULL`, the function simply return `false`. Otherwise, the value is assigned to the variable the pointer points to.\n\n```c++\nconst char *plugh(size_t *outputsize) {\n char res[] = \"xyzzy\";\n if !(NanSetPointerSafe(outputsize, strlen(res) + 1)) {\n ...\n }\n\n ...\n}\n```\n\n\n### char* NanFromV8String(Handle<Value>[, enum Nan::Encoding, size_t *, char *, size_t, int])\n\nWhen you want to convert a V8 `String` to a `char*` use `NanFromV8String`. It is possible to define an encoding that defaults to `Nan::UTF8` as well as a pointer to a variable that will be assigned the number of bytes in the returned string. It is also possible to supply a buffer and its length to the function in order not to have a new buffer allocated. The final argument allows optionally setting `String::WriteOptions`, which default to `String::HINT_MANY_WRITES_EXPECTED | String::NO_NULL_TERMINATION`.\nJust remember that you'll end up with an object that you'll need to `delete[]` at some point unless you supply your own buffer:\n\n```c++\nsize_t count;\nchar* name = NanFromV8String(args[0]);\nchar* decoded = NanFromV8String(args[1], Nan::BASE64, &count, NULL, 0, String::HINT_MANY_WRITES_EXPECTED);\nchar param_copy[count];\nmemcpy(param_copy, decoded, count);\ndelete[] decoded;\n```\n\n\n### bool NanBooleanOptionValue(Handle<Value>, Handle<String>[, bool])\n\nWhen you have an \"options\" object that you need to fetch properties from, boolean options can be fetched with this pair. They check first if the object exists (`IsEmpty`), then if the object has the given property (`Has`) then they get and convert/coerce the property to a `bool`.\n\nThe optional last parameter is the *default* value, which is `false` if left off:\n\n```c++\n// `foo` is false unless the user supplies a truthy value for it\nbool foo = NanBooleanOptionValue(optionsObj, NanSymbol(\"foo\"));\n// `bar` is true unless the user supplies a falsy value for it\nbool bar = NanBooleanOptionValueDefTrue(optionsObj, NanSymbol(\"bar\"), true);\n```\n\n\n### uint32_t NanUInt32OptionValue(Handle<Value>, Handle<String>, uint32_t)\n\nSimilar to `NanBooleanOptionValue`, use `NanUInt32OptionValue` to fetch an integer option from your options object. Can be any kind of JavaScript `Number` and it will be coerced to an unsigned 32-bit integer.\n\nRequires all 3 arguments as a default is not optional:\n\n```c++\nuint32_t count = NanUInt32OptionValue(optionsObj, NanSymbol(\"count\"), 1024);\n```\n\n\n### NanThrowError(message), NanThrowTypeError(message), NanThrowRangeError(message), NanThrowError(Local<Value>), NanThrowError(Local<Value>, int)\n\nFor throwing `Error`, `TypeError` and `RangeError` objects. You should `return` this call:\n\n```c++\nreturn NanThrowError(\"you must supply a callback argument\");\n```\n\nCan also handle any custom object you may want to throw. If used with the error code argument, it will add the supplied error code to the error object as a property called `code`.\n\n\n### Local<Object> NanNewBufferHandle(char *, uint32_t), Local<Object> NanNewBufferHandle(uint32_t)\n\nThe `Buffer` API has changed a little in Node 0.11, this helper provides consistent access to `Buffer` creation:\n\n```c++\nNanNewBufferHandle((char*)value.data(), value.size());\n```\n\nCan also be used to initialize a `Buffer` with just a `size` argument.\n\nCan also be supplied with a `NAN_WEAK_CALLBACK` and a hint for the garbage collector, when dealing with weak references.\n\n\n### Local<Object> NanBufferUse(char*, uint32_t)\n\n`Buffer::New(char*, uint32_t)` prior to 0.11 would make a copy of the data.\nWhile it was possible to get around this, it required a shim by passing a\ncallback. So the new API `Buffer::Use(char*, uint32_t)` was introduced to remove\nneeding to use this shim.\n\n`NanBufferUse` uses the `char*` passed as the backing data, and will free the\nmemory automatically when the weak callback is called. Keep this in mind, as\ncareless use can lead to \"double free or corruption\" and other cryptic failures.\n\n\n### bool NanHasInstance(Persistent<FunctionTemplate>&, Handle<Value>)\n\nCan be used to check the type of an object to determine it is of a particular class you have already defined and have a `Persistent` handle for.\n\n\n### Local<Type> NanPersistentToLocal(Persistent<Type>&)\n\nAside from `FunctionCallbackInfo`, the biggest and most painful change to V8 in Node 0.11 is the many restrictions now placed on `Persistent` handles. They are difficult to assign and difficult to fetch the original value out of.\n\nUse `NanPersistentToLocal` to convert a `Persistent` handle back to a `Local` handle.\n\n```c++\nLocal handle = NanPersistentToLocal(persistentHandle);\n```\n\n\n### Local<Context> NanNewContextHandle([ExtensionConfiguration*, Handle<ObjectTemplate>, Handle<Value>])\nCreates a new `Local` handle.\n\n```c++\nLocal ftmpl = FunctionTemplate::New();\nLocal otmpl = ftmpl->InstanceTemplate();\nLocal ctx = NanNewContextHandle(NULL, otmpl);\n```\n\n\n### void NanDispose(Persistent<T> &)\n\nUse `NanDispose` to dispose a `Persistent` handle.\n\n```c++\nNanDispose(persistentHandle);\n```\n\n\n### NanAssignPersistent(type, handle, object)\n\nUse `NanAssignPersistent` to assign a non-`Persistent` handle to a `Persistent` one. You can no longer just declare a `Persistent` handle and assign directly to it later, you have to `Reset` it in Node 0.11, so this makes it easier.\n\nIn general it is now better to place anything you want to protect from V8's garbage collector as properties of a generic `Object` and then assign that to a `Persistent`. This works in older versions of Node also if you use `NanAssignPersistent`:\n\n```c++\nPersistent persistentHandle;\n\n...\n\nLocal obj = Object::New();\nobj->Set(NanSymbol(\"key\"), keyHandle); // where keyHandle might be a Local\nNanAssignPersistent(Object, persistentHandle, obj)\n```\n\n\n### NanInitPersistent(type, name, object)\n\nUser `NanInitPersistent` to declare and initialize a new `Persistent` with the supplied object. The assignment operator for `Persistent` is no longer public in Node 0.11, so this macro makes it easier to declare and initializing a new `Persistent`. See NanAssignPersistent for more information.\n\n```c++\nLocal obj = Object::New();\nobj->Set(NanSymbol(\"key\"), keyHandle); // where keyHandle might be a Local\nNanInitPersistent(Object, persistentHandle, obj);\n```\n\n\n### NanCallback\n\nBecause of the difficulties imposed by the changes to `Persistent` handles in V8 in Node 0.11, creating `Persistent` versions of your `Local` handles is annoyingly tricky. `NanCallback` makes it easier by taking your `Local` handle, making it persistent until the `NanCallback` is deleted and even providing a handy `Call()` method to fetch and execute the callback `Function`.\n\n```c++\nLocal callbackHandle = callback = args[0].As();\nNanCallback *callback = new NanCallback(callbackHandle);\n// pass `callback` around and it's safe from GC until you:\ndelete callback;\n```\n\nYou can execute the callback like so:\n\n```c++\n// no arguments:\ncallback->Call(0, NULL);\n\n// an error argument:\nLocal argv[] = {\n Exception::Error(String::New(\"fail!\"))\n};\ncallback->Call(1, argv);\n\n// a success argument:\nLocal argv[] = {\n Local::New(Null()),\n String::New(\"w00t!\")\n};\ncallback->Call(2, argv);\n```\n\n`NanCallback` also has a `Local GetCallback()` method that you can use to fetch a local handle to the underlying callback function if you need it.\n\n\n### NanAsyncWorker\n\n`NanAsyncWorker` is an abstract class that you can subclass to have much of the annoying async queuing and handling taken care of for you. It can even store arbitrary V8 objects for you and have them persist while the async work is in progress.\n\nSee a rough outline of the implementation:\n\n```c++\nclass NanAsyncWorker {\npublic:\n NanAsyncWorker (NanCallback *callback);\n\n // Clean up persistent handles and delete the *callback\n virtual ~NanAsyncWorker ();\n\n // Check the `char *errmsg` property and call HandleOKCallback()\n // or HandleErrorCallback depending on whether it has been set or not\n virtual void WorkComplete ();\n\n // You must implement this to do some async work. If there is an\n // error then allocate `errmsg` to to a message and the callback will\n // be passed that string in an Error object\n virtual void Execute ();\n\nprotected:\n // Set this if there is an error, otherwise it's NULL\n const char *errmsg;\n\n // Save a V8 object in a Persistent handle to protect it from GC\n void SavePersistent(const char *key, Local &obj);\n\n // Fetch a stored V8 object (don't call from within `Execute()`)\n Local GetFromPersistent(const char *key);\n\n // Default implementation calls the callback function with no arguments.\n // Override this to return meaningful data\n virtual void HandleOKCallback ();\n\n // Default implementation calls the callback function with an Error object\n // wrapping the `errmsg` string\n virtual void HandleErrorCallback ();\n};\n```\n\n\n### NanAsyncQueueWorker(NanAsyncWorker *)\n\n`NanAsyncQueueWorker` will run a `NanAsyncWorker` asynchronously via libuv. Both the *execute* and *after_work* steps are taken care of for you—most of the logic for this is embedded in `NanAsyncWorker`.\n\n### Contributors\n\nNAN is only possible due to the excellent work of the following contributors:\n\n\n\n\n\n
Rod VaggGitHub/rvaggTwitter/@rvagg
Benjamin ByholmGitHub/kkoopa
Trevor NorrisGitHub/trevnorrisTwitter/@trevnorris
\n\nLicence & copyright\n-----------------------\n\nCopyright (c) 2013 Rod Vagg & NAN contributors (listed above).\n\nNative Abstractions for Node.js is licensed under an MIT +no-false-attribs license. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details.\n", + "readmeFilename": "README.md", + "bugs": { + "url": "https://github.com/rvagg/nan/issues" + }, + "homepage": "https://github.com/rvagg/nan", + "_id": "nan@0.3.2", + "_from": "nan@>=0.3.0-0 <0.4.0-0", + "scripts": {} +} diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/options/.npmignore b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/options/.npmignore new file mode 100644 index 0000000..6bfffbb --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/options/.npmignore @@ -0,0 +1,5 @@ +npm-debug.log +node_modules +.*.swp +.lock-* +build/ diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/options/Makefile b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/options/Makefile new file mode 100644 index 0000000..7496b6f --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/options/Makefile @@ -0,0 +1,12 @@ +ALL_TESTS = $(shell find test/ -name '*.test.js') + +run-tests: + @./node_modules/.bin/mocha \ + -t 2000 \ + $(TESTFLAGS) \ + $(TESTS) + +test: + @$(MAKE) NODE_PATH=lib TESTS="$(ALL_TESTS)" run-tests + +.PHONY: test diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/options/README.md b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/options/README.md new file mode 100644 index 0000000..4b39a2a --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/options/README.md @@ -0,0 +1,28 @@ +# options.js # + +A very light-weight in-code option parsers for node.js. + +## License ## + +(The MIT License) + +Copyright (c) 2012 Einar Otto Stangvik <einaros@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/options/lib/options.js b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/options/lib/options.js new file mode 100644 index 0000000..4fc45e9 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/options/lib/options.js @@ -0,0 +1,86 @@ +/*! + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ + +var fs = require('fs'); + +function Options(defaults) { + var internalValues = {}; + var values = this.value = {}; + Object.keys(defaults).forEach(function(key) { + internalValues[key] = defaults[key]; + Object.defineProperty(values, key, { + get: function() { return internalValues[key]; }, + configurable: false, + enumerable: true + }); + }); + this.reset = function() { + Object.keys(defaults).forEach(function(key) { + internalValues[key] = defaults[key]; + }); + return this; + }; + this.merge = function(options, required) { + options = options || {}; + if (Object.prototype.toString.call(required) === '[object Array]') { + var missing = []; + for (var i = 0, l = required.length; i < l; ++i) { + var key = required[i]; + if (!(key in options)) { + missing.push(key); + } + } + if (missing.length > 0) { + if (missing.length > 1) { + throw new Error('options ' + + missing.slice(0, missing.length - 1).join(', ') + ' and ' + + missing[missing.length - 1] + ' must be defined'); + } + else throw new Error('option ' + missing[0] + ' must be defined'); + } + } + Object.keys(options).forEach(function(key) { + if (key in internalValues) { + internalValues[key] = options[key]; + } + }); + return this; + }; + this.copy = function(keys) { + var obj = {}; + Object.keys(defaults).forEach(function(key) { + if (keys.indexOf(key) !== -1) { + obj[key] = values[key]; + } + }); + return obj; + }; + this.read = function(filename, cb) { + if (typeof cb == 'function') { + var self = this; + fs.readFile(filename, function(error, data) { + if (error) return cb(error); + var conf = JSON.parse(data); + self.merge(conf); + cb(); + }); + } + else { + var conf = JSON.parse(fs.readFileSync(filename)); + this.merge(conf); + } + return this; + }; + this.isDefined = function(key) { + return typeof values[key] != 'undefined'; + }; + this.isDefinedAndNonNull = function(key) { + return typeof values[key] != 'undefined' && values[key] !== null; + }; + Object.freeze(values); + Object.freeze(this); +} + +module.exports = Options; diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/options/package.json b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/options/package.json new file mode 100644 index 0000000..cbdc5c2 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/options/package.json @@ -0,0 +1,33 @@ +{ + "author": { + "name": "Einar Otto Stangvik", + "email": "einaros@gmail.com", + "url": "http://2x.io" + }, + "name": "options", + "description": "A very light-weight in-code option parsers for node.js.", + "version": "0.0.5", + "repository": { + "type": "git", + "url": "git://github.com/einaros/options.js.git" + }, + "main": "lib/options", + "scripts": { + "test": "make test" + }, + "engines": { + "node": ">=0.4.0" + }, + "dependencies": {}, + "devDependencies": { + "mocha": "latest" + }, + "readme": "# options.js #\n\nA very light-weight in-code option parsers for node.js.\n\n## License ##\n\n(The MIT License)\n\nCopyright (c) 2012 Einar Otto Stangvik <einaros@gmail.com>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n", + "readmeFilename": "README.md", + "bugs": { + "url": "https://github.com/einaros/options.js/issues" + }, + "homepage": "https://github.com/einaros/options.js", + "_id": "options@0.0.5", + "_from": "options@>=0.0.5" +} diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/options/test/fixtures/test.conf b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/options/test/fixtures/test.conf new file mode 100644 index 0000000..6e62444 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/options/test/fixtures/test.conf @@ -0,0 +1,4 @@ +{ + "a": "foobar", + "b": false +} \ No newline at end of file diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/options/test/options.test.js b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/options/test/options.test.js new file mode 100644 index 0000000..6a1d9f5 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/options/test/options.test.js @@ -0,0 +1,140 @@ +var Options = require('options') + , assert = require('assert'); + +describe('Options', function() { + describe('#ctor', function() { + it('initializes options', function() { + var option = new Options({a: true, b: false}); + assert.strictEqual(true, option.value.a); + assert.strictEqual(false, option.value.b); + }); + }); + + describe('#merge', function() { + it('merges options from another object', function() { + var option = new Options({a: true, b: false}); + option.merge({b: true}); + assert.strictEqual(true, option.value.a); + assert.strictEqual(true, option.value.b); + }); + it('does nothing when arguments are undefined', function() { + var option = new Options({a: true, b: false}); + option.merge(undefined); + assert.strictEqual(true, option.value.a); + assert.strictEqual(false, option.value.b); + }); + it('cannot set values that werent already there', function() { + var option = new Options({a: true, b: false}); + option.merge({c: true}); + assert.strictEqual('undefined', typeof option.value.c); + }); + it('can require certain options to be defined', function() { + var option = new Options({a: true, b: false, c: 3}); + var caughtException = false; + try { + option.merge({}, ['a', 'b', 'c']); + } + catch (e) { + caughtException = e.toString() == 'Error: options a, b and c must be defined'; + } + assert.strictEqual(true, caughtException); + }); + it('can require certain options to be defined, when options are undefined', function() { + var option = new Options({a: true, b: false, c: 3}); + var caughtException = false; + try { + option.merge(undefined, ['a', 'b', 'c']); + } + catch (e) { + caughtException = e.toString() == 'Error: options a, b and c must be defined'; + } + assert.strictEqual(true, caughtException); + }); + it('returns "this"', function() { + var option = new Options({a: true, b: false, c: 3}); + assert.strictEqual(option, option.merge()); + }); + }); + + describe('#copy', function() { + it('returns a new object with the indicated options', function() { + var option = new Options({a: true, b: false, c: 3}); + option.merge({c: 4}); + var obj = option.copy(['a', 'c']); + assert.strictEqual(true, obj.a); + assert.strictEqual(4, obj.c); + assert.strictEqual('undefined', typeof obj.b); + }); + }); + + describe('#value', function() { + it('can be enumerated', function() { + var option = new Options({a: true, b: false}); + assert.strictEqual(2, Object.keys(option.value).length); + }); + it('can not be used to set values', function() { + var option = new Options({a: true, b: false}); + option.value.b = true; + assert.strictEqual(false, option.value.b); + }); + it('can not be used to add values', function() { + var option = new Options({a: true, b: false}); + option.value.c = 3; + assert.strictEqual('undefined', typeof option.value.c); + }); + }); + + describe('#isDefined', function() { + it('returns true if the named value is defined', function() { + var option = new Options({a: undefined}); + assert.strictEqual(false, option.isDefined('a')); + option.merge({a: false}); + assert.strictEqual(true, option.isDefined('a')); + }); + }); + + describe('#isDefinedAndNonNull', function() { + it('returns true if the named value is defined and non-null', function() { + var option = new Options({a: undefined}); + assert.strictEqual(false, option.isDefinedAndNonNull('a')); + option.merge({a: null}); + assert.strictEqual(false, option.isDefinedAndNonNull('a')); + option.merge({a: 2}); + assert.strictEqual(true, option.isDefinedAndNonNull('a')); + }); + }); + + describe('#read', function() { + it('reads and merges config from a file', function() { + var option = new Options({a: true, b: true}); + option.read(__dirname + '/fixtures/test.conf'); + assert.strictEqual('foobar', option.value.a); + assert.strictEqual(false, option.value.b); + }); + + it('asynchronously reads and merges config from a file when a callback is passed', function(done) { + var option = new Options({a: true, b: true}); + option.read(__dirname + '/fixtures/test.conf', function(error) { + assert.strictEqual('foobar', option.value.a); + assert.strictEqual(false, option.value.b); + done(); + }); + }); + }); + + describe('#reset', function() { + it('resets options to defaults', function() { + var option = new Options({a: true, b: false}); + option.merge({b: true}); + assert.strictEqual(true, option.value.b); + option.reset(); + assert.strictEqual(false, option.value.b); + }); + }); + + it('is immutable', function() { + var option = new Options({a: true, b: false}); + option.foo = 2; + assert.strictEqual('undefined', typeof option.foo); + }); +}); diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/tinycolor/.npmignore b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/tinycolor/.npmignore new file mode 100644 index 0000000..6bfffbb --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/tinycolor/.npmignore @@ -0,0 +1,5 @@ +npm-debug.log +node_modules +.*.swp +.lock-* +build/ diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/tinycolor/README.md b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/tinycolor/README.md new file mode 100644 index 0000000..55eb3c1 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/tinycolor/README.md @@ -0,0 +1,3 @@ +# tinycolor # + +This is a no-fuzz, barebone, zero muppetry color module for node.js. \ No newline at end of file diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/tinycolor/example.js b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/tinycolor/example.js new file mode 100644 index 0000000..f754046 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/tinycolor/example.js @@ -0,0 +1,3 @@ +require('./tinycolor'); +console.log('this should be red and have an underline!'.grey.underline); +console.log('this should have a blue background!'.bgBlue); \ No newline at end of file diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/tinycolor/package.json b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/tinycolor/package.json new file mode 100644 index 0000000..7700265 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/tinycolor/package.json @@ -0,0 +1,29 @@ +{ + "author": { + "name": "Einar Otto Stangvik", + "email": "einaros@gmail.com", + "url": "http://2x.io" + }, + "name": "tinycolor", + "description": "a to-the-point color module for node", + "version": "0.0.1", + "repository": { + "type": "git", + "url": "git://github.com/einaros/tinycolor.git" + }, + "engines": { + "node": ">=0.4.0" + }, + "dependencies": {}, + "devDependencies": {}, + "main": "tinycolor", + "readme": "# tinycolor #\n\nThis is a no-fuzz, barebone, zero muppetry color module for node.js.", + "readmeFilename": "README.md", + "bugs": { + "url": "https://github.com/einaros/tinycolor/issues" + }, + "homepage": "https://github.com/einaros/tinycolor", + "_id": "tinycolor@0.0.1", + "_from": "tinycolor@>=0.0.0-0 <1.0.0-0", + "scripts": {} +} diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/tinycolor/tinycolor.js b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/tinycolor/tinycolor.js new file mode 100644 index 0000000..36e552c --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/tinycolor/tinycolor.js @@ -0,0 +1,31 @@ +var styles = { + 'bold': ['\033[1m', '\033[22m'], + 'italic': ['\033[3m', '\033[23m'], + 'underline': ['\033[4m', '\033[24m'], + 'inverse': ['\033[7m', '\033[27m'], + 'black': ['\033[30m', '\033[39m'], + 'red': ['\033[31m', '\033[39m'], + 'green': ['\033[32m', '\033[39m'], + 'yellow': ['\033[33m', '\033[39m'], + 'blue': ['\033[34m', '\033[39m'], + 'magenta': ['\033[35m', '\033[39m'], + 'cyan': ['\033[36m', '\033[39m'], + 'white': ['\033[37m', '\033[39m'], + 'default': ['\033[39m', '\033[39m'], + 'grey': ['\033[90m', '\033[39m'], + 'bgBlack': ['\033[40m', '\033[49m'], + 'bgRed': ['\033[41m', '\033[49m'], + 'bgGreen': ['\033[42m', '\033[49m'], + 'bgYellow': ['\033[43m', '\033[49m'], + 'bgBlue': ['\033[44m', '\033[49m'], + 'bgMagenta': ['\033[45m', '\033[49m'], + 'bgCyan': ['\033[46m', '\033[49m'], + 'bgWhite': ['\033[47m', '\033[49m'], + 'bgDefault': ['\033[49m', '\033[49m'] +} +Object.keys(styles).forEach(function(style) { + Object.defineProperty(String.prototype, style, { + get: function() { return styles[style][0] + this + styles[style][1]; }, + enumerable: false + }); +}); diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/package.json b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/package.json new file mode 100644 index 0000000..a8b2d1a --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/package.json @@ -0,0 +1,80 @@ +{ + "author": { + "name": "Einar Otto Stangvik", + "email": "einaros@gmail.com", + "url": "http://2x.io" + }, + "name": "ws", + "description": "simple to use, blazing fast and thoroughly tested websocket client, server and console for node.js, up-to-date against RFC-6455", + "version": "0.4.31", + "keywords": [ + "Hixie", + "HyBi", + "Push", + "RFC-6455", + "WebSocket", + "WebSockets", + "real-time" + ], + "repository": { + "type": "git", + "url": "git://github.com/einaros/ws.git" + }, + "bin": { + "wscat": "./bin/wscat" + }, + "scripts": { + "test": "make test", + "install": "(node-gyp rebuild 2> builderror.log) || (exit 0)" + }, + "engines": { + "node": ">=0.4.0" + }, + "dependencies": { + "commander": "~0.6.1", + "nan": "~0.3.0", + "tinycolor": "0.x", + "options": ">=0.0.5" + }, + "devDependencies": { + "mocha": "1.12.0", + "should": "1.2.x", + "expect.js": "0.2.x", + "benchmark": "0.3.x", + "ansi": "latest" + }, + "browser": "./lib/browser.js", + "component": { + "scripts": { + "ws/index.js": "./lib/browser.js" + } + }, + "gypfile": true, + "bugs": { + "url": "https://github.com/einaros/ws/issues" + }, + "_id": "ws@0.4.31", + "dist": { + "shasum": "5a4849e7a9ccd1ed5a81aeb4847c9fedf3122927", + "tarball": "http://registry.npmjs.org/ws/-/ws-0.4.31.tgz" + }, + "_from": "ws@0.4.31", + "_npmVersion": "1.3.5", + "_npmUser": { + "name": "V1", + "email": "info@3rd-Eden.com" + }, + "maintainers": [ + { + "name": "einaros", + "email": "einaros@gmail.com" + }, + { + "name": "V1", + "email": "info@3rd-Eden.com" + } + ], + "directories": {}, + "_shasum": "5a4849e7a9ccd1ed5a81aeb4847c9fedf3122927", + "_resolved": "https://registry.npmjs.org/ws/-/ws-0.4.31.tgz" +} diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/src/bufferutil.cc b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/src/bufferutil.cc new file mode 100644 index 0000000..f06777f --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/src/bufferutil.cc @@ -0,0 +1,117 @@ +/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include "nan.h" + +using namespace v8; +using namespace node; + +class BufferUtil : public ObjectWrap +{ +public: + + static void Initialize(v8::Handle target) + { + NanScope(); + Local t = FunctionTemplate::New(New); + t->InstanceTemplate()->SetInternalFieldCount(1); + NODE_SET_METHOD(t, "unmask", BufferUtil::Unmask); + NODE_SET_METHOD(t, "mask", BufferUtil::Mask); + NODE_SET_METHOD(t, "merge", BufferUtil::Merge); + target->Set(String::NewSymbol("BufferUtil"), t->GetFunction()); + } + +protected: + + static NAN_METHOD(New) + { + NanScope(); + BufferUtil* bufferUtil = new BufferUtil(); + bufferUtil->Wrap(args.This()); + NanReturnValue(args.This()); + } + + static NAN_METHOD(Merge) + { + NanScope(); + Local bufferObj = args[0]->ToObject(); + char* buffer = Buffer::Data(bufferObj); + Local array = Local::Cast(args[1]); + unsigned int arrayLength = array->Length(); + size_t offset = 0; + unsigned int i; + for (i = 0; i < arrayLength; ++i) { + Local src = array->Get(i)->ToObject(); + size_t length = Buffer::Length(src); + memcpy(buffer + offset, Buffer::Data(src), length); + offset += length; + } + NanReturnValue(True()); + } + + static NAN_METHOD(Unmask) + { + NanScope(); + Local buffer_obj = args[0]->ToObject(); + size_t length = Buffer::Length(buffer_obj); + Local mask_obj = args[1]->ToObject(); + unsigned int *mask = (unsigned int*)Buffer::Data(mask_obj); + unsigned int* from = (unsigned int*)Buffer::Data(buffer_obj); + size_t len32 = length / 4; + unsigned int i; + for (i = 0; i < len32; ++i) *(from + i) ^= *mask; + from += i; + switch (length % 4) { + case 3: *((unsigned char*)from+2) = *((unsigned char*)from+2) ^ ((unsigned char*)mask)[2]; + case 2: *((unsigned char*)from+1) = *((unsigned char*)from+1) ^ ((unsigned char*)mask)[1]; + case 1: *((unsigned char*)from ) = *((unsigned char*)from ) ^ ((unsigned char*)mask)[0]; + case 0:; + } + NanReturnValue(True()); + } + + static NAN_METHOD(Mask) + { + NanScope(); + Local buffer_obj = args[0]->ToObject(); + Local mask_obj = args[1]->ToObject(); + unsigned int *mask = (unsigned int*)Buffer::Data(mask_obj); + Local output_obj = args[2]->ToObject(); + unsigned int dataOffset = args[3]->Int32Value(); + unsigned int length = args[4]->Int32Value(); + unsigned int* to = (unsigned int*)(Buffer::Data(output_obj) + dataOffset); + unsigned int* from = (unsigned int*)Buffer::Data(buffer_obj); + unsigned int len32 = length / 4; + unsigned int i; + for (i = 0; i < len32; ++i) *(to + i) = *(from + i) ^ *mask; + to += i; + from += i; + switch (length % 4) { + case 3: *((unsigned char*)to+2) = *((unsigned char*)from+2) ^ *((unsigned char*)mask+2); + case 2: *((unsigned char*)to+1) = *((unsigned char*)from+1) ^ *((unsigned char*)mask+1); + case 1: *((unsigned char*)to ) = *((unsigned char*)from ) ^ *((unsigned char*)mask); + case 0:; + } + NanReturnValue(True()); + } +}; + +extern "C" void init (Handle target) +{ + NanScope(); + BufferUtil::Initialize(target); +} + +NODE_MODULE(bufferutil, init) + diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/src/validation.cc b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/src/validation.cc new file mode 100644 index 0000000..528eda1 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/src/validation.cc @@ -0,0 +1,145 @@ +/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ + +#include +#include +#include +#include +#include +#include +#include +#include "nan.h" + +using namespace v8; +using namespace node; + +#define UNI_SUR_HIGH_START (uint32_t) 0xD800 +#define UNI_SUR_LOW_END (uint32_t) 0xDFFF +#define UNI_REPLACEMENT_CHAR (uint32_t) 0x0000FFFD +#define UNI_MAX_LEGAL_UTF32 (uint32_t) 0x0010FFFF + +static const uint8_t trailingBytesForUTF8[256] = { + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5 +}; + +static const uint32_t offsetsFromUTF8[6] = { + 0x00000000, 0x00003080, 0x000E2080, + 0x03C82080, 0xFA082080, 0x82082080 +}; + +static int isLegalUTF8(const uint8_t *source, const int length) +{ + uint8_t a; + const uint8_t *srcptr = source+length; + switch (length) { + default: return 0; + /* Everything else falls through when "true"... */ + /* RFC3629 makes 5 & 6 bytes UTF-8 illegal + case 6: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return 0; + case 5: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return 0; */ + case 4: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return 0; + case 3: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return 0; + case 2: if ((a = (*--srcptr)) > 0xBF) return 0; + switch (*source) { + /* no fall-through in this inner switch */ + case 0xE0: if (a < 0xA0) return 0; break; + case 0xED: if (a > 0x9F) return 0; break; + case 0xF0: if (a < 0x90) return 0; break; + case 0xF4: if (a > 0x8F) return 0; break; + default: if (a < 0x80) return 0; + } + + case 1: if (*source >= 0x80 && *source < 0xC2) return 0; + } + if (*source > 0xF4) return 0; + return 1; +} + +int is_valid_utf8 (size_t len, char *value) +{ + /* is the string valid UTF-8? */ + for (unsigned int i = 0; i < len; i++) { + uint32_t ch = 0; + uint8_t extrabytes = trailingBytesForUTF8[(uint8_t) value[i]]; + + if (extrabytes + i >= len) + return 0; + + if (isLegalUTF8 ((uint8_t *) (value + i), extrabytes + 1) == 0) return 0; + + switch (extrabytes) { + case 5 : ch += (uint8_t) value[i++]; ch <<= 6; + case 4 : ch += (uint8_t) value[i++]; ch <<= 6; + case 3 : ch += (uint8_t) value[i++]; ch <<= 6; + case 2 : ch += (uint8_t) value[i++]; ch <<= 6; + case 1 : ch += (uint8_t) value[i++]; ch <<= 6; + case 0 : ch += (uint8_t) value[i]; + } + + ch -= offsetsFromUTF8[extrabytes]; + + if (ch <= UNI_MAX_LEGAL_UTF32) { + if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) + return 0; + } else { + return 0; + } + } + + return 1; +} + +class Validation : public ObjectWrap +{ +public: + + static void Initialize(v8::Handle target) + { + HandleScope scope; + Local t = FunctionTemplate::New(New); + t->InstanceTemplate()->SetInternalFieldCount(1); + NODE_SET_METHOD(t, "isValidUTF8", Validation::IsValidUTF8); + target->Set(String::NewSymbol("Validation"), t->GetFunction()); + } + +protected: + + static NAN_METHOD(New) + { + NanScope(); + Validation* validation = new Validation(); + validation->Wrap(args.This()); + NanReturnValue(args.This()); + } + + static NAN_METHOD(IsValidUTF8) + { + NanScope(); + if (!Buffer::HasInstance(args[0])) { + return NanThrowTypeError("First argument needs to be a buffer"); + } + Local buffer_obj = args[0]->ToObject(); + char *buffer_data = Buffer::Data(buffer_obj); + size_t buffer_length = Buffer::Length(buffer_obj); + NanReturnValue(is_valid_utf8(buffer_length, buffer_data) == 1 ? True() : False()); + } +}; + +extern "C" void init (Handle target) +{ + NanScope(); + Validation::Initialize(target); +} + +NODE_MODULE(validation, init) + diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/BufferPool.test.js b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/BufferPool.test.js new file mode 100644 index 0000000..1ee7ff0 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/BufferPool.test.js @@ -0,0 +1,63 @@ +var BufferPool = require('../lib/BufferPool'); +require('should'); + +describe('BufferPool', function() { + describe('#ctor', function() { + it('allocates pool', function() { + var db = new BufferPool(1000); + db.size.should.eql(1000); + }); + }); + describe('#get', function() { + it('grows the pool if necessary', function() { + var db = new BufferPool(1000); + var buf = db.get(2000); + db.size.should.be.above(1000); + db.used.should.eql(2000); + buf.length.should.eql(2000); + }); + it('grows the pool after the first call, if necessary', function() { + var db = new BufferPool(1000); + var buf = db.get(1000); + db.used.should.eql(1000); + db.size.should.eql(1000); + buf.length.should.eql(1000); + var buf2 = db.get(1000); + db.used.should.eql(2000); + db.size.should.be.above(1000); + buf2.length.should.eql(1000); + }); + it('grows the pool according to the growStrategy if necessary', function() { + var db = new BufferPool(1000, function(db, length) { + return db.size + 2345; + }); + var buf = db.get(2000); + db.size.should.eql(3345); + buf.length.should.eql(2000); + }); + it('doesnt grow the pool if theres enough room available', function() { + var db = new BufferPool(1000); + var buf = db.get(1000); + db.size.should.eql(1000); + buf.length.should.eql(1000); + }); + }); + describe('#reset', function() { + it('shinks the pool', function() { + var db = new BufferPool(1000); + var buf = db.get(2000); + db.reset(true); + db.size.should.eql(1000); + }); + it('shrinks the pool according to the shrinkStrategy', function() { + var db = new BufferPool(1000, function(db, length) { + return db.used + length; + }, function(db) { + return 0; + }); + var buf = db.get(2000); + db.reset(true); + db.size.should.eql(0); + }); + }); +}); diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/Receiver.hixie.test.js b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/Receiver.hixie.test.js new file mode 100644 index 0000000..043d3bc --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/Receiver.hixie.test.js @@ -0,0 +1,158 @@ +var assert = require('assert') + , expect = require('expect.js') + , Receiver = require('../lib/Receiver.hixie'); +require('./hybi-common'); + +describe('Receiver', function() { + it('can parse text message', function() { + var p = new Receiver(); + var packet = '00 48 65 6c 6c 6f ff'; + + var gotData = false; + p.ontext = function(data) { + gotData = true; + assert.equal('Hello', data); + }; + + p.add(getBufferFromHexString(packet)); + expect(gotData).to.equal(true); + }); + + it('can parse multiple text messages', function() { + var p = new Receiver(); + var packet = '00 48 65 6c 6c 6f ff 00 48 65 6c 6c 6f ff'; + + var gotData = false; + var messages = []; + p.ontext = function(data) { + gotData = true; + messages.push(data); + }; + + p.add(getBufferFromHexString(packet)); + expect(gotData).to.equal(true); + for (var i = 0; i < 2; ++i) { + expect(messages[i]).to.equal('Hello'); + } + }); + + it('can parse empty message', function() { + var p = new Receiver(); + var packet = '00 ff'; + + var gotData = false; + p.ontext = function(data) { + gotData = true; + assert.equal('', data); + }; + + p.add(getBufferFromHexString(packet)); + expect(gotData).to.equal(true); + }); + + it('can parse text messages delivered over multiple frames', function() { + var p = new Receiver(); + var packets = [ + '00 48', + '65 6c 6c', + '6f ff 00 48', + '65', + '6c 6c 6f', + 'ff' + ]; + + var gotData = false; + var messages = []; + p.ontext = function(data) { + gotData = true; + messages.push(data); + }; + + for (var i = 0; i < packets.length; ++i) { + p.add(getBufferFromHexString(packets[i])); + } + expect(gotData).to.equal(true); + for (var i = 0; i < 2; ++i) { + expect(messages[i]).to.equal('Hello'); + } + }); + + it('emits an error if a payload doesnt start with 0x00', function() { + var p = new Receiver(); + var packets = [ + '00 6c ff', + '00 6c ff ff', + 'ff 00 6c ff 00 6c ff', + '00', + '6c 6c 6f', + 'ff' + ]; + + var gotData = false; + var gotError = false; + var messages = []; + p.ontext = function(data) { + gotData = true; + messages.push(data); + }; + p.onerror = function(reason, code) { + gotError = code == true; + }; + + for (var i = 0; i < packets.length && !gotError; ++i) { + p.add(getBufferFromHexString(packets[i])); + } + expect(gotError).to.equal(true); + expect(messages[0]).to.equal('l'); + expect(messages[1]).to.equal('l'); + expect(messages.length).to.equal(2); + }); + + it('can parse close messages', function() { + var p = new Receiver(); + var packets = [ + 'ff 00' + ]; + + var gotClose = false; + var gotError = false; + p.onclose = function() { + gotClose = true; + }; + p.onerror = function(reason, code) { + gotError = code == true; + }; + + for (var i = 0; i < packets.length && !gotError; ++i) { + p.add(getBufferFromHexString(packets[i])); + } + expect(gotClose).to.equal(true); + expect(gotError).to.equal(false); + }); + + it('can parse binary messages delivered over multiple frames', function() { + var p = new Receiver(); + var packets = [ + '80 05 48', + '65 6c 6c', + '6f 80 80 05 48', + '65', + '6c 6c 6f' + ]; + + var gotData = false; + var messages = []; + p.ontext = function(data) { + gotData = true; + messages.push(data); + }; + + for (var i = 0; i < packets.length; ++i) { + p.add(getBufferFromHexString(packets[i])); + } + expect(gotData).to.equal(true); + for (var i = 0; i < 2; ++i) { + expect(messages[i]).to.equal('Hello'); + } + }); +}); diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/Receiver.test.js b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/Receiver.test.js new file mode 100644 index 0000000..b0b5c0a --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/Receiver.test.js @@ -0,0 +1,255 @@ +var assert = require('assert') + , Receiver = require('../lib/Receiver'); +require('should'); +require('./hybi-common'); + +describe('Receiver', function() { + it('can parse unmasked text message', function() { + var p = new Receiver(); + var packet = '81 05 48 65 6c 6c 6f'; + + var gotData = false; + p.ontext = function(data) { + gotData = true; + assert.equal('Hello', data); + }; + + p.add(getBufferFromHexString(packet)); + gotData.should.be.ok; + }); + it('can parse close message', function() { + var p = new Receiver(); + var packet = '88 00'; + + var gotClose = false; + p.onclose = function(data) { + gotClose = true; + }; + + p.add(getBufferFromHexString(packet)); + gotClose.should.be.ok; + }); + it('can parse masked text message', function() { + var p = new Receiver(); + var packet = '81 93 34 83 a8 68 01 b9 92 52 4f a1 c6 09 59 e6 8a 52 16 e6 cb 00 5b a1 d5'; + + var gotData = false; + p.ontext = function(data) { + gotData = true; + assert.equal('5:::{"name":"echo"}', data); + }; + + p.add(getBufferFromHexString(packet)); + gotData.should.be.ok; + }); + it('can parse a masked text message longer than 125 bytes', function() { + var p = new Receiver(); + var message = 'A'; + for (var i = 0; i < 300; ++i) message += (i % 5).toString(); + var packet = '81 FE ' + pack(4, message.length) + ' 34 83 a8 68 ' + getHexStringFromBuffer(mask(message, '34 83 a8 68')); + + var gotData = false; + p.ontext = function(data) { + gotData = true; + assert.equal(message, data); + }; + + p.add(getBufferFromHexString(packet)); + gotData.should.be.ok; + }); + it('can parse a really long masked text message', function() { + var p = new Receiver(); + var message = 'A'; + for (var i = 0; i < 64*1024; ++i) message += (i % 5).toString(); + var packet = '81 FF ' + pack(16, message.length) + ' 34 83 a8 68 ' + getHexStringFromBuffer(mask(message, '34 83 a8 68')); + + var gotData = false; + p.ontext = function(data) { + gotData = true; + assert.equal(message, data); + }; + + p.add(getBufferFromHexString(packet)); + gotData.should.be.ok; + }); + it('can parse a fragmented masked text message of 300 bytes', function() { + var p = new Receiver(); + var message = 'A'; + for (var i = 0; i < 300; ++i) message += (i % 5).toString(); + var msgpiece1 = message.substr(0, 150); + var msgpiece2 = message.substr(150); + var packet1 = '01 FE ' + pack(4, msgpiece1.length) + ' 34 83 a8 68 ' + getHexStringFromBuffer(mask(msgpiece1, '34 83 a8 68')); + var packet2 = '80 FE ' + pack(4, msgpiece2.length) + ' 34 83 a8 68 ' + getHexStringFromBuffer(mask(msgpiece2, '34 83 a8 68')); + + var gotData = false; + p.ontext = function(data) { + gotData = true; + assert.equal(message, data); + }; + + p.add(getBufferFromHexString(packet1)); + p.add(getBufferFromHexString(packet2)); + gotData.should.be.ok; + }); + it('can parse a ping message', function() { + var p = new Receiver(); + var message = 'Hello'; + var packet = '89 ' + getHybiLengthAsHexString(message.length, true) + ' 34 83 a8 68 ' + getHexStringFromBuffer(mask(message, '34 83 a8 68')); + + var gotPing = false; + p.onping = function(data) { + gotPing = true; + assert.equal(message, data); + }; + + p.add(getBufferFromHexString(packet)); + gotPing.should.be.ok; + }); + it('can parse a ping with no data', function() { + var p = new Receiver(); + var packet = '89 00'; + + var gotPing = false; + p.onping = function(data) { + gotPing = true; + }; + + p.add(getBufferFromHexString(packet)); + gotPing.should.be.ok; + }); + it('can parse a fragmented masked text message of 300 bytes with a ping in the middle', function() { + var p = new Receiver(); + var message = 'A'; + for (var i = 0; i < 300; ++i) message += (i % 5).toString(); + + var msgpiece1 = message.substr(0, 150); + var packet1 = '01 FE ' + pack(4, msgpiece1.length) + ' 34 83 a8 68 ' + getHexStringFromBuffer(mask(msgpiece1, '34 83 a8 68')); + + var pingMessage = 'Hello'; + var pingPacket = '89 ' + getHybiLengthAsHexString(pingMessage.length, true) + ' 34 83 a8 68 ' + getHexStringFromBuffer(mask(pingMessage, '34 83 a8 68')); + + var msgpiece2 = message.substr(150); + var packet2 = '80 FE ' + pack(4, msgpiece2.length) + ' 34 83 a8 68 ' + getHexStringFromBuffer(mask(msgpiece2, '34 83 a8 68')); + + var gotData = false; + p.ontext = function(data) { + gotData = true; + assert.equal(message, data); + }; + var gotPing = false; + p.onping = function(data) { + gotPing = true; + assert.equal(pingMessage, data); + }; + + p.add(getBufferFromHexString(packet1)); + p.add(getBufferFromHexString(pingPacket)); + p.add(getBufferFromHexString(packet2)); + gotData.should.be.ok; + gotPing.should.be.ok; + }); + it('can parse a fragmented masked text message of 300 bytes with a ping in the middle, which is delievered over sevaral tcp packets', function() { + var p = new Receiver(); + var message = 'A'; + for (var i = 0; i < 300; ++i) message += (i % 5).toString(); + + var msgpiece1 = message.substr(0, 150); + var packet1 = '01 FE ' + pack(4, msgpiece1.length) + ' 34 83 a8 68 ' + getHexStringFromBuffer(mask(msgpiece1, '34 83 a8 68')); + + var pingMessage = 'Hello'; + var pingPacket = '89 ' + getHybiLengthAsHexString(pingMessage.length, true) + ' 34 83 a8 68 ' + getHexStringFromBuffer(mask(pingMessage, '34 83 a8 68')); + + var msgpiece2 = message.substr(150); + var packet2 = '80 FE ' + pack(4, msgpiece2.length) + ' 34 83 a8 68 ' + getHexStringFromBuffer(mask(msgpiece2, '34 83 a8 68')); + + var gotData = false; + p.ontext = function(data) { + gotData = true; + assert.equal(message, data); + }; + var gotPing = false; + p.onping = function(data) { + gotPing = true; + assert.equal(pingMessage, data); + }; + + var buffers = []; + buffers = buffers.concat(splitBuffer(getBufferFromHexString(packet1))); + buffers = buffers.concat(splitBuffer(getBufferFromHexString(pingPacket))); + buffers = buffers.concat(splitBuffer(getBufferFromHexString(packet2))); + for (var i = 0; i < buffers.length; ++i) { + p.add(buffers[i]); + } + gotData.should.be.ok; + gotPing.should.be.ok; + }); + it('can parse a 100 byte long masked binary message', function() { + var p = new Receiver(); + var length = 100; + var message = new Buffer(length); + for (var i = 0; i < length; ++i) message[i] = i % 256; + var originalMessage = getHexStringFromBuffer(message); + var packet = '82 ' + getHybiLengthAsHexString(length, true) + ' 34 83 a8 68 ' + getHexStringFromBuffer(mask(message, '34 83 a8 68')); + + var gotData = false; + p.onbinary = function(data) { + gotData = true; + assert.equal(originalMessage, getHexStringFromBuffer(data)); + }; + + p.add(getBufferFromHexString(packet)); + gotData.should.be.ok; + }); + it('can parse a 256 byte long masked binary message', function() { + var p = new Receiver(); + var length = 256; + var message = new Buffer(length); + for (var i = 0; i < length; ++i) message[i] = i % 256; + var originalMessage = getHexStringFromBuffer(message); + var packet = '82 ' + getHybiLengthAsHexString(length, true) + ' 34 83 a8 68 ' + getHexStringFromBuffer(mask(message, '34 83 a8 68')); + + var gotData = false; + p.onbinary = function(data) { + gotData = true; + assert.equal(originalMessage, getHexStringFromBuffer(data)); + }; + + p.add(getBufferFromHexString(packet)); + gotData.should.be.ok; + }); + it('can parse a 200kb long masked binary message', function() { + var p = new Receiver(); + var length = 200 * 1024; + var message = new Buffer(length); + for (var i = 0; i < length; ++i) message[i] = i % 256; + var originalMessage = getHexStringFromBuffer(message); + var packet = '82 ' + getHybiLengthAsHexString(length, true) + ' 34 83 a8 68 ' + getHexStringFromBuffer(mask(message, '34 83 a8 68')); + + var gotData = false; + p.onbinary = function(data) { + gotData = true; + assert.equal(originalMessage, getHexStringFromBuffer(data)); + }; + + p.add(getBufferFromHexString(packet)); + gotData.should.be.ok; + }); + it('can parse a 200kb long unmasked binary message', function() { + var p = new Receiver(); + var length = 200 * 1024; + var message = new Buffer(length); + for (var i = 0; i < length; ++i) message[i] = i % 256; + var originalMessage = getHexStringFromBuffer(message); + var packet = '82 ' + getHybiLengthAsHexString(length, false) + ' ' + getHexStringFromBuffer(message); + + var gotData = false; + p.onbinary = function(data) { + gotData = true; + assert.equal(originalMessage, getHexStringFromBuffer(data)); + }; + + p.add(getBufferFromHexString(packet)); + gotData.should.be.ok; + }); +}); + diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/Sender.hixie.test.js b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/Sender.hixie.test.js new file mode 100644 index 0000000..783f892 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/Sender.hixie.test.js @@ -0,0 +1,134 @@ +var assert = require('assert') + , Sender = require('../lib/Sender.hixie'); +require('should'); +require('./hybi-common'); + +describe('Sender', function() { + describe('#send', function() { + it('frames and sends a text message', function(done) { + var message = 'Hello world'; + var received; + var socket = { + write: function(data, encoding, cb) { + received = data; + process.nextTick(cb); + } + }; + var sender = new Sender(socket, {}); + sender.send(message, {}, function() { + received.toString('utf8').should.eql('\u0000' + message + '\ufffd'); + done(); + }); + }); + + it('frames and sends an empty message', function(done) { + var socket = { + write: function(data, encoding, cb) { + done(); + } + }; + var sender = new Sender(socket, {}); + sender.send('', {}, function() {}); + }); + + it('frames and sends a buffer', function(done) { + var received; + var socket = { + write: function(data, encoding, cb) { + received = data; + process.nextTick(cb); + } + }; + var sender = new Sender(socket, {}); + sender.send(new Buffer('foobar'), {}, function() { + received.toString('utf8').should.eql('\u0000foobar\ufffd'); + done(); + }); + }); + + it('frames and sends a binary message', function(done) { + var message = 'Hello world'; + var received; + var socket = { + write: function(data, encoding, cb) { + received = data; + process.nextTick(cb); + } + }; + var sender = new Sender(socket, {}); + sender.send(message, {binary: true}, function() { + received.toString('hex').should.eql( + // 0x80 0x0b H e l l o w o r l d + '800b48656c6c6f20776f726c64'); + done(); + }); + }); +/* + it('throws an exception for binary data', function(done) { + var socket = { + write: function(data, encoding, cb) { + process.nextTick(cb); + } + }; + var sender = new Sender(socket, {}); + sender.on('error', function() { + done(); + }); + sender.send(new Buffer(100), {binary: true}, function() {}); + }); +*/ + it('can fauxe stream data', function(done) { + var received = []; + var socket = { + write: function(data, encoding, cb) { + received.push(data); + process.nextTick(cb); + } + }; + var sender = new Sender(socket, {}); + sender.send(new Buffer('foobar'), { fin: false }, function() {}); + sender.send('bazbar', { fin: false }, function() {}); + sender.send(new Buffer('end'), { fin: true }, function() { + received[0].toString('utf8').should.eql('\u0000foobar'); + received[1].toString('utf8').should.eql('bazbar'); + received[2].toString('utf8').should.eql('end\ufffd'); + done(); + }); + }); + }); + + describe('#close', function() { + it('sends a hixie close frame', function(done) { + var received; + var socket = { + write: function(data, encoding, cb) { + received = data; + process.nextTick(cb); + } + }; + var sender = new Sender(socket, {}); + sender.close(null, null, null, function() { + received.toString('utf8').should.eql('\ufffd\u0000'); + done(); + }); + }); + + it('sends a message end marker if fauxe streaming has started, before hixie close frame', function(done) { + var received = []; + var socket = { + write: function(data, encoding, cb) { + received.push(data); + if (cb) process.nextTick(cb); + } + }; + var sender = new Sender(socket, {}); + sender.send(new Buffer('foobar'), { fin: false }, function() {}); + sender.close(null, null, null, function() { + received[0].toString('utf8').should.eql('\u0000foobar'); + received[1].toString('utf8').should.eql('\ufffd'); + received[2].toString('utf8').should.eql('\ufffd\u0000'); + done(); + }); + }); + }); +}); diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/Sender.test.js b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/Sender.test.js new file mode 100644 index 0000000..43b4864 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/Sender.test.js @@ -0,0 +1,24 @@ +var Sender = require('../lib/Sender'); +require('should'); + +describe('Sender', function() { + describe('#frameAndSend', function() { + it('does not modify a masked binary buffer', function() { + var sender = new Sender({ write: function() {} }); + var buf = new Buffer([1, 2, 3, 4, 5]); + sender.frameAndSend(2, buf, true, true); + buf[0].should.eql(1); + buf[1].should.eql(2); + buf[2].should.eql(3); + buf[3].should.eql(4); + buf[4].should.eql(5); + }); + + it('does not modify a masked text buffer', function() { + var sender = new Sender({ write: function() {} }); + var text = 'hi there'; + sender.frameAndSend(1, text, true, true); + text.should.eql('hi there'); + }); + }); +}); diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/Validation.test.js b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/Validation.test.js new file mode 100644 index 0000000..37c3399 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/Validation.test.js @@ -0,0 +1,23 @@ +var Validation = require('../lib/Validation').Validation; +require('should'); + +describe('Validation', function() { + describe('isValidUTF8', function() { + it('should return true for a valid utf8 string', function() { + var validBuffer = new Buffer('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque gravida mattis rhoncus. Donec iaculis, metus quis varius accumsan, erat mauris condimentum diam, et egestas erat enim ut ligula. Praesent sollicitudin tellus eget dolor euismod euismod. Nullam ac augue nec neque varius luctus. Curabitur elit mi, consequat ultricies adipiscing mollis, scelerisque in erat. Phasellus facilisis fermentum ullamcorper. Nulla et sem eu arcu pharetra pellentesque. Praesent consectetur tempor justo, vel iaculis dui ullamcorper sit amet. Integer tristique viverra ullamcorper. Vivamus laoreet, nulla eget suscipit eleifend, lacus lectus feugiat libero, non fermentum erat nisi at risus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut pulvinar dignissim tellus, eu dignissim lorem vulputate quis. Morbi ut pulvinar augue.'); + Validation.isValidUTF8(validBuffer).should.be.ok; + }); + it('should return false for an erroneous string', function() { + var invalidBuffer = new Buffer([0xce, 0xba, 0xe1, 0xbd, 0xb9, 0xcf, 0x83, 0xce, 0xbc, 0xce, 0xb5, 0xed, 0xa0, 0x80, 0x65, 0x64, 0x69, 0x74, 0x65, 0x64]); + Validation.isValidUTF8(invalidBuffer).should.not.be.ok; + }); + it('should return true for valid cases from the autobahn test suite', function() { + Validation.isValidUTF8(new Buffer('\xf0\x90\x80\x80')).should.be.ok; + Validation.isValidUTF8(new Buffer([0xf0, 0x90, 0x80, 0x80])).should.be.ok; + }); + it('should return false for erroneous autobahn strings', function() { + Validation.isValidUTF8(new Buffer([0xce, 0xba, 0xe1, 0xbd])).should.not.be.ok; + }); + }); +}); + diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/WebSocket.integration.js b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/WebSocket.integration.js new file mode 100644 index 0000000..5d4f426 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/WebSocket.integration.js @@ -0,0 +1,44 @@ +var assert = require('assert') + , WebSocket = require('../') + , server = require('./testserver'); + +var port = 20000; + +function getArrayBuffer(buf) { + var l = buf.length; + var arrayBuf = new ArrayBuffer(l); + var uint8View = new Uint8Array(arrayBuf); + + for (var i = 0; i < l; i++) { + uint8View[i] = buf[i]; + } + return uint8View.buffer; +} + +function areArraysEqual(x, y) { + if (x.length != y.length) return false; + for (var i = 0, l = x.length; i < l; ++i) { + if (x[i] !== y[i]) return false; + } + return true; +} + +describe('WebSocket', function() { + it('communicates successfully with echo service', function(done) { + var ws = new WebSocket('ws://echo.websocket.org/', {protocolVersion: 13, origin: 'http://websocket.org'}); + var str = Date.now().toString(); + var dataReceived = false; + ws.on('open', function() { + ws.send(str, {mask: true}); + }); + ws.on('close', function() { + assert.equal(true, dataReceived); + done(); + }); + ws.on('message', function(data, flags) { + assert.equal(str, data); + ws.terminate(); + dataReceived = true; + }); + }); +}); diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/WebSocket.test.js b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/WebSocket.test.js new file mode 100644 index 0000000..91336b9 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/WebSocket.test.js @@ -0,0 +1,1724 @@ +var assert = require('assert') + , https = require('https') + , http = require('http') + , should = require('should') + , WebSocket = require('../') + , WebSocketServer = require('../').Server + , fs = require('fs') + , server = require('./testserver') + , crypto = require('crypto'); + +var port = 20000; + +function getArrayBuffer(buf) { + var l = buf.length; + var arrayBuf = new ArrayBuffer(l); + var uint8View = new Uint8Array(arrayBuf); + for (var i = 0; i < l; i++) { + uint8View[i] = buf[i]; + } + return uint8View.buffer; +} + + +function areArraysEqual(x, y) { + if (x.length != y.length) return false; + for (var i = 0, l = x.length; i < l; ++i) { + if (x[i] !== y[i]) return false; + } + return true; +} + +describe('WebSocket', function() { + describe('#ctor', function() { + it('throws exception for invalid url', function(done) { + try { + var ws = new WebSocket('echo.websocket.org'); + } + catch (e) { + done(); + } + }); + }); + + describe('options', function() { + it('should accept an `agent` option', function(done) { + var wss = new WebSocketServer({port: ++port}, function() { + var agent = { + addRequest: function() { + wss.close(); + done(); + } + }; + var ws = new WebSocket('ws://localhost:' + port, { agent: agent }); + }); + }); + // GH-227 + it('should accept the `options` object as the 3rd argument', function(done) { + var wss = new WebSocketServer({port: ++port}, function() { + var agent = { + addRequest: function() { + wss.close(); + done(); + } + }; + var ws = new WebSocket('ws://localhost:' + port, [], { agent: agent }); + }); + }); + }); + + describe('properties', function() { + it('#bytesReceived exposes number of bytes received', function(done) { + var wss = new WebSocketServer({port: ++port}, function() { + var ws = new WebSocket('ws://localhost:' + port); + ws.on('message', function() { + ws.bytesReceived.should.eql(8); + wss.close(); + done(); + }); + }); + wss.on('connection', function(ws) { + ws.send('foobar'); + }); + }); + + it('#url exposes the server url', function(done) { + server.createServer(++port, function(srv) { + var url = 'ws://localhost:' + port; + var ws = new WebSocket(url); + assert.equal(url, ws.url); + ws.terminate(); + ws.on('close', function() { + srv.close(); + done(); + }); + }); + }); + + it('#protocolVersion exposes the protocol version', function(done) { + server.createServer(++port, function(srv) { + var url = 'ws://localhost:' + port; + var ws = new WebSocket(url); + assert.equal(13, ws.protocolVersion); + ws.terminate(); + ws.on('close', function() { + srv.close(); + done(); + }); + }); + }); + + describe('#bufferedAmount', function() { + it('defaults to zero', function(done) { + server.createServer(++port, function(srv) { + var url = 'ws://localhost:' + port; + var ws = new WebSocket(url); + assert.equal(0, ws.bufferedAmount); + ws.terminate(); + ws.on('close', function() { + srv.close(); + done(); + }); + }); + }); + + it('defaults to zero upon "open"', function(done) { + server.createServer(++port, function(srv) { + var url = 'ws://localhost:' + port; + var ws = new WebSocket(url); + ws.onopen = function() { + assert.equal(0, ws.bufferedAmount); + ws.terminate(); + ws.on('close', function() { + srv.close(); + done(); + }); + }; + }); + }); + + it('stress kernel write buffer', function(done) { + var wss = new WebSocketServer({port: ++port}, function() { + var ws = new WebSocket('ws://localhost:' + port); + }); + wss.on('connection', function(ws) { + while (true) { + if (ws.bufferedAmount > 0) break; + ws.send((new Array(10000)).join('hello')); + } + ws.terminate(); + ws.on('close', function() { + wss.close(); + done(); + }); + }); + }); + }); + + describe('Custom headers', function() { + it('request has an authorization header', function (done) { + var auth = 'test:testpass'; + var srv = http.createServer(function (req, res) {}); + var wss = new WebSocketServer({server: srv}); + srv.listen(++port); + var ws = new WebSocket('ws://' + auth + '@localhost:' + port); + srv.on('upgrade', function (req, socket, head) { + assert(req.headers.authorization, 'auth header exists'); + assert.equal(req.headers.authorization, 'Basic ' + new Buffer(auth).toString('base64')); + ws.terminate(); + ws.on('close', function () { + srv.close(); + wss.close(); + done(); + }); + }); + }); + + it('accepts custom headers', function (done) { + var srv = http.createServer(function (req, res) {}); + var wss = new WebSocketServer({server: srv}); + srv.listen(++port); + + var ws = new WebSocket('ws://localhost:' + port, { + headers: { + 'Cookie': 'foo=bar' + } + }); + + srv.on('upgrade', function (req, socket, head) { + assert(req.headers.cookie, 'auth header exists'); + assert.equal(req.headers.cookie, 'foo=bar'); + + ws.terminate(); + ws.on('close', function () { + srv.close(); + wss.close(); + done(); + }); + }); + }); + }); + + describe('#readyState', function() { + it('defaults to connecting', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + assert.equal(WebSocket.CONNECTING, ws.readyState); + ws.terminate(); + ws.on('close', function() { + srv.close(); + done(); + }); + }); + }); + + it('set to open once connection is established', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + ws.on('open', function() { + assert.equal(WebSocket.OPEN, ws.readyState); + srv.close(); + done(); + }); + }); + }); + + it('set to closed once connection is closed', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + ws.close(1001); + ws.on('close', function() { + assert.equal(WebSocket.CLOSED, ws.readyState); + srv.close(); + done(); + }); + }); + }); + + it('set to closed once connection is terminated', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + ws.terminate(); + ws.on('close', function() { + assert.equal(WebSocket.CLOSED, ws.readyState); + srv.close(); + done(); + }); + }); + }); + }); + + /* + * Ready state constants + */ + + var readyStates = { + CONNECTING: 0, + OPEN: 1, + CLOSING: 2, + CLOSED: 3 + }; + + /* + * Ready state constant tests + */ + + Object.keys(readyStates).forEach(function(state) { + describe('.' + state, function() { + it('is enumerable property of class', function() { + var propertyDescripter = Object.getOwnPropertyDescriptor(WebSocket, state) + assert.equal(readyStates[state], propertyDescripter.value); + assert.equal(true, propertyDescripter.enumerable); + }); + }); + }); + + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + Object.keys(readyStates).forEach(function(state) { + describe('.' + state, function() { + it('is property of instance', function() { + assert.equal(readyStates[state], ws[state]); + }); + }); + }); + }); + }); + + describe('events', function() { + it('emits a ping event', function(done) { + var wss = new WebSocketServer({port: ++port}); + wss.on('connection', function(client) { + client.ping(); + }); + var ws = new WebSocket('ws://localhost:' + port); + ws.on('ping', function() { + ws.terminate(); + wss.close(); + done(); + }); + }); + + it('emits a pong event', function(done) { + var wss = new WebSocketServer({port: ++port}); + wss.on('connection', function(client) { + client.pong(); + }); + var ws = new WebSocket('ws://localhost:' + port); + ws.on('pong', function() { + ws.terminate(); + wss.close(); + done(); + }); + }); + }); + + describe('connection establishing', function() { + it('can disconnect before connection is established', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + ws.terminate(); + ws.on('open', function() { + assert.fail('connect shouldnt be raised here'); + }); + ws.on('close', function() { + srv.close(); + done(); + }); + }); + }); + + it('can close before connection is established', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + ws.close(1001); + ws.on('open', function() { + assert.fail('connect shouldnt be raised here'); + }); + ws.on('close', function() { + srv.close(); + done(); + }); + }); + }); + + it('invalid server key is denied', function(done) { + server.createServer(++port, server.handlers.invalidKey, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + ws.on('error', function() { + srv.close(); + done(); + }); + }); + }); + + it('close event is raised when server closes connection', function(done) { + server.createServer(++port, server.handlers.closeAfterConnect, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + ws.on('close', function() { + srv.close(); + done(); + }); + }); + }); + + it('error is emitted if server aborts connection', function(done) { + server.createServer(++port, server.handlers.return401, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + ws.on('open', function() { + assert.fail('connect shouldnt be raised here'); + }); + ws.on('error', function() { + srv.close(); + done(); + }); + }); + }); + }); + + describe('#pause and #resume', function() { + it('pauses the underlying stream', function(done) { + // this test is sort-of racecondition'y, since an unlikely slow connection + // to localhost can cause the test to succeed even when the stream pausing + // isn't working as intended. that is an extremely unlikely scenario, though + // and an acceptable risk for the test. + var client; + var serverClient; + var openCount = 0; + function onOpen() { + if (++openCount == 2) { + var paused = true; + serverClient.on('message', function() { + paused.should.not.be.ok; + wss.close(); + done(); + }); + serverClient.pause(); + setTimeout(function() { + paused = false; + serverClient.resume(); + }, 200); + client.send('foo'); + } + } + var wss = new WebSocketServer({port: ++port}, function() { + var ws = new WebSocket('ws://localhost:' + port); + serverClient = ws; + serverClient.on('open', onOpen); + }); + wss.on('connection', function(ws) { + client = ws; + onOpen(); + }); + }); + }); + + describe('#ping', function() { + it('before connect should fail', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + ws.on('error', function() {}); + try { + ws.ping(); + } + catch (e) { + srv.close(); + ws.terminate(); + done(); + } + }); + }); + + it('before connect can silently fail', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + ws.on('error', function() {}); + ws.ping('', {}, true); + srv.close(); + ws.terminate(); + done(); + }); + }); + + it('without message is successfully transmitted to the server', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + ws.on('open', function() { + ws.ping(); + }); + srv.on('ping', function(message) { + srv.close(); + ws.terminate(); + done(); + }); + }); + }); + + it('with message is successfully transmitted to the server', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + ws.on('open', function() { + ws.ping('hi'); + }); + srv.on('ping', function(message) { + assert.equal('hi', message); + srv.close(); + ws.terminate(); + done(); + }); + }); + }); + + it('with encoded message is successfully transmitted to the server', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + ws.on('open', function() { + ws.ping('hi', {mask: true}); + }); + srv.on('ping', function(message, flags) { + assert.ok(flags.masked); + assert.equal('hi', message); + srv.close(); + ws.terminate(); + done(); + }); + }); + }); + }); + + describe('#pong', function() { + it('before connect should fail', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + ws.on('error', function() {}); + try { + ws.pong(); + } + catch (e) { + srv.close(); + ws.terminate(); + done(); + } + }); + }); + + it('before connect can silently fail', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + ws.on('error', function() {}); + ws.pong('', {}, true); + srv.close(); + ws.terminate(); + done(); + }); + }); + + it('without message is successfully transmitted to the server', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + ws.on('open', function() { + ws.pong(); + }); + srv.on('pong', function(message) { + srv.close(); + ws.terminate(); + done(); + }); + }); + }); + + it('with message is successfully transmitted to the server', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + ws.on('open', function() { + ws.pong('hi'); + }); + srv.on('pong', function(message) { + assert.equal('hi', message); + srv.close(); + ws.terminate(); + done(); + }); + }); + }); + + it('with encoded message is successfully transmitted to the server', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + ws.on('open', function() { + ws.pong('hi', {mask: true}); + }); + srv.on('pong', function(message, flags) { + assert.ok(flags.masked); + assert.equal('hi', message); + srv.close(); + ws.terminate(); + done(); + }); + }); + }); + }); + + describe('#send', function() { + it('very long binary data can be sent and received (with echoing server)', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + var array = new Float32Array(5 * 1024 * 1024); + for (var i = 0; i < array.length; ++i) array[i] = i / 5; + ws.on('open', function() { + ws.send(array, {binary: true}); + }); + ws.on('message', function(message, flags) { + assert.ok(flags.binary); + assert.ok(areArraysEqual(array, new Float32Array(getArrayBuffer(message)))); + ws.terminate(); + srv.close(); + done(); + }); + }); + }); + + it('can send and receive text data', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + ws.on('open', function() { + ws.send('hi'); + }); + ws.on('message', function(message, flags) { + assert.equal('hi', message); + ws.terminate(); + srv.close(); + done(); + }); + }); + }); + + it('send and receive binary data as an array', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + var array = new Float32Array(6); + for (var i = 0; i < array.length; ++i) array[i] = i / 2; + var partial = array.subarray(2, 5); + ws.on('open', function() { + ws.send(partial, {binary: true}); + }); + ws.on('message', function(message, flags) { + assert.ok(flags.binary); + assert.ok(areArraysEqual(partial, new Float32Array(getArrayBuffer(message)))); + ws.terminate(); + srv.close(); + done(); + }); + }); + }); + + it('binary data can be sent and received as buffer', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + var buf = new Buffer('foobar'); + ws.on('open', function() { + ws.send(buf, {binary: true}); + }); + ws.on('message', function(message, flags) { + assert.ok(flags.binary); + assert.ok(areArraysEqual(buf, message)); + ws.terminate(); + srv.close(); + done(); + }); + }); + }); + + it('ArrayBuffer is auto-detected without binary flag', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + var array = new Float32Array(5); + for (var i = 0; i < array.length; ++i) array[i] = i / 2; + ws.on('open', function() { + ws.send(array.buffer); + }); + ws.onmessage = function (event) { + assert.ok(event.type = 'Binary'); + assert.ok(areArraysEqual(array, new Float32Array(getArrayBuffer(event.data)))); + ws.terminate(); + srv.close(); + done(); + }; + }); + }); + + it('Buffer is auto-detected without binary flag', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + var buf = new Buffer('foobar'); + ws.on('open', function() { + ws.send(buf); + }); + ws.onmessage = function (event) { + assert.ok(event.type = 'Binary'); + assert.ok(areArraysEqual(event.data, buf)); + ws.terminate(); + srv.close(); + done(); + }; + }); + }); + + it('before connect should fail', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + ws.on('error', function() {}); + try { + ws.send('hi'); + } + catch (e) { + ws.terminate(); + srv.close(); + done(); + } + }); + }); + + it('before connect should pass error through callback, if present', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + ws.on('error', function() {}); + ws.send('hi', function(error) { + assert.ok(error instanceof Error); + ws.terminate(); + srv.close(); + done(); + }); + }); + }); + + it('without data should be successful', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + ws.on('open', function() { + ws.send(); + }); + srv.on('message', function(message, flags) { + assert.equal('', message); + srv.close(); + ws.terminate(); + done(); + }); + }); + }); + + it('calls optional callback when flushed', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + ws.on('open', function() { + ws.send('hi', function() { + srv.close(); + ws.terminate(); + done(); + }); + }); + }); + }); + + it('with unencoded message is successfully transmitted to the server', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + ws.on('open', function() { + ws.send('hi'); + }); + srv.on('message', function(message, flags) { + assert.equal('hi', message); + srv.close(); + ws.terminate(); + done(); + }); + }); + }); + + it('with encoded message is successfully transmitted to the server', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + ws.on('open', function() { + ws.send('hi', {mask: true}); + }); + srv.on('message', function(message, flags) { + assert.ok(flags.masked); + assert.equal('hi', message); + srv.close(); + ws.terminate(); + done(); + }); + }); + }); + + it('with unencoded binary message is successfully transmitted to the server', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + var array = new Float32Array(5); + for (var i = 0; i < array.length; ++i) array[i] = i / 2; + ws.on('open', function() { + ws.send(array, {binary: true}); + }); + srv.on('message', function(message, flags) { + assert.ok(flags.binary); + assert.ok(areArraysEqual(array, new Float32Array(getArrayBuffer(message)))); + srv.close(); + ws.terminate(); + done(); + }); + }); + }); + + it('with encoded binary message is successfully transmitted to the server', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + var array = new Float32Array(5); + for (var i = 0; i < array.length; ++i) array[i] = i / 2; + ws.on('open', function() { + ws.send(array, {mask: true, binary: true}); + }); + srv.on('message', function(message, flags) { + assert.ok(flags.binary); + assert.ok(flags.masked); + assert.ok(areArraysEqual(array, new Float32Array(getArrayBuffer(message)))); + srv.close(); + ws.terminate(); + done(); + }); + }); + }); + + it('with binary stream will send fragmented data', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + var callbackFired = false; + ws.on('open', function() { + var fileStream = fs.createReadStream('test/fixtures/textfile'); + fileStream.bufferSize = 100; + ws.send(fileStream, {binary: true}, function(error) { + assert.equal(null, error); + callbackFired = true; + }); + }); + srv.on('message', function(data, flags) { + assert.ok(flags.binary); + assert.ok(areArraysEqual(fs.readFileSync('test/fixtures/textfile'), data)); + ws.terminate(); + }); + ws.on('close', function() { + assert.ok(callbackFired); + srv.close(); + done(); + }); + }); + }); + + it('with text stream will send fragmented data', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + var callbackFired = false; + ws.on('open', function() { + var fileStream = fs.createReadStream('test/fixtures/textfile'); + fileStream.setEncoding('utf8'); + fileStream.bufferSize = 100; + ws.send(fileStream, {binary: false}, function(error) { + assert.equal(null, error); + callbackFired = true; + }); + }); + srv.on('message', function(data, flags) { + assert.ok(!flags.binary); + assert.ok(areArraysEqual(fs.readFileSync('test/fixtures/textfile', 'utf8'), data)); + ws.terminate(); + }); + ws.on('close', function() { + assert.ok(callbackFired); + srv.close(); + done(); + }); + }); + }); + + it('will cause intermittent send to be delayed in order', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + ws.on('open', function() { + var fileStream = fs.createReadStream('test/fixtures/textfile'); + fileStream.setEncoding('utf8'); + fileStream.bufferSize = 100; + ws.send(fileStream); + ws.send('foobar'); + ws.send('baz'); + }); + var receivedIndex = 0; + srv.on('message', function(data, flags) { + ++receivedIndex; + if (receivedIndex == 1) { + assert.ok(!flags.binary); + assert.ok(areArraysEqual(fs.readFileSync('test/fixtures/textfile', 'utf8'), data)); + } + else if (receivedIndex == 2) { + assert.ok(!flags.binary); + assert.equal('foobar', data); + } + else { + assert.ok(!flags.binary); + assert.equal('baz', data); + srv.close(); + ws.terminate(); + done(); + } + }); + }); + }); + + it('will cause intermittent stream to be delayed in order', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + ws.on('open', function() { + var fileStream = fs.createReadStream('test/fixtures/textfile'); + fileStream.setEncoding('utf8'); + fileStream.bufferSize = 100; + ws.send(fileStream); + var i = 0; + ws.stream(function(error, send) { + assert.ok(!error); + if (++i == 1) send('foo'); + else send('bar', true); + }); + }); + var receivedIndex = 0; + srv.on('message', function(data, flags) { + ++receivedIndex; + if (receivedIndex == 1) { + assert.ok(!flags.binary); + assert.ok(areArraysEqual(fs.readFileSync('test/fixtures/textfile', 'utf8'), data)); + } + else if (receivedIndex == 2) { + assert.ok(!flags.binary); + assert.equal('foobar', data); + srv.close(); + ws.terminate(); + done(); + } + }); + }); + }); + + it('will cause intermittent ping to be delivered', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + ws.on('open', function() { + var fileStream = fs.createReadStream('test/fixtures/textfile'); + fileStream.setEncoding('utf8'); + fileStream.bufferSize = 100; + ws.send(fileStream); + ws.ping('foobar'); + }); + var receivedIndex = 0; + srv.on('message', function(data, flags) { + assert.ok(!flags.binary); + assert.ok(areArraysEqual(fs.readFileSync('test/fixtures/textfile', 'utf8'), data)); + if (++receivedIndex == 2) { + srv.close(); + ws.terminate(); + done(); + } + }); + srv.on('ping', function(data) { + assert.equal('foobar', data); + if (++receivedIndex == 2) { + srv.close(); + ws.terminate(); + done(); + } + }); + }); + }); + + it('will cause intermittent pong to be delivered', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + ws.on('open', function() { + var fileStream = fs.createReadStream('test/fixtures/textfile'); + fileStream.setEncoding('utf8'); + fileStream.bufferSize = 100; + ws.send(fileStream); + ws.pong('foobar'); + }); + var receivedIndex = 0; + srv.on('message', function(data, flags) { + assert.ok(!flags.binary); + assert.ok(areArraysEqual(fs.readFileSync('test/fixtures/textfile', 'utf8'), data)); + if (++receivedIndex == 2) { + srv.close(); + ws.terminate(); + done(); + } + }); + srv.on('pong', function(data) { + assert.equal('foobar', data); + if (++receivedIndex == 2) { + srv.close(); + ws.terminate(); + done(); + } + }); + }); + }); + + it('will cause intermittent close to be delivered', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + ws.on('open', function() { + var fileStream = fs.createReadStream('test/fixtures/textfile'); + fileStream.setEncoding('utf8'); + fileStream.bufferSize = 100; + ws.send(fileStream); + ws.close(1000, 'foobar'); + }); + ws.on('close', function() { + srv.close(); + ws.terminate(); + done(); + }); + ws.on('error', function() { /* That's quite alright -- a send was attempted after close */ }); + srv.on('message', function(data, flags) { + assert.ok(!flags.binary); + assert.ok(areArraysEqual(fs.readFileSync('test/fixtures/textfile', 'utf8'), data)); + }); + srv.on('close', function(code, data) { + assert.equal(1000, code); + assert.equal('foobar', data); + }); + }); + }); + }); + + describe('#stream', function() { + it('very long binary data can be streamed', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + var buffer = new Buffer(10 * 1024); + for (var i = 0; i < buffer.length; ++i) buffer[i] = i % 0xff; + ws.on('open', function() { + var i = 0; + var blockSize = 800; + var bufLen = buffer.length; + ws.stream({binary: true}, function(error, send) { + assert.ok(!error); + var start = i * blockSize; + var toSend = Math.min(blockSize, bufLen - (i * blockSize)); + var end = start + toSend; + var isFinal = toSend < blockSize; + send(buffer.slice(start, end), isFinal); + i += 1; + }); + }); + srv.on('message', function(data, flags) { + assert.ok(flags.binary); + assert.ok(areArraysEqual(buffer, data)); + ws.terminate(); + srv.close(); + done(); + }); + }); + }); + + it('before connect should pass error through callback', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + ws.on('error', function() {}); + ws.stream(function(error) { + assert.ok(error instanceof Error); + ws.terminate(); + srv.close(); + done(); + }); + }); + }); + + it('without callback should fail', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + var payload = 'HelloWorld'; + ws.on('open', function() { + try { + ws.stream(); + } + catch (e) { + srv.close(); + ws.terminate(); + done(); + } + }); + }); + }); + + it('will cause intermittent send to be delayed in order', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + var payload = 'HelloWorld'; + ws.on('open', function() { + var i = 0; + ws.stream(function(error, send) { + assert.ok(!error); + if (++i == 1) { + send(payload.substr(0, 5)); + ws.send('foobar'); + ws.send('baz'); + } + else { + send(payload.substr(5, 5), true); + } + }); + }); + var receivedIndex = 0; + srv.on('message', function(data, flags) { + ++receivedIndex; + if (receivedIndex == 1) { + assert.ok(!flags.binary); + assert.equal(payload, data); + } + else if (receivedIndex == 2) { + assert.ok(!flags.binary); + assert.equal('foobar', data); + } + else { + assert.ok(!flags.binary); + assert.equal('baz', data); + srv.close(); + ws.terminate(); + done(); + } + }); + }); + }); + + it('will cause intermittent stream to be delayed in order', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + var payload = 'HelloWorld'; + ws.on('open', function() { + var i = 0; + ws.stream(function(error, send) { + assert.ok(!error); + if (++i == 1) { + send(payload.substr(0, 5)); + var i2 = 0; + ws.stream(function(error, send) { + assert.ok(!error); + if (++i2 == 1) send('foo'); + else send('bar', true); + }); + ws.send('baz'); + } + else send(payload.substr(5, 5), true); + }); + }); + var receivedIndex = 0; + srv.on('message', function(data, flags) { + ++receivedIndex; + if (receivedIndex == 1) { + assert.ok(!flags.binary); + assert.equal(payload, data); + } + else if (receivedIndex == 2) { + assert.ok(!flags.binary); + assert.equal('foobar', data); + } + else if (receivedIndex == 3){ + assert.ok(!flags.binary); + assert.equal('baz', data); + setTimeout(function() { + srv.close(); + ws.terminate(); + done(); + }, 1000); + } + else throw new Error('more messages than we actually sent just arrived'); + }); + }); + }); + + it('will cause intermittent ping to be delivered', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + var payload = 'HelloWorld'; + ws.on('open', function() { + var i = 0; + ws.stream(function(error, send) { + assert.ok(!error); + if (++i == 1) { + send(payload.substr(0, 5)); + ws.ping('foobar'); + } + else { + send(payload.substr(5, 5), true); + } + }); + }); + var receivedIndex = 0; + srv.on('message', function(data, flags) { + assert.ok(!flags.binary); + assert.equal(payload, data); + if (++receivedIndex == 2) { + srv.close(); + ws.terminate(); + done(); + } + }); + srv.on('ping', function(data) { + assert.equal('foobar', data); + if (++receivedIndex == 2) { + srv.close(); + ws.terminate(); + done(); + } + }); + }); + }); + + it('will cause intermittent pong to be delivered', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + var payload = 'HelloWorld'; + ws.on('open', function() { + var i = 0; + ws.stream(function(error, send) { + assert.ok(!error); + if (++i == 1) { + send(payload.substr(0, 5)); + ws.pong('foobar'); + } + else { + send(payload.substr(5, 5), true); + } + }); + }); + var receivedIndex = 0; + srv.on('message', function(data, flags) { + assert.ok(!flags.binary); + assert.equal(payload, data); + if (++receivedIndex == 2) { + srv.close(); + ws.terminate(); + done(); + } + }); + srv.on('pong', function(data) { + assert.equal('foobar', data); + if (++receivedIndex == 2) { + srv.close(); + ws.terminate(); + done(); + } + }); + }); + }); + + it('will cause intermittent close to be delivered', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + var payload = 'HelloWorld'; + var errorGiven = false; + ws.on('open', function() { + var i = 0; + ws.stream(function(error, send) { + if (++i == 1) { + send(payload.substr(0, 5)); + ws.close(1000, 'foobar'); + } + else if(i == 2) { + send(payload.substr(5, 5), true); + } + else if (i == 3) { + assert.ok(error); + errorGiven = true; + } + }); + }); + ws.on('close', function() { + assert.ok(errorGiven); + srv.close(); + ws.terminate(); + done(); + }); + srv.on('message', function(data, flags) { + assert.ok(!flags.binary); + assert.equal(payload, data); + }); + srv.on('close', function(code, data) { + assert.equal(1000, code); + assert.equal('foobar', data); + }); + }); + }); + }); + + describe('#close', function() { + it('will raise error callback, if any, if called during send stream', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + var errorGiven = false; + ws.on('open', function() { + var fileStream = fs.createReadStream('test/fixtures/textfile'); + fileStream.setEncoding('utf8'); + fileStream.bufferSize = 100; + ws.send(fileStream, function(error) { + errorGiven = error != null; + }); + ws.close(1000, 'foobar'); + }); + ws.on('close', function() { + setTimeout(function() { + assert.ok(errorGiven); + srv.close(); + ws.terminate(); + done(); + }, 1000); + }); + }); + }); + + it('without invalid first argument throws exception', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + ws.on('open', function() { + try { + ws.close('error'); + } + catch (e) { + srv.close(); + ws.terminate(); + done(); + } + }); + }); + }); + + it('without reserved error code 1004 throws exception', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + ws.on('open', function() { + try { + ws.close(1004); + } + catch (e) { + srv.close(); + ws.terminate(); + done(); + } + }); + }); + }); + + it('without message is successfully transmitted to the server', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + ws.on('open', function() { + ws.close(1000); + }); + srv.on('close', function(code, message, flags) { + assert.equal('', message); + srv.close(); + ws.terminate(); + done(); + }); + }); + }); + + it('with message is successfully transmitted to the server', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + ws.on('open', function() { + ws.close(1000, 'some reason'); + }); + srv.on('close', function(code, message, flags) { + assert.ok(flags.masked); + assert.equal('some reason', message); + srv.close(); + ws.terminate(); + done(); + }); + }); + }); + + it('with encoded message is successfully transmitted to the server', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + ws.on('open', function() { + ws.close(1000, 'some reason', {mask: true}); + }); + srv.on('close', function(code, message, flags) { + assert.ok(flags.masked); + assert.equal('some reason', message); + srv.close(); + ws.terminate(); + done(); + }); + }); + }); + + it('ends connection to the server', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + var connectedOnce = false; + ws.on('open', function() { + connectedOnce = true; + ws.close(1000, 'some reason', {mask: true}); + }); + ws.on('close', function() { + assert.ok(connectedOnce); + srv.close(); + ws.terminate(); + done(); + }); + }); + }); + }); + + describe('W3C API emulation', function() { + it('should not throw errors when getting and setting', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + var listener = function () {}; + + ws.onmessage = listener; + ws.onerror = listener; + ws.onclose = listener; + ws.onopen = listener; + + assert.ok(ws.onopen === listener); + assert.ok(ws.onmessage === listener); + assert.ok(ws.onclose === listener); + assert.ok(ws.onerror === listener); + + srv.close(); + ws.terminate(); + done(); + }); + }); + + it('should work the same as the EventEmitter api', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + var listener = function() {}; + var message = 0; + var close = 0; + var open = 0; + + ws.onmessage = function(messageEvent) { + assert.ok(!!messageEvent.data); + ++message; + ws.close(); + }; + + ws.onopen = function() { + ++open; + } + + ws.onclose = function() { + ++close; + } + + ws.on('open', function() { + ws.send('foo'); + }); + + ws.on('close', function() { + process.nextTick(function() { + assert.ok(message === 1); + assert.ok(open === 1); + assert.ok(close === 1); + + srv.close(); + ws.terminate(); + done(); + }); + }); + }); + }); + + it('should receive text data wrapped in a MessageEvent when using addEventListener', function(done) { + server.createServer(++port, function(srv) { + var ws = new WebSocket('ws://localhost:' + port); + ws.addEventListener('open', function() { + ws.send('hi'); + }); + ws.addEventListener('message', function(messageEvent) { + assert.equal('hi', messageEvent.data); + ws.terminate(); + srv.close(); + done(); + }); + }); + }); + + it('should receive valid CloseEvent when server closes with code 1000', function(done) { + var wss = new WebSocketServer({port: ++port}, function() { + var ws = new WebSocket('ws://localhost:' + port); + ws.addEventListener('close', function(closeEvent) { + assert.equal(true, closeEvent.wasClean); + assert.equal(1000, closeEvent.code); + ws.terminate(); + wss.close(); + done(); + }); + }); + wss.on('connection', function(client) { + client.close(1000); + }); + }); + + it('should receive valid CloseEvent when server closes with code 1001', function(done) { + var wss = new WebSocketServer({port: ++port}, function() { + var ws = new WebSocket('ws://localhost:' + port); + ws.addEventListener('close', function(closeEvent) { + assert.equal(false, closeEvent.wasClean); + assert.equal(1001, closeEvent.code); + assert.equal('some daft reason', closeEvent.reason); + ws.terminate(); + wss.close(); + done(); + }); + }); + wss.on('connection', function(client) { + client.close(1001, 'some daft reason'); + }); + }); + + it('should have target set on Events', function(done) { + var wss = new WebSocketServer({port: ++port}, function() { + var ws = new WebSocket('ws://localhost:' + port); + ws.addEventListener('open', function(openEvent) { + assert.equal(ws, openEvent.target); + }); + ws.addEventListener('message', function(messageEvent) { + assert.equal(ws, messageEvent.target); + wss.close(); + }); + ws.addEventListener('close', function(closeEvent) { + assert.equal(ws, closeEvent.target); + ws.emit('error', new Error('forced')); + }); + ws.addEventListener('error', function(errorEvent) { + assert.equal(errorEvent.message, 'forced'); + assert.equal(ws, errorEvent.target); + ws.terminate(); + done(); + }); + }); + wss.on('connection', function(client) { + client.send('hi') + }); + }); + }); + + describe('ssl', function() { + it('can connect to secure websocket server', function(done) { + var options = { + key: fs.readFileSync('test/fixtures/key.pem'), + cert: fs.readFileSync('test/fixtures/certificate.pem') + }; + var app = https.createServer(options, function (req, res) { + res.writeHead(200); + res.end(); + }); + var wss = new WebSocketServer({server: app}); + app.listen(++port, function() { + var ws = new WebSocket('wss://localhost:' + port); + }); + wss.on('connection', function(ws) { + app.close(); + ws.terminate(); + wss.close(); + done(); + }); + }); + + it('can connect to secure websocket server with client side certificate', function(done) { + var options = { + key: fs.readFileSync('test/fixtures/key.pem'), + cert: fs.readFileSync('test/fixtures/certificate.pem'), + ca: [fs.readFileSync('test/fixtures/ca1-cert.pem')], + requestCert: true + }; + var clientOptions = { + key: fs.readFileSync('test/fixtures/agent1-key.pem'), + cert: fs.readFileSync('test/fixtures/agent1-cert.pem') + }; + var app = https.createServer(options, function (req, res) { + res.writeHead(200); + res.end(); + }); + var success = false; + var wss = new WebSocketServer({ + server: app, + verifyClient: function(info) { + success = !!info.req.client.authorized; + return true; + } + }); + app.listen(++port, function() { + var ws = new WebSocket('wss://localhost:' + port, clientOptions); + }); + wss.on('connection', function(ws) { + app.close(); + ws.terminate(); + wss.close(); + success.should.be.ok; + done(); + }); + }); + + it('cannot connect to secure websocket server via ws://', function(done) { + var options = { + key: fs.readFileSync('test/fixtures/key.pem'), + cert: fs.readFileSync('test/fixtures/certificate.pem') + }; + var app = https.createServer(options, function (req, res) { + res.writeHead(200); + res.end(); + }); + var wss = new WebSocketServer({server: app}); + app.listen(++port, function() { + var ws = new WebSocket('ws://localhost:' + port, { rejectUnauthorized :false }); + ws.on('error', function() { + app.close(); + ws.terminate(); + wss.close(); + done(); + }); + }); + }); + + it('can send and receive text data', function(done) { + var options = { + key: fs.readFileSync('test/fixtures/key.pem'), + cert: fs.readFileSync('test/fixtures/certificate.pem') + }; + var app = https.createServer(options, function (req, res) { + res.writeHead(200); + res.end(); + }); + var wss = new WebSocketServer({server: app}); + app.listen(++port, function() { + var ws = new WebSocket('wss://localhost:' + port); + ws.on('open', function() { + ws.send('foobar'); + }); + }); + wss.on('connection', function(ws) { + ws.on('message', function(message, flags) { + message.should.eql('foobar'); + app.close(); + ws.terminate(); + wss.close(); + done(); + }); + }); + }); + + it('can send and receive very long binary data', function(done) { + var options = { + key: fs.readFileSync('test/fixtures/key.pem'), + cert: fs.readFileSync('test/fixtures/certificate.pem') + } + var app = https.createServer(options, function (req, res) { + res.writeHead(200); + res.end(); + }); + crypto.randomBytes(5 * 1024 * 1024, function(ex, buf) { + if (ex) throw ex; + var wss = new WebSocketServer({server: app}); + app.listen(++port, function() { + var ws = new WebSocket('wss://localhost:' + port); + ws.on('open', function() { + ws.send(buf, {binary: true}); + }); + ws.on('message', function(message, flags) { + flags.binary.should.be.ok; + areArraysEqual(buf, message).should.be.ok; + app.close(); + ws.terminate(); + wss.close(); + done(); + }); + }); + wss.on('connection', function(ws) { + ws.on('message', function(message, flags) { + ws.send(message, {binary: true}); + }); + }); + }); + }); + }); + + describe('protocol support discovery', function() { + describe('#supports', function() { + describe('#binary', function() { + it('returns true for hybi transport', function(done) { + var wss = new WebSocketServer({port: ++port}, function() { + var ws = new WebSocket('ws://localhost:' + port); + }); + wss.on('connection', function(client) { + assert.equal(true, client.supports.binary); + wss.close(); + done(); + }); + }); + + it('returns false for hixie transport', function(done) { + var wss = new WebSocketServer({port: ++port}, function() { + var options = { + port: port, + host: '127.0.0.1', + headers: { + 'Connection': 'Upgrade', + 'Upgrade': 'WebSocket', + 'Sec-WebSocket-Key1': '3e6b263 4 17 80', + 'Sec-WebSocket-Key2': '17 9 G`ZD9 2 2b 7X 3 /r90' + } + }; + var req = http.request(options); + req.write('WjN}|M(6'); + req.end(); + }); + wss.on('connection', function(client) { + assert.equal(false, client.supports.binary); + wss.close(); + done(); + }); + }); + }); + }); + }); + + describe('host and origin headers', function() { + it('includes the host header with port number', function(done) { + var srv = http.createServer(); + srv.listen(++port, function(){ + srv.on('upgrade', function(req, socket, upgradeHeade) { + assert.equal('localhost:' + port, req.headers['host']); + srv.close(); + done(); + }); + var ws = new WebSocket('ws://localhost:' + port); + }); + }); + + it('includes the origin header with port number', function(done) { + var srv = http.createServer(); + srv.listen(++port, function() { + srv.on('upgrade', function(req, socket, upgradeHeade) { + assert.equal('localhost:' + port, req.headers['origin']); + srv.close(); + done(); + }); + var ws = new WebSocket('ws://localhost:' + port); + }); + }); + }); + +}); diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/WebSocketServer.test.js b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/WebSocketServer.test.js new file mode 100644 index 0000000..c21fd97 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/WebSocketServer.test.js @@ -0,0 +1,1103 @@ +var http = require('http') + , https = require('https') + , WebSocket = require('../') + , WebSocketServer = WebSocket.Server + , fs = require('fs') + , should = require('should'); + +var port = 8000; + +function getArrayBuffer(buf) { + var l = buf.length; + var arrayBuf = new ArrayBuffer(l); + for (var i = 0; i < l; ++i) { + arrayBuf[i] = buf[i]; + } + return arrayBuf; +} + +function areArraysEqual(x, y) { + if (x.length != y.length) return false; + for (var i = 0, l = x.length; i < l; ++i) { + if (x[i] !== y[i]) return false; + } + return true; +} + +describe('WebSocketServer', function() { + describe('#ctor', function() { + it('throws an error if no option object is passed', function() { + var gotException = false; + try { + var wss = new WebSocketServer(); + } + catch (e) { + gotException = true; + } + gotException.should.be.ok; + }); + + it('throws an error if no port or server is specified', function() { + var gotException = false; + try { + var wss = new WebSocketServer({}); + } + catch (e) { + gotException = true; + } + gotException.should.be.ok; + }); + + it('does not throw an error if no port or server is specified, when the noServer option is true', function() { + var gotException = false; + try { + var wss = new WebSocketServer({noServer: true}); + } + catch (e) { + gotException = true; + } + gotException.should.eql(false); + }); + + it('emits an error if http server bind fails', function(done) { + var wss = new WebSocketServer({port: 1}); + wss.on('error', function() { done(); }); + }); + + it('starts a server on a given port', function(done) { + var wss = new WebSocketServer({port: ++port}, function() { + var ws = new WebSocket('ws://localhost:' + port); + }); + wss.on('connection', function(client) { + wss.close(); + done(); + }); + }); + + it('uses a precreated http server', function (done) { + var srv = http.createServer(); + srv.listen(++port, function () { + var wss = new WebSocketServer({server: srv}); + var ws = new WebSocket('ws://localhost:' + port); + + wss.on('connection', function(client) { + wss.close(); + srv.close(); + done(); + }); + }); + }); + + it('uses a precreated http server listening on unix socket', function (done) { + var srv = http.createServer(); + var sockPath = '/tmp/ws_socket_'+new Date().getTime()+'.'+Math.floor(Math.random() * 1000); + srv.listen(sockPath, function () { + var wss = new WebSocketServer({server: srv}); + var ws = new WebSocket('ws+unix://'+sockPath); + + wss.on('connection', function(client) { + wss.close(); + srv.close(); + done(); + }); + }); + }); + + it('emits path specific connection event', function (done) { + var srv = http.createServer(); + srv.listen(++port, function () { + var wss = new WebSocketServer({server: srv}); + var ws = new WebSocket('ws://localhost:' + port+'/endpointName'); + + wss.on('connection/endpointName', function(client) { + wss.close(); + srv.close(); + done(); + }); + }); + }); + + it('can have two different instances listening on the same http server with two different paths', function(done) { + var srv = http.createServer(); + srv.listen(++port, function () { + var wss1 = new WebSocketServer({server: srv, path: '/wss1'}) + , wss2 = new WebSocketServer({server: srv, path: '/wss2'}); + var doneCount = 0; + wss1.on('connection', function(client) { + wss1.close(); + if (++doneCount == 2) { + srv.close(); + done(); + } + }); + wss2.on('connection', function(client) { + wss2.close(); + if (++doneCount == 2) { + srv.close(); + done(); + } + }); + var ws1 = new WebSocket('ws://localhost:' + port + '/wss1'); + var ws2 = new WebSocket('ws://localhost:' + port + '/wss2?foo=1'); + }); + }); + + it('cannot have two different instances listening on the same http server with the same path', function(done) { + var srv = http.createServer(); + srv.listen(++port, function () { + var wss1 = new WebSocketServer({server: srv, path: '/wss1'}); + try { + var wss2 = new WebSocketServer({server: srv, path: '/wss1'}); + } + catch (e) { + wss1.close(); + srv.close(); + done(); + } + }); + }); + }); + + describe('#close', function() { + it('will close all clients', function(done) { + var wss = new WebSocketServer({port: ++port}, function() { + var ws = new WebSocket('ws://localhost:' + port); + ws.on('close', function() { + if (++closes == 2) done(); + }); + }); + var closes = 0; + wss.on('connection', function(client) { + client.on('close', function() { + if (++closes == 2) done(); + }); + wss.close(); + }); + }); + + it('does not close a precreated server', function(done) { + var srv = http.createServer(); + var realClose = srv.close; + srv.close = function() { + should.fail('must not close pre-created server'); + } + srv.listen(++port, function () { + var wss = new WebSocketServer({server: srv}); + var ws = new WebSocket('ws://localhost:' + port); + wss.on('connection', function(client) { + wss.close(); + srv.close = realClose; + srv.close(); + done(); + }); + }); + }); + + it('cleans up websocket data on a precreated server', function(done) { + var srv = http.createServer(); + srv.listen(++port, function () { + var wss1 = new WebSocketServer({server: srv, path: '/wss1'}) + , wss2 = new WebSocketServer({server: srv, path: '/wss2'}); + (typeof srv._webSocketPaths).should.eql('object'); + Object.keys(srv._webSocketPaths).length.should.eql(2); + wss1.close(); + Object.keys(srv._webSocketPaths).length.should.eql(1); + wss2.close(); + (typeof srv._webSocketPaths).should.eql('undefined'); + srv.close(); + done(); + }); + }); + }); + + describe('#clients', function() { + it('returns a list of connected clients', function(done) { + var wss = new WebSocketServer({port: ++port}, function() { + wss.clients.length.should.eql(0); + var ws = new WebSocket('ws://localhost:' + port); + }); + wss.on('connection', function(client) { + wss.clients.length.should.eql(1); + wss.close(); + done(); + }); + }); + + it('can be disabled', function(done) { + var wss = new WebSocketServer({port: ++port, clientTracking: false}, function() { + wss.clients.length.should.eql(0); + var ws = new WebSocket('ws://localhost:' + port); + }); + wss.on('connection', function(client) { + wss.clients.length.should.eql(0); + wss.close(); + done(); + }); + }); + + it('is updated when client terminates the connection', function(done) { + var ws; + var wss = new WebSocketServer({port: ++port}, function() { + ws = new WebSocket('ws://localhost:' + port); + }); + wss.on('connection', function(client) { + client.on('close', function() { + wss.clients.length.should.eql(0); + wss.close(); + done(); + }); + ws.terminate(); + }); + }); + + it('is updated when client closes the connection', function(done) { + var ws; + var wss = new WebSocketServer({port: ++port}, function() { + ws = new WebSocket('ws://localhost:' + port); + }); + wss.on('connection', function(client) { + client.on('close', function() { + wss.clients.length.should.eql(0); + wss.close(); + done(); + }); + ws.close(); + }); + }); + }); + + describe('#options', function() { + it('exposes options passed to constructor', function(done) { + var wss = new WebSocketServer({port: ++port}, function() { + wss.options.port.should.eql(port); + wss.close(); + done(); + }); + }); + }); + + describe('#handleUpgrade', function() { + it('can be used for a pre-existing server', function (done) { + var srv = http.createServer(); + srv.listen(++port, function () { + var wss = new WebSocketServer({noServer: true}); + srv.on('upgrade', function(req, socket, upgradeHead) { + wss.handleUpgrade(req, socket, upgradeHead, function(client) { + client.send('hello'); + }); + }); + var ws = new WebSocket('ws://localhost:' + port); + ws.on('message', function(message) { + message.should.eql('hello'); + wss.close(); + srv.close(); + done(); + }); + }); + }); + }); + + describe('hybi mode', function() { + describe('connection establishing', function() { + it('does not accept connections with no sec-websocket-key', function(done) { + var wss = new WebSocketServer({port: ++port}, function() { + var options = { + port: port, + host: '127.0.0.1', + headers: { + 'Connection': 'Upgrade', + 'Upgrade': 'websocket' + } + }; + var req = http.request(options); + req.end(); + req.on('response', function(res) { + res.statusCode.should.eql(400); + wss.close(); + done(); + }); + }); + wss.on('connection', function(ws) { + done(new Error('connection must not be established')); + }); + wss.on('error', function() {}); + }); + + it('does not accept connections with no sec-websocket-version', function(done) { + var wss = new WebSocketServer({port: ++port}, function() { + var options = { + port: port, + host: '127.0.0.1', + headers: { + 'Connection': 'Upgrade', + 'Upgrade': 'websocket', + 'Sec-WebSocket-Key': 'dGhlIHNhbXBsZSBub25jZQ==' + } + }; + var req = http.request(options); + req.end(); + req.on('response', function(res) { + res.statusCode.should.eql(400); + wss.close(); + done(); + }); + }); + wss.on('connection', function(ws) { + done(new Error('connection must not be established')); + }); + wss.on('error', function() {}); + }); + + it('does not accept connections with invalid sec-websocket-version', function(done) { + var wss = new WebSocketServer({port: ++port}, function() { + var options = { + port: port, + host: '127.0.0.1', + headers: { + 'Connection': 'Upgrade', + 'Upgrade': 'websocket', + 'Sec-WebSocket-Key': 'dGhlIHNhbXBsZSBub25jZQ==', + 'Sec-WebSocket-Version': 12 + } + }; + var req = http.request(options); + req.end(); + req.on('response', function(res) { + res.statusCode.should.eql(400); + wss.close(); + done(); + }); + }); + wss.on('connection', function(ws) { + done(new Error('connection must not be established')); + }); + wss.on('error', function() {}); + }); + + it('client can be denied', function(done) { + var wss = new WebSocketServer({port: ++port, verifyClient: function(o) { + return false; + }}, function() { + var options = { + port: port, + host: '127.0.0.1', + headers: { + 'Connection': 'Upgrade', + 'Upgrade': 'websocket', + 'Sec-WebSocket-Key': 'dGhlIHNhbXBsZSBub25jZQ==', + 'Sec-WebSocket-Version': 8, + 'Sec-WebSocket-Origin': 'http://foobar.com' + } + }; + var req = http.request(options); + req.end(); + req.on('response', function(res) { + res.statusCode.should.eql(401); + process.nextTick(function() { + wss.close(); + done(); + }); + }); + }); + wss.on('connection', function(ws) { + done(new Error('connection must not be established')); + }); + wss.on('error', function() {}); + }); + + it('client can be accepted', function(done) { + var wss = new WebSocketServer({port: ++port, verifyClient: function(o) { + return true; + }}, function() { + var options = { + port: port, + host: '127.0.0.1', + headers: { + 'Connection': 'Upgrade', + 'Upgrade': 'websocket', + 'Sec-WebSocket-Key': 'dGhlIHNhbXBsZSBub25jZQ==', + 'Sec-WebSocket-Version': 13, + 'Origin': 'http://foobar.com' + } + }; + var req = http.request(options); + req.end(); + }); + wss.on('connection', function(ws) { + ws.terminate(); + wss.close(); + done(); + }); + wss.on('error', function() {}); + }); + + it('verifyClient gets client origin', function(done) { + var verifyClientCalled = false; + var wss = new WebSocketServer({port: ++port, verifyClient: function(info) { + info.origin.should.eql('http://foobarbaz.com'); + verifyClientCalled = true; + return false; + }}, function() { + var options = { + port: port, + host: '127.0.0.1', + headers: { + 'Connection': 'Upgrade', + 'Upgrade': 'websocket', + 'Sec-WebSocket-Key': 'dGhlIHNhbXBsZSBub25jZQ==', + 'Sec-WebSocket-Version': 13, + 'Origin': 'http://foobarbaz.com' + } + }; + var req = http.request(options); + req.end(); + req.on('response', function(res) { + verifyClientCalled.should.be.ok; + wss.close(); + done(); + }); + }); + wss.on('error', function() {}); + }); + + it('verifyClient gets original request', function(done) { + var verifyClientCalled = false; + var wss = new WebSocketServer({port: ++port, verifyClient: function(info) { + info.req.headers['sec-websocket-key'].should.eql('dGhlIHNhbXBsZSBub25jZQ=='); + verifyClientCalled = true; + return false; + }}, function() { + var options = { + port: port, + host: '127.0.0.1', + headers: { + 'Connection': 'Upgrade', + 'Upgrade': 'websocket', + 'Sec-WebSocket-Key': 'dGhlIHNhbXBsZSBub25jZQ==', + 'Sec-WebSocket-Version': 13, + 'Origin': 'http://foobarbaz.com' + } + }; + var req = http.request(options); + req.end(); + req.on('response', function(res) { + verifyClientCalled.should.be.ok; + wss.close(); + done(); + }); + }); + wss.on('error', function() {}); + }); + + it('verifyClient has secure:true for ssl connections', function(done) { + var options = { + key: fs.readFileSync('test/fixtures/key.pem'), + cert: fs.readFileSync('test/fixtures/certificate.pem') + }; + var app = https.createServer(options, function (req, res) { + res.writeHead(200); + res.end(); + }); + var success = false; + var wss = new WebSocketServer({ + server: app, + verifyClient: function(info) { + success = info.secure === true; + return true; + } + }); + app.listen(++port, function() { + var ws = new WebSocket('wss://localhost:' + port); + }); + wss.on('connection', function(ws) { + app.close(); + ws.terminate(); + wss.close(); + success.should.be.ok; + done(); + }); + }); + + it('verifyClient has secure:false for non-ssl connections', function(done) { + var app = http.createServer(function (req, res) { + res.writeHead(200); + res.end(); + }); + var success = false; + var wss = new WebSocketServer({ + server: app, + verifyClient: function(info) { + success = info.secure === false; + return true; + } + }); + app.listen(++port, function() { + var ws = new WebSocket('ws://localhost:' + port); + }); + wss.on('connection', function(ws) { + app.close(); + ws.terminate(); + wss.close(); + success.should.be.ok; + done(); + }); + }); + + it('client can be denied asynchronously', function(done) { + var wss = new WebSocketServer({port: ++port, verifyClient: function(o, cb) { + process.nextTick(function() { + cb(false); + }); + }}, function() { + var options = { + port: port, + host: '127.0.0.1', + headers: { + 'Connection': 'Upgrade', + 'Upgrade': 'websocket', + 'Sec-WebSocket-Key': 'dGhlIHNhbXBsZSBub25jZQ==', + 'Sec-WebSocket-Version': 8, + 'Sec-WebSocket-Origin': 'http://foobar.com' + } + }; + var req = http.request(options); + req.end(); + req.on('response', function(res) { + res.statusCode.should.eql(401); + process.nextTick(function() { + wss.close(); + done(); + }); + }); + }); + wss.on('connection', function(ws) { + done(new Error('connection must not be established')); + }); + wss.on('error', function() {}); + }); + + it('client can be accepted asynchronously', function(done) { + var wss = new WebSocketServer({port: ++port, verifyClient: function(o, cb) { + process.nextTick(function() { + cb(true); + }); + }}, function() { + var options = { + port: port, + host: '127.0.0.1', + headers: { + 'Connection': 'Upgrade', + 'Upgrade': 'websocket', + 'Sec-WebSocket-Key': 'dGhlIHNhbXBsZSBub25jZQ==', + 'Sec-WebSocket-Version': 13, + 'Origin': 'http://foobar.com' + } + }; + var req = http.request(options); + req.end(); + }); + wss.on('connection', function(ws) { + ws.terminate(); + wss.close(); + done(); + }); + wss.on('error', function() {}); + }); + + it('handles messages passed along with the upgrade request (upgrade head)', function(done) { + var wss = new WebSocketServer({port: ++port, verifyClient: function(o) { + return true; + }}, function() { + var options = { + port: port, + host: '127.0.0.1', + headers: { + 'Connection': 'Upgrade', + 'Upgrade': 'websocket', + 'Sec-WebSocket-Key': 'dGhlIHNhbXBsZSBub25jZQ==', + 'Sec-WebSocket-Version': 13, + 'Origin': 'http://foobar.com' + } + }; + var req = http.request(options); + req.write(new Buffer([0x81, 0x05, 0x48, 0x65, 0x6c, 0x6c, 0x6f], 'binary')); + req.end(); + }); + wss.on('connection', function(ws) { + ws.on('message', function(data) { + data.should.eql('Hello'); + ws.terminate(); + wss.close(); + done(); + }); + }); + wss.on('error', function() {}); + }); + + it('selects the first protocol by default', function(done) { + var wss = new WebSocketServer({port: ++port}, function() { + var ws = new WebSocket('ws://localhost:' + port, {protocol: 'prot1, prot2'}); + ws.on('open', function(client) { + ws.protocol.should.eql('prot1'); + wss.close(); + done(); + }); + }); + }); + + it('selects the last protocol via protocol handler', function(done) { + var wss = new WebSocketServer({port: ++port, handleProtocols: function(ps, cb) { + cb(true, ps[ps.length-1]); }}, function() { + var ws = new WebSocket('ws://localhost:' + port, {protocol: 'prot1, prot2'}); + ws.on('open', function(client) { + ws.protocol.should.eql('prot2'); + wss.close(); + done(); + }); + }); + }); + + it('client detects invalid server protocol', function(done) { + var wss = new WebSocketServer({port: ++port, handleProtocols: function(ps, cb) { + cb(true, 'prot3'); }}, function() { + var ws = new WebSocket('ws://localhost:' + port, {protocol: 'prot1, prot2'}); + ws.on('open', function(client) { + done(new Error('connection must not be established')); + }); + ws.on('error', function() { + done(); + }); + }); + }); + + it('client detects no server protocol', function(done) { + var wss = new WebSocketServer({port: ++port, handleProtocols: function(ps, cb) { + cb(true); }}, function() { + var ws = new WebSocket('ws://localhost:' + port, {protocol: 'prot1, prot2'}); + ws.on('open', function(client) { + done(new Error('connection must not be established')); + }); + ws.on('error', function() { + done(); + }); + }); + }); + + it('client refuses server protocols', function(done) { + var wss = new WebSocketServer({port: ++port, handleProtocols: function(ps, cb) { + cb(false); }}, function() { + var ws = new WebSocket('ws://localhost:' + port, {protocol: 'prot1, prot2'}); + ws.on('open', function(client) { + done(new Error('connection must not be established')); + }); + ws.on('error', function() { + done(); + }); + }); + }); + + it('server detects invalid protocol handler', function(done) { + var wss = new WebSocketServer({port: ++port, handleProtocols: function(ps, cb) { + // not calling callback is an error and shouldn't timeout + }}, function() { + var options = { + port: port, + host: '127.0.0.1', + headers: { + 'Connection': 'Upgrade', + 'Upgrade': 'websocket', + 'Sec-WebSocket-Key': 'dGhlIHNhbXBsZSBub25jZQ==', + 'Sec-WebSocket-Version': 13, + 'Sec-WebSocket-Origin': 'http://foobar.com' + } + }; + options.port = port; + var req = http.request(options); + req.end(); + req.on('response', function(res) { + res.statusCode.should.eql(501); + wss.close(); + done(); + }); + }); + wss.on('connection', function(ws) { + done(new Error('connection must not be established')); + }); + wss.on('error', function() {}); + }); + }); + + describe('messaging', function() { + it('can send and receive data', function(done) { + var data = new Array(65*1024); + for (var i = 0; i < data.length; ++i) { + data[i] = String.fromCharCode(65 + ~~(25 * Math.random())); + } + data = data.join(''); + var wss = new WebSocketServer({port: ++port}, function() { + var ws = new WebSocket('ws://localhost:' + port); + ws.on('message', function(message, flags) { + ws.send(message); + }); + }); + wss.on('connection', function(client) { + client.on('message', function(message) { + message.should.eql(data); + wss.close(); + done(); + }); + client.send(data); + }); + }); + }); + }); + + describe('hixie mode', function() { + it('can be disabled', function(done) { + var wss = new WebSocketServer({port: ++port, disableHixie: true}, function() { + var options = { + port: port, + host: '127.0.0.1', + headers: { + 'Connection': 'Upgrade', + 'Upgrade': 'WebSocket', + 'Sec-WebSocket-Key1': '3e6b263 4 17 80', + 'Sec-WebSocket-Key2': '17 9 G`ZD9 2 2b 7X 3 /r90' + } + }; + var req = http.request(options); + req.write('WjN}|M(6'); + req.end(); + req.on('response', function(res) { + res.statusCode.should.eql(401); + process.nextTick(function() { + wss.close(); + done(); + }); + }); + }); + wss.on('connection', function(ws) { + done(new Error('connection must not be established')); + }); + wss.on('error', function() {}); + }); + + describe('connection establishing', function() { + it('does not accept connections with no sec-websocket-key1', function(done) { + var wss = new WebSocketServer({port: ++port}, function() { + var options = { + port: port, + host: '127.0.0.1', + headers: { + 'Connection': 'Upgrade', + 'Upgrade': 'WebSocket', + 'Sec-WebSocket-Key1': '3e6b263 4 17 80' + } + }; + var req = http.request(options); + req.end(); + req.on('response', function(res) { + res.statusCode.should.eql(400); + wss.close(); + done(); + }); + }); + wss.on('connection', function(ws) { + done(new Error('connection must not be established')); + }); + wss.on('error', function() {}); + }); + + it('does not accept connections with no sec-websocket-key2', function(done) { + var wss = new WebSocketServer({port: ++port}, function() { + var options = { + port: port, + host: '127.0.0.1', + headers: { + 'Connection': 'Upgrade', + 'Upgrade': 'WebSocket', + 'Sec-WebSocket-Key2': '17 9 G`ZD9 2 2b 7X 3 /r90' + } + }; + var req = http.request(options); + req.end(); + req.on('response', function(res) { + res.statusCode.should.eql(400); + wss.close(); + done(); + }); + }); + wss.on('connection', function(ws) { + done(new Error('connection must not be established')); + }); + wss.on('error', function() {}); + }); + + it('accepts connections with valid handshake', function(done) { + var wss = new WebSocketServer({port: ++port}, function() { + var options = { + port: port, + host: '127.0.0.1', + headers: { + 'Connection': 'Upgrade', + 'Upgrade': 'WebSocket', + 'Sec-WebSocket-Key1': '3e6b263 4 17 80', + 'Sec-WebSocket-Key2': '17 9 G`ZD9 2 2b 7X 3 /r90' + } + }; + var req = http.request(options); + req.write('WjN}|M(6'); + req.end(); + }); + wss.on('connection', function(ws) { + ws.terminate(); + wss.close(); + done(); + }); + wss.on('error', function() {}); + }); + + it('client can be denied', function(done) { + var wss = new WebSocketServer({port: ++port, verifyClient: function(o) { + return false; + }}, function() { + var options = { + port: port, + host: '127.0.0.1', + headers: { + 'Connection': 'Upgrade', + 'Upgrade': 'WebSocket', + 'Sec-WebSocket-Key1': '3e6b263 4 17 80', + 'Sec-WebSocket-Key2': '17 9 G`ZD9 2 2b 7X 3 /r90' + } + }; + var req = http.request(options); + req.write('WjN}|M(6'); + req.end(); + req.on('response', function(res) { + res.statusCode.should.eql(401); + process.nextTick(function() { + wss.close(); + done(); + }); + }); + }); + wss.on('connection', function(ws) { + done(new Error('connection must not be established')); + }); + wss.on('error', function() {}); + }); + + it('client can be accepted', function(done) { + var wss = new WebSocketServer({port: ++port, verifyClient: function(o) { + return true; + }}, function() { + var options = { + port: port, + host: '127.0.0.1', + headers: { + 'Connection': 'Upgrade', + 'Upgrade': 'WebSocket', + 'Sec-WebSocket-Key1': '3e6b263 4 17 80', + 'Sec-WebSocket-Key2': '17 9 G`ZD9 2 2b 7X 3 /r90' + } + }; + var req = http.request(options); + req.write('WjN}|M(6'); + req.end(); + }); + wss.on('connection', function(ws) { + ws.terminate(); + wss.close(); + done(); + }); + wss.on('error', function() {}); + }); + + it('verifyClient gets client origin', function(done) { + var verifyClientCalled = false; + var wss = new WebSocketServer({port: ++port, verifyClient: function(info) { + info.origin.should.eql('http://foobarbaz.com'); + verifyClientCalled = true; + return false; + }}, function() { + var options = { + port: port, + host: '127.0.0.1', + headers: { + 'Connection': 'Upgrade', + 'Upgrade': 'WebSocket', + 'Origin': 'http://foobarbaz.com', + 'Sec-WebSocket-Key1': '3e6b263 4 17 80', + 'Sec-WebSocket-Key2': '17 9 G`ZD9 2 2b 7X 3 /r90' + } + }; + var req = http.request(options); + req.write('WjN}|M(6'); + req.end(); + req.on('response', function(res) { + verifyClientCalled.should.be.ok; + wss.close(); + done(); + }); + }); + wss.on('error', function() {}); + }); + + it('verifyClient gets original request', function(done) { + var verifyClientCalled = false; + var wss = new WebSocketServer({port: ++port, verifyClient: function(info) { + info.req.headers['sec-websocket-key1'].should.eql('3e6b263 4 17 80'); + verifyClientCalled = true; + return false; + }}, function() { + var options = { + port: port, + host: '127.0.0.1', + headers: { + 'Connection': 'Upgrade', + 'Upgrade': 'WebSocket', + 'Origin': 'http://foobarbaz.com', + 'Sec-WebSocket-Key1': '3e6b263 4 17 80', + 'Sec-WebSocket-Key2': '17 9 G`ZD9 2 2b 7X 3 /r90' + } + }; + var req = http.request(options); + req.write('WjN}|M(6'); + req.end(); + req.on('response', function(res) { + verifyClientCalled.should.be.ok; + wss.close(); + done(); + }); + }); + wss.on('error', function() {}); + }); + + it('client can be denied asynchronously', function(done) { + var wss = new WebSocketServer({port: ++port, verifyClient: function(o, cb) { + cb(false); + }}, function() { + var options = { + port: port, + host: '127.0.0.1', + headers: { + 'Connection': 'Upgrade', + 'Upgrade': 'WebSocket', + 'Origin': 'http://foobarbaz.com', + 'Sec-WebSocket-Key1': '3e6b263 4 17 80', + 'Sec-WebSocket-Key2': '17 9 G`ZD9 2 2b 7X 3 /r90' + } + }; + var req = http.request(options); + req.write('WjN}|M(6'); + req.end(); + req.on('response', function(res) { + res.statusCode.should.eql(401); + process.nextTick(function() { + wss.close(); + done(); + }); + }); + }); + wss.on('connection', function(ws) { + done(new Error('connection must not be established')); + }); + wss.on('error', function() {}); + }); + + it('client can be accepted asynchronously', function(done) { + var wss = new WebSocketServer({port: ++port, verifyClient: function(o, cb) { + cb(true); + }}, function() { + var options = { + port: port, + host: '127.0.0.1', + headers: { + 'Connection': 'Upgrade', + 'Upgrade': 'WebSocket', + 'Origin': 'http://foobarbaz.com', + 'Sec-WebSocket-Key1': '3e6b263 4 17 80', + 'Sec-WebSocket-Key2': '17 9 G`ZD9 2 2b 7X 3 /r90' + } + }; + var req = http.request(options); + req.write('WjN}|M(6'); + req.end(); + }); + wss.on('connection', function(ws) { + wss.close(); + done(); + }); + wss.on('error', function() {}); + }); + + it('handles messages passed along with the upgrade request (upgrade head)', function(done) { + var wss = new WebSocketServer({port: ++port, verifyClient: function(o) { + return true; + }}, function() { + var options = { + port: port, + host: '127.0.0.1', + headers: { + 'Connection': 'Upgrade', + 'Upgrade': 'WebSocket', + 'Sec-WebSocket-Key1': '3e6b263 4 17 80', + 'Sec-WebSocket-Key2': '17 9 G`ZD9 2 2b 7X 3 /r90', + 'Origin': 'http://foobar.com' + } + }; + var req = http.request(options); + req.write('WjN}|M(6'); + req.write(new Buffer([0x00, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0xff], 'binary')); + req.end(); + }); + wss.on('connection', function(ws) { + ws.on('message', function(data) { + data.should.eql('Hello'); + ws.terminate(); + wss.close(); + done(); + }); + }); + wss.on('error', function() {}); + }); + }); + }); + + describe('client properties', function() { + it('protocol is exposed', function(done) { + var wss = new WebSocketServer({port: ++port}, function() { + var ws = new WebSocket('ws://localhost:' + port, {protocol: 'hi'}); + }); + wss.on('connection', function(client) { + client.protocol.should.eql('hi'); + wss.close(); + done(); + }); + }); + + it('protocolVersion is exposed', function(done) { + var wss = new WebSocketServer({port: ++port}, function() { + var ws = new WebSocket('ws://localhost:' + port, {protocolVersion: 8}); + }); + wss.on('connection', function(client) { + client.protocolVersion.should.eql(8); + wss.close(); + done(); + }); + }); + + it('upgradeReq is the original request object', function(done) { + var wss = new WebSocketServer({port: ++port}, function() { + var ws = new WebSocket('ws://localhost:' + port, {protocolVersion: 8}); + }); + wss.on('connection', function(client) { + client.upgradeReq.httpVersion.should.eql('1.1'); + wss.close(); + done(); + }); + }); + }); + +}); diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/autobahn-server.js b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/autobahn-server.js new file mode 100644 index 0000000..36fe0c2 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/autobahn-server.js @@ -0,0 +1,29 @@ +var WebSocketServer = require('../').Server; + +process.on('uncaughtException', function(err) { + console.log('Caught exception: ', err, err.stack); +}); + +process.on('SIGINT', function () { + try { + console.log('Updating reports and shutting down'); + var ws = new WebSocket('ws://localhost:9001/updateReports?agent=ws'); + ws.on('close', function() { + process.exit(); + }); + } + catch(e) { + process.exit(); + } +}); + +var wss = new WebSocketServer({port: 8181}); +wss.on('connection', function(ws) { + console.log('new connection'); + ws.on('message', function(data, flags) { + ws.send(flags.buffer, {binary: flags.binary === true}); + }); + ws.on('error', function() { + console.log('error', arguments); + }); +}); diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/autobahn.js b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/autobahn.js new file mode 100644 index 0000000..048cc90 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/autobahn.js @@ -0,0 +1,52 @@ +var WebSocket = require('../'); +var currentTest = 1; +var lastTest = -1; +var testCount = null; + +process.on('uncaughtException', function(err) { + console.log('Caught exception: ', err, err.stack); +}); + +process.on('SIGINT', function () { + try { + console.log('Updating reports and shutting down'); + var ws = new WebSocket('ws://localhost:9001/updateReports?agent=ws'); + ws.on('close', function() { + process.exit(); + }); + } + catch(e) { + process.exit(); + } +}); + +function nextTest() { + if (currentTest > testCount || (lastTest != -1 && currentTest > lastTest)) { + console.log('Updating reports and shutting down'); + var ws = new WebSocket('ws://localhost:9001/updateReports?agent=ws'); + ws.on('close', function() { + process.exit(); + }); + return; + }; + console.log('Running test case ' + currentTest + '/' + testCount); + var ws = new WebSocket('ws://localhost:9001/runCase?case=' + currentTest + '&agent=ws'); + ws.on('message', function(data, flags) { + ws.send(flags.buffer, {binary: flags.binary === true, mask: true}); + }); + ws.on('close', function(data) { + currentTest += 1; + process.nextTick(nextTest); + }); + ws.on('error', function(e) {}); +} + +var ws = new WebSocket('ws://localhost:9001/getCaseCount'); +ws.on('message', function(data, flags) { + testCount = parseInt(data); +}); +ws.on('close', function() { + if (testCount > 0) { + nextTest(); + } +}); \ No newline at end of file diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/fixtures/agent1-cert.pem b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/fixtures/agent1-cert.pem new file mode 100644 index 0000000..cccb9fb --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/fixtures/agent1-cert.pem @@ -0,0 +1,16 @@ +-----BEGIN CERTIFICATE----- +MIICbjCCAdcCCQCVvok5oeLpqzANBgkqhkiG9w0BAQUFADB6MQswCQYDVQQGEwJV +UzELMAkGA1UECBMCQ0ExCzAJBgNVBAcTAlNGMQ8wDQYDVQQKEwZKb3llbnQxEDAO +BgNVBAsTB05vZGUuanMxDDAKBgNVBAMTA2NhMTEgMB4GCSqGSIb3DQEJARYRcnlA +dGlueWNsb3Vkcy5vcmcwHhcNMTMwMzA4MDAzMDIyWhcNNDAwNzIzMDAzMDIyWjB9 +MQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExCzAJBgNVBAcTAlNGMQ8wDQYDVQQK +EwZKb3llbnQxEDAOBgNVBAsTB05vZGUuanMxDzANBgNVBAMTBmFnZW50MTEgMB4G +CSqGSIb3DQEJARYRcnlAdGlueWNsb3Vkcy5vcmcwgZ8wDQYJKoZIhvcNAQEBBQAD +gY0AMIGJAoGBAL6GwKosYb0Yc3Qo0OtQVlCJ4208Idw11ij+t2W5sfYbCil5tyQo +jnhGM1CJhEXynQpXXwjKJuIeTQCkeUibTyFKa0bs8+li2FiGoKYbb4G81ovnqkmE +2iDVb8Gw3rrM4zeZ0ZdFnjMsAZac8h6+C4sB/pS9BiMOo6qTl15RQlcJAgMBAAEw +DQYJKoZIhvcNAQEFBQADgYEAOtmLo8DwTPnI4wfQbQ3hWlTS/9itww6IsxH2ODt9 +ggB7wi7N3uAdIWRZ54ke0NEAO5CW1xNTwsWcxQbiHrDOqX1vfVCjIenI76jVEEap +/Ay53ydHNBKdsKkib61Me14Mu0bA3lUul57VXwmH4NUEFB3w973Q60PschUhOEXj +7DY= +-----END CERTIFICATE----- diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/fixtures/agent1-key.pem b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/fixtures/agent1-key.pem new file mode 100644 index 0000000..cbd5f0c --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/fixtures/agent1-key.pem @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXAIBAAKBgQC+hsCqLGG9GHN0KNDrUFZQieNtPCHcNdYo/rdlubH2Gwopebck +KI54RjNQiYRF8p0KV18IyibiHk0ApHlIm08hSmtG7PPpYthYhqCmG2+BvNaL56pJ +hNog1W/BsN66zOM3mdGXRZ4zLAGWnPIevguLAf6UvQYjDqOqk5deUUJXCQIDAQAB +AoGANu/CBA+SCyVOvRK70u4yRTzNMAUjukxnuSBhH1rg/pajYnwvG6T6F6IeT72n +P0gKkh3JUE6B0bds+p9yPUZTFUXghxjcF33wlIY44H6gFE4K5WutsFJ9c450wtuu +8rXZTsIg7lAXWjTFVmdtOEPetcGlO2Hpi1O7ZzkzHgB2w9ECQQDksCCYx78or1zY +ZSokm8jmpIjG3VLKdvI9HAoJRN40ldnwFoigrFa1AHwsFtWNe8bKyVRPDoLDUjpB +dkPWgweVAkEA1UfgqguQ2KIkbtp9nDBionu3QaajksrRHwIa8vdfRfLxszfHk2fh +NGY3dkRZF8HUAbzYLrd9poVhCBAEjWekpQJASOM6AHfpnXYHCZF01SYx6hEW5wsz +kARJQODm8f1ZNTlttO/5q/xBxn7ZFNRSTD3fJlL05B2j380ddC/Vf1FT4QJAP1BC +GliqnBSuGhZUWYxni3KMeTm9rzL0F29pjpzutHYlWB2D6ndY/FQnvL0XcZ0Bka58 +womIDGnl3x3aLBwLXQJBAJv6h5CHbXHx7VyDJAcNfppAqZGcEaiVg8yf2F33iWy2 +FLthhJucx7df7SO2aw5h06bRDRAhb9br0R9/3mLr7RE= +-----END RSA PRIVATE KEY----- diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/fixtures/ca1-cert.pem b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/fixtures/ca1-cert.pem new file mode 100644 index 0000000..1d0c0d6 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/fixtures/ca1-cert.pem @@ -0,0 +1,15 @@ +-----BEGIN CERTIFICATE----- +MIICazCCAdQCCQC9/g69HtxXRzANBgkqhkiG9w0BAQUFADB6MQswCQYDVQQGEwJV +UzELMAkGA1UECBMCQ0ExCzAJBgNVBAcTAlNGMQ8wDQYDVQQKEwZKb3llbnQxEDAO +BgNVBAsTB05vZGUuanMxDDAKBgNVBAMTA2NhMTEgMB4GCSqGSIb3DQEJARYRcnlA +dGlueWNsb3Vkcy5vcmcwHhcNMTMwMzA4MDAzMDIyWhcNNDAwNzIzMDAzMDIyWjB6 +MQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExCzAJBgNVBAcTAlNGMQ8wDQYDVQQK +EwZKb3llbnQxEDAOBgNVBAsTB05vZGUuanMxDDAKBgNVBAMTA2NhMTEgMB4GCSqG +SIb3DQEJARYRcnlAdGlueWNsb3Vkcy5vcmcwgZ8wDQYJKoZIhvcNAQEBBQADgY0A +MIGJAoGBAKxr1mARUcv7zaqx5y4AxJPK6c1jdbSg7StcL4vg8klaPAlfNO6o+/Cl +w5CdQD3ukaVUwUOJ4T/+b3Xf7785XcWBC33GdjVQkfbHATJYcka7j7JDw3qev5Jk +1rAbRw48hF6rYlSGcx1mccAjoLoa3I8jgxCNAYHIjUQXgdmU893rAgMBAAEwDQYJ +KoZIhvcNAQEFBQADgYEAis05yxjCtJRuv8uX/DK6TX/j9C9Lzp1rKDNFTaTZ0iRw +KCw1EcNx4OXSj9gNblW4PWxpDvygrt1AmH9h2cb8K859NSHa9JOBFw6MA5C2A4Sj +NQfNATqUl4T6cdORlcDEZwHtT8b6D4A6Er31G/eJF4Sen0TUFpjdjd+l9RBjHlo= +-----END CERTIFICATE----- diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/fixtures/ca1-key.pem b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/fixtures/ca1-key.pem new file mode 100644 index 0000000..df14950 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/fixtures/ca1-key.pem @@ -0,0 +1,17 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIICxjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQIFeWxJE1BrRECAggA +MBQGCCqGSIb3DQMHBAgu9PlMSQ+BOASCAoDEZN2tX0xWo/N+Jg+PrvCrFDk3P+3x +5xG/PEDjtMCAWPBEwbnaYHDzYmhNcAmxzGqEHGMDiWYs46LbO560VS3uMvFbEWPo +KYYVb13vkxl2poXdonCb5cHZA5GUYzTIVVJFptl4LHwBczHoMHtA4FqAhKlYvlWw +EOrdLB8XcwMmGPFabbbGxno0+EWWM27uNjlogfoxj35mQqSW4rOlhZ460XjOB1Zx +LjXMuZeONojkGYQRG5EUMchBoctQpCOM6cAi9r1B9BvtFCBpDV1c1zEZBzTEUd8o +kLn6tjLmY+QpTdylFjEWc7U3ppLY/pkoTBv4r85a2sEMWqkhSJboLaTboWzDJcU3 +Ke61pMpovt/3yCUd3TKgwduVwwQtDVTlBe0p66aN9QVj3CrFy/bKAGO3vxlli24H +aIjZf+OVoBY21ESlW3jLvNlBf7Ezf///2E7j4SCDLyZSFMTpFoAG/jDRyvi+wTKX +Kh485Bptnip6DCSuoH4u2SkOqwz3gJS/6s02YKe4m311QT4Pzne5/FwOFaS/HhQg +Xvyh2/d00OgJ0Y0PYQsHILPRgTUCKUXvj1O58opn3fxSacsPxIXwj6Z4FYAjUTaV +2B85k1lpant/JJEilDqMjqzx4pHZ/Z3Uto1lSM1JZs9SNL/0UR+6F0TXZTULVU9V +w8jYzz4sPr7LEyrrTbzmjQgnQFVbhAN/eKgRZK/SpLjxpmBV5MfpbPKsPUZqT4UC +4nXa8a/NYUQ9e+QKK8enq9E599c2W442W7Z1uFRZTWReMx/lF8wwA6G8zOPG0bdj +d+T5Gegzd5mvRiXMBklCo8RLxOOvgxun1n3PY4a63aH6mqBhdfhiLp5j +-----END ENCRYPTED PRIVATE KEY----- diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/fixtures/certificate.pem b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/fixtures/certificate.pem new file mode 100644 index 0000000..0efc2ef --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/fixtures/certificate.pem @@ -0,0 +1,13 @@ +-----BEGIN CERTIFICATE----- +MIICATCCAWoCCQDPufXH86n2QzANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQGEwJu +bzETMBEGA1UECAwKU29tZS1TdGF0ZTEhMB8GA1UECgwYSW50ZXJuZXQgV2lkZ2l0 +cyBQdHkgTHRkMB4XDTEyMDEwMTE0NDQwMFoXDTIwMDMxOTE0NDQwMFowRTELMAkG +A1UEBhMCbm8xEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoMGEludGVybmV0 +IFdpZGdpdHMgUHR5IEx0ZDCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAtrQ7 ++r//2iV/B6F+4boH0XqFn7alcV9lpjvAmwRXNKnxAoa0f97AjYPGNLKrjpkNXXhB +JROIdbRbZnCNeC5fzX1a+JCo7KStzBXuGSZr27TtFmcV4H+9gIRIcNHtZmJLnxbJ +sIhkGR8yVYdmJZe4eT5ldk1zoB1adgPF1hZhCBMCAwEAATANBgkqhkiG9w0BAQUF +AAOBgQCeWBEHYJ4mCB5McwSSUox0T+/mJ4W48L/ZUE4LtRhHasU9hiW92xZkTa7E +QLcoJKQiWfiLX2ysAro0NX4+V8iqLziMqvswnPzz5nezaOLE/9U/QvH3l8qqNkXu +rNbsW1h/IO6FV8avWFYVFoutUwOaZ809k7iMh2F2JMgXQ5EymQ== +-----END CERTIFICATE----- diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/fixtures/key.pem b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/fixtures/key.pem new file mode 100644 index 0000000..176fe32 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/fixtures/key.pem @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXAIBAAKBgQC2tDv6v//aJX8HoX7hugfReoWftqVxX2WmO8CbBFc0qfEChrR/ +3sCNg8Y0squOmQ1deEElE4h1tFtmcI14Ll/NfVr4kKjspK3MFe4ZJmvbtO0WZxXg +f72AhEhw0e1mYkufFsmwiGQZHzJVh2Yll7h5PmV2TXOgHVp2A8XWFmEIEwIDAQAB +AoGAAlVY8sHi/aE+9xT77twWX3mGHV0SzdjfDnly40fx6S1Gc7bOtVdd9DC7pk6l +3ENeJVR02IlgU8iC5lMHq4JEHPE272jtPrLlrpWLTGmHEqoVFv9AITPqUDLhB9Kk +Hjl7h8NYBKbr2JHKICr3DIPKOT+RnXVb1PD4EORbJ3ooYmkCQQDfknUnVxPgxUGs +ouABw1WJIOVgcCY/IFt4Ihf6VWTsxBgzTJKxn3HtgvE0oqTH7V480XoH0QxHhjLq +DrgobWU9AkEA0TRJ8/ouXGnFEPAXjWr9GdPQRZ1Use2MrFjneH2+Sxc0CmYtwwqL +Kr5kS6mqJrxprJeluSjBd+3/ElxURrEXjwJAUvmlN1OPEhXDmRHd92mKnlkyKEeX +OkiFCiIFKih1S5Y/sRJTQ0781nyJjtJqO7UyC3pnQu1oFEePL+UEniRztQJAMfav +AtnpYKDSM+1jcp7uu9BemYGtzKDTTAYfoiNF42EzSJiGrWJDQn4eLgPjY0T0aAf/ +yGz3Z9ErbhMm/Ysl+QJBAL4kBxRT8gM4ByJw4sdOvSeCCANFq8fhbgm8pGWlCPb5 +JGmX3/GHFM8x2tbWMGpyZP1DLtiNEFz7eCGktWK5rqE= +-----END RSA PRIVATE KEY----- diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/fixtures/request.pem b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/fixtures/request.pem new file mode 100644 index 0000000..51bc7f6 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/fixtures/request.pem @@ -0,0 +1,11 @@ +-----BEGIN CERTIFICATE REQUEST----- +MIIBhDCB7gIBADBFMQswCQYDVQQGEwJubzETMBEGA1UECAwKU29tZS1TdGF0ZTEh +MB8GA1UECgwYSW50ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIGfMA0GCSqGSIb3DQEB +AQUAA4GNADCBiQKBgQC2tDv6v//aJX8HoX7hugfReoWftqVxX2WmO8CbBFc0qfEC +hrR/3sCNg8Y0squOmQ1deEElE4h1tFtmcI14Ll/NfVr4kKjspK3MFe4ZJmvbtO0W +ZxXgf72AhEhw0e1mYkufFsmwiGQZHzJVh2Yll7h5PmV2TXOgHVp2A8XWFmEIEwID +AQABoAAwDQYJKoZIhvcNAQEFBQADgYEAjsUXEARgfxZNkMjuUcudgU2w4JXS0gGI +JQ0U1LmU0vMDSKwqndMlvCbKzEgPbJnGJDI8D4MeINCJHa5Ceyb8c+jaJYUcCabl +lQW5Psn3+eWp8ncKlIycDRj1Qk615XuXtV0fhkrgQM2ZCm9LaQ1O1Gd/CzLihLjF +W0MmgMKMMRk= +-----END CERTIFICATE REQUEST----- diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/fixtures/textfile b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/fixtures/textfile new file mode 100644 index 0000000..a10483b --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/fixtures/textfile @@ -0,0 +1,9 @@ +Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam egestas, massa at aliquam luctus, sapien erat viverra elit, nec pulvinar turpis eros sagittis urna. Pellentesque imperdiet tempor varius. Pellentesque blandit, ipsum in imperdiet venenatis, mi elit faucibus odio, id condimentum ante enim sed lectus. Aliquam et odio non odio pellentesque pulvinar. Vestibulum a erat dolor. Integer pretium risus sit amet nisl volutpat nec venenatis magna egestas. Ut bibendum felis eu tellus laoreet eleifend. Nam pulvinar auctor tortor, eu iaculis leo vestibulum quis. In euismod risus ac purus vehicula et fermentum ligula consectetur. Vivamus condimentum tempus lacinia. + +Curabitur sodales condimentum urna id dictum. Sed quis justo sit amet quam ultrices tincidunt vel laoreet nulla. Nullam quis ipsum sed nisi mollis bibendum at sit amet nisi. Donec laoreet consequat velit sit amet mollis. Nam sed sapien a massa iaculis dapibus. Sed dui nunc, ultricies et pellentesque ullamcorper, aliquet vitae ligula. Integer eu velit in neque iaculis venenatis. Ut rhoncus cursus est, ac dignissim leo vehicula a. Nulla ullamcorper vulputate mauris id blandit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque eleifend, nisi a tempor sollicitudin, odio massa pretium urna, quis congue sapien elit at tortor. Curabitur ipsum orci, vehicula non commodo molestie, laoreet id enim. Pellentesque convallis ultrices congue. Pellentesque nec iaculis lorem. In sagittis pharetra ipsum eget sodales. + +Fusce id nulla odio. Nunc nibh justo, placerat vel tincidunt sed, ornare et enim. Nulla vel urna vel ante commodo bibendum in vitae metus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Duis erat nunc, semper eget sagittis sit amet, ullamcorper eget lacus. Donec hendrerit ipsum vitae eros vestibulum eu gravida neque tincidunt. Ut molestie lacinia nulla. Donec mattis odio at magna egestas at pellentesque eros accumsan. Praesent interdum sem sit amet nibh commodo dignissim. Duis laoreet, enim ultricies fringilla suscipit, enim libero cursus nulla, sollicitudin adipiscing erat velit ut dui. Nulla eleifend mauris at velit fringilla a molestie lorem venenatis. + +Donec sit amet scelerisque metus. Cras ac felis a nulla venenatis vulputate. Duis porttitor eros ac neque rhoncus eget aliquet neque egestas. Quisque sed nunc est, vitae dapibus quam. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; In vehicula, est vitae posuere ultricies, diam purus pretium sapien, nec rhoncus dolor nisl eget arcu. Aliquam et nisi vitae risus tincidunt auctor. In vehicula, erat a cursus adipiscing, lorem orci congue est, nec ultricies elit dui in nunc. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Lorem ipsum dolor sit amet, consectetur adipiscing elit. + +Duis congue tempus elit sit amet auctor. Duis dignissim, risus ut sollicitudin ultricies, dolor ligula gravida odio, nec congue orci purus ut ligula. Fusce pretium dictum lectus at volutpat. Sed non auctor mauris. Etiam placerat vestibulum massa id blandit. Quisque consequat lacus ut nulla euismod facilisis. Sed aliquet ipsum nec mi imperdiet viverra. Pellentesque ullamcorper, lectus nec varius gravida, odio justo cursus risus, eu sagittis metus arcu quis felis. Phasellus consectetur vehicula libero, at condimentum orci euismod vel. Nunc purus tortor, suscipit nec fringilla nec, vulputate et nibh. Nam porta vehicula neque. Praesent porttitor, sapien eu auctor euismod, arcu quam elementum urna, sed hendrerit magna augue sed quam. \ No newline at end of file diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/hybi-common.js b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/hybi-common.js new file mode 100644 index 0000000..006f9c6 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/hybi-common.js @@ -0,0 +1,99 @@ +/** + * Returns a Buffer from a "ff 00 ff"-type hex string. + */ + +getBufferFromHexString = function(byteStr) { + var bytes = byteStr.split(' '); + var buf = new Buffer(bytes.length); + for (var i = 0; i < bytes.length; ++i) { + buf[i] = parseInt(bytes[i], 16); + } + return buf; +} + +/** + * Returns a hex string from a Buffer. + */ + +getHexStringFromBuffer = function(data) { + var s = ''; + for (var i = 0; i < data.length; ++i) { + s += padl(data[i].toString(16), 2, '0') + ' '; + } + return s.trim(); +} + +/** + * Splits a buffer in two parts. + */ + +splitBuffer = function(buffer) { + var b1 = new Buffer(Math.ceil(buffer.length / 2)); + buffer.copy(b1, 0, 0, b1.length); + var b2 = new Buffer(Math.floor(buffer.length / 2)); + buffer.copy(b2, 0, b1.length, b1.length + b2.length); + return [b1, b2]; +} + +/** + * Performs hybi07+ type masking on a hex string or buffer. + */ + +mask = function(buf, maskString) { + if (typeof buf == 'string') buf = new Buffer(buf); + var mask = getBufferFromHexString(maskString || '34 83 a8 68'); + for (var i = 0; i < buf.length; ++i) { + buf[i] ^= mask[i % 4]; + } + return buf; +} + +/** + * Returns a hex string representing the length of a message + */ + +getHybiLengthAsHexString = function(len, masked) { + if (len < 126) { + var buf = new Buffer(1); + buf[0] = (masked ? 0x80 : 0) | len; + } + else if (len < 65536) { + var buf = new Buffer(3); + buf[0] = (masked ? 0x80 : 0) | 126; + getBufferFromHexString(pack(4, len)).copy(buf, 1); + } + else { + var buf = new Buffer(9); + buf[0] = (masked ? 0x80 : 0) | 127; + getBufferFromHexString(pack(16, len)).copy(buf, 1); + } + return getHexStringFromBuffer(buf); +} + +/** + * Unpacks a Buffer into a number. + */ + +unpack = function(buffer) { + var n = 0; + for (var i = 0; i < buffer.length; ++i) { + n = (i == 0) ? buffer[i] : (n * 256) + buffer[i]; + } + return n; +} + +/** + * Returns a hex string, representing a specific byte count 'length', from a number. + */ + +pack = function(length, number) { + return padl(number.toString(16), length, '0').replace(/([0-9a-f][0-9a-f])/gi, '$1 ').trim(); +} + +/** + * Left pads the string 's' to a total length of 'n' with char 'c'. + */ + +padl = function(s, n, c) { + return new Array(1 + n - s.length).join(c) + s; +} diff --git a/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/testserver.js b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/testserver.js new file mode 100644 index 0000000..3e7a966 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/node_modules/ws/test/testserver.js @@ -0,0 +1,180 @@ +var http = require('http') + , util = require('util') + , crypto = require('crypto') + , events = require('events') + , Sender = require('../lib/Sender') + , Receiver = require('../lib/Receiver'); + +module.exports = { + handlers: { + valid: validServer, + invalidKey: invalidRequestHandler, + closeAfterConnect: closeAfterConnectHandler, + return401: return401 + }, + createServer: function(port, handler, cb) { + if (handler && !cb) { + cb = handler; + handler = null; + } + var webServer = http.createServer(function (req, res) { + res.writeHead(200, {'Content-Type': 'text/plain'}); + res.end('okay'); + }); + var srv = new Server(webServer); + webServer.on('upgrade', function(req, socket) { + webServer._socket = socket; + (handler || validServer)(srv, req, socket); + }); + webServer.listen(port, '127.0.0.1', function() { cb(srv); }); + } +}; + +/** + * Test strategies + */ + +function validServer(server, req, socket) { + if (typeof req.headers.upgrade === 'undefined' || + req.headers.upgrade.toLowerCase() !== 'websocket') { + throw new Error('invalid headers'); + return; + } + + if (!req.headers['sec-websocket-key']) { + socket.end(); + throw new Error('websocket key is missing'); + } + + // calc key + var key = req.headers['sec-websocket-key']; + var shasum = crypto.createHash('sha1'); + shasum.update(key + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"); + key = shasum.digest('base64'); + + var headers = [ + 'HTTP/1.1 101 Switching Protocols' + , 'Upgrade: websocket' + , 'Connection: Upgrade' + , 'Sec-WebSocket-Accept: ' + key + ]; + + socket.write(headers.concat('', '').join('\r\n')); + socket.setTimeout(0); + socket.setNoDelay(true); + + var sender = new Sender(socket); + var receiver = new Receiver(); + receiver.ontext = function (message, flags) { + server.emit('message', message, flags); + sender.send(message); + }; + receiver.onbinary = function (message, flags) { + flags = flags || {}; + flags.binary = true; + server.emit('message', message, flags); + sender.send(message, {binary: true}); + }; + receiver.onping = function (message, flags) { + flags = flags || {}; + server.emit('ping', message, flags); + }; + receiver.onpong = function (message, flags) { + flags = flags || {}; + server.emit('pong', message, flags); + }; + receiver.onclose = function (code, message, flags) { + flags = flags || {}; + server.emit('close', code, message, flags); + }; + socket.on('data', function (data) { + receiver.add(data); + }); + socket.on('end', function() { + socket.end(); + }); +} + +function invalidRequestHandler(server, req, socket) { + if (typeof req.headers.upgrade === 'undefined' || + req.headers.upgrade.toLowerCase() !== 'websocket') { + throw new Error('invalid headers'); + return; + } + + if (!req.headers['sec-websocket-key']) { + socket.end(); + throw new Error('websocket key is missing'); + } + + // calc key + var key = req.headers['sec-websocket-key']; + var shasum = crypto.createHash('sha1'); + shasum.update(key + "bogus"); + key = shasum.digest('base64'); + + var headers = [ + 'HTTP/1.1 101 Switching Protocols' + , 'Upgrade: websocket' + , 'Connection: Upgrade' + , 'Sec-WebSocket-Accept: ' + key + ]; + + socket.write(headers.concat('', '').join('\r\n')); + socket.end(); +} + +function closeAfterConnectHandler(server, req, socket) { + if (typeof req.headers.upgrade === 'undefined' || + req.headers.upgrade.toLowerCase() !== 'websocket') { + throw new Error('invalid headers'); + return; + } + + if (!req.headers['sec-websocket-key']) { + socket.end(); + throw new Error('websocket key is missing'); + } + + // calc key + var key = req.headers['sec-websocket-key']; + var shasum = crypto.createHash('sha1'); + shasum.update(key + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"); + key = shasum.digest('base64'); + + var headers = [ + 'HTTP/1.1 101 Switching Protocols' + , 'Upgrade: websocket' + , 'Connection: Upgrade' + , 'Sec-WebSocket-Accept: ' + key + ]; + + socket.write(headers.concat('', '').join('\r\n')); + socket.end(); +} + + +function return401(server, req, socket) { + var headers = [ + 'HTTP/1.1 401 Unauthorized' + , 'Content-type: text/html' + ]; + + socket.write(headers.concat('', '').join('\r\n')); + socket.end(); +} + +/** + * Server object, which will do the actual emitting + */ + +function Server(webServer) { + this.webServer = webServer; +} + +util.inherits(Server, events.EventEmitter); + +Server.prototype.close = function() { + this.webServer.close(); + if (this._socket) this._socket.end(); +} diff --git a/node_modules/socket.io/node_modules/engine.io/package.json b/node_modules/socket.io/node_modules/engine.io/package.json new file mode 100644 index 0000000..0b846f8 --- /dev/null +++ b/node_modules/socket.io/node_modules/engine.io/package.json @@ -0,0 +1,73 @@ +{ + "name": "engine.io", + "version": "1.3.1", + "description": "The realtime engine behind Socket.IO. Provides the foundation of a bidirectional connection between client and server", + "main": "./lib/engine.io", + "author": { + "name": "Guillermo Rauch", + "email": "guillermo@learnboost.com" + }, + "homepage": "https://github.com/LearnBoost/engine.io", + "repository": { + "type": "git", + "url": "git@github.com:LearnBoost/engine.io.git" + }, + "contributors": [ + { + "name": "Eugen Dueck", + "url": "https://github.com/EugenDueck" + }, + { + "name": "Afshin Mehrabani", + "url": "https://github.com/afshinm" + }, + { + "name": "Christoph Dorn", + "url": "https://github.com/cadorn" + }, + { + "name": "Mark Mokryn", + "email": "mokesmokes@gmail.com" + } + ], + "dependencies": { + "debug": "0.6.0", + "ws": "0.4.31", + "engine.io-parser": "1.0.6", + "base64id": "0.1.0" + }, + "devDependencies": { + "mocha": "1.12.0", + "expect.js": "0.2.0", + "superagent": "0.15.4", + "engine.io-client": "1.3.1", + "s": "0.1.1" + }, + "scripts": { + "test": "make test" + }, + "gitHead": "f3ada3c7236c254bf78be820ccef3d4b9a4e097e", + "bugs": { + "url": "https://github.com/LearnBoost/engine.io/issues" + }, + "_id": "engine.io@1.3.1", + "_shasum": "2d968308fffae5d17f5209b6775246e90d8a705e", + "_from": "engine.io@1.3.1", + "_npmVersion": "1.4.14", + "_npmUser": { + "name": "rauchg", + "email": "rauchg@gmail.com" + }, + "maintainers": [ + { + "name": "rauchg", + "email": "rauchg@gmail.com" + } + ], + "dist": { + "shasum": "2d968308fffae5d17f5209b6775246e90d8a705e", + "tarball": "http://registry.npmjs.org/engine.io/-/engine.io-1.3.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/engine.io/-/engine.io-1.3.1.tgz" +} diff --git a/node_modules/socket.io/node_modules/has-binary-data/.npmignore b/node_modules/socket.io/node_modules/has-binary-data/.npmignore new file mode 100644 index 0000000..a72b52e --- /dev/null +++ b/node_modules/socket.io/node_modules/has-binary-data/.npmignore @@ -0,0 +1,15 @@ +lib-cov +*.seed +*.log +*.csv +*.dat +*.out +*.pid +*.gz + +pids +logs +results + +npm-debug.log +node_modules diff --git a/node_modules/socket.io/node_modules/has-binary-data/LICENSE b/node_modules/socket.io/node_modules/has-binary-data/LICENSE new file mode 100644 index 0000000..e6603cd --- /dev/null +++ b/node_modules/socket.io/node_modules/has-binary-data/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2014 Kevin Roark + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/socket.io/node_modules/has-binary-data/Makefile b/node_modules/socket.io/node_modules/has-binary-data/Makefile new file mode 100644 index 0000000..1d90629 --- /dev/null +++ b/node_modules/socket.io/node_modules/has-binary-data/Makefile @@ -0,0 +1,3 @@ + +test: + @./node_modules/.bin/mocha test.js diff --git a/node_modules/socket.io/node_modules/has-binary-data/README.md b/node_modules/socket.io/node_modules/has-binary-data/README.md new file mode 100644 index 0000000..76a0035 --- /dev/null +++ b/node_modules/socket.io/node_modules/has-binary-data/README.md @@ -0,0 +1,4 @@ +has-binarydata.js +================= + +Simple module to test if an object contains binary data diff --git a/node_modules/socket.io/node_modules/has-binary-data/index.js b/node_modules/socket.io/node_modules/has-binary-data/index.js new file mode 100644 index 0000000..b7f2fbe --- /dev/null +++ b/node_modules/socket.io/node_modules/has-binary-data/index.js @@ -0,0 +1,57 @@ +/* + * Module requirements. + */ + +var isArray = require('isarray'); + +/** + * Module exports. + */ + +module.exports = hasBinary; + +/** + * Checks for binary data. + * + * Right now only Buffer and ArrayBuffer are supported.. + * + * @param {Object} anything + * @api public + */ + +function hasBinary(data) { + + function recursiveCheckForBinary(obj) { + if (!obj) return false; + + if ( (global.Buffer && Buffer.isBuffer(obj)) || + (global.ArrayBuffer && obj instanceof ArrayBuffer) || + (global.Blob && obj instanceof Blob) || + (global.File && obj instanceof File) + ) { + return true; + } + + if (isArray(obj)) { + for (var i = 0; i < obj.length; i++) { + if (recursiveCheckForBinary(obj[i])) { + return true; + } + } + } else if (obj && 'object' == typeof obj) { + if (obj.toJSON) { + obj = obj.toJSON(); + } + + for (var key in obj) { + if (recursiveCheckForBinary(obj[key])) { + return true; + } + } + } + + return false; + } + + return recursiveCheckForBinary(data); +} diff --git a/node_modules/socket.io/node_modules/has-binary-data/node_modules/isarray/README.md b/node_modules/socket.io/node_modules/has-binary-data/node_modules/isarray/README.md new file mode 100644 index 0000000..052a62b --- /dev/null +++ b/node_modules/socket.io/node_modules/has-binary-data/node_modules/isarray/README.md @@ -0,0 +1,54 @@ + +# isarray + +`Array#isArray` for older browsers. + +## Usage + +```js +var isArray = require('isarray'); + +console.log(isArray([])); // => true +console.log(isArray({})); // => false +``` + +## Installation + +With [npm](http://npmjs.org) do + +```bash +$ npm install isarray +``` + +Then bundle for the browser with +[browserify](https://github.com/substack/browserify). + +With [component](http://component.io) do + +```bash +$ component install juliangruber/isarray +``` + +## License + +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/socket.io/node_modules/has-binary-data/node_modules/isarray/build/build.js b/node_modules/socket.io/node_modules/has-binary-data/node_modules/isarray/build/build.js new file mode 100644 index 0000000..ec58596 --- /dev/null +++ b/node_modules/socket.io/node_modules/has-binary-data/node_modules/isarray/build/build.js @@ -0,0 +1,209 @@ + +/** + * Require the given path. + * + * @param {String} path + * @return {Object} exports + * @api public + */ + +function require(path, parent, orig) { + var resolved = require.resolve(path); + + // lookup failed + if (null == resolved) { + orig = orig || path; + parent = parent || 'root'; + var err = new Error('Failed to require "' + orig + '" from "' + parent + '"'); + err.path = orig; + err.parent = parent; + err.require = true; + throw err; + } + + var module = require.modules[resolved]; + + // perform real require() + // by invoking the module's + // registered function + if (!module.exports) { + module.exports = {}; + module.client = module.component = true; + module.call(this, module.exports, require.relative(resolved), module); + } + + return module.exports; +} + +/** + * Registered modules. + */ + +require.modules = {}; + +/** + * Registered aliases. + */ + +require.aliases = {}; + +/** + * Resolve `path`. + * + * Lookup: + * + * - PATH/index.js + * - PATH.js + * - PATH + * + * @param {String} path + * @return {String} path or null + * @api private + */ + +require.resolve = function(path) { + if (path.charAt(0) === '/') path = path.slice(1); + var index = path + '/index.js'; + + var paths = [ + path, + path + '.js', + path + '.json', + path + '/index.js', + path + '/index.json' + ]; + + for (var i = 0; i < paths.length; i++) { + var path = paths[i]; + if (require.modules.hasOwnProperty(path)) return path; + } + + if (require.aliases.hasOwnProperty(index)) { + return require.aliases[index]; + } +}; + +/** + * Normalize `path` relative to the current path. + * + * @param {String} curr + * @param {String} path + * @return {String} + * @api private + */ + +require.normalize = function(curr, path) { + var segs = []; + + if ('.' != path.charAt(0)) return path; + + curr = curr.split('/'); + path = path.split('/'); + + for (var i = 0; i < path.length; ++i) { + if ('..' == path[i]) { + curr.pop(); + } else if ('.' != path[i] && '' != path[i]) { + segs.push(path[i]); + } + } + + return curr.concat(segs).join('/'); +}; + +/** + * Register module at `path` with callback `definition`. + * + * @param {String} path + * @param {Function} definition + * @api private + */ + +require.register = function(path, definition) { + require.modules[path] = definition; +}; + +/** + * Alias a module definition. + * + * @param {String} from + * @param {String} to + * @api private + */ + +require.alias = function(from, to) { + if (!require.modules.hasOwnProperty(from)) { + throw new Error('Failed to alias "' + from + '", it does not exist'); + } + require.aliases[to] = from; +}; + +/** + * Return a require function relative to the `parent` path. + * + * @param {String} parent + * @return {Function} + * @api private + */ + +require.relative = function(parent) { + var p = require.normalize(parent, '..'); + + /** + * lastIndexOf helper. + */ + + function lastIndexOf(arr, obj) { + var i = arr.length; + while (i--) { + if (arr[i] === obj) return i; + } + return -1; + } + + /** + * The relative require() itself. + */ + + function localRequire(path) { + var resolved = localRequire.resolve(path); + return require(resolved, parent, path); + } + + /** + * Resolve relative to the parent. + */ + + localRequire.resolve = function(path) { + var c = path.charAt(0); + if ('/' == c) return path.slice(1); + if ('.' == c) return require.normalize(p, path); + + // resolve deps by returning + // the dep in the nearest "deps" + // directory + var segs = parent.split('/'); + var i = lastIndexOf(segs, 'deps') + 1; + if (!i) i = 0; + path = segs.slice(0, i + 1).join('/') + '/deps/' + path; + return path; + }; + + /** + * Check if module is defined at `path`. + */ + + localRequire.exists = function(path) { + return require.modules.hasOwnProperty(localRequire.resolve(path)); + }; + + return localRequire; +}; +require.register("isarray/index.js", function(exports, require, module){ +module.exports = Array.isArray || function (arr) { + return Object.prototype.toString.call(arr) == '[object Array]'; +}; + +}); +require.alias("isarray/index.js", "isarray/index.js"); + diff --git a/node_modules/socket.io/node_modules/has-binary-data/node_modules/isarray/component.json b/node_modules/socket.io/node_modules/has-binary-data/node_modules/isarray/component.json new file mode 100644 index 0000000..9e31b68 --- /dev/null +++ b/node_modules/socket.io/node_modules/has-binary-data/node_modules/isarray/component.json @@ -0,0 +1,19 @@ +{ + "name" : "isarray", + "description" : "Array#isArray for older browsers", + "version" : "0.0.1", + "repository" : "juliangruber/isarray", + "homepage": "https://github.com/juliangruber/isarray", + "main" : "index.js", + "scripts" : [ + "index.js" + ], + "dependencies" : {}, + "keywords": ["browser","isarray","array"], + "author": { + "name": "Julian Gruber", + "email": "mail@juliangruber.com", + "url": "http://juliangruber.com" + }, + "license": "MIT" +} diff --git a/node_modules/socket.io/node_modules/has-binary-data/node_modules/isarray/index.js b/node_modules/socket.io/node_modules/has-binary-data/node_modules/isarray/index.js new file mode 100644 index 0000000..5f5ad45 --- /dev/null +++ b/node_modules/socket.io/node_modules/has-binary-data/node_modules/isarray/index.js @@ -0,0 +1,3 @@ +module.exports = Array.isArray || function (arr) { + return Object.prototype.toString.call(arr) == '[object Array]'; +}; diff --git a/node_modules/socket.io/node_modules/has-binary-data/node_modules/isarray/package.json b/node_modules/socket.io/node_modules/has-binary-data/node_modules/isarray/package.json new file mode 100644 index 0000000..04d6a3f --- /dev/null +++ b/node_modules/socket.io/node_modules/has-binary-data/node_modules/isarray/package.json @@ -0,0 +1,51 @@ +{ + "name": "isarray", + "description": "Array#isArray for older browsers", + "version": "0.0.1", + "repository": { + "type": "git", + "url": "git://github.com/juliangruber/isarray.git" + }, + "homepage": "https://github.com/juliangruber/isarray", + "main": "index.js", + "scripts": { + "test": "tap test/*.js" + }, + "dependencies": {}, + "devDependencies": { + "tap": "*" + }, + "keywords": [ + "browser", + "isarray", + "array" + ], + "author": { + "name": "Julian Gruber", + "email": "mail@juliangruber.com", + "url": "http://juliangruber.com" + }, + "license": "MIT", + "readme": "\n# isarray\n\n`Array#isArray` for older browsers.\n\n## Usage\n\n```js\nvar isArray = require('isarray');\n\nconsole.log(isArray([])); // => true\nconsole.log(isArray({})); // => false\n```\n\n## Installation\n\nWith [npm](http://npmjs.org) do\n\n```bash\n$ npm install isarray\n```\n\nThen bundle for the browser with\n[browserify](https://github.com/substack/browserify).\n\nWith [component](http://component.io) do\n\n```bash\n$ component install juliangruber/isarray\n```\n\n## License\n\n(MIT)\n\nCopyright (c) 2013 Julian Gruber <julian@juliangruber.com>\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\nof the Software, and to permit persons to whom the Software is furnished to do\nso, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n", + "readmeFilename": "README.md", + "_id": "isarray@0.0.1", + "dist": { + "shasum": "8a18acfca9a8f4177e09abfc6038939b05d1eedf", + "tarball": "http://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz" + }, + "_from": "isarray@0.0.1", + "_npmVersion": "1.2.18", + "_npmUser": { + "name": "juliangruber", + "email": "julian@juliangruber.com" + }, + "maintainers": [ + { + "name": "juliangruber", + "email": "julian@juliangruber.com" + } + ], + "directories": {}, + "_shasum": "8a18acfca9a8f4177e09abfc6038939b05d1eedf", + "_resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz" +} diff --git a/node_modules/socket.io/node_modules/has-binary-data/package.json b/node_modules/socket.io/node_modules/has-binary-data/package.json new file mode 100644 index 0000000..68ab889 --- /dev/null +++ b/node_modules/socket.io/node_modules/has-binary-data/package.json @@ -0,0 +1,36 @@ +{ + "name": "has-binary-data", + "version": "0.1.1", + "description": "A function that takes anything in javascript and returns true if its argument contains binary data.", + "dependencies": { + "isarray": "0.0.1" + }, + "devDependencies": { + "better-assert": "1.0.0", + "mocha": "1.17.1" + }, + "author": { + "name": "Kevin Roark" + }, + "license": "ISC", + "_id": "has-binary-data@0.1.1", + "dist": { + "shasum": "e10749fb87828a52df96f4086587eb4a03966439", + "tarball": "http://registry.npmjs.org/has-binary-data/-/has-binary-data-0.1.1.tgz" + }, + "_from": "has-binary-data@0.1.1", + "_npmVersion": "1.3.24", + "_npmUser": { + "name": "porkfat", + "email": "ker2143@columbia.edu" + }, + "maintainers": [ + { + "name": "porkfat", + "email": "ker2143@columbia.edu" + } + ], + "directories": {}, + "_shasum": "e10749fb87828a52df96f4086587eb4a03966439", + "_resolved": "https://registry.npmjs.org/has-binary-data/-/has-binary-data-0.1.1.tgz" +} diff --git a/node_modules/socket.io/node_modules/has-binary-data/test.js b/node_modules/socket.io/node_modules/has-binary-data/test.js new file mode 100644 index 0000000..c7f6993 --- /dev/null +++ b/node_modules/socket.io/node_modules/has-binary-data/test.js @@ -0,0 +1,29 @@ + +var hasBinary = require('./'); +var assert = require('better-assert'); +var fs = require('fs'); + +describe('has-binarydata', function(){ + + it('should work with buffer', function(){ + assert(hasBinary(fs.readFileSync('./test.js'))); + }); + + it('should work with an array that contains a buffer', function() { + var arr = [1, new Buffer('asdfasdf', 'utf8'), 2]; + assert(hasBinary(arr)); + }); + + if (global.ArrayBuffer) { + it('should work with an ArrayBuffer', function() { + assert(hasBinary(new ArrayBuffer())); + }); + } + + if (global.Blob) { + it('should work with a Blob', function() { + assert(hasBinary(new Blob())); + }); + } + +}); diff --git a/node_modules/socket.io/node_modules/socket.io-adapter/.npmignore b/node_modules/socket.io/node_modules/socket.io-adapter/.npmignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-adapter/.npmignore @@ -0,0 +1 @@ +node_modules diff --git a/node_modules/socket.io/node_modules/socket.io-adapter/History.md b/node_modules/socket.io/node_modules/socket.io-adapter/History.md new file mode 100644 index 0000000..d6a0003 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-adapter/History.md @@ -0,0 +1,10 @@ + +0.2.0 / 2014-03-14 +================== + + * upgraded faster parser + +0.1.0 / 2014-03-07 +================== + + * initial commit diff --git a/node_modules/socket.io/node_modules/socket.io-adapter/Readme.md b/node_modules/socket.io/node_modules/socket.io-adapter/Readme.md new file mode 100644 index 0000000..bcef653 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-adapter/Readme.md @@ -0,0 +1,16 @@ + +# socket.io-adapter + +Default socket.io in-memory adapter class. + +## How to use + +This module is not intended for end-user usage, but can be used as an +interface to inheirt from from other adapters you might want to build. + +As an example of an adapter that builds on top of this, please take a look +at [socket.io-redis](https://github.com/learnboost/socket.io-redis). + +## License + +MIT diff --git a/node_modules/socket.io/node_modules/socket.io-adapter/index.js b/node_modules/socket.io/node_modules/socket.io-adapter/index.js new file mode 100644 index 0000000..61138df --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-adapter/index.js @@ -0,0 +1,129 @@ + +/** + * Module dependencies. + */ + +var Emitter = require('events').EventEmitter; +var parser = require('socket.io-parser'); + +/** + * Module exports. + */ + +module.exports = Adapter; + +/** + * Memory adapter constructor. + * + * @param {Namespace} nsp + * @api public + */ + +function Adapter(nsp){ + this.nsp = nsp; + this.rooms = {}; + this.sids = {}; + this.encoder = new parser.Encoder(); +} + +/** + * Inherits from `EventEmitter`. + */ + +Adapter.prototype.__proto__ = Emitter.prototype; + +/** + * Adds a socket from a room. + * + * @param {String} socket id + * @param {String} room name + * @param {Function} callback + * @api public + */ + +Adapter.prototype.add = function(id, room, fn){ + this.sids[id] = this.sids[id] || {}; + this.sids[id][room] = true; + this.rooms[room] = this.rooms[room] || []; + this.rooms[room][id] = true; + if (fn) process.nextTick(fn.bind(null, null)); +}; + +/** + * Removes a socket from a room. + * + * @param {String} socket id + * @param {String} room name + * @param {Function} callback + * @api public + */ + +Adapter.prototype.del = function(id, room, fn){ + this.sids[id] = this.sids[id] || {}; + this.rooms[room] = this.rooms[room] || {}; + delete this.sids[id][room]; + delete this.rooms[room][id]; + if (fn) process.nextTick(fn.bind(null, null)); +}; + +/** + * Removes a socket from all rooms it's joined. + * + * @param {String} socket id + * @api public + */ + +Adapter.prototype.delAll = function(id, fn){ + var rooms = this.sids[id]; + if (rooms) { + for (var room in rooms) { + delete this.rooms[room][id]; + } + } + delete this.sids[id]; +}; + +/** + * Broadcasts a packet. + * + * Options: + * - `flags` {Object} flags for this packet + * - `except` {Array} sids that should be excluded + * - `rooms` {Array} list of rooms to broadcast to + * + * @param {Object} packet object + * @api public + */ + +Adapter.prototype.broadcast = function(packet, opts){ + var rooms = opts.rooms || []; + var except = opts.except || []; + var flags = opts.flags || {}; + var ids = {}; + var self = this; + var socket; + + packet.nsp = this.nsp.name; + this.encoder.encode(packet, function(encodedPackets) { + if (rooms.length) { + for (var i = 0; i < rooms.length; i++) { + var room = self.rooms[rooms[i]]; + if (!room) continue; + for (var id in room) { + if (ids[id] || ~except.indexOf(id)) continue; + socket = self.nsp.connected[id]; + if (socket) { + socket.packet(encodedPackets, true, flags.volatile); + ids[id] = true; + } + } + } + } else { + for (var id in self.sids) { + if (~except.indexOf(id)) continue; + socket = self.nsp.connected[id]; + if (socket) socket.packet(encodedPackets, true, flags.volatile); + } + } + }); +}; diff --git a/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/.npmignore b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/.npmignore new file mode 100644 index 0000000..7fbb06f --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/.npmignore @@ -0,0 +1,5 @@ +node_modules +build +components + +test diff --git a/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/.travis.yml b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/.travis.yml new file mode 100644 index 0000000..be696ff --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/.travis.yml @@ -0,0 +1,9 @@ +language: node_js +node_js: + - 0.10 +notifications: + irc: irc.freenode.org##socket.io +env: + global: + - secure: 28HHk1J0H64KNjzmmlxG/Ro0EPuLnhO0rU+kZjjthDHj/FaugIsqjAVQ1Dl6heWV2/MlVzw6nDCyMNiGwiVk0ruZPQ0SYdAKLplrdMtzAihbU3xx+ULFQPLM3SoW0ZFCEpe8dWPGy4WdgW7aLByeel9TJb3vlhAu7p7AvrcO7Fs= + - secure: rKEG0Cfw0vkw8thk63RHYG7h8XWYcBlvZ0w1IWpr2dAfnnLMi1palSTrBrFQc77flk7rN00zGIe76FhKydV9r4WWYAUYKPqo4k+9/FkpzjZlNtL49QRoNwC9jmJ8OeUwGowA13gZPyl/5P13wVaKCB0YrKnzz5LHo3Sp7So6J8U= diff --git a/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/.zuul.yml b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/.zuul.yml new file mode 100644 index 0000000..38bc342 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/.zuul.yml @@ -0,0 +1,16 @@ +ui: mocha-bdd +browsers: + - name: chrome + version: 29..latest + - name: firefox + version: latest + - name: safari + version: latest + - name: ie + version: 10 + platform: Windows 2012 + - name: ie + version: 9 + version: [6..9, latest] + - name: iphone + version: oldest..latest diff --git a/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/History.md b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/History.md new file mode 100644 index 0000000..6ed37f7 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/History.md @@ -0,0 +1,52 @@ + +2.1.2 / 2014-03-06 +================== + + * added support for binary in ACK packets + +2.1.1 / 2014-03-04 +================== + + * removed has-binary-data dependency + * fixed the object check in binary.removeBlobs + +2.1.0 / 2014-03-01 +================== + + * faster and smaller binary parser and protocol [kevin-roark] + +2.0.0 / 2014-02-19 +================== + + * binary support [kevin-roark] + +1.1.2 / 2014-02-11 +================== + + * package: bump `json3` to fix IE6-7 + +1.1.1 / 2014-02-10 +================== + + * package: bump debug to fix browserify issues + +1.1.0 / 2013-12-25 +================== + + * index: use `json3` + +1.0.3 / 2012-12-18 +================== + + * index: added instrumentation through `debug` + * index: make sure decoded `id` is a `Number` + +1.0.2 / 2012-12-18 +================== + + * index: allow for falsy values in `id` and `data` + +1.0.1 / 2012-12-10 +================== + + * Revision 1 diff --git a/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/Makefile b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/Makefile new file mode 100644 index 0000000..ee0a3b2 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/Makefile @@ -0,0 +1,11 @@ + +REPORTER = dot + +test: + @./node_modules/.bin/mocha \ + --reporter $(REPORTER) \ + --bail \ + test/index.js + @./node_modules/.bin/zuul -- test/index.js + +.PHONY: test diff --git a/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/Readme.md b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/Readme.md new file mode 100644 index 0000000..ffa43ea --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/Readme.md @@ -0,0 +1,5 @@ + +# socket.io-parser + +[![Build Status](https://secure.travis-ci.org/LearnBoost/socket.io-parser.png)](http://travis-ci.org/LearnBoost/socket.io-parser) +[![NPM version](https://badge.fury.io/js/socket.io-parser.png)](http://badge.fury.io/js/socket.io-parser) diff --git a/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/binary.js b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/binary.js new file mode 100644 index 0000000..4e96662 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/binary.js @@ -0,0 +1,152 @@ +/** + * Modle requirements + */ + +var isArray = require('isarray'); + +/** + * Replaces every Buffer | ArrayBuffer in packet with a numbered placeholder. + * Anything with blobs or files should be fed through removeBlobs before coming + * here. + * + * @param {Object} packet - socket.io event packet + * @return {Object} with deconstructed packet and list of buffers + * @api public + */ + +exports.deconstructPacket = function(packet) { + var buffers = []; + var packetData = packet.data; + + function deconstructBinPackRecursive(data) { + if (!data) return data; + + if ((global.Buffer && Buffer.isBuffer(data)) || + (global.ArrayBuffer && data instanceof ArrayBuffer)) { // replace binary + var placeholder = {_placeholder: true, num: buffers.length}; + buffers.push(data); + return placeholder; + } else if (isArray(data)) { + var newData = new Array(data.length); + for (var i = 0; i < data.length; i++) { + newData[i] = deconstructBinPackRecursive(data[i]); + } + return newData; + } else if ('object' == typeof data) { + var newData = {}; + for (var key in data) { + newData[key] = deconstructBinPackRecursive(data[key]); + } + return newData; + } + return data; + } + + var pack = packet; + pack.data = deconstructBinPackRecursive(packetData); + pack.attachments = buffers.length; // number of binary 'attachments' + return {packet: pack, buffers: buffers}; +} + +/** + * Reconstructs a binary packet from its placeholder packet and buffers + * + * @param {Object} packet - event packet with placeholders + * @param {Array} buffers - binary buffers to put in placeholder positions + * @return {Object} reconstructed packet + * @api public + */ + + exports.reconstructPacket = function(packet, buffers) { + var curPlaceHolder = 0; + + function reconstructBinPackRecursive(data) { + if (data._placeholder) { + var buf = buffers[data.num]; // appropriate buffer (should be natural order anyway) + return buf; + } else if (isArray(data)) { + for (var i = 0; i < data.length; i++) { + data[i] = reconstructBinPackRecursive(data[i]); + } + return data; + } else if ('object' == typeof data) { + for (var key in data) { + data[key] = reconstructBinPackRecursive(data[key]); + } + return data; + } + return data; + } + + packet.data = reconstructBinPackRecursive(packet.data); + packet.attachments = undefined; // no longer useful + return packet; + } + +/** + * Asynchronously removes Blobs or Files from data via + * FileReader's readAsArrayBuffer method. Used before encoding + * data as msgpack. Calls callback with the blobless data. + * + * @param {Object} data + * @param {Function} callback + * @api private + */ + +exports.removeBlobs = function(data, callback) { + + function removeBlobsRecursive(obj, curKey, containingObject) { + if (!obj) return obj; + + // convert any blob + if ((global.Blob && obj instanceof Blob) || + (global.File && obj instanceof File)) { + pendingBlobs++; + + // async filereader + var fileReader = new FileReader(); + fileReader.onload = function() { // this.result == arraybuffer + if (containingObject) { + containingObject[curKey] = this.result; + } + else { + bloblessData = this.result; + } + + // if nothing pending its callback time + if(! --pendingBlobs) { + callback(bloblessData); + } + }; + + fileReader.readAsArrayBuffer(obj); // blob -> arraybuffer + } + + if (isArray(obj)) { // handle array + for (var i = 0; i < obj.length; i++) { + removeBlobsRecursive(obj[i], i, obj); + } + } else if (obj && 'object' == typeof obj && !isBuf(obj)) { // and object + for (var key in obj) { + removeBlobsRecursive(obj[key], key, obj); + } + } + } + + var pendingBlobs = 0; + var bloblessData = data; + removeBlobsRecursive(bloblessData); + if (!pendingBlobs) { + callback(bloblessData); + } +} + +/** + * Returns true if obj is a buffer or an arraybuffer. + * + * @api private + */ +function isBuf(obj) { + return (global.Buffer && Buffer.isBuffer(obj)) || + (global.ArrayBuffer && obj instanceof ArrayBuffer); +} diff --git a/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/index.js b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/index.js new file mode 100644 index 0000000..8ae08c4 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/index.js @@ -0,0 +1,375 @@ + +/** + * Module dependencies. + */ + +var debug = require('debug')('socket.io-parser'); +var json = require('json3'); +var isArray = require('isarray'); +var Emitter = require('emitter'); +var binary = require('./binary'); + +/** + * Protocol version. + * + * @api public + */ + +exports.protocol = 1; + +/** + * Packet types. + * + * @api public + */ + +exports.types = [ + 'CONNECT', + 'DISCONNECT', + 'EVENT', + 'BINARY_EVENT', + 'ACK', + 'ERROR' +]; + +/** + * Packet type `connect`. + * + * @api public + */ + +exports.CONNECT = 0; + +/** + * Packet type `disconnect`. + * + * @api public + */ + +exports.DISCONNECT = 1; + +/** + * Packet type `event`. + * + * @api public + */ + +exports.EVENT = 2; + +/** + * Packet type `ack`. + * + * @api public + */ + +exports.ACK = 3; + +/** + * Packet type `error`. + * + * @api public + */ + +exports.ERROR = 4; + +/** + * Packet type 'binary event' + * + * @api public + */ + +exports.BINARY_EVENT = 5; + +exports.Encoder = Encoder + +/** + * A socket.io Encoder instance + * + * @api public + */ +function Encoder() {}; + +/** + * Encode a packet as a single string if non-binary, or as a + * buffer sequence, depending on packet type. + * + * @param {Object} obj - packet object + * @param {Function} callback - function to handle encodings (likely engine.write) + * @return Calls callback with Array of encodings + * @api public + */ + +Encoder.prototype.encode = function(obj, callback){ + debug('encoding packet %j', obj); + + if (exports.BINARY_EVENT == obj.type || exports.ACK == obj.type) { + encodeAsBinary(obj, callback); + } + else { + var encoding = encodeAsString(obj); + callback([encoding]); + } +}; + +/** + * Encode packet as string. + * + * @param {Object} packet + * @return {String} encoded + * @api private + */ + +function encodeAsString(obj) { + var str = ''; + var nsp = false; + + // first is type + str += obj.type; + + // attachments if we have them + if (exports.BINARY_EVENT == obj.type || exports.ACK == obj.type) { + str += obj.attachments; + str += '-'; + } + + // if we have a namespace other than `/` + // we append it followed by a comma `,` + if (obj.nsp && '/' != obj.nsp) { + nsp = true; + str += obj.nsp; + } + + // immediately followed by the id + if (null != obj.id) { + if (nsp) { + str += ','; + nsp = false; + } + str += obj.id; + } + + // json data + if (null != obj.data) { + if (nsp) str += ','; + str += json.stringify(obj.data); + } + + debug('encoded %j as %s', obj, str); + return str; +} + +/** + * Encode packet as 'buffer sequence' by removing blobs, and + * deconstructing packet into object with placeholders and + * a list of buffers. + * + * @param {Object} packet + * @return {Buffer} encoded + * @api private + */ + +function encodeAsBinary(obj, callback) { + + function writeEncoding(bloblessData) { + var deconstruction = binary.deconstructPacket(bloblessData); + var pack = encodeAsString(deconstruction.packet); + var buffers = deconstruction.buffers; + + buffers.unshift(pack); // add packet info to beginning of data list + callback(buffers); // write all the buffers + } + + binary.removeBlobs(obj, writeEncoding); +} + +exports.Decoder = Decoder + +/** + * A socket.io Decoder instance + * + * @return {Object} decoder + * @api public + */ + +function Decoder() { + this.reconstructor = null; +} + +/** + * Mix in `Emitter` with Decoder. + */ + +Emitter(Decoder.prototype); + +/** + * Decodes an ecoded packet string into packet JSON. + * + * @param {String} obj - encoded packet + * @return {Object} packet + * @api public + */ + +Decoder.prototype.add = function(obj) { + var packet; + if ('string' == typeof obj) { + packet = decodeString(obj); + if (exports.BINARY_EVENT == packet.type || exports.ACK == packet.type) { // binary packet's json + this.reconstructor = new BinaryReconstructor(packet); + + // no attachments, labeled binary but no binary data to follow + if (this.reconstructor.reconPack.attachments == 0) { + this.emit('decoded', packet); + } + } else { // non-binary full packet + this.emit('decoded', packet); + } + } + else if ((global.Buffer && Buffer.isBuffer(obj)) || + (global.ArrayBuffer && obj instanceof ArrayBuffer) || + obj.base64) { // raw binary data + if (!this.reconstructor) { + throw new Error('got binary data when not reconstructing a packet'); + } else { + packet = this.reconstructor.takeBinaryData(obj); + if (packet) { // received final buffer + this.reconstructor = null; + this.emit('decoded', packet); + } + } + } + else { + throw new Error('Unknown type: ' + obj); + } +} + +/** + * Decode a packet String (JSON data) + * + * @param {String} str + * @return {Object} packet + * @api private + */ + +function decodeString(str) { + var p = {}; + var i = 0; + + // look up type + p.type = Number(str.charAt(0)); + if (null == exports.types[p.type]) return error(); + + // look up attachments if type binary + if (exports.BINARY_EVENT == p.type || exports.ACK == p.type) { + p.attachments = ''; + while (str.charAt(++i) != '-') { + p.attachments += str.charAt(i); + } + p.attachments = Number(p.attachments); + } + + // look up namespace (if any) + if ('/' == str.charAt(i + 1)) { + p.nsp = ''; + while (++i) { + var c = str.charAt(i); + if (',' == c) break; + p.nsp += c; + if (i + 1 == str.length) break; + } + } else { + p.nsp = '/'; + } + + // look up id + var next = str.charAt(i + 1); + if ('' != next && Number(next) == next) { + p.id = ''; + while (++i) { + var c = str.charAt(i); + if (null == c || Number(c) != c) { + --i; + break; + } + p.id += str.charAt(i); + if (i + 1 == str.length) break; + } + p.id = Number(p.id); + } + + // look up json data + if (str.charAt(++i)) { + try { + p.data = json.parse(str.substr(i)); + } catch(e){ + return error(); + } + } + + debug('decoded %s as %j', str, p); + return p; +}; + +/** + * Deallocates a parser's resources + * + * @api public + */ + +Decoder.prototype.destroy = function() { + if (this.reconstructor) { + this.reconstructor.finishedReconstruction(); + } +} + +/** + * A manager of a binary event's 'buffer sequence'. Should + * be constructed whenever a packet of type BINARY_EVENT is + * decoded. + * + * @param {Object} packet + * @return {BinaryReconstructor} initialized reconstructor + * @api private + */ + +function BinaryReconstructor(packet) { + this.reconPack = packet; + this.buffers = []; +} + +/** + * Method to be called when binary data received from connection + * after a BINARY_EVENT packet. + * + * @param {Buffer | ArrayBuffer} binData - the raw binary data received + * @return {null | Object} returns null if more binary data is expected or + * a reconstructed packet object if all buffers have been received. + * @api private + */ + +BinaryReconstructor.prototype.takeBinaryData = function(binData) { + this.buffers.push(binData); + if (this.buffers.length == this.reconPack.attachments) { // done with buffer list + var packet = binary.reconstructPacket(this.reconPack, this.buffers); + this.finishedReconstruction(); + return packet; + } + return null; +} + +/** + * Cleans up binary packet reconstruction variables. + * + * @api private + */ + +BinaryReconstructor.prototype.finishedReconstruction = function() { + this.reconPack = null; + this.buffers = []; +} + +function error(data){ + return { + type: exports.ERROR, + data: 'parser error' + }; +} diff --git a/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/emitter/.gitignore b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/emitter/.gitignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/emitter/.gitignore @@ -0,0 +1 @@ +node_modules diff --git a/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/emitter/History.md b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/emitter/History.md new file mode 100644 index 0000000..b0d371a --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/emitter/History.md @@ -0,0 +1,31 @@ + +1.0.1 / 2013-06-27 +================== + + * add support for legacy ie + +1.0.0 / 2013-02-26 +================== + + * add `.off()` support for removing all listeners + +0.0.6 / 2012-10-08 +================== + + * add `this._callbacks` initialization to prevent funky gotcha + +0.0.5 / 2012-09-07 +================== + + * fix `Emitter.call(this)` usage + +0.0.3 / 2012-07-11 +================== + + * add `.listeners()` + * rename `.has()` to `.hasListeners()` + +0.0.2 / 2012-06-28 +================== + + * fix `.off()` with `.once()`-registered callbacks diff --git a/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/emitter/Makefile b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/emitter/Makefile new file mode 100644 index 0000000..4e9c8d3 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/emitter/Makefile @@ -0,0 +1,7 @@ + +test: + @./node_modules/.bin/mocha \ + --require should \ + --reporter spec + +.PHONY: test \ No newline at end of file diff --git a/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/emitter/Readme.md b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/emitter/Readme.md new file mode 100644 index 0000000..134d6c0 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/emitter/Readme.md @@ -0,0 +1,69 @@ +# Emitter + + Event emitter component. + +## Installation + +``` +$ component install component/emitter +``` + +## API + +### Emitter(obj) + + The `Emitter` may also be used as a mixin. For example + a "plain" object may become an emitter, or you may + extend an existing prototype. + + As an `Emitter` instance: + +```js +var Emitter = require('emitter'); +var emitter = new Emitter; +emitter.emit('something'); +``` + + As a mixin: + +```js +var Emitter = require('emitter'); +var user = { name: 'tobi' }; +Emitter(user); + +user.emit('im a user'); +``` + + As a prototype mixin: + +```js +var Emitter = require('emitter'); +Emitter(User.prototype); +``` + +### Emitter#on(event, fn) + + Register an `event` handler `fn`. + +### Emitter#once(event, fn) + + Register a single-shot `event` handler `fn`, + removed immediately after it is invoked the + first time. + +### Emitter#off(event, fn) + + Remove `event` handler `fn`, or pass only the `event` + name to remove all handlers for `event`. + +### Emitter#emit(event, ...) + + Emit an `event` with variable option args. + +### Emitter#listeners(event) + + Return an array of callbacks, or an empty array. + +### Emitter#hasListeners(event) + + Check if this emitter has `event` handlers. \ No newline at end of file diff --git a/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/emitter/component.json b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/emitter/component.json new file mode 100644 index 0000000..af94e53 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/emitter/component.json @@ -0,0 +1,11 @@ +{ + "name": "emitter", + "description": "Event emitter", + "keywords": ["emitter", "events"], + "dependencies": { + "component/indexof": "*" + }, + "version": "1.0.1", + "scripts": ["index.js"], + "license": "MIT" +} diff --git a/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/emitter/index.js b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/emitter/index.js new file mode 100644 index 0000000..785897e --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/emitter/index.js @@ -0,0 +1,162 @@ + +/** + * Module dependencies. + */ + +var index = require('indexof'); + +/** + * Expose `Emitter`. + */ + +module.exports = Emitter; + +/** + * Initialize a new `Emitter`. + * + * @api public + */ + +function Emitter(obj) { + if (obj) return mixin(obj); +}; + +/** + * Mixin the emitter properties. + * + * @param {Object} obj + * @return {Object} + * @api private + */ + +function mixin(obj) { + for (var key in Emitter.prototype) { + obj[key] = Emitter.prototype[key]; + } + return obj; +} + +/** + * Listen on the given `event` with `fn`. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + +Emitter.prototype.on = function(event, fn){ + this._callbacks = this._callbacks || {}; + (this._callbacks[event] = this._callbacks[event] || []) + .push(fn); + return this; +}; + +/** + * Adds an `event` listener that will be invoked a single + * time then automatically removed. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + +Emitter.prototype.once = function(event, fn){ + var self = this; + this._callbacks = this._callbacks || {}; + + function on() { + self.off(event, on); + fn.apply(this, arguments); + } + + fn._off = on; + this.on(event, on); + return this; +}; + +/** + * Remove the given callback for `event` or all + * registered callbacks. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + +Emitter.prototype.off = +Emitter.prototype.removeListener = +Emitter.prototype.removeAllListeners = function(event, fn){ + this._callbacks = this._callbacks || {}; + + // all + if (0 == arguments.length) { + this._callbacks = {}; + return this; + } + + // specific event + var callbacks = this._callbacks[event]; + if (!callbacks) return this; + + // remove all handlers + if (1 == arguments.length) { + delete this._callbacks[event]; + return this; + } + + // remove specific handler + var i = index(callbacks, fn._off || fn); + if (~i) callbacks.splice(i, 1); + return this; +}; + +/** + * Emit `event` with the given args. + * + * @param {String} event + * @param {Mixed} ... + * @return {Emitter} + */ + +Emitter.prototype.emit = function(event){ + this._callbacks = this._callbacks || {}; + var args = [].slice.call(arguments, 1) + , callbacks = this._callbacks[event]; + + if (callbacks) { + callbacks = callbacks.slice(0); + for (var i = 0, len = callbacks.length; i < len; ++i) { + callbacks[i].apply(this, args); + } + } + + return this; +}; + +/** + * Return array of callbacks for `event`. + * + * @param {String} event + * @return {Array} + * @api public + */ + +Emitter.prototype.listeners = function(event){ + this._callbacks = this._callbacks || {}; + return this._callbacks[event] || []; +}; + +/** + * Check if this emitter has `event` handlers. + * + * @param {String} event + * @return {Boolean} + * @api public + */ + +Emitter.prototype.hasListeners = function(event){ + return !! this.listeners(event).length; +}; diff --git a/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/emitter/package.json b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/emitter/package.json new file mode 100644 index 0000000..688cf8f --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/emitter/package.json @@ -0,0 +1,23 @@ +{ + "name": "emitter", + "description": "Event emitter", + "version": "1.0.1", + "dependencies": { + "indexof": "0.0.1" + }, + "devDependencies": { + "mocha": "*", + "should": "*" + }, + "component": { + "scripts": { + "emitter": "index.js" + } + }, + "readme": "# Emitter\n\n Event emitter component.\n\n## Installation\n\n```\n$ component install component/emitter\n```\n\n## API\n\n### Emitter(obj)\n\n The `Emitter` may also be used as a mixin. For example\n a \"plain\" object may become an emitter, or you may\n extend an existing prototype.\n\n As an `Emitter` instance:\n\n```js\nvar Emitter = require('emitter');\nvar emitter = new Emitter;\nemitter.emit('something');\n```\n\n As a mixin:\n\n```js\nvar Emitter = require('emitter');\nvar user = { name: 'tobi' };\nEmitter(user);\n\nuser.emit('im a user');\n```\n\n As a prototype mixin:\n\n```js\nvar Emitter = require('emitter');\nEmitter(User.prototype);\n```\n \n### Emitter#on(event, fn)\n\n Register an `event` handler `fn`.\n\n### Emitter#once(event, fn)\n\n Register a single-shot `event` handler `fn`,\n removed immediately after it is invoked the\n first time.\n\n### Emitter#off(event, fn)\n\n Remove `event` handler `fn`, or pass only the `event`\n name to remove all handlers for `event`.\n\n### Emitter#emit(event, ...)\n\n Emit an `event` with variable option args.\n\n### Emitter#listeners(event)\n\n Return an array of callbacks, or an empty array.\n\n### Emitter#hasListeners(event)\n\n Check if this emitter has `event` handlers.", + "readmeFilename": "Readme.md", + "_id": "emitter@1.0.1", + "_shasum": "ecf2b3245322eefd38409ffb899e0d0003fa6fe9", + "_from": "http://github.com/component/emitter/archive/1.0.1.tar.gz", + "_resolved": "http://github.com/component/emitter/archive/1.0.1.tar.gz" +} diff --git a/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/emitter/test/emitter.js b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/emitter/test/emitter.js new file mode 100644 index 0000000..02521f3 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/emitter/test/emitter.js @@ -0,0 +1,194 @@ + +var Emitter = require('..'); + +function Custom() { + Emitter.call(this) +} + +Custom.prototype.__proto__ = Emitter.prototype; + +describe('Custom', function(){ + describe('with Emitter.call(this)', function(){ + it('should work', function(done){ + var emitter = new Custom; + emitter.on('foo', done); + emitter.emit('foo'); + }) + }) +}) + +describe('Emitter', function(){ + describe('.on(event, fn)', function(){ + it('should add listeners', function(){ + var emitter = new Emitter; + var calls = []; + + emitter.on('foo', function(val){ + calls.push('one', val); + }); + + emitter.on('foo', function(val){ + calls.push('two', val); + }); + + emitter.emit('foo', 1); + emitter.emit('bar', 1); + emitter.emit('foo', 2); + + calls.should.eql([ 'one', 1, 'two', 1, 'one', 2, 'two', 2 ]); + }) + }) + + describe('.once(event, fn)', function(){ + it('should add a single-shot listener', function(){ + var emitter = new Emitter; + var calls = []; + + emitter.once('foo', function(val){ + calls.push('one', val); + }); + + emitter.emit('foo', 1); + emitter.emit('foo', 2); + emitter.emit('foo', 3); + emitter.emit('bar', 1); + + calls.should.eql([ 'one', 1 ]); + }) + }) + + describe('.off(event, fn)', function(){ + it('should remove a listener', function(){ + var emitter = new Emitter; + var calls = []; + + function one() { calls.push('one'); } + function two() { calls.push('two'); } + + emitter.on('foo', one); + emitter.on('foo', two); + emitter.off('foo', two); + + emitter.emit('foo'); + + calls.should.eql([ 'one' ]); + }) + + it('should work with .once()', function(){ + var emitter = new Emitter; + var calls = []; + + function one() { calls.push('one'); } + + emitter.once('foo', one); + emitter.off('foo', one); + + emitter.emit('foo'); + + calls.should.eql([]); + }) + + it('should work when called from an event', function(){ + var emitter = new Emitter + , called + function b () { + called = true; + } + emitter.on('tobi', function () { + emitter.off('tobi', b); + }); + emitter.on('tobi', b); + emitter.emit('tobi'); + called.should.be.true; + called = false; + emitter.emit('tobi'); + called.should.be.false; + }); + }) + + describe('.off(event)', function(){ + it('should remove all listeners for an event', function(){ + var emitter = new Emitter; + var calls = []; + + function one() { calls.push('one'); } + function two() { calls.push('two'); } + + emitter.on('foo', one); + emitter.on('foo', two); + emitter.off('foo'); + + emitter.emit('foo'); + emitter.emit('foo'); + + calls.should.eql([]); + }) + }) + + describe('.off()', function(){ + it('should remove all listeners', function(){ + var emitter = new Emitter; + var calls = []; + + function one() { calls.push('one'); } + function two() { calls.push('two'); } + + emitter.on('foo', one); + emitter.on('bar', two); + + emitter.emit('foo'); + emitter.emit('bar'); + + emitter.off(); + + emitter.emit('foo'); + emitter.emit('bar'); + + calls.should.eql(['one', 'two']); + }) + }) + + describe('.listeners(event)', function(){ + describe('when handlers are present', function(){ + it('should return an array of callbacks', function(){ + var emitter = new Emitter; + function foo(){} + emitter.on('foo', foo); + emitter.listeners('foo').should.eql([foo]); + }) + }) + + describe('when no handlers are present', function(){ + it('should return an empty array', function(){ + var emitter = new Emitter; + emitter.listeners('foo').should.eql([]); + }) + }) + }) + + describe('.hasListeners(event)', function(){ + describe('when handlers are present', function(){ + it('should return true', function(){ + var emitter = new Emitter; + emitter.on('foo', function(){}); + emitter.hasListeners('foo').should.be.true; + }) + }) + + describe('when no handlers are present', function(){ + it('should return false', function(){ + var emitter = new Emitter; + emitter.hasListeners('foo').should.be.false; + }) + }) + }) +}) + +describe('Emitter(obj)', function(){ + it('should mixin', function(done){ + var proto = {}; + Emitter(proto); + proto.on('something', done); + proto.emit('something'); + }) +}) diff --git a/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/isarray/README.md b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/isarray/README.md new file mode 100644 index 0000000..052a62b --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/isarray/README.md @@ -0,0 +1,54 @@ + +# isarray + +`Array#isArray` for older browsers. + +## Usage + +```js +var isArray = require('isarray'); + +console.log(isArray([])); // => true +console.log(isArray({})); // => false +``` + +## Installation + +With [npm](http://npmjs.org) do + +```bash +$ npm install isarray +``` + +Then bundle for the browser with +[browserify](https://github.com/substack/browserify). + +With [component](http://component.io) do + +```bash +$ component install juliangruber/isarray +``` + +## License + +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/isarray/build/build.js b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/isarray/build/build.js new file mode 100644 index 0000000..ec58596 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/isarray/build/build.js @@ -0,0 +1,209 @@ + +/** + * Require the given path. + * + * @param {String} path + * @return {Object} exports + * @api public + */ + +function require(path, parent, orig) { + var resolved = require.resolve(path); + + // lookup failed + if (null == resolved) { + orig = orig || path; + parent = parent || 'root'; + var err = new Error('Failed to require "' + orig + '" from "' + parent + '"'); + err.path = orig; + err.parent = parent; + err.require = true; + throw err; + } + + var module = require.modules[resolved]; + + // perform real require() + // by invoking the module's + // registered function + if (!module.exports) { + module.exports = {}; + module.client = module.component = true; + module.call(this, module.exports, require.relative(resolved), module); + } + + return module.exports; +} + +/** + * Registered modules. + */ + +require.modules = {}; + +/** + * Registered aliases. + */ + +require.aliases = {}; + +/** + * Resolve `path`. + * + * Lookup: + * + * - PATH/index.js + * - PATH.js + * - PATH + * + * @param {String} path + * @return {String} path or null + * @api private + */ + +require.resolve = function(path) { + if (path.charAt(0) === '/') path = path.slice(1); + var index = path + '/index.js'; + + var paths = [ + path, + path + '.js', + path + '.json', + path + '/index.js', + path + '/index.json' + ]; + + for (var i = 0; i < paths.length; i++) { + var path = paths[i]; + if (require.modules.hasOwnProperty(path)) return path; + } + + if (require.aliases.hasOwnProperty(index)) { + return require.aliases[index]; + } +}; + +/** + * Normalize `path` relative to the current path. + * + * @param {String} curr + * @param {String} path + * @return {String} + * @api private + */ + +require.normalize = function(curr, path) { + var segs = []; + + if ('.' != path.charAt(0)) return path; + + curr = curr.split('/'); + path = path.split('/'); + + for (var i = 0; i < path.length; ++i) { + if ('..' == path[i]) { + curr.pop(); + } else if ('.' != path[i] && '' != path[i]) { + segs.push(path[i]); + } + } + + return curr.concat(segs).join('/'); +}; + +/** + * Register module at `path` with callback `definition`. + * + * @param {String} path + * @param {Function} definition + * @api private + */ + +require.register = function(path, definition) { + require.modules[path] = definition; +}; + +/** + * Alias a module definition. + * + * @param {String} from + * @param {String} to + * @api private + */ + +require.alias = function(from, to) { + if (!require.modules.hasOwnProperty(from)) { + throw new Error('Failed to alias "' + from + '", it does not exist'); + } + require.aliases[to] = from; +}; + +/** + * Return a require function relative to the `parent` path. + * + * @param {String} parent + * @return {Function} + * @api private + */ + +require.relative = function(parent) { + var p = require.normalize(parent, '..'); + + /** + * lastIndexOf helper. + */ + + function lastIndexOf(arr, obj) { + var i = arr.length; + while (i--) { + if (arr[i] === obj) return i; + } + return -1; + } + + /** + * The relative require() itself. + */ + + function localRequire(path) { + var resolved = localRequire.resolve(path); + return require(resolved, parent, path); + } + + /** + * Resolve relative to the parent. + */ + + localRequire.resolve = function(path) { + var c = path.charAt(0); + if ('/' == c) return path.slice(1); + if ('.' == c) return require.normalize(p, path); + + // resolve deps by returning + // the dep in the nearest "deps" + // directory + var segs = parent.split('/'); + var i = lastIndexOf(segs, 'deps') + 1; + if (!i) i = 0; + path = segs.slice(0, i + 1).join('/') + '/deps/' + path; + return path; + }; + + /** + * Check if module is defined at `path`. + */ + + localRequire.exists = function(path) { + return require.modules.hasOwnProperty(localRequire.resolve(path)); + }; + + return localRequire; +}; +require.register("isarray/index.js", function(exports, require, module){ +module.exports = Array.isArray || function (arr) { + return Object.prototype.toString.call(arr) == '[object Array]'; +}; + +}); +require.alias("isarray/index.js", "isarray/index.js"); + diff --git a/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/isarray/component.json b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/isarray/component.json new file mode 100644 index 0000000..9e31b68 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/isarray/component.json @@ -0,0 +1,19 @@ +{ + "name" : "isarray", + "description" : "Array#isArray for older browsers", + "version" : "0.0.1", + "repository" : "juliangruber/isarray", + "homepage": "https://github.com/juliangruber/isarray", + "main" : "index.js", + "scripts" : [ + "index.js" + ], + "dependencies" : {}, + "keywords": ["browser","isarray","array"], + "author": { + "name": "Julian Gruber", + "email": "mail@juliangruber.com", + "url": "http://juliangruber.com" + }, + "license": "MIT" +} diff --git a/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/isarray/index.js b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/isarray/index.js new file mode 100644 index 0000000..5f5ad45 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/isarray/index.js @@ -0,0 +1,3 @@ +module.exports = Array.isArray || function (arr) { + return Object.prototype.toString.call(arr) == '[object Array]'; +}; diff --git a/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/isarray/package.json b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/isarray/package.json new file mode 100644 index 0000000..04d6a3f --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/isarray/package.json @@ -0,0 +1,51 @@ +{ + "name": "isarray", + "description": "Array#isArray for older browsers", + "version": "0.0.1", + "repository": { + "type": "git", + "url": "git://github.com/juliangruber/isarray.git" + }, + "homepage": "https://github.com/juliangruber/isarray", + "main": "index.js", + "scripts": { + "test": "tap test/*.js" + }, + "dependencies": {}, + "devDependencies": { + "tap": "*" + }, + "keywords": [ + "browser", + "isarray", + "array" + ], + "author": { + "name": "Julian Gruber", + "email": "mail@juliangruber.com", + "url": "http://juliangruber.com" + }, + "license": "MIT", + "readme": "\n# isarray\n\n`Array#isArray` for older browsers.\n\n## Usage\n\n```js\nvar isArray = require('isarray');\n\nconsole.log(isArray([])); // => true\nconsole.log(isArray({})); // => false\n```\n\n## Installation\n\nWith [npm](http://npmjs.org) do\n\n```bash\n$ npm install isarray\n```\n\nThen bundle for the browser with\n[browserify](https://github.com/substack/browserify).\n\nWith [component](http://component.io) do\n\n```bash\n$ component install juliangruber/isarray\n```\n\n## License\n\n(MIT)\n\nCopyright (c) 2013 Julian Gruber <julian@juliangruber.com>\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\nof the Software, and to permit persons to whom the Software is furnished to do\nso, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n", + "readmeFilename": "README.md", + "_id": "isarray@0.0.1", + "dist": { + "shasum": "8a18acfca9a8f4177e09abfc6038939b05d1eedf", + "tarball": "http://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz" + }, + "_from": "isarray@0.0.1", + "_npmVersion": "1.2.18", + "_npmUser": { + "name": "juliangruber", + "email": "julian@juliangruber.com" + }, + "maintainers": [ + { + "name": "juliangruber", + "email": "julian@juliangruber.com" + } + ], + "directories": {}, + "_shasum": "8a18acfca9a8f4177e09abfc6038939b05d1eedf", + "_resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz" +} diff --git a/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/json3/.gitmodules b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/json3/.gitmodules new file mode 100644 index 0000000..dc5a174 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/json3/.gitmodules @@ -0,0 +1,6 @@ +[submodule "vendor/spec"] + path = vendor/spec + url = git://github.com/kitcambridge/spec.git +[submodule "vendor/marked"] + path = vendor/marked + url = git://github.com/chjj/marked.git diff --git a/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/json3/.jamignore b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/json3/.jamignore new file mode 100644 index 0000000..ab53ee0 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/json3/.jamignore @@ -0,0 +1,10 @@ +.* +build.js +index.html +component.json +bower.json +index.js +benchmark +page +test +vendor diff --git a/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/json3/.npmignore b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/json3/.npmignore new file mode 100644 index 0000000..6b67b55 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/json3/.npmignore @@ -0,0 +1,11 @@ +bower.json +component.json +build.js +index.html +index.js +.jshintrc + +benchmark +page +test +vendor diff --git a/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/json3/.travis.yml b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/json3/.travis.yml new file mode 100644 index 0000000..d8e3ae7 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/json3/.travis.yml @@ -0,0 +1,33 @@ +language: node_js +node_js: + - "0.6" + - "0.8" + - "0.10" +env: + matrix: + - BIN="node" + - BIN="phantomjs" +matrix: + include: + - node_js: "0.10" + env: BIN="narwhal" + - node_js: "0.10" + env: BIN="rhino" + - node_js: "0.10" + env: BIN="ringo" +git: + depth: 10 +branches: + only: + - gh-pages +before_install: + - "[ $BIN == 'istanbul' ] && npm i -g istanbul@\"~0.1.0\" || true" + - "[ $BIN == 'narwhal' ] && wget https://github.com/280north/narwhal/archive/v0.3.2.zip && sudo unzip v0.3.2 -d /opt/ && rm v0.3.2.zip || true" + - "[ $BIN == 'narwhal' ] && sudo ln -s /opt/narwhal-0.3.2/bin/narwhal /usr/local/bin/narwhal && sudo chmod +x /usr/local/bin/narwhal || true" + - "[ $BIN == 'rhino' ] && sudo mkdir /opt/rhino-1.7R5 && sudo wget -O /opt/rhino-1.7R5/js.jar https://oss.sonatype.org/content/repositories/snapshots/org/mozilla/rhino/1.7R5-SNAPSHOT/rhino-1.7R5-20120629.144839-4.jar || true" + - "[ $BIN == 'rhino' ] && echo -e '#!/bin/sh\\njava -jar /opt/rhino-1.7R5/js.jar $@' | sudo tee /usr/local/bin/rhino && sudo chmod +x /usr/local/bin/rhino || true" + - "[ $BIN == 'ringo' ] && wget http://ringojs.org/downloads/ringojs-0.9.zip && sudo unzip ringojs-0.9 -d /opt && rm ringojs-0.9.zip || true" + - "[ $BIN == 'ringo' ] && sudo ln -s /opt/ringojs-0.9/bin/ringo /usr/local/bin/ringo && sudo chmod +x /usr/local/bin/ringo || true" +install: true +script: + - "[ $BIN == 'istanbul' ] && $BIN cover ./test/test_json3.js || cd test && $BIN ./test_json3.js" diff --git a/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/json3/LICENSE b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/json3/LICENSE new file mode 100644 index 0000000..6d42c54 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/json3/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2012-2013 Kit Cambridge. +http://kitcambridge.be/ + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/json3/README.md b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/json3/README.md new file mode 100644 index 0000000..bcb807a --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/json3/README.md @@ -0,0 +1,126 @@ +# JSON 3 # + +![JSON 3 Logo](http://bestiejs.github.io/json3/page/logo.png) + +**JSON 3** is a modern JSON implementation compatible with a variety of JavaScript platforms, including Internet Explorer 6, Opera 7, Safari 2, and Netscape 6. The current version is **3.2.6**. + +- [Development Version](https://raw.github.com/bestiejs/json3/v3.2.6/lib/json3.js) *(40 KB; uncompressed with comments)* +- [Production Version](https://raw.github.com/bestiejs/json3/v3.2.6/lib/json3.min.js) *(3.3 KB; compressed and `gzip`-ped)* + +CDN copies are also available at [cdnjs](http://cdnjs.com/libraries/json3/) & [jsDelivr](http://www.jsdelivr.com/#!json3). + +[JSON](http://json.org/) is a language-independent data interchange format based on a loose subset of the JavaScript grammar. Originally popularized by [Douglas Crockford](http://www.crockford.com/), the format was standardized in the [fifth edition](http://es5.github.com/) of the ECMAScript specification. The 5.1 edition, ratified in June 2011, incorporates several modifications to the grammar pertaining to the serialization of dates. + +JSON 3 exposes two functions: `stringify()` for [serializing](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/JSON/stringify) a JavaScript value to JSON, and `parse()` for [producing](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/JSON/parse) a JavaScript value from a JSON source string. It is a **drop-in replacement** for [JSON 2](http://json.org/js). The functions behave exactly as described in the ECMAScript spec, **except** for the date serialization discrepancy noted below. + +The JSON 3 parser does **not** use `eval` or regular expressions. This provides security and performance benefits in obsolete and mobile environments, where the margin is particularly significant. The complete [benchmark suite](http://jsperf.com/json3) is available on [jsPerf](http://jsperf.com/). + +The project is [hosted on GitHub](http://git.io/json3), along with the [unit tests](http://bestiejs.github.io/json3/test/test_browser.html). It is part of the [BestieJS](https://github.com/bestiejs) family, a collection of best-in-class JavaScript libraries that promote cross-platform support, specification precedents, unit testing, and plenty of documentation. + +# Changes from JSON 2 # + +JSON 3... + +* Correctly serializes primitive wrapper objects. +* Throws a `TypeError` when serializing cyclic structures (JSON 2 recurses until the call stack overflows). +* Utilizes **feature tests** to detect broken or incomplete *native* JSON implementations (JSON 2 only checks for the presence of the native functions). The tests are only executed once at runtime, so there is no additional performance cost when parsing or serializing values. + +**As of v3.2.3**, JSON 3 is compatible with [Prototype](http://prototypejs.org) 1.6.1 and older. + +In contrast to JSON 2, JSON 3 **does not**... + +* Add `toJSON()` methods to the `Boolean`, `Number`, and `String` prototypes. These are not part of any standard, and are made redundant by the design of the `stringify()` implementation. +* Add `toJSON()` or `toISOString()` methods to `Date.prototype`. See the note about date serialization below. + +## Date Serialization + +**JSON 3 deviates from the specification in one important way**: it does not define `Date#toISOString()` or `Date#toJSON()`. This preserves CommonJS compatibility and avoids polluting native prototypes. Instead, date serialization is performed internally by the `stringify()` implementation: if a date object does not define a custom `toJSON()` method, it is serialized as a [simplified ISO 8601 date-time string](http://es5.github.com/#x15.9.1.15). + +**Several native `Date#toJSON()` implementations produce date time strings that do *not* conform to the grammar outlined in the spec**. For instance, all versions of Safari 4, as well as JSON 2, fail to serialize extended years correctly. Furthermore, JSON 2 and older implementations omit the milliseconds from the date-time string (optional in ES 5, but required in 5.1). Finally, in all versions of Safari 4 and 5, serializing an invalid date will produce the string `"Invalid Date"`, rather than `null`. Because these environments exhibit other serialization bugs, however, JSON 3 will override the native `stringify()` implementation. + +Portions of the date serialization code are adapted from the [`date-shim`](https://github.com/Yaffle/date-shim) project. + +# Usage # + +## Web Browsers + + + + +## CommonJS Environments + + var JSON3 = require("./path/to/json3"); + JSON3.parse("[1, 2, 3]"); + // => [1, 2, 3] + +## JavaScript Engines + + load("path/to/json3.js"); + JSON.stringify({"Hello": 123, "Good-bye": 456}, ["Hello"], "\t"); + // => '{\n\t"Hello": 123\n}' + +# Compatibility # + +JSON 3 has been **tested** with the following web browsers, CommonJS environments, and JavaScript engines. + +## Web Browsers + +- Windows [Internet Explorer](http://www.microsoft.com/windows/internet-explorer), version 6.0 and higher +- Mozilla [Firefox](http://www.mozilla.com/firefox), version 1.0 and higher +- Apple [Safari](http://www.apple.com/safari), version 2.0 and higher +- [Opera](http://www.opera.com) 7.02 and higher +- [Mozilla](http://sillydog.org/narchive/gecko.php) 1.0, [Netscape](http://sillydog.org/narchive/) 6.2.3, and [SeaMonkey](http://www.seamonkey-project.org/) 1.0 and higher + +## CommonJS Environments + +- [Node](http://nodejs.org/) 0.2.6 and higher +- [RingoJS](http://ringojs.org/) 0.4 and higher +- [Narwhal](http://narwhaljs.org/) 0.3.2 and higher + +## JavaScript Engines + +- Mozilla [Rhino](http://www.mozilla.org/rhino) 1.5R5 and higher +- WebKit [JSC](https://trac.webkit.org/wiki/JSC) +- Google [V8](http://code.google.com/p/v8) + +## Known Incompatibilities + +* Attempting to serialize the `arguments` object may produce inconsistent results across environments due to specification version differences. As a workaround, please convert the `arguments` object to an array first: `JSON.stringify([].slice.call(arguments, 0))`. + +## Required Native Methods + +JSON 3 assumes that the following methods exist and function as described in the ECMAScript specification: + +- The `Number`, `String`, `Array`, `Object`, `Date`, `SyntaxError`, and `TypeError` constructors. +- `String.fromCharCode` +- `Object#toString` +- `Function#call` +- `Math.floor` +- `Number#toString` +- `Date#valueOf` +- `String.prototype`: `indexOf`, `charCodeAt`, `charAt`, `slice`. +- `Array.prototype`: `push`, `pop`, `join`. + +# Contribute # + +Check out a working copy of the JSON 3 source code with [Git](http://git-scm.com/): + + $ git clone git://github.com/bestiejs/json3.git + $ cd json3 + $ git submodule update --init + +If you'd like to contribute a feature or bug fix, you can [fork](http://help.github.com/fork-a-repo/) JSON 3, commit your changes, and [send a pull request](http://help.github.com/send-pull-requests/). Please make sure to update the unit tests in the `test` directory as well. + +Alternatively, you can use the [GitHub issue tracker](https://github.com/bestiejs/json3/issues) to submit bug reports, feature requests, and questions, or send tweets to [@kitcambridge](http://twitter.com/kitcambridge). + +JSON 3 is released under the [MIT License](http://kit.mit-license.org/). \ No newline at end of file diff --git a/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/json3/coverage/coverage.json b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/json3/coverage/coverage.json new file mode 100644 index 0000000..07b9920 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/json3/coverage/coverage.json @@ -0,0 +1 @@ +{"/Users/kit/Dropbox/Projects/json3/vendor/spec/lib/spec.js":{"path":"/Users/kit/Dropbox/Projects/json3/vendor/spec/lib/spec.js","s":{"1":1,"2":1,"3":0,"4":1,"5":1,"6":0,"7":0,"8":0,"9":0,"10":1,"11":1,"12":1,"13":1,"14":1,"15":1,"16":1,"17":5538,"18":0,"19":5538,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":1,"35":1,"36":1,"37":1,"38":1,"39":1,"40":1,"41":1,"42":1,"43":1,"44":1,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":1,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":1,"71":26,"72":26,"73":0,"74":26,"75":26,"76":30,"77":0,"78":26,"79":0,"80":1,"81":1,"82":102,"83":102,"84":72,"85":30,"86":0,"87":30,"88":30,"89":0,"90":30,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0,"97":30,"98":0,"99":30,"100":22,"101":0,"102":30,"103":30,"104":30,"105":17,"106":17,"107":17,"108":17,"109":36,"110":0,"111":13,"112":13,"113":13,"114":15,"115":15,"116":13,"117":13,"118":15,"119":0,"120":13,"121":30,"122":30,"123":1,"124":51,"125":51,"126":0,"127":51,"128":1,"129":49,"130":49,"131":0,"132":49,"133":114,"134":0,"135":49,"136":1,"137":1,"138":1,"139":1,"140":0,"141":0,"142":0,"143":0,"144":1,"145":0,"146":0,"147":0,"148":0,"149":0,"150":1,"151":0,"152":0,"153":0,"154":0,"155":0,"156":0,"157":0,"158":1,"159":1,"160":11,"161":1,"162":1,"163":0,"164":0,"165":1,"166":1,"167":14,"168":1,"169":1,"170":34,"171":34,"172":34,"173":34,"174":34,"175":34,"176":34,"177":34,"178":1,"179":1,"180":11,"181":0,"182":11,"183":11,"184":11,"185":11,"186":11,"187":11,"188":11,"189":11,"190":22,"191":11,"192":11,"193":1,"194":1,"195":594,"196":594,"197":13,"198":594,"199":594,"200":298,"201":594,"202":594,"203":0,"204":0,"205":0,"206":0,"207":0,"208":594,"209":594,"210":594,"211":890,"212":890,"213":0,"214":594,"215":1,"216":1,"217":1,"218":1,"219":1,"220":1,"221":1,"222":1,"223":1,"224":1,"225":1,"226":8,"227":1,"228":1,"229":1,"230":11,"231":11,"232":11,"233":11,"234":1,"235":1,"236":1,"237":11,"238":11,"239":1,"240":1,"241":12,"242":12,"243":12,"244":0,"245":12,"246":11,"247":11,"248":11,"249":1,"250":1,"251":1,"252":296,"253":296,"254":296,"255":274,"256":274,"257":0,"258":0,"259":11,"260":11,"261":10,"262":10,"263":1,"264":1,"265":1,"266":1,"267":1,"268":1,"269":1,"270":1,"271":1,"272":0,"273":1,"274":1,"275":1,"276":11,"277":11,"278":0,"279":0,"280":11,"281":11,"282":11,"283":11,"284":1,"285":1,"286":1,"287":1,"288":1,"289":296,"290":296,"291":11,"292":11,"293":274,"294":274,"295":0,"296":0,"297":11,"298":11,"299":0,"300":1,"301":1,"302":1,"303":117,"304":6,"305":1,"306":1,"307":11,"308":11,"309":11,"310":1,"311":1,"312":274,"313":157,"314":274,"315":274,"316":1,"317":1,"318":0,"319":1,"320":1,"321":15,"322":1,"323":1,"324":0,"325":1,"326":1,"327":51,"328":1,"329":1,"330":0,"331":1,"332":1,"333":1,"334":0,"335":1,"336":1,"337":156,"338":156,"339":0,"340":0,"341":156,"342":156,"343":156,"344":156,"345":1,"346":1,"347":0,"348":0,"349":0,"350":0,"351":0,"352":1,"353":1,"354":11,"355":1},"b":{"1":[0,1],"2":[1,0],"3":[1,1,0],"4":[1,1,1],"5":[1,0,0,0],"6":[1,0],"7":[0,5538],"8":[0,0],"9":[0,0],"10":[0,0],"11":[0,0],"12":[0,0],"13":[0,0],"14":[1,0],"15":[0,1],"16":[0,0],"17":[0,0],"18":[0,0,0],"19":[0,0],"20":[0,0],"21":[0,0],"22":[0,1],"23":[0,0],"24":[0,0],"25":[0,0,0,0,0],"26":[0,0],"27":[0,26],"28":[0,30],"29":[30,30,30,30],"30":[30,0],"31":[0,26],"32":[26,26],"33":[72,30],"34":[72,15],"35":[0,30],"36":[0,30],"37":[0,0,0,0,0],"38":[0,0],"39":[0,0],"40":[0,0,0,0,0],"41":[0,30],"42":[30,30],"43":[0,22],"44":[17,13],"45":[17,0],"46":[0,36],"47":[36,36],"48":[15,15],"49":[13,0],"50":[0,15],"51":[0,51],"52":[0,49],"53":[0,114],"54":[1,0],"55":[0,0],"56":[0,0],"57":[1,0],"58":[1,1],"59":[34,0],"60":[34,34],"61":[34,11],"62":[11,23],"63":[11,23],"64":[0,11],"65":[11,0],"66":[11,11],"67":[11,0],"68":[11,0],"69":[11,11],"70":[33,33],"71":[11,11],"72":[22,22,11,11,11],"73":[13,581],"74":[594,581],"75":[594,594],"76":[298,296],"77":[594,594,594],"78":[0,594],"79":[594,0],"80":[0,0],"81":[0,0],"82":[0,0,0],"83":[594,0],"84":[594,594],"85":[1484,1484],"86":[890,890,298],"87":[1,0],"88":[12,1],"89":[0,12],"90":[11,11],"91":[11,0],"92":[11,11,11],"93":[274,0,11],"94":[10,1],"95":[1,0],"96":[0,11],"97":[11,11],"98":[11,0],"99":[11,274,0,11],"100":[0,11],"101":[11,0,11],"102":[0,117],"103":[157,117],"104":[0,157],"105":[274,0],"106":[0,0],"107":[0,156],"108":[156,0],"109":[156,156,156],"110":[0,156],"111":[0,0]},"f":{"1":1,"2":0,"3":0,"4":1,"5":1,"6":5538,"7":0,"8":0,"9":1,"10":1,"11":0,"12":0,"13":26,"14":1,"15":102,"16":15,"17":15,"18":51,"19":49,"20":1,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":11,"29":0,"30":0,"31":14,"32":34,"33":34,"34":11,"35":11,"36":594,"37":1,"38":1,"39":1,"40":11,"41":12,"42":296,"43":1,"44":11,"45":296,"46":6,"47":117,"48":11,"49":274,"50":0,"51":15,"52":0,"53":51,"54":0,"55":0,"56":156,"57":0,"58":11},"fnMap":{"1":{"name":"(anonymous_1)","line":11,"loc":{"start":{"line":11,"column":2},"end":{"line":11,"column":24}}},"2":{"name":"(anonymous_2)","line":20,"loc":{"start":{"line":20,"column":21},"end":{"line":20,"column":41}}},"3":{"name":"noConflict","line":21,"loc":{"start":{"line":21,"column":8},"end":{"line":21,"column":30}}},"4":{"name":"(anonymous_4)","line":31,"loc":{"start":{"line":31,"column":9},"end":{"line":31,"column":28}}},"5":{"name":"(anonymous_5)","line":70,"loc":{"start":{"line":70,"column":29},"end":{"line":70,"column":41}}},"6":{"name":"hasKey","line":78,"loc":{"start":{"line":78,"column":15},"end":{"line":78,"column":49}}},"7":{"name":"hasKey","line":86,"loc":{"start":{"line":86,"column":15},"end":{"line":86,"column":49}}},"8":{"name":"hasKey","line":102,"loc":{"start":{"line":102,"column":15},"end":{"line":102,"column":49}}},"9":{"name":"(anonymous_9)","line":117,"loc":{"start":{"line":117,"column":29},"end":{"line":117,"column":41}}},"10":{"name":"Properties","line":123,"loc":{"start":{"line":123,"column":4},"end":{"line":123,"column":26}}},"11":{"name":"forOwn","line":145,"loc":{"start":{"line":145,"column":15},"end":{"line":145,"column":58}}},"12":{"name":"forOwn","line":169,"loc":{"start":{"line":169,"column":15},"end":{"line":169,"column":58}}},"13":{"name":"forOwn","line":188,"loc":{"start":{"line":188,"column":15},"end":{"line":188,"column":58}}},"14":{"name":"(anonymous_14)","line":210,"loc":{"start":{"line":210,"column":29},"end":{"line":210,"column":41}}},"15":{"name":"eq","line":213,"loc":{"start":{"line":213,"column":4},"end":{"line":213,"column":36}}},"16":{"name":"(anonymous_16)","line":289,"loc":{"start":{"line":289,"column":21},"end":{"line":289,"column":43}}},"17":{"name":"(anonymous_17)","line":297,"loc":{"start":{"line":297,"column":24},"end":{"line":297,"column":36}}},"18":{"name":"equals","line":311,"loc":{"start":{"line":311,"column":4},"end":{"line":311,"column":22}}},"19":{"name":"forEach","line":328,"loc":{"start":{"line":328,"column":30},"end":{"line":328,"column":72}}},"20":{"name":"(anonymous_20)","line":343,"loc":{"start":{"line":343,"column":27},"end":{"line":343,"column":38}}},"21":{"name":"defer","line":347,"loc":{"start":{"line":347,"column":14},"end":{"line":347,"column":48}}},"22":{"name":"run","line":354,"loc":{"start":{"line":354,"column":8},"end":{"line":354,"column":23}}},"23":{"name":"defer","line":361,"loc":{"start":{"line":361,"column":14},"end":{"line":361,"column":48}}},"24":{"name":"run","line":362,"loc":{"start":{"line":362,"column":8},"end":{"line":362,"column":23}}},"25":{"name":"defer","line":370,"loc":{"start":{"line":370,"column":14},"end":{"line":370,"column":48}}},"26":{"name":"run","line":372,"loc":{"start":{"line":372,"column":8},"end":{"line":372,"column":23}}},"27":{"name":"(anonymous_27)","line":387,"loc":{"start":{"line":387,"column":14},"end":{"line":387,"column":25}}},"28":{"name":"defer","line":395,"loc":{"start":{"line":395,"column":14},"end":{"line":395,"column":48}}},"29":{"name":"rethrow","line":404,"loc":{"start":{"line":404,"column":2},"end":{"line":404,"column":30}}},"30":{"name":"(anonymous_30)","line":405,"loc":{"start":{"line":405,"column":10},"end":{"line":405,"column":22}}},"31":{"name":"Events","line":418,"loc":{"start":{"line":418,"column":2},"end":{"line":418,"column":20}}},"32":{"name":"addListener","line":429,"loc":{"start":{"line":429,"column":2},"end":{"line":429,"column":49}}},"33":{"name":"(anonymous_33)","line":431,"loc":{"start":{"line":431,"column":32},"end":{"line":431,"column":49}}},"34":{"name":"removeListener","line":454,"loc":{"start":{"line":454,"column":2},"end":{"line":454,"column":52}}},"35":{"name":"(anonymous_35)","line":459,"loc":{"start":{"line":459,"column":32},"end":{"line":459,"column":49}}},"36":{"name":"emit","line":483,"loc":{"start":{"line":483,"column":2},"end":{"line":483,"column":23}}},"37":{"name":"Suite","line":531,"loc":{"start":{"line":531,"column":2},"end":{"line":531,"column":23}}},"38":{"name":"(anonymous_38)","line":547,"loc":{"start":{"line":547,"column":3},"end":{"line":547,"column":33}}},"39":{"name":"shuffle","line":555,"loc":{"start":{"line":555,"column":2},"end":{"line":555,"column":21}}},"40":{"name":"addTest","line":567,"loc":{"start":{"line":567,"column":2},"end":{"line":567,"column":31}}},"41":{"name":"index","line":575,"loc":{"start":{"line":575,"column":2},"end":{"line":575,"column":27}}},"42":{"name":"onSuiteEvent","line":594,"loc":{"start":{"line":594,"column":2},"end":{"line":594,"column":31}}},"43":{"name":"runSuite","line":622,"loc":{"start":{"line":622,"column":2},"end":{"line":622,"column":22}}},"44":{"name":"Test","line":645,"loc":{"start":{"line":645,"column":2},"end":{"line":645,"column":28}}},"45":{"name":"onTestEvent","line":668,"loc":{"start":{"line":668,"column":2},"end":{"line":668,"column":30}}},"46":{"name":"assert","line":697,"loc":{"start":{"line":697,"column":2},"end":{"line":697,"column":34}}},"47":{"name":"assertion","line":698,"loc":{"start":{"line":698,"column":4},"end":{"line":698,"column":50}}},"48":{"name":"runTest","line":710,"loc":{"start":{"line":710,"column":2},"end":{"line":710,"column":21}}},"49":{"name":"ok","line":720,"loc":{"start":{"line":720,"column":2},"end":{"line":720,"column":33}}},"50":{"name":"notOk","line":735,"loc":{"start":{"line":735,"column":2},"end":{"line":735,"column":38}}},"51":{"name":"assertEqual","line":742,"loc":{"start":{"line":742,"column":2},"end":{"line":742,"column":41}}},"52":{"name":"assertNotEqual","line":748,"loc":{"start":{"line":748,"column":2},"end":{"line":748,"column":44}}},"53":{"name":"assertStrictEqual","line":754,"loc":{"start":{"line":754,"column":2},"end":{"line":754,"column":47}}},"54":{"name":"assertStrictNotEqual","line":760,"loc":{"start":{"line":760,"column":2},"end":{"line":760,"column":50}}},"55":{"name":"assertNotDeepEqual","line":770,"loc":{"start":{"line":770,"column":2},"end":{"line":770,"column":48}}},"56":{"name":"assertError","line":776,"loc":{"start":{"line":776,"column":2},"end":{"line":776,"column":52}}},"57":{"name":"assertNoError","line":793,"loc":{"start":{"line":793,"column":2},"end":{"line":793,"column":44}}},"58":{"name":"done","line":806,"loc":{"start":{"line":806,"column":2},"end":{"line":806,"column":28}}}},"statementMap":{"1":{"start":{"line":11,"column":1},"end":{"line":813,"column":3}},"2":{"start":{"line":12,"column":2},"end":{"line":30,"column":3}},"3":{"start":{"line":14,"column":4},"end":{"line":14,"column":38}},"4":{"start":{"line":17,"column":4},"end":{"line":29,"column":8}},"5":{"start":{"line":21,"column":8},"end":{"line":26,"column":9}},"6":{"start":{"line":22,"column":10},"end":{"line":22,"column":31}},"7":{"start":{"line":24,"column":10},"end":{"line":24,"column":33}},"8":{"start":{"line":25,"column":10},"end":{"line":25,"column":22}},"9":{"start":{"line":27,"column":8},"end":{"line":27,"column":26}},"10":{"start":{"line":35,"column":2},"end":{"line":35,"column":28}},"11":{"start":{"line":41,"column":2},"end":{"line":400,"column":7}},"12":{"start":{"line":71,"column":4},"end":{"line":71,"column":64}},"13":{"start":{"line":73,"column":4},"end":{"line":73,"column":96}},"14":{"start":{"line":74,"column":4},"end":{"line":74,"column":16}},"15":{"start":{"line":76,"column":4},"end":{"line":109,"column":5}},"16":{"start":{"line":78,"column":6},"end":{"line":83,"column":8}},"17":{"start":{"line":79,"column":8},"end":{"line":81,"column":9}},"18":{"start":{"line":80,"column":10},"end":{"line":80,"column":47}},"19":{"start":{"line":82,"column":8},"end":{"line":82,"column":59}},"20":{"start":{"line":84,"column":11},"end":{"line":109,"column":5}},"21":{"start":{"line":86,"column":6},"end":{"line":98,"column":8}},"22":{"start":{"line":87,"column":8},"end":{"line":87,"column":29}},"23":{"start":{"line":88,"column":8},"end":{"line":90,"column":9}},"24":{"start":{"line":89,"column":10},"end":{"line":89,"column":47}},"25":{"start":{"line":93,"column":8},"end":{"line":93,"column":36}},"26":{"start":{"line":94,"column":8},"end":{"line":94,"column":63}},"27":{"start":{"line":96,"column":8},"end":{"line":96,"column":36}},"28":{"start":{"line":97,"column":8},"end":{"line":97,"column":22}},"29":{"start":{"line":102,"column":6},"end":{"line":108,"column":8}},"30":{"start":{"line":103,"column":8},"end":{"line":105,"column":9}},"31":{"start":{"line":104,"column":10},"end":{"line":104,"column":47}},"32":{"start":{"line":106,"column":8},"end":{"line":106,"column":62}},"33":{"start":{"line":107,"column":8},"end":{"line":107,"column":100}},"34":{"start":{"line":110,"column":4},"end":{"line":110,"column":18}},"35":{"start":{"line":118,"column":4},"end":{"line":118,"column":44}},"36":{"start":{"line":123,"column":4},"end":{"line":125,"column":5}},"37":{"start":{"line":124,"column":6},"end":{"line":124,"column":23}},"38":{"start":{"line":126,"column":4},"end":{"line":126,"column":37}},"39":{"start":{"line":129,"column":4},"end":{"line":129,"column":31}},"40":{"start":{"line":130,"column":4},"end":{"line":135,"column":5}},"41":{"start":{"line":132,"column":6},"end":{"line":134,"column":7}},"42":{"start":{"line":133,"column":8},"end":{"line":133,"column":18}},"43":{"start":{"line":136,"column":4},"end":{"line":136,"column":19}},"44":{"start":{"line":139,"column":4},"end":{"line":205,"column":5}},"45":{"start":{"line":141,"column":6},"end":{"line":141,"column":132}},"46":{"start":{"line":144,"column":6},"end":{"line":144,"column":34}},"47":{"start":{"line":145,"column":6},"end":{"line":165,"column":8}},"48":{"start":{"line":146,"column":8},"end":{"line":146,"column":41}},"49":{"start":{"line":147,"column":8},"end":{"line":149,"column":9}},"50":{"start":{"line":148,"column":10},"end":{"line":148,"column":47}},"51":{"start":{"line":150,"column":8},"end":{"line":150,"column":66}},"52":{"start":{"line":151,"column":8},"end":{"line":157,"column":9}},"53":{"start":{"line":154,"column":10},"end":{"line":156,"column":11}},"54":{"start":{"line":155,"column":12},"end":{"line":155,"column":19}},"55":{"start":{"line":159,"column":8},"end":{"line":164,"column":9}},"56":{"start":{"line":160,"column":10},"end":{"line":160,"column":37}},"57":{"start":{"line":161,"column":10},"end":{"line":163,"column":11}},"58":{"start":{"line":162,"column":12},"end":{"line":162,"column":18}},"59":{"start":{"line":166,"column":11},"end":{"line":205,"column":5}},"60":{"start":{"line":168,"column":6},"end":{"line":168,"column":36}},"61":{"start":{"line":169,"column":6},"end":{"line":185,"column":8}},"62":{"start":{"line":170,"column":8},"end":{"line":170,"column":42}},"63":{"start":{"line":171,"column":8},"end":{"line":173,"column":9}},"64":{"start":{"line":172,"column":10},"end":{"line":172,"column":47}},"65":{"start":{"line":175,"column":8},"end":{"line":175,"column":21}},"66":{"start":{"line":176,"column":8},"end":{"line":176,"column":66}},"67":{"start":{"line":177,"column":8},"end":{"line":184,"column":9}},"68":{"start":{"line":181,"column":10},"end":{"line":183,"column":11}},"69":{"start":{"line":182,"column":12},"end":{"line":182,"column":18}},"70":{"start":{"line":188,"column":6},"end":{"line":204,"column":8}},"71":{"start":{"line":189,"column":8},"end":{"line":189,"column":48}},"72":{"start":{"line":190,"column":8},"end":{"line":192,"column":9}},"73":{"start":{"line":191,"column":10},"end":{"line":191,"column":47}},"74":{"start":{"line":193,"column":8},"end":{"line":193,"column":66}},"75":{"start":{"line":194,"column":8},"end":{"line":198,"column":9}},"76":{"start":{"line":195,"column":10},"end":{"line":197,"column":11}},"77":{"start":{"line":196,"column":12},"end":{"line":196,"column":19}},"78":{"start":{"line":201,"column":8},"end":{"line":203,"column":9}},"79":{"start":{"line":202,"column":10},"end":{"line":202,"column":82}},"80":{"start":{"line":206,"column":4},"end":{"line":206,"column":18}},"81":{"start":{"line":213,"column":4},"end":{"line":308,"column":5}},"82":{"start":{"line":214,"column":6},"end":{"line":214,"column":34}},"83":{"start":{"line":216,"column":6},"end":{"line":220,"column":7}},"84":{"start":{"line":219,"column":8},"end":{"line":219,"column":52}},"85":{"start":{"line":222,"column":6},"end":{"line":224,"column":7}},"86":{"start":{"line":223,"column":8},"end":{"line":223,"column":30}},"87":{"start":{"line":225,"column":6},"end":{"line":225,"column":38}},"88":{"start":{"line":226,"column":6},"end":{"line":228,"column":7}},"89":{"start":{"line":227,"column":8},"end":{"line":227,"column":21}},"90":{"start":{"line":229,"column":6},"end":{"line":255,"column":7}},"91":{"start":{"line":234,"column":10},"end":{"line":234,"column":47}},"92":{"start":{"line":236,"column":10},"end":{"line":236,"column":23}},"93":{"start":{"line":237,"column":10},"end":{"line":237,"column":25}},"94":{"start":{"line":240,"column":10},"end":{"line":240,"column":98}},"95":{"start":{"line":246,"column":10},"end":{"line":246,"column":33}},"96":{"start":{"line":250,"column":10},"end":{"line":254,"column":51}},"97":{"start":{"line":256,"column":6},"end":{"line":258,"column":7}},"98":{"start":{"line":257,"column":8},"end":{"line":257,"column":21}},"99":{"start":{"line":263,"column":6},"end":{"line":267,"column":7}},"100":{"start":{"line":264,"column":8},"end":{"line":266,"column":9}},"101":{"start":{"line":265,"column":10},"end":{"line":265,"column":22}},"102":{"start":{"line":269,"column":6},"end":{"line":269,"column":23}},"103":{"start":{"line":270,"column":6},"end":{"line":270,"column":20}},"104":{"start":{"line":272,"column":6},"end":{"line":304,"column":7}},"105":{"start":{"line":274,"column":8},"end":{"line":274,"column":27}},"106":{"start":{"line":275,"column":8},"end":{"line":275,"column":38}},"107":{"start":{"line":276,"column":8},"end":{"line":284,"column":9}},"108":{"start":{"line":278,"column":10},"end":{"line":283,"column":11}},"109":{"start":{"line":280,"column":12},"end":{"line":282,"column":13}},"110":{"start":{"line":281,"column":14},"end":{"line":281,"column":20}},"111":{"start":{"line":286,"column":8},"end":{"line":286,"column":17}},"112":{"start":{"line":288,"column":8},"end":{"line":288,"column":22}},"113":{"start":{"line":289,"column":8},"end":{"line":294,"column":11}},"114":{"start":{"line":291,"column":10},"end":{"line":291,"column":20}},"115":{"start":{"line":293,"column":10},"end":{"line":293,"column":77}},"116":{"start":{"line":296,"column":8},"end":{"line":303,"column":9}},"117":{"start":{"line":297,"column":10},"end":{"line":301,"column":13}},"118":{"start":{"line":298,"column":12},"end":{"line":300,"column":13}},"119":{"start":{"line":299,"column":14},"end":{"line":299,"column":27}},"120":{"start":{"line":302,"column":10},"end":{"line":302,"column":25}},"121":{"start":{"line":306,"column":6},"end":{"line":306,"column":18}},"122":{"start":{"line":307,"column":6},"end":{"line":307,"column":20}},"123":{"start":{"line":311,"column":4},"end":{"line":320,"column":5}},"124":{"start":{"line":312,"column":6},"end":{"line":318,"column":7}},"125":{"start":{"line":315,"column":8},"end":{"line":317,"column":9}},"126":{"start":{"line":316,"column":10},"end":{"line":316,"column":23}},"127":{"start":{"line":319,"column":6},"end":{"line":319,"column":18}},"128":{"start":{"line":322,"column":4},"end":{"line":322,"column":18}},"129":{"start":{"line":329,"column":4},"end":{"line":329,"column":22}},"130":{"start":{"line":330,"column":4},"end":{"line":332,"column":5}},"131":{"start":{"line":331,"column":6},"end":{"line":331,"column":43}},"132":{"start":{"line":333,"column":4},"end":{"line":337,"column":5}},"133":{"start":{"line":334,"column":6},"end":{"line":336,"column":7}},"134":{"start":{"line":335,"column":8},"end":{"line":335,"column":14}},"135":{"start":{"line":338,"column":4},"end":{"line":338,"column":16}},"136":{"start":{"line":344,"column":4},"end":{"line":344,"column":21}},"137":{"start":{"line":346,"column":4},"end":{"line":392,"column":5}},"138":{"start":{"line":347,"column":6},"end":{"line":358,"column":8}},"139":{"start":{"line":354,"column":8},"end":{"line":356,"column":9}},"140":{"start":{"line":355,"column":10},"end":{"line":355,"column":39}},"141":{"start":{"line":357,"column":8},"end":{"line":357,"column":30}},"142":{"start":{"line":360,"column":11},"end":{"line":392,"column":5}},"143":{"start":{"line":361,"column":6},"end":{"line":366,"column":8}},"144":{"start":{"line":362,"column":8},"end":{"line":364,"column":9}},"145":{"start":{"line":363,"column":10},"end":{"line":363,"column":39}},"146":{"start":{"line":365,"column":8},"end":{"line":365,"column":27}},"147":{"start":{"line":369,"column":11},"end":{"line":392,"column":5}},"148":{"start":{"line":370,"column":6},"end":{"line":383,"column":8}},"149":{"start":{"line":371,"column":8},"end":{"line":371,"column":38}},"150":{"start":{"line":372,"column":8},"end":{"line":378,"column":9}},"151":{"start":{"line":376,"column":10},"end":{"line":376,"column":25}},"152":{"start":{"line":377,"column":10},"end":{"line":377,"column":39}},"153":{"start":{"line":382,"column":8},"end":{"line":382,"column":80}},"154":{"start":{"line":386,"column":6},"end":{"line":391,"column":7}},"155":{"start":{"line":387,"column":8},"end":{"line":387,"column":29}},"156":{"start":{"line":388,"column":8},"end":{"line":388,"column":39}},"157":{"start":{"line":390,"column":8},"end":{"line":390,"column":23}},"158":{"start":{"line":394,"column":4},"end":{"line":398,"column":5}},"159":{"start":{"line":395,"column":6},"end":{"line":397,"column":8}},"160":{"start":{"line":396,"column":8},"end":{"line":396,"column":37}},"161":{"start":{"line":399,"column":4},"end":{"line":399,"column":17}},"162":{"start":{"line":404,"column":2},"end":{"line":408,"column":3}},"163":{"start":{"line":405,"column":4},"end":{"line":407,"column":7}},"164":{"start":{"line":406,"column":6},"end":{"line":406,"column":22}},"165":{"start":{"line":417,"column":2},"end":{"line":417,"column":26}},"166":{"start":{"line":418,"column":2},"end":{"line":420,"column":3}},"167":{"start":{"line":419,"column":4},"end":{"line":419,"column":21}},"168":{"start":{"line":428,"column":2},"end":{"line":428,"column":67}},"169":{"start":{"line":429,"column":2},"end":{"line":445,"column":3}},"170":{"start":{"line":430,"column":4},"end":{"line":443,"column":5}},"171":{"start":{"line":431,"column":6},"end":{"line":442,"column":15}},"172":{"start":{"line":432,"column":8},"end":{"line":432,"column":129}},"173":{"start":{"line":433,"column":8},"end":{"line":433,"column":36}},"174":{"start":{"line":435,"column":8},"end":{"line":435,"column":35}},"175":{"start":{"line":436,"column":8},"end":{"line":436,"column":33}},"176":{"start":{"line":438,"column":8},"end":{"line":441,"column":10}},"177":{"start":{"line":444,"column":4},"end":{"line":444,"column":16}},"178":{"start":{"line":453,"column":2},"end":{"line":453,"column":51}},"179":{"start":{"line":454,"column":2},"end":{"line":477,"column":3}},"180":{"start":{"line":455,"column":4},"end":{"line":475,"column":5}},"181":{"start":{"line":457,"column":6},"end":{"line":457,"column":23}},"182":{"start":{"line":458,"column":11},"end":{"line":475,"column":5}},"183":{"start":{"line":459,"column":6},"end":{"line":474,"column":15}},"184":{"start":{"line":460,"column":8},"end":{"line":460,"column":80}},"185":{"start":{"line":461,"column":8},"end":{"line":473,"column":9}},"186":{"start":{"line":463,"column":10},"end":{"line":463,"column":36}},"187":{"start":{"line":464,"column":10},"end":{"line":472,"column":11}},"188":{"start":{"line":466,"column":12},"end":{"line":466,"column":69}},"189":{"start":{"line":467,"column":12},"end":{"line":471,"column":13}},"190":{"start":{"line":468,"column":14},"end":{"line":470,"column":15}},"191":{"start":{"line":469,"column":16},"end":{"line":469,"column":64}},"192":{"start":{"line":476,"column":4},"end":{"line":476,"column":16}},"193":{"start":{"line":482,"column":2},"end":{"line":482,"column":31}},"194":{"start":{"line":483,"column":2},"end":{"line":519,"column":3}},"195":{"start":{"line":484,"column":4},"end":{"line":484,"column":43}},"196":{"start":{"line":486,"column":4},"end":{"line":488,"column":5}},"197":{"start":{"line":487,"column":6},"end":{"line":487,"column":32}},"198":{"start":{"line":489,"column":4},"end":{"line":489,"column":47}},"199":{"start":{"line":491,"column":4},"end":{"line":493,"column":5}},"200":{"start":{"line":492,"column":6},"end":{"line":492,"column":26}},"201":{"start":{"line":495,"column":4},"end":{"line":495,"column":73}},"202":{"start":{"line":496,"column":4},"end":{"line":506,"column":5}},"203":{"start":{"line":497,"column":6},"end":{"line":497,"column":63}},"204":{"start":{"line":498,"column":6},"end":{"line":505,"column":7}},"205":{"start":{"line":500,"column":8},"end":{"line":504,"column":9}},"206":{"start":{"line":501,"column":10},"end":{"line":501,"column":97}},"207":{"start":{"line":503,"column":10},"end":{"line":503,"column":29}},"208":{"start":{"line":508,"column":4},"end":{"line":517,"column":5}},"209":{"start":{"line":509,"column":6},"end":{"line":509,"column":57}},"210":{"start":{"line":510,"column":6},"end":{"line":516,"column":7}},"211":{"start":{"line":511,"column":8},"end":{"line":515,"column":9}},"212":{"start":{"line":512,"column":10},"end":{"line":512,"column":88}},"213":{"start":{"line":514,"column":10},"end":{"line":514,"column":29}},"214":{"start":{"line":518,"column":4},"end":{"line":518,"column":16}},"215":{"start":{"line":528,"column":2},"end":{"line":528,"column":24}},"216":{"start":{"line":531,"column":2},"end":{"line":537,"column":3}},"217":{"start":{"line":532,"column":4},"end":{"line":532,"column":22}},"218":{"start":{"line":533,"column":4},"end":{"line":535,"column":5}},"219":{"start":{"line":534,"column":6},"end":{"line":534,"column":23}},"220":{"start":{"line":536,"column":4},"end":{"line":536,"column":20}},"221":{"start":{"line":540,"column":2},"end":{"line":540,"column":43}},"222":{"start":{"line":543,"column":2},"end":{"line":543,"column":33}},"223":{"start":{"line":544,"column":2},"end":{"line":544,"column":38}},"224":{"start":{"line":547,"column":2},"end":{"line":551,"column":96}},"225":{"start":{"line":548,"column":4},"end":{"line":550,"column":5}},"226":{"start":{"line":549,"column":6},"end":{"line":549,"column":42}},"227":{"start":{"line":554,"column":2},"end":{"line":554,"column":36}},"228":{"start":{"line":555,"column":2},"end":{"line":563,"column":3}},"229":{"start":{"line":556,"column":4},"end":{"line":561,"column":5}},"230":{"start":{"line":557,"column":6},"end":{"line":557,"column":49}},"231":{"start":{"line":558,"column":6},"end":{"line":558,"column":29}},"232":{"start":{"line":559,"column":6},"end":{"line":559,"column":33}},"233":{"start":{"line":560,"column":6},"end":{"line":560,"column":26}},"234":{"start":{"line":562,"column":4},"end":{"line":562,"column":16}},"235":{"start":{"line":566,"column":2},"end":{"line":566,"column":36}},"236":{"start":{"line":567,"column":2},"end":{"line":570,"column":3}},"237":{"start":{"line":568,"column":4},"end":{"line":568,"column":36}},"238":{"start":{"line":569,"column":4},"end":{"line":569,"column":16}},"239":{"start":{"line":574,"column":2},"end":{"line":574,"column":32}},"240":{"start":{"line":575,"column":2},"end":{"line":588,"column":3}},"241":{"start":{"line":576,"column":4},"end":{"line":576,"column":41}},"242":{"start":{"line":577,"column":4},"end":{"line":577,"column":31}},"243":{"start":{"line":578,"column":4},"end":{"line":580,"column":5}},"244":{"start":{"line":579,"column":6},"end":{"line":579,"column":35}},"245":{"start":{"line":581,"column":4},"end":{"line":586,"column":5}},"246":{"start":{"line":582,"column":6},"end":{"line":582,"column":48}},"247":{"start":{"line":583,"column":6},"end":{"line":585,"column":7}},"248":{"start":{"line":584,"column":8},"end":{"line":584,"column":24}},"249":{"start":{"line":587,"column":4},"end":{"line":587,"column":16}},"250":{"start":{"line":593,"column":2},"end":{"line":593,"column":41}},"251":{"start":{"line":594,"column":2},"end":{"line":618,"column":3}},"252":{"start":{"line":595,"column":4},"end":{"line":595,"column":30}},"253":{"start":{"line":597,"column":4},"end":{"line":597,"column":21}},"254":{"start":{"line":598,"column":4},"end":{"line":617,"column":5}},"255":{"start":{"line":601,"column":8},"end":{"line":601,"column":29}},"256":{"start":{"line":602,"column":8},"end":{"line":602,"column":14}},"257":{"start":{"line":604,"column":8},"end":{"line":604,"column":27}},"258":{"start":{"line":605,"column":8},"end":{"line":605,"column":14}},"259":{"start":{"line":608,"column":8},"end":{"line":608,"column":57}},"260":{"start":{"line":609,"column":8},"end":{"line":616,"column":9}},"261":{"start":{"line":610,"column":10},"end":{"line":610,"column":39}},"262":{"start":{"line":612,"column":10},"end":{"line":612,"column":66}},"263":{"start":{"line":615,"column":10},"end":{"line":615,"column":32}},"264":{"start":{"line":621,"column":2},"end":{"line":621,"column":33}},"265":{"start":{"line":622,"column":2},"end":{"line":638,"column":3}},"266":{"start":{"line":624,"column":4},"end":{"line":624,"column":15}},"267":{"start":{"line":625,"column":4},"end":{"line":625,"column":56}},"268":{"start":{"line":627,"column":4},"end":{"line":627,"column":23}},"269":{"start":{"line":629,"column":4},"end":{"line":636,"column":5}},"270":{"start":{"line":630,"column":6},"end":{"line":630,"column":35}},"271":{"start":{"line":632,"column":6},"end":{"line":632,"column":62}},"272":{"start":{"line":635,"column":6},"end":{"line":635,"column":28}},"273":{"start":{"line":637,"column":4},"end":{"line":637,"column":16}},"274":{"start":{"line":644,"column":2},"end":{"line":644,"column":22}},"275":{"start":{"line":645,"column":2},"end":{"line":657,"column":3}},"276":{"start":{"line":646,"column":4},"end":{"line":646,"column":22}},"277":{"start":{"line":647,"column":4},"end":{"line":650,"column":5}},"278":{"start":{"line":648,"column":6},"end":{"line":648,"column":18}},"279":{"start":{"line":649,"column":6},"end":{"line":649,"column":18}},"280":{"start":{"line":651,"column":4},"end":{"line":653,"column":5}},"281":{"start":{"line":652,"column":6},"end":{"line":652,"column":23}},"282":{"start":{"line":654,"column":4},"end":{"line":654,"column":21}},"283":{"start":{"line":656,"column":4},"end":{"line":656,"column":39}},"284":{"start":{"line":660,"column":2},"end":{"line":660,"column":32}},"285":{"start":{"line":661,"column":2},"end":{"line":661,"column":36}},"286":{"start":{"line":664,"column":2},"end":{"line":664,"column":41}},"287":{"start":{"line":667,"column":2},"end":{"line":667,"column":39}},"288":{"start":{"line":668,"column":2},"end":{"line":692,"column":3}},"289":{"start":{"line":669,"column":4},"end":{"line":669,"column":17}},"290":{"start":{"line":670,"column":4},"end":{"line":691,"column":5}},"291":{"start":{"line":672,"column":8},"end":{"line":672,"column":44}},"292":{"start":{"line":673,"column":8},"end":{"line":673,"column":14}},"293":{"start":{"line":675,"column":8},"end":{"line":675,"column":29}},"294":{"start":{"line":676,"column":8},"end":{"line":676,"column":14}},"295":{"start":{"line":678,"column":8},"end":{"line":678,"column":27}},"296":{"start":{"line":679,"column":8},"end":{"line":679,"column":14}},"297":{"start":{"line":681,"column":8},"end":{"line":681,"column":34}},"298":{"start":{"line":683,"column":8},"end":{"line":690,"column":9}},"299":{"start":{"line":684,"column":10},"end":{"line":689,"column":13}},"300":{"start":{"line":696,"column":2},"end":{"line":696,"column":23}},"301":{"start":{"line":697,"column":2},"end":{"line":706,"column":3}},"302":{"start":{"line":698,"column":4},"end":{"line":704,"column":5}},"303":{"start":{"line":699,"column":6},"end":{"line":703,"column":9}},"304":{"start":{"line":705,"column":4},"end":{"line":705,"column":21}},"305":{"start":{"line":709,"column":2},"end":{"line":709,"column":31}},"306":{"start":{"line":710,"column":2},"end":{"line":715,"column":3}},"307":{"start":{"line":711,"column":4},"end":{"line":711,"column":23}},"308":{"start":{"line":713,"column":4},"end":{"line":713,"column":20}},"309":{"start":{"line":714,"column":4},"end":{"line":714,"column":16}},"310":{"start":{"line":719,"column":2},"end":{"line":719,"column":25}},"311":{"start":{"line":720,"column":2},"end":{"line":731,"column":3}},"312":{"start":{"line":721,"column":4},"end":{"line":727,"column":5}},"313":{"start":{"line":722,"column":6},"end":{"line":726,"column":8}},"314":{"start":{"line":729,"column":4},"end":{"line":729,"column":54}},"315":{"start":{"line":730,"column":4},"end":{"line":730,"column":28}},"316":{"start":{"line":734,"column":2},"end":{"line":734,"column":31}},"317":{"start":{"line":735,"column":2},"end":{"line":737,"column":3}},"318":{"start":{"line":736,"column":4},"end":{"line":736,"column":69}},"319":{"start":{"line":741,"column":2},"end":{"line":741,"column":54}},"320":{"start":{"line":742,"column":2},"end":{"line":744,"column":3}},"321":{"start":{"line":743,"column":4},"end":{"line":743,"column":30}},"322":{"start":{"line":747,"column":2},"end":{"line":747,"column":63}},"323":{"start":{"line":748,"column":2},"end":{"line":750,"column":3}},"324":{"start":{"line":749,"column":4},"end":{"line":749,"column":30}},"325":{"start":{"line":753,"column":2},"end":{"line":753,"column":72}},"326":{"start":{"line":754,"column":2},"end":{"line":756,"column":3}},"327":{"start":{"line":755,"column":4},"end":{"line":755,"column":31}},"328":{"start":{"line":759,"column":2},"end":{"line":759,"column":81}},"329":{"start":{"line":760,"column":2},"end":{"line":762,"column":3}},"330":{"start":{"line":761,"column":4},"end":{"line":761,"column":31}},"331":{"start":{"line":766,"column":2},"end":{"line":766,"column":57}},"332":{"start":{"line":769,"column":2},"end":{"line":769,"column":75}},"333":{"start":{"line":770,"column":2},"end":{"line":772,"column":3}},"334":{"start":{"line":771,"column":4},"end":{"line":771,"column":37}},"335":{"start":{"line":775,"column":2},"end":{"line":775,"column":37}},"336":{"start":{"line":776,"column":2},"end":{"line":789,"column":3}},"337":{"start":{"line":777,"column":4},"end":{"line":777,"column":63}},"338":{"start":{"line":779,"column":4},"end":{"line":782,"column":5}},"339":{"start":{"line":780,"column":6},"end":{"line":780,"column":25}},"340":{"start":{"line":781,"column":6},"end":{"line":781,"column":22}},"341":{"start":{"line":783,"column":4},"end":{"line":787,"column":5}},"342":{"start":{"line":784,"column":6},"end":{"line":784,"column":17}},"343":{"start":{"line":786,"column":6},"end":{"line":786,"column":90}},"344":{"start":{"line":788,"column":4},"end":{"line":788,"column":60}},"345":{"start":{"line":792,"column":2},"end":{"line":792,"column":41}},"346":{"start":{"line":793,"column":2},"end":{"line":801,"column":3}},"347":{"start":{"line":794,"column":4},"end":{"line":794,"column":18}},"348":{"start":{"line":795,"column":4},"end":{"line":799,"column":5}},"349":{"start":{"line":796,"column":6},"end":{"line":796,"column":17}},"350":{"start":{"line":798,"column":6},"end":{"line":798,"column":17}},"351":{"start":{"line":800,"column":4},"end":{"line":800,"column":62}},"352":{"start":{"line":805,"column":2},"end":{"line":805,"column":29}},"353":{"start":{"line":806,"column":2},"end":{"line":811,"column":3}},"354":{"start":{"line":807,"column":4},"end":{"line":810,"column":7}},"355":{"start":{"line":812,"column":2},"end":{"line":812,"column":17}}},"branchMap":{"1":{"line":12,"type":"if","locations":[{"start":{"line":12,"column":2},"end":{"line":12,"column":2}},{"start":{"line":12,"column":2},"end":{"line":12,"column":2}}]},"2":{"line":12,"type":"binary-expr","locations":[{"start":{"line":12,"column":6},"end":{"line":12,"column":33}},{"start":{"line":12,"column":37},"end":{"line":12,"column":47}}]},"3":{"line":17,"type":"binary-expr","locations":[{"start":{"line":17,"column":16},"end":{"line":17,"column":42}},{"start":{"line":17,"column":46},"end":{"line":17,"column":53}},{"start":{"line":17,"column":58},"end":{"line":29,"column":5}}]},"4":{"line":59,"type":"binary-expr","locations":[{"start":{"line":59,"column":16},"end":{"line":59,"column":42}},{"start":{"line":59,"column":46},"end":{"line":59,"column":61}},{"start":{"line":59,"column":65},"end":{"line":59,"column":102}}]},"5":{"line":63,"type":"binary-expr","locations":[{"start":{"line":63,"column":12},"end":{"line":63,"column":38}},{"start":{"line":63,"column":42},"end":{"line":63,"column":54}},{"start":{"line":63,"column":58},"end":{"line":63,"column":103}},{"start":{"line":63,"column":107},"end":{"line":63,"column":139}}]},"6":{"line":76,"type":"if","locations":[{"start":{"line":76,"column":4},"end":{"line":76,"column":4}},{"start":{"line":76,"column":4},"end":{"line":76,"column":4}}]},"7":{"line":79,"type":"if","locations":[{"start":{"line":79,"column":8},"end":{"line":79,"column":8}},{"start":{"line":79,"column":8},"end":{"line":79,"column":8}}]},"8":{"line":84,"type":"if","locations":[{"start":{"line":84,"column":11},"end":{"line":84,"column":11}},{"start":{"line":84,"column":11},"end":{"line":84,"column":11}}]},"9":{"line":88,"type":"if","locations":[{"start":{"line":88,"column":8},"end":{"line":88,"column":8}},{"start":{"line":88,"column":8},"end":{"line":88,"column":8}}]},"10":{"line":103,"type":"if","locations":[{"start":{"line":103,"column":8},"end":{"line":103,"column":8}},{"start":{"line":103,"column":8},"end":{"line":103,"column":8}}]},"11":{"line":106,"type":"binary-expr","locations":[{"start":{"line":106,"column":22},"end":{"line":106,"column":40}},{"start":{"line":106,"column":44},"end":{"line":106,"column":50}}]},"12":{"line":107,"type":"binary-expr","locations":[{"start":{"line":107,"column":15},"end":{"line":107,"column":33}},{"start":{"line":107,"column":37},"end":{"line":107,"column":99}}]},"13":{"line":107,"type":"binary-expr","locations":[{"start":{"line":107,"column":39},"end":{"line":107,"column":57}},{"start":{"line":107,"column":61},"end":{"line":107,"column":98}}]},"14":{"line":132,"type":"if","locations":[{"start":{"line":132,"column":6},"end":{"line":132,"column":6}},{"start":{"line":132,"column":6},"end":{"line":132,"column":6}}]},"15":{"line":139,"type":"if","locations":[{"start":{"line":139,"column":4},"end":{"line":139,"column":4}},{"start":{"line":139,"column":4},"end":{"line":139,"column":4}}]},"16":{"line":147,"type":"if","locations":[{"start":{"line":147,"column":8},"end":{"line":147,"column":8}},{"start":{"line":147,"column":8},"end":{"line":147,"column":8}}]},"17":{"line":154,"type":"if","locations":[{"start":{"line":154,"column":10},"end":{"line":154,"column":10}},{"start":{"line":154,"column":10},"end":{"line":154,"column":10}}]},"18":{"line":154,"type":"binary-expr","locations":[{"start":{"line":154,"column":14},"end":{"line":154,"column":54}},{"start":{"line":154,"column":58},"end":{"line":154,"column":82}},{"start":{"line":154,"column":86},"end":{"line":154,"column":160}}]},"19":{"line":154,"type":"binary-expr","locations":[{"start":{"line":154,"column":16},"end":{"line":154,"column":26}},{"start":{"line":154,"column":30},"end":{"line":154,"column":53}}]},"20":{"line":161,"type":"if","locations":[{"start":{"line":161,"column":10},"end":{"line":161,"column":10}},{"start":{"line":161,"column":10},"end":{"line":161,"column":10}}]},"21":{"line":161,"type":"binary-expr","locations":[{"start":{"line":161,"column":14},"end":{"line":161,"column":38}},{"start":{"line":161,"column":42},"end":{"line":161,"column":116}}]},"22":{"line":166,"type":"if","locations":[{"start":{"line":166,"column":11},"end":{"line":166,"column":11}},{"start":{"line":166,"column":11},"end":{"line":166,"column":11}}]},"23":{"line":171,"type":"if","locations":[{"start":{"line":171,"column":8},"end":{"line":171,"column":8}},{"start":{"line":171,"column":8},"end":{"line":171,"column":8}}]},"24":{"line":181,"type":"if","locations":[{"start":{"line":181,"column":10},"end":{"line":181,"column":10}},{"start":{"line":181,"column":10},"end":{"line":181,"column":10}}]},"25":{"line":181,"type":"binary-expr","locations":[{"start":{"line":181,"column":14},"end":{"line":181,"column":54}},{"start":{"line":181,"column":58},"end":{"line":181,"column":84}},{"start":{"line":181,"column":89},"end":{"line":181,"column":110}},{"start":{"line":181,"column":115},"end":{"line":181,"column":139}},{"start":{"line":181,"column":143},"end":{"line":181,"column":217}}]},"26":{"line":181,"type":"binary-expr","locations":[{"start":{"line":181,"column":16},"end":{"line":181,"column":26}},{"start":{"line":181,"column":30},"end":{"line":181,"column":53}}]},"27":{"line":190,"type":"if","locations":[{"start":{"line":190,"column":8},"end":{"line":190,"column":8}},{"start":{"line":190,"column":8},"end":{"line":190,"column":8}}]},"28":{"line":195,"type":"if","locations":[{"start":{"line":195,"column":10},"end":{"line":195,"column":10}},{"start":{"line":195,"column":10},"end":{"line":195,"column":10}}]},"29":{"line":195,"type":"binary-expr","locations":[{"start":{"line":195,"column":14},"end":{"line":195,"column":54}},{"start":{"line":195,"column":58},"end":{"line":195,"column":82}},{"start":{"line":195,"column":86},"end":{"line":195,"column":131}},{"start":{"line":195,"column":135},"end":{"line":195,"column":209}}]},"30":{"line":195,"type":"binary-expr","locations":[{"start":{"line":195,"column":16},"end":{"line":195,"column":26}},{"start":{"line":195,"column":30},"end":{"line":195,"column":53}}]},"31":{"line":201,"type":"if","locations":[{"start":{"line":201,"column":8},"end":{"line":201,"column":8}},{"start":{"line":201,"column":8},"end":{"line":201,"column":8}}]},"32":{"line":201,"type":"binary-expr","locations":[{"start":{"line":201,"column":12},"end":{"line":201,"column":25}},{"start":{"line":201,"column":29},"end":{"line":201,"column":58}}]},"33":{"line":216,"type":"if","locations":[{"start":{"line":216,"column":6},"end":{"line":216,"column":6}},{"start":{"line":216,"column":6},"end":{"line":216,"column":6}}]},"34":{"line":219,"type":"binary-expr","locations":[{"start":{"line":219,"column":15},"end":{"line":219,"column":24}},{"start":{"line":219,"column":29},"end":{"line":219,"column":50}}]},"35":{"line":222,"type":"if","locations":[{"start":{"line":222,"column":6},"end":{"line":222,"column":6}},{"start":{"line":222,"column":6},"end":{"line":222,"column":6}}]},"36":{"line":226,"type":"if","locations":[{"start":{"line":226,"column":6},"end":{"line":226,"column":6}},{"start":{"line":226,"column":6},"end":{"line":226,"column":6}}]},"37":{"line":229,"type":"switch","locations":[{"start":{"line":233,"column":8},"end":{"line":234,"column":47}},{"start":{"line":235,"column":8},"end":{"line":240,"column":98}},{"start":{"line":244,"column":8},"end":{"line":244,"column":29}},{"start":{"line":245,"column":8},"end":{"line":246,"column":33}},{"start":{"line":249,"column":8},"end":{"line":254,"column":51}}]},"38":{"line":240,"type":"cond-expr","locations":[{"start":{"line":240,"column":32},"end":{"line":240,"column":46}},{"start":{"line":240,"column":50},"end":{"line":240,"column":96}}]},"39":{"line":240,"type":"cond-expr","locations":[{"start":{"line":240,"column":57},"end":{"line":240,"column":70}},{"start":{"line":240,"column":74},"end":{"line":240,"column":95}}]},"40":{"line":250,"type":"binary-expr","locations":[{"start":{"line":250,"column":17},"end":{"line":250,"column":44}},{"start":{"line":251,"column":17},"end":{"line":251,"column":44}},{"start":{"line":252,"column":17},"end":{"line":252,"column":50}},{"start":{"line":253,"column":17},"end":{"line":253,"column":52}},{"start":{"line":254,"column":17},"end":{"line":254,"column":50}}]},"41":{"line":256,"type":"if","locations":[{"start":{"line":256,"column":6},"end":{"line":256,"column":6}},{"start":{"line":256,"column":6},"end":{"line":256,"column":6}}]},"42":{"line":256,"type":"binary-expr","locations":[{"start":{"line":256,"column":10},"end":{"line":256,"column":33}},{"start":{"line":256,"column":37},"end":{"line":256,"column":61}}]},"43":{"line":264,"type":"if","locations":[{"start":{"line":264,"column":8},"end":{"line":264,"column":8}},{"start":{"line":264,"column":8},"end":{"line":264,"column":8}}]},"44":{"line":272,"type":"if","locations":[{"start":{"line":272,"column":6},"end":{"line":272,"column":6}},{"start":{"line":272,"column":6},"end":{"line":272,"column":6}}]},"45":{"line":276,"type":"if","locations":[{"start":{"line":276,"column":8},"end":{"line":276,"column":8}},{"start":{"line":276,"column":8},"end":{"line":276,"column":8}}]},"46":{"line":280,"type":"if","locations":[{"start":{"line":280,"column":12},"end":{"line":280,"column":12}},{"start":{"line":280,"column":12},"end":{"line":280,"column":12}}]},"47":{"line":280,"type":"binary-expr","locations":[{"start":{"line":280,"column":28},"end":{"line":280,"column":57}},{"start":{"line":280,"column":62},"end":{"line":280,"column":96}}]},"48":{"line":293,"type":"binary-expr","locations":[{"start":{"line":293,"column":26},"end":{"line":293,"column":44}},{"start":{"line":293,"column":48},"end":{"line":293,"column":76}}]},"49":{"line":296,"type":"if","locations":[{"start":{"line":296,"column":8},"end":{"line":296,"column":8}},{"start":{"line":296,"column":8},"end":{"line":296,"column":8}}]},"50":{"line":298,"type":"if","locations":[{"start":{"line":298,"column":12},"end":{"line":298,"column":12}},{"start":{"line":298,"column":12},"end":{"line":298,"column":12}}]},"51":{"line":315,"type":"if","locations":[{"start":{"line":315,"column":8},"end":{"line":315,"column":8}},{"start":{"line":315,"column":8},"end":{"line":315,"column":8}}]},"52":{"line":330,"type":"if","locations":[{"start":{"line":330,"column":4},"end":{"line":330,"column":4}},{"start":{"line":330,"column":4},"end":{"line":330,"column":4}}]},"53":{"line":334,"type":"if","locations":[{"start":{"line":334,"column":6},"end":{"line":334,"column":6}},{"start":{"line":334,"column":6},"end":{"line":334,"column":6}}]},"54":{"line":346,"type":"if","locations":[{"start":{"line":346,"column":4},"end":{"line":346,"column":4}},{"start":{"line":346,"column":4},"end":{"line":346,"column":4}}]},"55":{"line":360,"type":"if","locations":[{"start":{"line":360,"column":11},"end":{"line":360,"column":11}},{"start":{"line":360,"column":11},"end":{"line":360,"column":11}}]},"56":{"line":369,"type":"if","locations":[{"start":{"line":369,"column":11},"end":{"line":369,"column":11}},{"start":{"line":369,"column":11},"end":{"line":369,"column":11}}]},"57":{"line":394,"type":"if","locations":[{"start":{"line":394,"column":4},"end":{"line":394,"column":4}},{"start":{"line":394,"column":4},"end":{"line":394,"column":4}}]},"58":{"line":394,"type":"binary-expr","locations":[{"start":{"line":394,"column":8},"end":{"line":394,"column":14}},{"start":{"line":394,"column":18},"end":{"line":394,"column":42}}]},"59":{"line":430,"type":"if","locations":[{"start":{"line":430,"column":4},"end":{"line":430,"column":4}},{"start":{"line":430,"column":4},"end":{"line":430,"column":4}}]},"60":{"line":430,"type":"binary-expr","locations":[{"start":{"line":430,"column":8},"end":{"line":430,"column":13}},{"start":{"line":430,"column":17},"end":{"line":430,"column":25}}]},"61":{"line":432,"type":"binary-expr","locations":[{"start":{"line":432,"column":24},"end":{"line":432,"column":50}},{"start":{"line":432,"column":54},"end":{"line":432,"column":72}}]},"62":{"line":432,"type":"cond-expr","locations":[{"start":{"line":432,"column":95},"end":{"line":432,"column":113}},{"start":{"line":432,"column":116},"end":{"line":432,"column":118}}]},"63":{"line":440,"type":"cond-expr","locations":[{"start":{"line":440,"column":30},"end":{"line":440,"column":44}},{"start":{"line":440,"column":47},"end":{"line":440,"column":53}}]},"64":{"line":455,"type":"if","locations":[{"start":{"line":455,"column":4},"end":{"line":455,"column":4}},{"start":{"line":455,"column":4},"end":{"line":455,"column":4}}]},"65":{"line":458,"type":"if","locations":[{"start":{"line":458,"column":11},"end":{"line":458,"column":11}},{"start":{"line":458,"column":11},"end":{"line":458,"column":11}}]},"66":{"line":460,"type":"binary-expr","locations":[{"start":{"line":460,"column":21},"end":{"line":460,"column":47}},{"start":{"line":460,"column":51},"end":{"line":460,"column":69}}]},"67":{"line":461,"type":"if","locations":[{"start":{"line":461,"column":8},"end":{"line":461,"column":8}},{"start":{"line":461,"column":8},"end":{"line":461,"column":8}}]},"68":{"line":464,"type":"if","locations":[{"start":{"line":464,"column":10},"end":{"line":464,"column":10}},{"start":{"line":464,"column":10},"end":{"line":464,"column":10}}]},"69":{"line":466,"type":"binary-expr","locations":[{"start":{"line":466,"column":23},"end":{"line":466,"column":49}},{"start":{"line":466,"column":53},"end":{"line":466,"column":68}}]},"70":{"line":467,"type":"binary-expr","locations":[{"start":{"line":467,"column":29},"end":{"line":467,"column":51}},{"start":{"line":467,"column":55},"end":{"line":467,"column":66}}]},"71":{"line":468,"type":"if","locations":[{"start":{"line":468,"column":14},"end":{"line":468,"column":14}},{"start":{"line":468,"column":14},"end":{"line":468,"column":14}}]},"72":{"line":468,"type":"binary-expr","locations":[{"start":{"line":468,"column":18},"end":{"line":468,"column":44}},{"start":{"line":468,"column":48},"end":{"line":468,"column":75}},{"start":{"line":468,"column":80},"end":{"line":468,"column":87}},{"start":{"line":468,"column":92},"end":{"line":468,"column":117}},{"start":{"line":468,"column":121},"end":{"line":468,"column":146}}]},"73":{"line":486,"type":"if","locations":[{"start":{"line":486,"column":4},"end":{"line":486,"column":4}},{"start":{"line":486,"column":4},"end":{"line":486,"column":4}}]},"74":{"line":486,"type":"binary-expr","locations":[{"start":{"line":486,"column":8},"end":{"line":486,"column":32}},{"start":{"line":486,"column":36},"end":{"line":486,"column":77}}]},"75":{"line":489,"type":"binary-expr","locations":[{"start":{"line":489,"column":11},"end":{"line":489,"column":32}},{"start":{"line":489,"column":36},"end":{"line":489,"column":46}}]},"76":{"line":491,"type":"if","locations":[{"start":{"line":491,"column":4},"end":{"line":491,"column":4}},{"start":{"line":491,"column":4},"end":{"line":491,"column":4}}]},"77":{"line":495,"type":"binary-expr","locations":[{"start":{"line":495,"column":10},"end":{"line":495,"column":23}},{"start":{"line":495,"column":27},"end":{"line":495,"column":53}},{"start":{"line":495,"column":57},"end":{"line":495,"column":72}}]},"78":{"line":496,"type":"if","locations":[{"start":{"line":496,"column":4},"end":{"line":496,"column":4}},{"start":{"line":496,"column":4},"end":{"line":496,"column":4}}]},"79":{"line":496,"type":"binary-expr","locations":[{"start":{"line":496,"column":18},"end":{"line":496,"column":43}},{"start":{"line":496,"column":47},"end":{"line":496,"column":64}}]},"80":{"line":497,"type":"binary-expr","locations":[{"start":{"line":497,"column":17},"end":{"line":497,"column":43}},{"start":{"line":497,"column":47},"end":{"line":497,"column":62}}]},"81":{"line":498,"type":"binary-expr","locations":[{"start":{"line":498,"column":23},"end":{"line":498,"column":45}},{"start":{"line":498,"column":49},"end":{"line":498,"column":60}}]},"82":{"line":501,"type":"binary-expr","locations":[{"start":{"line":501,"column":37},"end":{"line":501,"column":62}},{"start":{"line":501,"column":66},"end":{"line":501,"column":80}},{"start":{"line":501,"column":84},"end":{"line":501,"column":88}}]},"83":{"line":508,"type":"if","locations":[{"start":{"line":508,"column":4},"end":{"line":508,"column":4}},{"start":{"line":508,"column":4},"end":{"line":508,"column":4}}]},"84":{"line":509,"type":"binary-expr","locations":[{"start":{"line":509,"column":17},"end":{"line":509,"column":40}},{"start":{"line":509,"column":44},"end":{"line":509,"column":56}}]},"85":{"line":510,"type":"binary-expr","locations":[{"start":{"line":510,"column":20},"end":{"line":510,"column":39}},{"start":{"line":510,"column":43},"end":{"line":510,"column":51}}]},"86":{"line":512,"type":"binary-expr","locations":[{"start":{"line":512,"column":34},"end":{"line":512,"column":56}},{"start":{"line":512,"column":60},"end":{"line":512,"column":71}},{"start":{"line":512,"column":75},"end":{"line":512,"column":79}}]},"87":{"line":533,"type":"if","locations":[{"start":{"line":533,"column":4},"end":{"line":533,"column":4}},{"start":{"line":533,"column":4},"end":{"line":533,"column":4}}]},"88":{"line":577,"type":"binary-expr","locations":[{"start":{"line":577,"column":4},"end":{"line":577,"column":12}},{"start":{"line":577,"column":17},"end":{"line":577,"column":29}}]},"89":{"line":578,"type":"if","locations":[{"start":{"line":578,"column":4},"end":{"line":578,"column":4}},{"start":{"line":578,"column":4},"end":{"line":578,"column":4}}]},"90":{"line":582,"type":"binary-expr","locations":[{"start":{"line":582,"column":13},"end":{"line":582,"column":29}},{"start":{"line":582,"column":33},"end":{"line":582,"column":47}}]},"91":{"line":583,"type":"if","locations":[{"start":{"line":583,"column":6},"end":{"line":583,"column":6}},{"start":{"line":583,"column":6},"end":{"line":583,"column":6}}]},"92":{"line":583,"type":"binary-expr","locations":[{"start":{"line":583,"column":10},"end":{"line":583,"column":14}},{"start":{"line":583,"column":18},"end":{"line":583,"column":55}},{"start":{"line":583,"column":59},"end":{"line":583,"column":79}}]},"93":{"line":598,"type":"switch","locations":[{"start":{"line":600,"column":6},"end":{"line":602,"column":14}},{"start":{"line":603,"column":6},"end":{"line":605,"column":14}},{"start":{"line":606,"column":6},"end":{"line":616,"column":9}}]},"94":{"line":609,"type":"if","locations":[{"start":{"line":609,"column":8},"end":{"line":609,"column":8}},{"start":{"line":609,"column":8},"end":{"line":609,"column":8}}]},"95":{"line":629,"type":"if","locations":[{"start":{"line":629,"column":4},"end":{"line":629,"column":4}},{"start":{"line":629,"column":4},"end":{"line":629,"column":4}}]},"96":{"line":647,"type":"if","locations":[{"start":{"line":647,"column":4},"end":{"line":647,"column":4}},{"start":{"line":647,"column":4},"end":{"line":647,"column":4}}]},"97":{"line":647,"type":"binary-expr","locations":[{"start":{"line":647,"column":8},"end":{"line":647,"column":12}},{"start":{"line":647,"column":16},"end":{"line":647,"column":28}}]},"98":{"line":651,"type":"if","locations":[{"start":{"line":651,"column":4},"end":{"line":651,"column":4}},{"start":{"line":651,"column":4},"end":{"line":651,"column":4}}]},"99":{"line":670,"type":"switch","locations":[{"start":{"line":671,"column":6},"end":{"line":673,"column":14}},{"start":{"line":674,"column":6},"end":{"line":676,"column":14}},{"start":{"line":677,"column":6},"end":{"line":679,"column":14}},{"start":{"line":680,"column":6},"end":{"line":690,"column":9}}]},"100":{"line":683,"type":"if","locations":[{"start":{"line":683,"column":8},"end":{"line":683,"column":8}},{"start":{"line":683,"column":8},"end":{"line":683,"column":8}}]},"101":{"line":683,"type":"binary-expr","locations":[{"start":{"line":683,"column":13},"end":{"line":683,"column":40}},{"start":{"line":683,"column":44},"end":{"line":683,"column":88}},{"start":{"line":683,"column":93},"end":{"line":683,"column":120}}]},"102":{"line":702,"type":"cond-expr","locations":[{"start":{"line":702,"column":37},"end":{"line":702,"column":41}},{"start":{"line":702,"column":44},"end":{"line":702,"column":51}}]},"103":{"line":721,"type":"if","locations":[{"start":{"line":721,"column":4},"end":{"line":721,"column":4}},{"start":{"line":721,"column":4},"end":{"line":721,"column":4}}]},"104":{"line":725,"type":"cond-expr","locations":[{"start":{"line":725,"column":35},"end":{"line":725,"column":39}},{"start":{"line":725,"column":42},"end":{"line":725,"column":47}}]},"105":{"line":729,"type":"cond-expr","locations":[{"start":{"line":729,"column":30},"end":{"line":729,"column":41}},{"start":{"line":729,"column":44},"end":{"line":729,"column":53}}]},"106":{"line":736,"type":"cond-expr","locations":[{"start":{"line":736,"column":50},"end":{"line":736,"column":57}},{"start":{"line":736,"column":60},"end":{"line":736,"column":67}}]},"107":{"line":779,"type":"if","locations":[{"start":{"line":779,"column":4},"end":{"line":779,"column":4}},{"start":{"line":779,"column":4},"end":{"line":779,"column":4}}]},"108":{"line":779,"type":"binary-expr","locations":[{"start":{"line":779,"column":8},"end":{"line":779,"column":19}},{"start":{"line":779,"column":23},"end":{"line":779,"column":38}}]},"109":{"line":786,"type":"binary-expr","locations":[{"start":{"line":786,"column":11},"end":{"line":786,"column":27}},{"start":{"line":786,"column":32},"end":{"line":786,"column":42}},{"start":{"line":786,"column":46},"end":{"line":786,"column":88}}]},"110":{"line":788,"type":"cond-expr","locations":[{"start":{"line":788,"column":41},"end":{"line":788,"column":48}},{"start":{"line":788,"column":51},"end":{"line":788,"column":58}}]},"111":{"line":800,"type":"cond-expr","locations":[{"start":{"line":800,"column":41},"end":{"line":800,"column":50}},{"start":{"line":800,"column":53},"end":{"line":800,"column":60}}]}}},"/Users/kit/Dropbox/Projects/json3/vendor/spec/lib/newton.js":{"path":"/Users/kit/Dropbox/Projects/json3/vendor/spec/lib/newton.js","s":{"1":1,"2":1,"3":1,"4":0,"5":0,"6":1,"7":1,"8":1,"9":1,"10":0,"11":0,"12":0,"13":1,"14":0,"15":0,"16":0,"17":0,"18":1,"19":1,"20":0,"21":1,"22":0,"23":1,"24":1,"25":0,"26":0,"27":0,"28":0,"29":1,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":1,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0,"104":0,"105":0,"106":0,"107":298,"108":298,"109":298,"110":0,"111":298,"112":4294,"113":4294,"114":322,"115":322,"116":0,"117":322,"118":322,"119":24,"120":24,"121":0,"122":0,"123":0,"124":0,"125":298,"126":0,"127":322,"128":322,"129":3972,"130":298,"131":1,"132":298,"133":1,"134":1,"135":11,"136":11,"137":274,"138":274,"139":0,"140":0,"141":11,"142":11,"143":1,"144":1,"145":0,"146":1,"147":0,"148":1,"149":0,"150":0,"151":0,"152":0,"153":0,"154":0,"155":0,"156":0,"157":0,"158":0,"159":0,"160":0,"161":0,"162":1,"163":0,"164":0,"165":0,"166":0,"167":0,"168":0,"169":0,"170":0,"171":0,"172":0,"173":0,"174":0,"175":0,"176":0,"177":0,"178":0,"179":0,"180":0,"181":0,"182":0,"183":0,"184":0,"185":0,"186":0,"187":0,"188":0,"189":0,"190":0,"191":0,"192":0,"193":0,"194":0,"195":0,"196":0,"197":0,"198":0,"199":0,"200":0,"201":0,"202":0,"203":0,"204":0,"205":0,"206":0,"207":0,"208":0,"209":1,"210":0,"211":0,"212":0,"213":0,"214":0,"215":0,"216":0,"217":0,"218":0,"219":0,"220":0,"221":0,"222":0,"223":0,"224":0,"225":0,"226":0,"227":0,"228":0,"229":0,"230":0,"231":0,"232":0,"233":1,"234":1},"b":{"1":[1,0],"2":[1,1,1,1],"3":[1,0,0],"4":[1,1,0],"5":[0,1],"6":[1,0],"7":[1,0],"8":[0,0],"9":[0,0],"10":[0,0],"11":[0,0],"12":[0,0],"13":[0,0,0,0,0],"14":[0,0],"15":[0,0],"16":[0,0],"17":[0,0],"18":[0,0],"19":[0,0],"20":[0,0],"21":[0,0],"22":[0,0],"23":[0,0],"24":[0,0,0],"25":[0,0],"26":[0,0],"27":[0,0],"28":[0,0],"29":[0,0],"30":[0,0],"31":[0,0,0],"32":[0,0],"33":[0,0],"34":[0,0],"35":[0,0],"36":[0,0],"37":[0,0],"38":[0,0],"39":[0,0],"40":[0,0],"41":[0,0],"42":[0,0,0,0,0,0,0,0],"43":[0,0],"44":[0,298],"45":[298,298],"46":[322,3972],"47":[0,322],"48":[322,0],"49":[0,24,0,0,298],"50":[24,12],"51":[0,0],"52":[1,11,274,0,11,1],"53":[0,0,0],"54":[0,1],"55":[0,0],"56":[0,0],"57":[0,0],"58":[0,0],"59":[0,0],"60":[0,0],"61":[0,0],"62":[0,0],"63":[0,0],"64":[0,0],"65":[0,0],"66":[0,0],"67":[0,0],"68":[0,0],"69":[0,0],"70":[0,0],"71":[0,0],"72":[0,0,0,0,0,0],"73":[0,0],"74":[0,0],"75":[0,0],"76":[0,0]},"f":{"1":1,"2":0,"3":0,"4":0,"5":1,"6":1,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":298,"22":1,"23":298,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0},"fnMap":{"1":{"name":"(anonymous_1)","line":8,"loc":{"start":{"line":8,"column":2},"end":{"line":8,"column":30}}},"2":{"name":"(anonymous_2)","line":26,"loc":{"start":{"line":26,"column":32},"end":{"line":26,"column":57}}},"3":{"name":"(anonymous_3)","line":42,"loc":{"start":{"line":42,"column":21},"end":{"line":42,"column":41}}},"4":{"name":"noConflict","line":43,"loc":{"start":{"line":43,"column":8},"end":{"line":43,"column":30}}},"5":{"name":"(anonymous_5)","line":52,"loc":{"start":{"line":52,"column":9},"end":{"line":52,"column":47}}},"6":{"name":"(anonymous_6)","line":61,"loc":{"start":{"line":61,"column":35},"end":{"line":61,"column":47}}},"7":{"name":"stringify","line":62,"loc":{"start":{"line":62,"column":4},"end":{"line":62,"column":31}}},"8":{"name":"toPaddedString","line":68,"loc":{"start":{"line":68,"column":4},"end":{"line":68,"column":42}}},"9":{"name":"quote","line":85,"loc":{"start":{"line":85,"column":4},"end":{"line":85,"column":26}}},"10":{"name":"serialize","line":99,"loc":{"start":{"line":99,"column":4},"end":{"line":99,"column":37}}},"11":{"name":"(anonymous_11)","line":155,"loc":{"start":{"line":155,"column":29},"end":{"line":155,"column":51}}},"12":{"name":"all","line":172,"loc":{"start":{"line":172,"column":22},"end":{"line":172,"column":62}}},"13":{"name":"(anonymous_13)","line":174,"loc":{"start":{"line":174,"column":24},"end":{"line":174,"column":54}}},"14":{"name":"toQueryPair","line":181,"loc":{"start":{"line":181,"column":16},"end":{"line":181,"column":55}}},"15":{"name":"serializeQuery","line":200,"loc":{"start":{"line":200,"column":44},"end":{"line":200,"column":84}}},"16":{"name":"(anonymous_16)","line":202,"loc":{"start":{"line":202,"column":21},"end":{"line":202,"column":49}}},"17":{"name":"(anonymous_17)","line":204,"loc":{"start":{"line":204,"column":28},"end":{"line":204,"column":45}}},"18":{"name":"parseQuery","line":223,"loc":{"start":{"line":223,"column":36},"end":{"line":223,"column":75}}},"19":{"name":"isEmpty","line":256,"loc":{"start":{"line":256,"column":30},"end":{"line":256,"column":54}}},"20":{"name":"(anonymous_20)","line":275,"loc":{"start":{"line":275,"column":19},"end":{"line":275,"column":31}}},"21":{"name":"substitute","line":283,"loc":{"start":{"line":283,"column":36},"end":{"line":283,"column":63}}},"22":{"name":"createConsole","line":333,"loc":{"start":{"line":333,"column":42},"end":{"line":333,"column":72}}},"23":{"name":"onEvent","line":334,"loc":{"start":{"line":334,"column":4},"end":{"line":334,"column":28}}},"24":{"name":"createTAP","line":359,"loc":{"start":{"line":359,"column":34},"end":{"line":359,"column":60}}},"25":{"name":"description","line":362,"loc":{"start":{"line":362,"column":4},"end":{"line":362,"column":38}}},"26":{"name":"onEvent","line":365,"loc":{"start":{"line":365,"column":4},"end":{"line":365,"column":28}}},"27":{"name":"onClick","line":391,"loc":{"start":{"line":391,"column":14},"end":{"line":391,"column":33}}},"28":{"name":"(anonymous_28)","line":401,"loc":{"start":{"line":401,"column":37},"end":{"line":401,"column":49}}},"29":{"name":"(anonymous_29)","line":405,"loc":{"start":{"line":405,"column":43},"end":{"line":405,"column":55}}},"30":{"name":"serializeAttribute","line":427,"loc":{"start":{"line":427,"column":27},"end":{"line":427,"column":68}}},"31":{"name":"buildNode","line":433,"loc":{"start":{"line":433,"column":18},"end":{"line":433,"column":68}}},"32":{"name":"(anonymous_32)","line":458,"loc":{"start":{"line":458,"column":42},"end":{"line":458,"column":69}}},"33":{"name":"(anonymous_33)","line":464,"loc":{"start":{"line":464,"column":34},"end":{"line":464,"column":61}}},"34":{"name":"(anonymous_34)","line":470,"loc":{"start":{"line":470,"column":33},"end":{"line":470,"column":50}}},"35":{"name":"clearElement","line":480,"loc":{"start":{"line":480,"column":19},"end":{"line":480,"column":50}}},"36":{"name":"createReport","line":489,"loc":{"start":{"line":489,"column":42},"end":{"line":489,"column":73}}},"37":{"name":"onEvent","line":490,"loc":{"start":{"line":490,"column":6},"end":{"line":490,"column":30}}}},"statementMap":{"1":{"start":{"line":8,"column":1},"end":{"line":577,"column":3}},"2":{"start":{"line":10,"column":2},"end":{"line":22,"column":18}},"3":{"start":{"line":24,"column":2},"end":{"line":51,"column":3}},"4":{"start":{"line":26,"column":4},"end":{"line":28,"column":7}},"5":{"start":{"line":27,"column":6},"end":{"line":27,"column":52}},"6":{"start":{"line":29,"column":9},"end":{"line":51,"column":3}},"7":{"start":{"line":31,"column":4},"end":{"line":34,"column":26}},"8":{"start":{"line":33,"column":6},"end":{"line":33,"column":31}},"9":{"start":{"line":35,"column":4},"end":{"line":35,"column":49}},"10":{"start":{"line":38,"column":4},"end":{"line":40,"column":5}},"11":{"start":{"line":39,"column":6},"end":{"line":39,"column":43}},"12":{"start":{"line":41,"column":4},"end":{"line":50,"column":25}},"13":{"start":{"line":43,"column":8},"end":{"line":47,"column":9}},"14":{"start":{"line":44,"column":10},"end":{"line":44,"column":33}},"15":{"start":{"line":45,"column":10},"end":{"line":45,"column":35}},"16":{"start":{"line":46,"column":10},"end":{"line":46,"column":24}},"17":{"start":{"line":48,"column":8},"end":{"line":48,"column":26}},"18":{"start":{"line":56,"column":2},"end":{"line":387,"column":49}},"19":{"start":{"line":62,"column":4},"end":{"line":64,"column":5}},"20":{"start":{"line":63,"column":6},"end":{"line":63,"column":35}},"21":{"start":{"line":68,"column":4},"end":{"line":70,"column":5}},"22":{"start":{"line":69,"column":6},"end":{"line":69,"column":46}},"23":{"start":{"line":73,"column":4},"end":{"line":81,"column":6}},"24":{"start":{"line":85,"column":4},"end":{"line":96,"column":5}},"25":{"start":{"line":86,"column":6},"end":{"line":86,"column":42}},"26":{"start":{"line":87,"column":6},"end":{"line":94,"column":7}},"27":{"start":{"line":90,"column":8},"end":{"line":93,"column":95}},"28":{"start":{"line":95,"column":6},"end":{"line":95,"column":26}},"29":{"start":{"line":99,"column":4},"end":{"line":165,"column":5}},"30":{"start":{"line":100,"column":6},"end":{"line":100,"column":51}},"31":{"start":{"line":101,"column":6},"end":{"line":103,"column":7}},"32":{"start":{"line":102,"column":8},"end":{"line":102,"column":22}},"33":{"start":{"line":104,"column":6},"end":{"line":104,"column":39}},"34":{"start":{"line":105,"column":6},"end":{"line":132,"column":7}},"35":{"start":{"line":110,"column":10},"end":{"line":110,"column":54}},"36":{"start":{"line":113,"column":10},"end":{"line":113,"column":30}},"37":{"start":{"line":115,"column":10},"end":{"line":117,"column":11}},"38":{"start":{"line":116,"column":12},"end":{"line":116,"column":26}},"39":{"start":{"line":121,"column":10},"end":{"line":121,"column":40}},"40":{"start":{"line":123,"column":10},"end":{"line":129,"column":71}},"41":{"start":{"line":131,"column":10},"end":{"line":131,"column":165}},"42":{"start":{"line":134,"column":6},"end":{"line":163,"column":7}},"43":{"start":{"line":138,"column":8},"end":{"line":142,"column":9}},"44":{"start":{"line":139,"column":10},"end":{"line":141,"column":11}},"45":{"start":{"line":140,"column":12},"end":{"line":140,"column":26}},"46":{"start":{"line":144,"column":8},"end":{"line":144,"column":26}},"47":{"start":{"line":145,"column":8},"end":{"line":145,"column":20}},"48":{"start":{"line":146,"column":8},"end":{"line":160,"column":9}},"49":{"start":{"line":148,"column":10},"end":{"line":152,"column":11}},"50":{"start":{"line":149,"column":12},"end":{"line":151,"column":13}},"51":{"start":{"line":150,"column":14},"end":{"line":150,"column":63}},"52":{"start":{"line":153,"column":10},"end":{"line":153,"column":47}},"53":{"start":{"line":155,"column":10},"end":{"line":158,"column":13}},"54":{"start":{"line":157,"column":12},"end":{"line":157,"column":69}},"55":{"start":{"line":159,"column":10},"end":{"line":159,"column":47}},"56":{"start":{"line":162,"column":8},"end":{"line":162,"column":20}},"57":{"start":{"line":164,"column":6},"end":{"line":164,"column":20}},"58":{"start":{"line":167,"column":4},"end":{"line":167,"column":21}},"59":{"start":{"line":173,"column":4},"end":{"line":173,"column":22}},"60":{"start":{"line":174,"column":4},"end":{"line":176,"column":7}},"61":{"start":{"line":175,"column":6},"end":{"line":175,"column":67}},"62":{"start":{"line":177,"column":4},"end":{"line":177,"column":18}},"63":{"start":{"line":182,"column":4},"end":{"line":182,"column":46}},"64":{"start":{"line":183,"column":4},"end":{"line":185,"column":5}},"65":{"start":{"line":184,"column":6},"end":{"line":184,"column":23}},"66":{"start":{"line":186,"column":4},"end":{"line":191,"column":5}},"67":{"start":{"line":190,"column":8},"end":{"line":190,"column":59}},"68":{"start":{"line":201,"column":4},"end":{"line":201,"column":28}},"69":{"start":{"line":202,"column":4},"end":{"line":213,"column":7}},"70":{"start":{"line":203,"column":6},"end":{"line":212,"column":7}},"71":{"start":{"line":204,"column":8},"end":{"line":209,"column":11}},"72":{"start":{"line":205,"column":10},"end":{"line":205,"column":53}},"73":{"start":{"line":206,"column":10},"end":{"line":208,"column":11}},"74":{"start":{"line":207,"column":12},"end":{"line":207,"column":32}},"75":{"start":{"line":210,"column":13},"end":{"line":212,"column":7}},"76":{"start":{"line":211,"column":8},"end":{"line":211,"column":28}},"77":{"start":{"line":214,"column":4},"end":{"line":214,"column":41}},"78":{"start":{"line":224,"column":4},"end":{"line":224,"column":115}},"79":{"start":{"line":226,"column":4},"end":{"line":228,"column":5}},"80":{"start":{"line":227,"column":6},"end":{"line":227,"column":21}},"81":{"start":{"line":229,"column":4},"end":{"line":229,"column":44}},"82":{"start":{"line":230,"column":4},"end":{"line":251,"column":5}},"83":{"start":{"line":231,"column":6},"end":{"line":231,"column":19}},"84":{"start":{"line":232,"column":6},"end":{"line":232,"column":56}},"85":{"start":{"line":233,"column":6},"end":{"line":250,"column":7}},"86":{"start":{"line":234,"column":8},"end":{"line":241,"column":9}},"87":{"start":{"line":235,"column":10},"end":{"line":235,"column":68}},"88":{"start":{"line":236,"column":10},"end":{"line":238,"column":11}},"89":{"start":{"line":237,"column":12},"end":{"line":237,"column":46}},"90":{"start":{"line":240,"column":10},"end":{"line":240,"column":29}},"91":{"start":{"line":242,"column":8},"end":{"line":249,"column":9}},"92":{"start":{"line":243,"column":10},"end":{"line":245,"column":11}},"93":{"start":{"line":244,"column":12},"end":{"line":244,"column":54}},"94":{"start":{"line":246,"column":10},"end":{"line":246,"column":41}},"95":{"start":{"line":248,"column":10},"end":{"line":248,"column":37}},"96":{"start":{"line":252,"column":4},"end":{"line":252,"column":19}},"97":{"start":{"line":257,"column":4},"end":{"line":257,"column":15}},"98":{"start":{"line":258,"column":4},"end":{"line":260,"column":5}},"99":{"start":{"line":259,"column":6},"end":{"line":259,"column":18}},"100":{"start":{"line":261,"column":4},"end":{"line":278,"column":5}},"101":{"start":{"line":265,"column":8},"end":{"line":265,"column":23}},"102":{"start":{"line":266,"column":8},"end":{"line":266,"column":39}},"103":{"start":{"line":270,"column":8},"end":{"line":270,"column":21}},"104":{"start":{"line":273,"column":8},"end":{"line":273,"column":29}},"105":{"start":{"line":275,"column":8},"end":{"line":277,"column":18}},"106":{"start":{"line":276,"column":10},"end":{"line":276,"column":23}},"107":{"start":{"line":284,"column":4},"end":{"line":284,"column":59}},"108":{"start":{"line":285,"column":4},"end":{"line":285,"column":23}},"109":{"start":{"line":286,"column":4},"end":{"line":288,"column":5}},"110":{"start":{"line":287,"column":6},"end":{"line":287,"column":19}},"111":{"start":{"line":289,"column":4},"end":{"line":328,"column":5}},"112":{"start":{"line":290,"column":6},"end":{"line":290,"column":35}},"113":{"start":{"line":291,"column":6},"end":{"line":327,"column":7}},"114":{"start":{"line":292,"column":8},"end":{"line":292,"column":44}},"115":{"start":{"line":293,"column":8},"end":{"line":323,"column":9}},"116":{"start":{"line":295,"column":10},"end":{"line":295,"column":30}},"117":{"start":{"line":297,"column":10},"end":{"line":320,"column":11}},"118":{"start":{"line":299,"column":12},"end":{"line":316,"column":13}},"119":{"start":{"line":303,"column":16},"end":{"line":303,"column":63}},"120":{"start":{"line":304,"column":16},"end":{"line":304,"column":22}},"121":{"start":{"line":307,"column":16},"end":{"line":307,"column":52}},"122":{"start":{"line":308,"column":16},"end":{"line":308,"column":22}},"123":{"start":{"line":311,"column":16},"end":{"line":311,"column":57}},"124":{"start":{"line":312,"column":16},"end":{"line":312,"column":22}},"125":{"start":{"line":315,"column":16},"end":{"line":315,"column":46}},"126":{"start":{"line":319,"column":12},"end":{"line":319,"column":41}},"127":{"start":{"line":322,"column":10},"end":{"line":322,"column":24}},"128":{"start":{"line":324,"column":8},"end":{"line":324,"column":19}},"129":{"start":{"line":326,"column":8},"end":{"line":326,"column":25}},"130":{"start":{"line":329,"column":4},"end":{"line":329,"column":18}},"131":{"start":{"line":334,"column":4},"end":{"line":354,"column":5}},"132":{"start":{"line":335,"column":6},"end":{"line":353,"column":7}},"133":{"start":{"line":337,"column":10},"end":{"line":337,"column":61}},"134":{"start":{"line":338,"column":10},"end":{"line":338,"column":16}},"135":{"start":{"line":340,"column":10},"end":{"line":340,"column":69}},"136":{"start":{"line":341,"column":10},"end":{"line":341,"column":16}},"137":{"start":{"line":343,"column":10},"end":{"line":343,"column":61}},"138":{"start":{"line":344,"column":10},"end":{"line":344,"column":16}},"139":{"start":{"line":346,"column":10},"end":{"line":346,"column":115}},"140":{"start":{"line":347,"column":10},"end":{"line":347,"column":16}},"141":{"start":{"line":349,"column":10},"end":{"line":349,"column":146}},"142":{"start":{"line":350,"column":10},"end":{"line":350,"column":16}},"143":{"start":{"line":352,"column":10},"end":{"line":352,"column":122}},"144":{"start":{"line":355,"column":4},"end":{"line":355,"column":19}},"145":{"start":{"line":360,"column":4},"end":{"line":360,"column":23}},"146":{"start":{"line":362,"column":4},"end":{"line":364,"column":5}},"147":{"start":{"line":363,"column":6},"end":{"line":363,"column":43}},"148":{"start":{"line":365,"column":4},"end":{"line":382,"column":5}},"149":{"start":{"line":366,"column":6},"end":{"line":381,"column":7}},"150":{"start":{"line":368,"column":10},"end":{"line":368,"column":82}},"151":{"start":{"line":369,"column":10},"end":{"line":369,"column":16}},"152":{"start":{"line":371,"column":10},"end":{"line":371,"column":86}},"153":{"start":{"line":372,"column":10},"end":{"line":372,"column":64}},"154":{"start":{"line":373,"column":10},"end":{"line":373,"column":61}},"155":{"start":{"line":374,"column":10},"end":{"line":374,"column":16}},"156":{"start":{"line":376,"column":10},"end":{"line":376,"column":54}},"157":{"start":{"line":377,"column":10},"end":{"line":377,"column":58}},"158":{"start":{"line":378,"column":10},"end":{"line":378,"column":56}},"159":{"start":{"line":379,"column":10},"end":{"line":379,"column":74}},"160":{"start":{"line":380,"column":10},"end":{"line":380,"column":16}},"161":{"start":{"line":383,"column":4},"end":{"line":383,"column":19}},"162":{"start":{"line":389,"column":2},"end":{"line":571,"column":3}},"163":{"start":{"line":391,"column":4},"end":{"line":397,"column":6}},"164":{"start":{"line":393,"column":6},"end":{"line":393,"column":68}},"165":{"start":{"line":394,"column":6},"end":{"line":396,"column":7}},"166":{"start":{"line":395,"column":8},"end":{"line":395,"column":76}},"167":{"start":{"line":401,"column":4},"end":{"line":477,"column":9}},"168":{"start":{"line":405,"column":6},"end":{"line":475,"column":8}},"169":{"start":{"line":406,"column":8},"end":{"line":406,"column":36}},"170":{"start":{"line":407,"column":8},"end":{"line":410,"column":30}},"171":{"start":{"line":408,"column":10},"end":{"line":408,"column":68}},"172":{"start":{"line":409,"column":10},"end":{"line":409,"column":62}},"173":{"start":{"line":411,"column":8},"end":{"line":411,"column":23}},"174":{"start":{"line":412,"column":8},"end":{"line":412,"column":22}},"175":{"start":{"line":428,"column":8},"end":{"line":428,"column":35}},"176":{"start":{"line":429,"column":8},"end":{"line":429,"column":81}},"177":{"start":{"line":434,"column":8},"end":{"line":434,"column":60}},"178":{"start":{"line":435,"column":8},"end":{"line":440,"column":9}},"179":{"start":{"line":436,"column":10},"end":{"line":436,"column":32}},"180":{"start":{"line":437,"column":10},"end":{"line":437,"column":28}},"181":{"start":{"line":439,"column":10},"end":{"line":439,"column":60}},"182":{"start":{"line":442,"column":8},"end":{"line":453,"column":9}},"183":{"start":{"line":443,"column":10},"end":{"line":443,"column":34}},"184":{"start":{"line":444,"column":10},"end":{"line":447,"column":11}},"185":{"start":{"line":445,"column":12},"end":{"line":445,"column":73}},"186":{"start":{"line":446,"column":12},"end":{"line":446,"column":35}},"187":{"start":{"line":448,"column":10},"end":{"line":451,"column":11}},"188":{"start":{"line":449,"column":12},"end":{"line":449,"column":73}},"189":{"start":{"line":450,"column":12},"end":{"line":450,"column":35}},"190":{"start":{"line":452,"column":10},"end":{"line":452,"column":25}},"191":{"start":{"line":454,"column":8},"end":{"line":454,"column":50}},"192":{"start":{"line":456,"column":8},"end":{"line":467,"column":9}},"193":{"start":{"line":457,"column":10},"end":{"line":463,"column":11}},"194":{"start":{"line":458,"column":12},"end":{"line":461,"column":15}},"195":{"start":{"line":460,"column":14},"end":{"line":460,"column":100}},"196":{"start":{"line":462,"column":12},"end":{"line":462,"column":36}},"197":{"start":{"line":464,"column":10},"end":{"line":466,"column":13}},"198":{"start":{"line":465,"column":12},"end":{"line":465,"column":38}},"199":{"start":{"line":469,"column":8},"end":{"line":473,"column":9}},"200":{"start":{"line":470,"column":10},"end":{"line":472,"column":13}},"201":{"start":{"line":471,"column":12},"end":{"line":471,"column":39}},"202":{"start":{"line":474,"column":8},"end":{"line":474,"column":23}},"203":{"start":{"line":476,"column":6},"end":{"line":476,"column":23}},"204":{"start":{"line":480,"column":4},"end":{"line":485,"column":6}},"205":{"start":{"line":481,"column":6},"end":{"line":483,"column":7}},"206":{"start":{"line":482,"column":8},"end":{"line":482,"column":48}},"207":{"start":{"line":484,"column":6},"end":{"line":484,"column":21}},"208":{"start":{"line":489,"column":4},"end":{"line":570,"column":6}},"209":{"start":{"line":490,"column":6},"end":{"line":568,"column":7}},"210":{"start":{"line":491,"column":8},"end":{"line":491,"column":72}},"211":{"start":{"line":492,"column":8},"end":{"line":494,"column":9}},"212":{"start":{"line":493,"column":10},"end":{"line":493,"column":53}},"213":{"start":{"line":495,"column":8},"end":{"line":497,"column":9}},"214":{"start":{"line":496,"column":10},"end":{"line":496,"column":80}},"215":{"start":{"line":498,"column":8},"end":{"line":567,"column":9}},"216":{"start":{"line":502,"column":12},"end":{"line":502,"column":34}},"217":{"start":{"line":504,"column":12},"end":{"line":512,"column":14}},"218":{"start":{"line":513,"column":12},"end":{"line":513,"column":18}},"219":{"start":{"line":517,"column":12},"end":{"line":519,"column":16}},"220":{"start":{"line":520,"column":12},"end":{"line":520,"column":18}},"221":{"start":{"line":523,"column":12},"end":{"line":523,"column":138}},"222":{"start":{"line":524,"column":12},"end":{"line":524,"column":18}},"223":{"start":{"line":528,"column":12},"end":{"line":528,"column":117}},"224":{"start":{"line":530,"column":12},"end":{"line":530,"column":162}},"225":{"start":{"line":532,"column":12},"end":{"line":532,"column":33}},"226":{"start":{"line":533,"column":12},"end":{"line":533,"column":18}},"227":{"start":{"line":537,"column":12},"end":{"line":541,"column":13}},"228":{"start":{"line":539,"column":14},"end":{"line":539,"column":107}},"229":{"start":{"line":540,"column":14},"end":{"line":540,"column":84}},"230":{"start":{"line":543,"column":12},"end":{"line":564,"column":17}},"231":{"start":{"line":566,"column":12},"end":{"line":566,"column":42}},"232":{"start":{"line":569,"column":6},"end":{"line":569,"column":21}},"233":{"start":{"line":574,"column":2},"end":{"line":574,"column":36}},"234":{"start":{"line":576,"column":2},"end":{"line":576,"column":17}}},"branchMap":{"1":{"line":10,"type":"binary-expr","locations":[{"start":{"line":10,"column":17},"end":{"line":10,"column":44}},{"start":{"line":10,"column":48},"end":{"line":10,"column":60}}]},"2":{"line":11,"type":"binary-expr","locations":[{"start":{"line":11,"column":13},"end":{"line":11,"column":41}},{"start":{"line":11,"column":45},"end":{"line":11,"column":71}},{"start":{"line":11,"column":75},"end":{"line":11,"column":82}},{"start":{"line":11,"column":86},"end":{"line":11,"column":95}}]},"3":{"line":14,"type":"binary-expr","locations":[{"start":{"line":14,"column":14},"end":{"line":14,"column":30}},{"start":{"line":14,"column":34},"end":{"line":14,"column":53}},{"start":{"line":14,"column":57},"end":{"line":14,"column":93}}]},"4":{"line":15,"type":"binary-expr","locations":[{"start":{"line":15,"column":13},"end":{"line":15,"column":23}},{"start":{"line":15,"column":27},"end":{"line":15,"column":36}},{"start":{"line":15,"column":40},"end":{"line":15,"column":70}}]},"5":{"line":24,"type":"if","locations":[{"start":{"line":24,"column":2},"end":{"line":24,"column":2}},{"start":{"line":24,"column":2},"end":{"line":24,"column":2}}]},"6":{"line":29,"type":"if","locations":[{"start":{"line":29,"column":9},"end":{"line":29,"column":9}},{"start":{"line":29,"column":9},"end":{"line":29,"column":9}}]},"7":{"line":35,"type":"binary-expr","locations":[{"start":{"line":35,"column":37},"end":{"line":35,"column":41}},{"start":{"line":35,"column":45},"end":{"line":35,"column":47}}]},"8":{"line":38,"type":"if","locations":[{"start":{"line":38,"column":4},"end":{"line":38,"column":4}},{"start":{"line":38,"column":4},"end":{"line":38,"column":4}}]},"9":{"line":50,"type":"binary-expr","locations":[{"start":{"line":50,"column":8},"end":{"line":50,"column":17}},{"start":{"line":50,"column":21},"end":{"line":50,"column":23}}]},"10":{"line":90,"type":"cond-expr","locations":[{"start":{"line":90,"column":57},"end":{"line":90,"column":72}},{"start":{"line":93,"column":10},"end":{"line":93,"column":94}}]},"11":{"line":93,"type":"cond-expr","locations":[{"start":{"line":93,"column":25},"end":{"line":93,"column":85}},{"start":{"line":93,"column":88},"end":{"line":93,"column":94}}]},"12":{"line":101,"type":"if","locations":[{"start":{"line":101,"column":6},"end":{"line":101,"column":6}},{"start":{"line":101,"column":6},"end":{"line":101,"column":6}}]},"13":{"line":105,"type":"switch","locations":[{"start":{"line":106,"column":8},"end":{"line":106,"column":31}},{"start":{"line":107,"column":8},"end":{"line":110,"column":54}},{"start":{"line":111,"column":8},"end":{"line":113,"column":30}},{"start":{"line":114,"column":8},"end":{"line":129,"column":71}},{"start":{"line":130,"column":8},"end":{"line":131,"column":165}}]},"14":{"line":110,"type":"cond-expr","locations":[{"start":{"line":110,"column":34},"end":{"line":110,"column":40}},{"start":{"line":110,"column":43},"end":{"line":110,"column":53}}]},"15":{"line":115,"type":"if","locations":[{"start":{"line":115,"column":10},"end":{"line":115,"column":10}},{"start":{"line":115,"column":10},"end":{"line":115,"column":10}}]},"16":{"line":123,"type":"cond-expr","locations":[{"start":{"line":123,"column":51},"end":{"line":123,"column":109}},{"start":{"line":123,"column":112},"end":{"line":123,"column":135}}]},"17":{"line":123,"type":"binary-expr","locations":[{"start":{"line":123,"column":24},"end":{"line":123,"column":33}},{"start":{"line":123,"column":37},"end":{"line":123,"column":48}}]},"18":{"line":123,"type":"cond-expr","locations":[{"start":{"line":123,"column":63},"end":{"line":123,"column":66}},{"start":{"line":123,"column":69},"end":{"line":123,"column":72}}]},"19":{"line":134,"type":"if","locations":[{"start":{"line":134,"column":6},"end":{"line":134,"column":6}},{"start":{"line":134,"column":6},"end":{"line":134,"column":6}}]},"20":{"line":139,"type":"if","locations":[{"start":{"line":139,"column":10},"end":{"line":139,"column":10}},{"start":{"line":139,"column":10},"end":{"line":139,"column":10}}]},"21":{"line":146,"type":"if","locations":[{"start":{"line":146,"column":8},"end":{"line":146,"column":8}},{"start":{"line":146,"column":8},"end":{"line":146,"column":8}}]},"22":{"line":149,"type":"if","locations":[{"start":{"line":149,"column":12},"end":{"line":149,"column":12}},{"start":{"line":149,"column":12},"end":{"line":149,"column":12}}]},"23":{"line":183,"type":"if","locations":[{"start":{"line":183,"column":4},"end":{"line":183,"column":4}},{"start":{"line":183,"column":4},"end":{"line":183,"column":4}}]},"24":{"line":186,"type":"switch","locations":[{"start":{"line":187,"column":6},"end":{"line":187,"column":29}},{"start":{"line":188,"column":6},"end":{"line":188,"column":29}},{"start":{"line":189,"column":6},"end":{"line":190,"column":59}}]},"25":{"line":203,"type":"if","locations":[{"start":{"line":203,"column":6},"end":{"line":203,"column":6}},{"start":{"line":203,"column":6},"end":{"line":203,"column":6}}]},"26":{"line":203,"type":"binary-expr","locations":[{"start":{"line":203,"column":10},"end":{"line":203,"column":15}},{"start":{"line":203,"column":19},"end":{"line":203,"column":59}}]},"27":{"line":206,"type":"if","locations":[{"start":{"line":206,"column":10},"end":{"line":206,"column":10}},{"start":{"line":206,"column":10},"end":{"line":206,"column":10}}]},"28":{"line":210,"type":"if","locations":[{"start":{"line":210,"column":13},"end":{"line":210,"column":13}},{"start":{"line":210,"column":13},"end":{"line":210,"column":13}}]},"29":{"line":214,"type":"binary-expr","locations":[{"start":{"line":214,"column":23},"end":{"line":214,"column":32}},{"start":{"line":214,"column":36},"end":{"line":214,"column":39}}]},"30":{"line":226,"type":"if","locations":[{"start":{"line":226,"column":4},"end":{"line":226,"column":4}},{"start":{"line":226,"column":4},"end":{"line":226,"column":4}}]},"31":{"line":226,"type":"binary-expr","locations":[{"start":{"line":226,"column":8},"end":{"line":226,"column":24}},{"start":{"line":226,"column":28},"end":{"line":226,"column":37}},{"start":{"line":226,"column":41},"end":{"line":226,"column":133}}]},"32":{"line":226,"type":"binary-expr","locations":[{"start":{"line":226,"column":45},"end":{"line":226,"column":94}},{"start":{"line":226,"column":101},"end":{"line":226,"column":131}}]},"33":{"line":226,"type":"binary-expr","locations":[{"start":{"line":226,"column":62},"end":{"line":226,"column":70}},{"start":{"line":226,"column":74},"end":{"line":226,"column":82}}]},"34":{"line":229,"type":"binary-expr","locations":[{"start":{"line":229,"column":26},"end":{"line":229,"column":35}},{"start":{"line":229,"column":39},"end":{"line":229,"column":42}}]},"35":{"line":233,"type":"if","locations":[{"start":{"line":233,"column":6},"end":{"line":233,"column":6}},{"start":{"line":233,"column":6},"end":{"line":233,"column":6}}]},"36":{"line":233,"type":"binary-expr","locations":[{"start":{"line":233,"column":10},"end":{"line":233,"column":16}},{"start":{"line":233,"column":20},"end":{"line":233,"column":28}}]},"37":{"line":234,"type":"if","locations":[{"start":{"line":234,"column":8},"end":{"line":234,"column":8}},{"start":{"line":234,"column":8},"end":{"line":234,"column":8}}]},"38":{"line":236,"type":"if","locations":[{"start":{"line":236,"column":10},"end":{"line":236,"column":10}},{"start":{"line":236,"column":10},"end":{"line":236,"column":10}}]},"39":{"line":242,"type":"if","locations":[{"start":{"line":242,"column":8},"end":{"line":242,"column":8}},{"start":{"line":242,"column":8},"end":{"line":242,"column":8}}]},"40":{"line":243,"type":"if","locations":[{"start":{"line":243,"column":10},"end":{"line":243,"column":10}},{"start":{"line":243,"column":10},"end":{"line":243,"column":10}}]},"41":{"line":258,"type":"if","locations":[{"start":{"line":258,"column":4},"end":{"line":258,"column":4}},{"start":{"line":258,"column":4},"end":{"line":258,"column":4}}]},"42":{"line":261,"type":"switch","locations":[{"start":{"line":262,"column":6},"end":{"line":262,"column":29}},{"start":{"line":263,"column":6},"end":{"line":266,"column":39}},{"start":{"line":267,"column":6},"end":{"line":267,"column":30}},{"start":{"line":268,"column":6},"end":{"line":268,"column":31}},{"start":{"line":269,"column":6},"end":{"line":270,"column":21}},{"start":{"line":271,"column":6},"end":{"line":271,"column":29}},{"start":{"line":272,"column":6},"end":{"line":273,"column":29}},{"start":{"line":274,"column":6},"end":{"line":277,"column":18}}]},"43":{"line":266,"type":"binary-expr","locations":[{"start":{"line":266,"column":15},"end":{"line":266,"column":29}},{"start":{"line":266,"column":33},"end":{"line":266,"column":38}}]},"44":{"line":286,"type":"if","locations":[{"start":{"line":286,"column":4},"end":{"line":286,"column":4}},{"start":{"line":286,"column":4},"end":{"line":286,"column":4}}]},"45":{"line":286,"type":"binary-expr","locations":[{"start":{"line":286,"column":8},"end":{"line":286,"column":30}},{"start":{"line":286,"column":34},"end":{"line":286,"column":54}}]},"46":{"line":291,"type":"if","locations":[{"start":{"line":291,"column":6},"end":{"line":291,"column":6}},{"start":{"line":291,"column":6},"end":{"line":291,"column":6}}]},"47":{"line":293,"type":"if","locations":[{"start":{"line":293,"column":8},"end":{"line":293,"column":8}},{"start":{"line":293,"column":8},"end":{"line":293,"column":8}}]},"48":{"line":297,"type":"if","locations":[{"start":{"line":297,"column":10},"end":{"line":297,"column":10}},{"start":{"line":297,"column":10},"end":{"line":297,"column":10}}]},"49":{"line":299,"type":"switch","locations":[{"start":{"line":301,"column":14},"end":{"line":301,"column":23}},{"start":{"line":302,"column":14},"end":{"line":304,"column":22}},{"start":{"line":306,"column":14},"end":{"line":308,"column":22}},{"start":{"line":310,"column":14},"end":{"line":312,"column":22}},{"start":{"line":314,"column":14},"end":{"line":315,"column":46}}]},"50":{"line":303,"type":"binary-expr","locations":[{"start":{"line":303,"column":26},"end":{"line":303,"column":57}},{"start":{"line":303,"column":61},"end":{"line":303,"column":62}}]},"51":{"line":307,"type":"binary-expr","locations":[{"start":{"line":307,"column":26},"end":{"line":307,"column":46}},{"start":{"line":307,"column":50},"end":{"line":307,"column":51}}]},"52":{"line":335,"type":"switch","locations":[{"start":{"line":336,"column":8},"end":{"line":338,"column":16}},{"start":{"line":339,"column":8},"end":{"line":341,"column":16}},{"start":{"line":342,"column":8},"end":{"line":344,"column":16}},{"start":{"line":345,"column":8},"end":{"line":347,"column":16}},{"start":{"line":348,"column":8},"end":{"line":350,"column":16}},{"start":{"line":351,"column":8},"end":{"line":352,"column":122}}]},"53":{"line":366,"type":"switch","locations":[{"start":{"line":367,"column":8},"end":{"line":369,"column":16}},{"start":{"line":370,"column":8},"end":{"line":374,"column":16}},{"start":{"line":375,"column":8},"end":{"line":380,"column":16}}]},"54":{"line":389,"type":"if","locations":[{"start":{"line":389,"column":2},"end":{"line":389,"column":2}},{"start":{"line":389,"column":2},"end":{"line":389,"column":2}}]},"55":{"line":393,"type":"binary-expr","locations":[{"start":{"line":393,"column":19},"end":{"line":393,"column":34}},{"start":{"line":393,"column":38},"end":{"line":393,"column":67}}]},"56":{"line":394,"type":"if","locations":[{"start":{"line":394,"column":6},"end":{"line":394,"column":6}},{"start":{"line":394,"column":6},"end":{"line":394,"column":6}}]},"57":{"line":395,"type":"cond-expr","locations":[{"start":{"line":395,"column":64},"end":{"line":395,"column":66}},{"start":{"line":395,"column":69},"end":{"line":395,"column":75}}]},"58":{"line":409,"type":"binary-expr","locations":[{"start":{"line":409,"column":19},"end":{"line":409,"column":38}},{"start":{"line":409,"column":42},"end":{"line":409,"column":61}}]},"59":{"line":418,"type":"cond-expr","locations":[{"start":{"line":418,"column":71},"end":{"line":418,"column":83}},{"start":{"line":418,"column":86},"end":{"line":418,"column":96}}]},"60":{"line":435,"type":"if","locations":[{"start":{"line":435,"column":8},"end":{"line":435,"column":8}},{"start":{"line":435,"column":8},"end":{"line":435,"column":8}}]},"61":{"line":435,"type":"binary-expr","locations":[{"start":{"line":435,"column":12},"end":{"line":435,"column":22}},{"start":{"line":435,"column":26},"end":{"line":435,"column":71}}]},"62":{"line":442,"type":"if","locations":[{"start":{"line":442,"column":8},"end":{"line":442,"column":8}},{"start":{"line":442,"column":8},"end":{"line":442,"column":8}}]},"63":{"line":442,"type":"binary-expr","locations":[{"start":{"line":442,"column":12},"end":{"line":442,"column":25}},{"start":{"line":442,"column":29},"end":{"line":442,"column":58}}]},"64":{"line":444,"type":"if","locations":[{"start":{"line":444,"column":10},"end":{"line":444,"column":10}},{"start":{"line":444,"column":10},"end":{"line":444,"column":10}}]},"65":{"line":448,"type":"if","locations":[{"start":{"line":448,"column":10},"end":{"line":448,"column":10}},{"start":{"line":448,"column":10},"end":{"line":448,"column":10}}]},"66":{"line":456,"type":"if","locations":[{"start":{"line":456,"column":8},"end":{"line":456,"column":8}},{"start":{"line":456,"column":8},"end":{"line":456,"column":8}}]},"67":{"line":457,"type":"if","locations":[{"start":{"line":457,"column":10},"end":{"line":457,"column":10}},{"start":{"line":457,"column":10},"end":{"line":457,"column":10}}]},"68":{"line":460,"type":"cond-expr","locations":[{"start":{"line":460,"column":71},"end":{"line":460,"column":79}},{"start":{"line":460,"column":82},"end":{"line":460,"column":90}}]},"69":{"line":469,"type":"if","locations":[{"start":{"line":469,"column":8},"end":{"line":469,"column":8}},{"start":{"line":469,"column":8},"end":{"line":469,"column":8}}]},"70":{"line":492,"type":"if","locations":[{"start":{"line":492,"column":8},"end":{"line":492,"column":8}},{"start":{"line":492,"column":8},"end":{"line":492,"column":8}}]},"71":{"line":495,"type":"if","locations":[{"start":{"line":495,"column":8},"end":{"line":495,"column":8}},{"start":{"line":495,"column":8},"end":{"line":495,"column":8}}]},"72":{"line":498,"type":"switch","locations":[{"start":{"line":500,"column":10},"end":{"line":513,"column":18}},{"start":{"line":515,"column":10},"end":{"line":520,"column":18}},{"start":{"line":522,"column":10},"end":{"line":524,"column":18}},{"start":{"line":526,"column":10},"end":{"line":533,"column":18}},{"start":{"line":534,"column":10},"end":{"line":534,"column":27}},{"start":{"line":535,"column":10},"end":{"line":566,"column":42}}]},"73":{"line":523,"type":"cond-expr","locations":[{"start":{"line":523,"column":90},"end":{"line":523,"column":112}},{"start":{"line":523,"column":115},"end":{"line":523,"column":137}}]},"74":{"line":528,"type":"cond-expr","locations":[{"start":{"line":528,"column":63},"end":{"line":528,"column":88}},{"start":{"line":528,"column":91},"end":{"line":528,"column":116}}]},"75":{"line":537,"type":"if","locations":[{"start":{"line":537,"column":12},"end":{"line":537,"column":12}},{"start":{"line":537,"column":12},"end":{"line":537,"column":12}}]},"76":{"line":543,"type":"cond-expr","locations":[{"start":{"line":545,"column":14},"end":{"line":547,"column":16}},{"start":{"line":549,"column":14},"end":{"line":564,"column":16}}]}}},"/Users/kit/Dropbox/Projects/json3/lib/json3.js":{"path":"/Users/kit/Dropbox/Projects/json3/lib/json3.js","s":{"1":1,"2":1,"3":1,"4":1,"5":1,"6":1,"7":1,"8":1,"9":0,"10":1,"11":1,"12":1,"13":1,"14":3,"15":0,"16":3,"17":3,"18":0,"19":3,"20":1,"21":2,"22":2,"23":1,"24":1,"25":1,"26":4,"27":1,"28":1,"29":0,"30":1,"31":2,"32":1,"33":1,"34":1,"35":1,"36":1,"37":1,"38":1,"39":1,"40":1,"41":1,"42":1,"43":1,"44":1,"45":1,"46":1,"47":0,"48":1,"49":3,"50":1,"51":1,"52":1,"53":1,"54":1,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0,"104":0,"105":0,"106":0,"107":0,"108":0,"109":0,"110":0,"111":0,"112":0,"113":0,"114":0,"115":0,"116":0,"117":0,"118":0,"119":0,"120":0,"121":0,"122":0,"123":0,"124":0,"125":0,"126":0,"127":0,"128":0,"129":0,"130":0,"131":0,"132":0,"133":0,"134":0,"135":0,"136":0,"137":0,"138":0,"139":0,"140":0,"141":0,"142":0,"143":0,"144":0,"145":0,"146":0,"147":0,"148":0,"149":0,"150":0,"151":0,"152":0,"153":0,"154":0,"155":0,"156":0,"157":0,"158":0,"159":0,"160":0,"161":0,"162":0,"163":0,"164":0,"165":0,"166":0,"167":0,"168":0,"169":0,"170":0,"171":0,"172":0,"173":0,"174":0,"175":0,"176":0,"177":0,"178":0,"179":0,"180":0,"181":0,"182":0,"183":0,"184":0,"185":0,"186":0,"187":0,"188":0,"189":0,"190":0,"191":0,"192":0,"193":0,"194":0,"195":0,"196":0,"197":0,"198":0,"199":0,"200":0,"201":0,"202":0,"203":0,"204":0,"205":0,"206":0,"207":0,"208":0,"209":0,"210":0,"211":0,"212":0,"213":0,"214":0,"215":0,"216":0,"217":0,"218":0,"219":0,"220":0,"221":0,"222":0,"223":0,"224":0,"225":0,"226":0,"227":0,"228":0,"229":0,"230":0,"231":0,"232":0,"233":0,"234":0,"235":0,"236":0,"237":0,"238":0,"239":0,"240":0,"241":0,"242":0,"243":0,"244":0,"245":0,"246":0,"247":0,"248":0,"249":0,"250":0,"251":0,"252":0,"253":0,"254":0,"255":0,"256":0,"257":0,"258":0,"259":0,"260":0,"261":0,"262":0,"263":0,"264":0,"265":0,"266":0,"267":0,"268":0,"269":0,"270":0,"271":0,"272":0,"273":0,"274":0,"275":0,"276":0,"277":0,"278":0,"279":0,"280":0,"281":0,"282":0,"283":0,"284":0,"285":0,"286":0,"287":0,"288":0,"289":0,"290":0,"291":0,"292":0,"293":0,"294":0,"295":0,"296":0,"297":0,"298":0,"299":0,"300":0,"301":0,"302":0,"303":0,"304":0,"305":0,"306":0,"307":0,"308":0,"309":0,"310":0,"311":0,"312":0,"313":0,"314":0,"315":0,"316":0,"317":0,"318":0,"319":0,"320":0,"321":0,"322":0,"323":0,"324":0,"325":0,"326":0,"327":0,"328":0,"329":0,"330":0,"331":0,"332":0,"333":0,"334":0,"335":0,"336":0,"337":0,"338":0,"339":0,"340":0,"341":0,"342":0,"343":0,"344":0,"345":0,"346":0,"347":0,"348":0,"349":0,"350":0,"351":0,"352":0,"353":0,"354":0,"355":0,"356":0,"357":0,"358":0,"359":0,"360":0,"361":1,"362":0,"363":0},"b":{"1":[1,0],"2":[1,1],"3":[1,1,1,1],"4":[1,0],"5":[1,1],"6":[0,0],"7":[1,1,1,1,1,1,1],"8":[0,3],"9":[0,3],"10":[1,2],"11":[1,1],"12":[1,1],"13":[1,1],"14":[1,0],"15":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],"16":[1,1],"17":[1,0],"18":[1,0],"19":[1,1],"20":[1,1],"21":[1,0],"22":[1,0],"23":[1,0],"24":[0,1],"25":[0,0],"26":[0,0],"27":[0,0],"28":[0,0],"29":[0,0],"30":[0,0],"31":[0,0],"32":[0,0],"33":[0,0],"34":[0,0],"35":[0,0,0],"36":[0,0],"37":[0,0],"38":[0,0],"39":[0,0],"40":[0,0],"41":[0,0],"42":[0,0,0,0],"43":[0,0],"44":[0,0],"45":[0,0,0],"46":[0,0],"47":[0,0],"48":[0,0],"49":[0,0],"50":[0,0],"51":[0,0],"52":[0,0],"53":[0,0,0,0,0,0,0,0],"54":[0,0],"55":[0,0],"56":[0,0],"57":[0,0],"58":[0,0],"59":[0,0],"60":[0,0],"61":[0,0],"62":[0,0],"63":[0,0],"64":[0,0],"65":[0,0],"66":[0,0],"67":[0,0],"68":[0,0],"69":[0,0,0,0,0],"70":[0,0],"71":[0,0],"72":[0,0],"73":[0,0],"74":[0,0],"75":[0,0],"76":[0,0],"77":[0,0],"78":[0,0],"79":[0,0],"80":[0,0],"81":[0,0],"82":[0,0],"83":[0,0],"84":[0,0],"85":[0,0],"86":[0,0],"87":[0,0],"88":[0,0],"89":[0,0],"90":[0,0],"91":[0,0,0],"92":[0,0],"93":[0,0],"94":[0,0,0],"95":[0,0],"96":[0,0],"97":[0,0],"98":[0,0],"99":[0,0],"100":[0,0],"101":[0,0,0,0,0,0,0,0,0,0,0,0],"102":[0,0],"103":[0,0],"104":[0,0],"105":[0,0,0,0,0,0,0,0,0,0],"106":[0,0],"107":[0,0,0,0,0,0],"108":[0,0],"109":[0,0,0],"110":[0,0],"111":[0,0],"112":[0,0],"113":[0,0],"114":[0,0],"115":[0,0],"116":[0,0],"117":[0,0],"118":[0,0],"119":[0,0],"120":[0,0],"121":[0,0],"122":[0,0],"123":[0,0],"124":[0,0],"125":[0,0],"126":[0,0],"127":[0,0],"128":[0,0],"129":[0,0],"130":[0,0],"131":[0,0],"132":[0,0],"133":[0,0],"134":[0,0],"135":[0,0],"136":[0,0],"137":[0,0],"138":[0,0],"139":[0,0],"140":[0,0],"141":[0,0],"142":[0,0],"143":[0,0],"144":[0,0],"145":[0,0],"146":[0,0],"147":[0,0],"148":[0,0],"149":[0,0],"150":[0,0],"151":[0,0],"152":[0,0,0,0],"153":[0,0],"154":[0,0],"155":[0,0],"156":[0,0],"157":[0,0],"158":[0,0],"159":[0,0],"160":[0,0],"161":[0,1]},"f":{"1":1,"2":3,"3":4,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0},"fnMap":{"1":{"name":"(anonymous_1)","line":2,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":20}}},"2":{"name":"has","line":42,"loc":{"start":{"line":42,"column":2},"end":{"line":42,"column":21}}},"3":{"name":"(anonymous_3)","line":64,"loc":{"start":{"line":64,"column":19},"end":{"line":64,"column":31}}},"4":{"name":"(anonymous_4)","line":196,"loc":{"start":{"line":196,"column":19},"end":{"line":196,"column":42}}},"5":{"name":"(anonymous_5)","line":204,"loc":{"start":{"line":204,"column":19},"end":{"line":204,"column":39}}},"6":{"name":"(anonymous_6)","line":213,"loc":{"start":{"line":213,"column":23},"end":{"line":213,"column":43}}},"7":{"name":"(anonymous_7)","line":227,"loc":{"start":{"line":227,"column":23},"end":{"line":227,"column":43}}},"8":{"name":"(anonymous_8)","line":247,"loc":{"start":{"line":247,"column":21},"end":{"line":247,"column":49}}},"9":{"name":"(anonymous_9)","line":254,"loc":{"start":{"line":254,"column":14},"end":{"line":254,"column":42}}},"10":{"name":"(anonymous_10)","line":260,"loc":{"start":{"line":260,"column":20},"end":{"line":260,"column":32}}},"11":{"name":"(anonymous_11)","line":280,"loc":{"start":{"line":280,"column":18},"end":{"line":280,"column":46}}},"12":{"name":"(anonymous_12)","line":295,"loc":{"start":{"line":295,"column":18},"end":{"line":295,"column":46}}},"13":{"name":"(anonymous_13)","line":309,"loc":{"start":{"line":309,"column":18},"end":{"line":309,"column":46}}},"14":{"name":"(anonymous_14)","line":347,"loc":{"start":{"line":347,"column":27},"end":{"line":347,"column":51}}},"15":{"name":"(anonymous_15)","line":358,"loc":{"start":{"line":358,"column":18},"end":{"line":358,"column":35}}},"16":{"name":"(anonymous_16)","line":384,"loc":{"start":{"line":384,"column":22},"end":{"line":384,"column":104}}},"17":{"name":"(anonymous_17)","line":491,"loc":{"start":{"line":491,"column":41},"end":{"line":491,"column":61}}},"18":{"name":"(anonymous_18)","line":513,"loc":{"start":{"line":513,"column":24},"end":{"line":513,"column":57}}},"19":{"name":"(anonymous_19)","line":563,"loc":{"start":{"line":563,"column":18},"end":{"line":563,"column":29}}},"20":{"name":"(anonymous_20)","line":571,"loc":{"start":{"line":571,"column":16},"end":{"line":571,"column":28}}},"21":{"name":"(anonymous_21)","line":729,"loc":{"start":{"line":729,"column":16},"end":{"line":729,"column":33}}},"22":{"name":"(anonymous_22)","line":812,"loc":{"start":{"line":812,"column":19},"end":{"line":812,"column":56}}},"23":{"name":"(anonymous_23)","line":824,"loc":{"start":{"line":824,"column":17},"end":{"line":824,"column":55}}},"24":{"name":"(anonymous_24)","line":835,"loc":{"start":{"line":835,"column":27},"end":{"line":835,"column":47}}},"25":{"name":"(anonymous_25)","line":844,"loc":{"start":{"line":844,"column":20},"end":{"line":844,"column":48}}},"26":{"name":"(anonymous_26)","line":862,"loc":{"start":{"line":862,"column":11},"end":{"line":862,"column":23}}}},"statementMap":{"1":{"start":{"line":2,"column":1},"end":{"line":866,"column":9}},"2":{"start":{"line":4,"column":2},"end":{"line":4,"column":57}},"3":{"start":{"line":8,"column":2},"end":{"line":8,"column":60}},"4":{"start":{"line":11,"column":2},"end":{"line":11,"column":51}},"5":{"start":{"line":15,"column":2},"end":{"line":15,"column":84}},"6":{"start":{"line":17,"column":2},"end":{"line":26,"column":3}},"7":{"start":{"line":20,"column":4},"end":{"line":20,"column":43}},"8":{"start":{"line":21,"column":4},"end":{"line":21,"column":35}},"9":{"start":{"line":25,"column":4},"end":{"line":25,"column":43}},"10":{"start":{"line":29,"column":2},"end":{"line":29,"column":47}},"11":{"start":{"line":30,"column":2},"end":{"line":38,"column":24}},"12":{"start":{"line":33,"column":4},"end":{"line":37,"column":150}},"13":{"start":{"line":42,"column":2},"end":{"line":170,"column":3}},"14":{"start":{"line":43,"column":4},"end":{"line":46,"column":5}},"15":{"start":{"line":45,"column":6},"end":{"line":45,"column":23}},"16":{"start":{"line":48,"column":4},"end":{"line":48,"column":20}},"17":{"start":{"line":49,"column":4},"end":{"line":168,"column":5}},"18":{"start":{"line":52,"column":6},"end":{"line":52,"column":34}},"19":{"start":{"line":53,"column":11},"end":{"line":168,"column":5}},"20":{"start":{"line":56,"column":6},"end":{"line":56,"column":63}},"21":{"start":{"line":58,"column":6},"end":{"line":58,"column":83}},"22":{"start":{"line":60,"column":6},"end":{"line":126,"column":7}},"23":{"start":{"line":61,"column":8},"end":{"line":61,"column":107}},"24":{"start":{"line":62,"column":8},"end":{"line":124,"column":9}},"25":{"start":{"line":64,"column":10},"end":{"line":66,"column":28}},"26":{"start":{"line":65,"column":12},"end":{"line":65,"column":21}},"27":{"start":{"line":67,"column":10},"end":{"line":123,"column":11}},"28":{"start":{"line":68,"column":12},"end":{"line":120,"column":70}},"29":{"start":{"line":122,"column":12},"end":{"line":122,"column":39}},"30":{"start":{"line":125,"column":8},"end":{"line":125,"column":41}},"31":{"start":{"line":128,"column":6},"end":{"line":167,"column":7}},"32":{"start":{"line":129,"column":8},"end":{"line":129,"column":32}},"33":{"start":{"line":130,"column":8},"end":{"line":165,"column":9}},"34":{"start":{"line":131,"column":10},"end":{"line":164,"column":11}},"35":{"start":{"line":135,"column":12},"end":{"line":161,"column":13}},"36":{"start":{"line":137,"column":14},"end":{"line":137,"column":40}},"37":{"start":{"line":138,"column":14},"end":{"line":138,"column":81}},"38":{"start":{"line":139,"column":14},"end":{"line":160,"column":15}},"39":{"start":{"line":140,"column":16},"end":{"line":143,"column":38}},"40":{"start":{"line":142,"column":18},"end":{"line":142,"column":50}},"41":{"start":{"line":144,"column":16},"end":{"line":151,"column":17}},"42":{"start":{"line":145,"column":18},"end":{"line":150,"column":40}},"43":{"start":{"line":149,"column":20},"end":{"line":149,"column":55}},"44":{"start":{"line":152,"column":16},"end":{"line":159,"column":17}},"45":{"start":{"line":153,"column":18},"end":{"line":158,"column":40}},"46":{"start":{"line":157,"column":20},"end":{"line":157,"column":55}},"47":{"start":{"line":163,"column":12},"end":{"line":163,"column":35}},"48":{"start":{"line":166,"column":8},"end":{"line":166,"column":37}},"49":{"start":{"line":169,"column":4},"end":{"line":169,"column":37}},"50":{"start":{"line":171,"column":2},"end":{"line":171,"column":38}},"51":{"start":{"line":172,"column":2},"end":{"line":172,"column":21}},"52":{"start":{"line":173,"column":2},"end":{"line":173,"column":31}},"53":{"start":{"line":174,"column":2},"end":{"line":174,"column":27}},"54":{"start":{"line":176,"column":2},"end":{"line":858,"column":3}},"55":{"start":{"line":178,"column":4},"end":{"line":178,"column":44}},"56":{"start":{"line":179,"column":4},"end":{"line":179,"column":36}},"57":{"start":{"line":180,"column":4},"end":{"line":180,"column":40}},"58":{"start":{"line":181,"column":4},"end":{"line":181,"column":40}},"59":{"start":{"line":182,"column":4},"end":{"line":182,"column":38}},"60":{"start":{"line":183,"column":4},"end":{"line":183,"column":42}},"61":{"start":{"line":186,"column":4},"end":{"line":186,"column":54}},"62":{"start":{"line":189,"column":4},"end":{"line":199,"column":5}},"63":{"start":{"line":190,"column":6},"end":{"line":190,"column":29}},"64":{"start":{"line":193,"column":6},"end":{"line":193,"column":75}},"65":{"start":{"line":196,"column":6},"end":{"line":198,"column":8}},"66":{"start":{"line":197,"column":8},"end":{"line":197,"column":177}},"67":{"start":{"line":203,"column":4},"end":{"line":235,"column":5}},"68":{"start":{"line":204,"column":6},"end":{"line":234,"column":8}},"69":{"start":{"line":205,"column":8},"end":{"line":205,"column":38}},"70":{"start":{"line":206,"column":8},"end":{"line":231,"column":9}},"71":{"start":{"line":213,"column":10},"end":{"line":221,"column":12}},"72":{"start":{"line":217,"column":12},"end":{"line":217,"column":94}},"73":{"start":{"line":219,"column":12},"end":{"line":219,"column":38}},"74":{"start":{"line":220,"column":12},"end":{"line":220,"column":26}},"75":{"start":{"line":224,"column":10},"end":{"line":224,"column":44}},"76":{"start":{"line":227,"column":10},"end":{"line":230,"column":12}},"77":{"start":{"line":228,"column":12},"end":{"line":228,"column":69}},"78":{"start":{"line":229,"column":12},"end":{"line":229,"column":100}},"79":{"start":{"line":232,"column":8},"end":{"line":232,"column":23}},"80":{"start":{"line":233,"column":8},"end":{"line":233,"column":47}},"81":{"start":{"line":238,"column":4},"end":{"line":243,"column":6}},"82":{"start":{"line":247,"column":4},"end":{"line":250,"column":6}},"83":{"start":{"line":248,"column":6},"end":{"line":248,"column":41}},"84":{"start":{"line":249,"column":6},"end":{"line":249,"column":75}},"85":{"start":{"line":254,"column":4},"end":{"line":324,"column":6}},"86":{"start":{"line":255,"column":6},"end":{"line":255,"column":50}},"87":{"start":{"line":260,"column":6},"end":{"line":262,"column":31}},"88":{"start":{"line":261,"column":8},"end":{"line":261,"column":25}},"89":{"start":{"line":265,"column":6},"end":{"line":265,"column":33}},"90":{"start":{"line":266,"column":6},"end":{"line":271,"column":7}},"91":{"start":{"line":268,"column":8},"end":{"line":270,"column":9}},"92":{"start":{"line":269,"column":10},"end":{"line":269,"column":17}},"93":{"start":{"line":272,"column":6},"end":{"line":272,"column":34}},"94":{"start":{"line":275,"column":6},"end":{"line":322,"column":7}},"95":{"start":{"line":277,"column":8},"end":{"line":277,"column":134}},"96":{"start":{"line":280,"column":8},"end":{"line":292,"column":10}},"97":{"start":{"line":281,"column":10},"end":{"line":281,"column":84}},"98":{"start":{"line":282,"column":10},"end":{"line":282,"column":160}},"99":{"start":{"line":283,"column":10},"end":{"line":289,"column":11}},"100":{"start":{"line":286,"column":12},"end":{"line":288,"column":13}},"101":{"start":{"line":287,"column":14},"end":{"line":287,"column":33}},"102":{"start":{"line":291,"column":10},"end":{"line":291,"column":128}},"103":{"start":{"line":293,"column":13},"end":{"line":322,"column":7}},"104":{"start":{"line":295,"column":8},"end":{"line":306,"column":10}},"105":{"start":{"line":297,"column":10},"end":{"line":297,"column":90}},"106":{"start":{"line":298,"column":10},"end":{"line":305,"column":11}},"107":{"start":{"line":302,"column":12},"end":{"line":304,"column":13}},"108":{"start":{"line":303,"column":14},"end":{"line":303,"column":33}},"109":{"start":{"line":309,"column":8},"end":{"line":321,"column":10}},"110":{"start":{"line":310,"column":10},"end":{"line":310,"column":91}},"111":{"start":{"line":311,"column":10},"end":{"line":315,"column":11}},"112":{"start":{"line":312,"column":12},"end":{"line":314,"column":13}},"113":{"start":{"line":313,"column":14},"end":{"line":313,"column":33}},"114":{"start":{"line":318,"column":10},"end":{"line":320,"column":11}},"115":{"start":{"line":319,"column":12},"end":{"line":319,"column":31}},"116":{"start":{"line":323,"column":6},"end":{"line":323,"column":39}},"117":{"start":{"line":332,"column":4},"end":{"line":540,"column":5}},"118":{"start":{"line":334,"column":6},"end":{"line":342,"column":8}},"119":{"start":{"line":346,"column":6},"end":{"line":346,"column":35}},"120":{"start":{"line":347,"column":6},"end":{"line":351,"column":8}},"121":{"start":{"line":350,"column":8},"end":{"line":350,"column":60}},"122":{"start":{"line":357,"column":6},"end":{"line":357,"column":34}},"123":{"start":{"line":358,"column":6},"end":{"line":380,"column":8}},"124":{"start":{"line":359,"column":8},"end":{"line":359,"column":109}},"125":{"start":{"line":360,"column":8},"end":{"line":362,"column":9}},"126":{"start":{"line":361,"column":10},"end":{"line":361,"column":36}},"127":{"start":{"line":363,"column":8},"end":{"line":378,"column":9}},"128":{"start":{"line":364,"column":10},"end":{"line":364,"column":49}},"129":{"start":{"line":367,"column":10},"end":{"line":377,"column":11}},"130":{"start":{"line":369,"column":14},"end":{"line":369,"column":42}},"131":{"start":{"line":370,"column":14},"end":{"line":370,"column":20}},"132":{"start":{"line":372,"column":14},"end":{"line":375,"column":15}},"133":{"start":{"line":373,"column":16},"end":{"line":373,"column":83}},"134":{"start":{"line":374,"column":16},"end":{"line":374,"column":22}},"135":{"start":{"line":376,"column":14},"end":{"line":376,"column":103}},"136":{"start":{"line":379,"column":8},"end":{"line":379,"column":28}},"137":{"start":{"line":384,"column":6},"end":{"line":510,"column":8}},"138":{"start":{"line":385,"column":8},"end":{"line":385,"column":154}},"139":{"start":{"line":386,"column":8},"end":{"line":389,"column":30}},"140":{"start":{"line":388,"column":10},"end":{"line":388,"column":35}},"141":{"start":{"line":390,"column":8},"end":{"line":443,"column":9}},"142":{"start":{"line":391,"column":10},"end":{"line":391,"column":43}},"143":{"start":{"line":392,"column":10},"end":{"line":442,"column":11}},"144":{"start":{"line":393,"column":12},"end":{"line":435,"column":13}},"145":{"start":{"line":397,"column":14},"end":{"line":424,"column":15}},"146":{"start":{"line":401,"column":16},"end":{"line":401,"column":44}},"147":{"start":{"line":402,"column":16},"end":{"line":402,"column":100}},"148":{"start":{"line":403,"column":16},"end":{"line":403,"column":112}},"149":{"start":{"line":404,"column":16},"end":{"line":404,"column":54}},"150":{"start":{"line":409,"column":16},"end":{"line":409,"column":55}},"151":{"start":{"line":412,"column":16},"end":{"line":412,"column":48}},"152":{"start":{"line":413,"column":16},"end":{"line":413,"column":49}},"153":{"start":{"line":414,"column":16},"end":{"line":414,"column":49}},"154":{"start":{"line":415,"column":16},"end":{"line":415,"column":42}},"155":{"start":{"line":417,"column":16},"end":{"line":417,"column":46}},"156":{"start":{"line":418,"column":16},"end":{"line":418,"column":44}},"157":{"start":{"line":419,"column":16},"end":{"line":419,"column":42}},"158":{"start":{"line":420,"column":16},"end":{"line":420,"column":44}},"159":{"start":{"line":421,"column":16},"end":{"line":421,"column":48}},"160":{"start":{"line":422,"column":16},"end":{"line":422,"column":48}},"161":{"start":{"line":423,"column":16},"end":{"line":423,"column":58}},"162":{"start":{"line":426,"column":14},"end":{"line":432,"column":60}},"163":{"start":{"line":434,"column":14},"end":{"line":434,"column":27}},"164":{"start":{"line":436,"column":17},"end":{"line":442,"column":11}},"165":{"start":{"line":441,"column":12},"end":{"line":441,"column":43}},"166":{"start":{"line":444,"column":8},"end":{"line":448,"column":9}},"167":{"start":{"line":447,"column":10},"end":{"line":447,"column":57}},"168":{"start":{"line":449,"column":8},"end":{"line":451,"column":9}},"169":{"start":{"line":450,"column":10},"end":{"line":450,"column":24}},"170":{"start":{"line":452,"column":8},"end":{"line":452,"column":41}},"171":{"start":{"line":453,"column":8},"end":{"line":463,"column":9}},"172":{"start":{"line":455,"column":10},"end":{"line":455,"column":28}},"173":{"start":{"line":456,"column":15},"end":{"line":463,"column":9}},"174":{"start":{"line":459,"column":10},"end":{"line":459,"column":71}},"175":{"start":{"line":460,"column":15},"end":{"line":463,"column":9}},"176":{"start":{"line":462,"column":10},"end":{"line":462,"column":35}},"177":{"start":{"line":465,"column":8},"end":{"line":509,"column":9}},"178":{"start":{"line":468,"column":10},"end":{"line":473,"column":11}},"179":{"start":{"line":469,"column":12},"end":{"line":472,"column":13}},"180":{"start":{"line":471,"column":14},"end":{"line":471,"column":32}},"181":{"start":{"line":475,"column":10},"end":{"line":475,"column":28}},"182":{"start":{"line":476,"column":10},"end":{"line":476,"column":23}},"183":{"start":{"line":478,"column":10},"end":{"line":478,"column":31}},"184":{"start":{"line":479,"column":10},"end":{"line":479,"column":36}},"185":{"start":{"line":480,"column":10},"end":{"line":505,"column":11}},"186":{"start":{"line":482,"column":12},"end":{"line":485,"column":13}},"187":{"start":{"line":483,"column":14},"end":{"line":483,"column":102}},"188":{"start":{"line":484,"column":14},"end":{"line":484,"column":65}},"189":{"start":{"line":486,"column":12},"end":{"line":486,"column":168}},"190":{"start":{"line":491,"column":12},"end":{"line":503,"column":15}},"191":{"start":{"line":492,"column":14},"end":{"line":492,"column":109}},"192":{"start":{"line":493,"column":14},"end":{"line":501,"column":15}},"193":{"start":{"line":500,"column":16},"end":{"line":500,"column":88}},"194":{"start":{"line":502,"column":14},"end":{"line":502,"column":48}},"195":{"start":{"line":504,"column":12},"end":{"line":504,"column":168}},"196":{"start":{"line":507,"column":10},"end":{"line":507,"column":22}},"197":{"start":{"line":508,"column":10},"end":{"line":508,"column":24}},"198":{"start":{"line":513,"column":6},"end":{"line":539,"column":8}},"199":{"start":{"line":514,"column":8},"end":{"line":514,"column":56}},"200":{"start":{"line":515,"column":8},"end":{"line":523,"column":9}},"201":{"start":{"line":516,"column":10},"end":{"line":522,"column":11}},"202":{"start":{"line":517,"column":12},"end":{"line":517,"column":30}},"203":{"start":{"line":518,"column":17},"end":{"line":522,"column":11}},"204":{"start":{"line":520,"column":12},"end":{"line":520,"column":28}},"205":{"start":{"line":521,"column":12},"end":{"line":521,"column":211}},"206":{"start":{"line":524,"column":8},"end":{"line":534,"column":9}},"207":{"start":{"line":525,"column":10},"end":{"line":533,"column":11}},"208":{"start":{"line":528,"column":12},"end":{"line":530,"column":13}},"209":{"start":{"line":529,"column":14},"end":{"line":529,"column":110}},"210":{"start":{"line":531,"column":17},"end":{"line":533,"column":11}},"211":{"start":{"line":532,"column":12},"end":{"line":532,"column":73}},"212":{"start":{"line":538,"column":8},"end":{"line":538,"column":112}},"213":{"start":{"line":543,"column":4},"end":{"line":857,"column":5}},"214":{"start":{"line":544,"column":6},"end":{"line":544,"column":45}},"215":{"start":{"line":548,"column":6},"end":{"line":557,"column":8}},"216":{"start":{"line":560,"column":6},"end":{"line":560,"column":24}},"217":{"start":{"line":563,"column":6},"end":{"line":566,"column":8}},"218":{"start":{"line":564,"column":8},"end":{"line":564,"column":30}},"219":{"start":{"line":565,"column":8},"end":{"line":565,"column":28}},"220":{"start":{"line":571,"column":6},"end":{"line":726,"column":8}},"221":{"start":{"line":572,"column":8},"end":{"line":572,"column":96}},"222":{"start":{"line":573,"column":8},"end":{"line":722,"column":9}},"223":{"start":{"line":574,"column":10},"end":{"line":574,"column":46}},"224":{"start":{"line":575,"column":10},"end":{"line":721,"column":11}},"225":{"start":{"line":579,"column":14},"end":{"line":579,"column":22}},"226":{"start":{"line":580,"column":14},"end":{"line":580,"column":20}},"227":{"start":{"line":584,"column":14},"end":{"line":584,"column":76}},"228":{"start":{"line":585,"column":14},"end":{"line":585,"column":22}},"229":{"start":{"line":586,"column":14},"end":{"line":586,"column":27}},"230":{"start":{"line":592,"column":14},"end":{"line":645,"column":15}},"231":{"start":{"line":593,"column":16},"end":{"line":593,"column":52}},"232":{"start":{"line":594,"column":16},"end":{"line":644,"column":17}},"233":{"start":{"line":597,"column":18},"end":{"line":597,"column":26}},"234":{"start":{"line":598,"column":23},"end":{"line":644,"column":17}},"235":{"start":{"line":602,"column":18},"end":{"line":602,"column":56}},"236":{"start":{"line":603,"column":18},"end":{"line":629,"column":19}},"237":{"start":{"line":606,"column":22},"end":{"line":606,"column":51}},"238":{"start":{"line":607,"column":22},"end":{"line":607,"column":30}},"239":{"start":{"line":608,"column":22},"end":{"line":608,"column":28}},"240":{"start":{"line":613,"column":22},"end":{"line":613,"column":38}},"241":{"start":{"line":614,"column":22},"end":{"line":622,"column":23}},"242":{"start":{"line":615,"column":24},"end":{"line":615,"column":60}},"243":{"start":{"line":618,"column":24},"end":{"line":621,"column":25}},"244":{"start":{"line":620,"column":26},"end":{"line":620,"column":34}},"245":{"start":{"line":624,"column":22},"end":{"line":624,"column":79}},"246":{"start":{"line":625,"column":22},"end":{"line":625,"column":28}},"247":{"start":{"line":628,"column":22},"end":{"line":628,"column":30}},"248":{"start":{"line":631,"column":18},"end":{"line":635,"column":19}},"249":{"start":{"line":634,"column":20},"end":{"line":634,"column":26}},"250":{"start":{"line":636,"column":18},"end":{"line":636,"column":54}},"251":{"start":{"line":637,"column":18},"end":{"line":637,"column":32}},"252":{"start":{"line":639,"column":18},"end":{"line":641,"column":19}},"253":{"start":{"line":640,"column":20},"end":{"line":640,"column":58}},"254":{"start":{"line":643,"column":18},"end":{"line":643,"column":54}},"255":{"start":{"line":646,"column":14},"end":{"line":650,"column":15}},"256":{"start":{"line":648,"column":16},"end":{"line":648,"column":24}},"257":{"start":{"line":649,"column":16},"end":{"line":649,"column":29}},"258":{"start":{"line":652,"column":14},"end":{"line":652,"column":22}},"259":{"start":{"line":655,"column":14},"end":{"line":655,"column":28}},"260":{"start":{"line":657,"column":14},"end":{"line":660,"column":15}},"261":{"start":{"line":658,"column":16},"end":{"line":658,"column":32}},"262":{"start":{"line":659,"column":16},"end":{"line":659,"column":54}},"263":{"start":{"line":662,"column":14},"end":{"line":703,"column":15}},"264":{"start":{"line":664,"column":16},"end":{"line":667,"column":17}},"265":{"start":{"line":666,"column":18},"end":{"line":666,"column":26}},"266":{"start":{"line":668,"column":16},"end":{"line":668,"column":33}},"267":{"start":{"line":670,"column":16},"end":{"line":670,"column":125}},"268":{"start":{"line":673,"column":16},"end":{"line":682,"column":17}},"269":{"start":{"line":674,"column":18},"end":{"line":674,"column":37}},"270":{"start":{"line":676,"column":18},"end":{"line":676,"column":136}},"271":{"start":{"line":677,"column":18},"end":{"line":680,"column":19}},"272":{"start":{"line":679,"column":20},"end":{"line":679,"column":28}},"273":{"start":{"line":681,"column":18},"end":{"line":681,"column":35}},"274":{"start":{"line":685,"column":16},"end":{"line":685,"column":52}},"275":{"start":{"line":686,"column":16},"end":{"line":700,"column":17}},"276":{"start":{"line":687,"column":18},"end":{"line":687,"column":56}},"277":{"start":{"line":690,"column":18},"end":{"line":692,"column":19}},"278":{"start":{"line":691,"column":20},"end":{"line":691,"column":28}},"279":{"start":{"line":694,"column":18},"end":{"line":694,"column":152}},"280":{"start":{"line":695,"column":18},"end":{"line":698,"column":19}},"281":{"start":{"line":697,"column":20},"end":{"line":697,"column":28}},"282":{"start":{"line":699,"column":18},"end":{"line":699,"column":35}},"283":{"start":{"line":702,"column":16},"end":{"line":702,"column":51}},"284":{"start":{"line":705,"column":14},"end":{"line":707,"column":15}},"285":{"start":{"line":706,"column":16},"end":{"line":706,"column":24}},"286":{"start":{"line":709,"column":14},"end":{"line":718,"column":15}},"287":{"start":{"line":710,"column":16},"end":{"line":710,"column":27}},"288":{"start":{"line":711,"column":16},"end":{"line":711,"column":28}},"289":{"start":{"line":712,"column":21},"end":{"line":718,"column":15}},"290":{"start":{"line":713,"column":16},"end":{"line":713,"column":27}},"291":{"start":{"line":714,"column":16},"end":{"line":714,"column":29}},"292":{"start":{"line":715,"column":21},"end":{"line":718,"column":15}},"293":{"start":{"line":716,"column":16},"end":{"line":716,"column":27}},"294":{"start":{"line":717,"column":16},"end":{"line":717,"column":28}},"295":{"start":{"line":720,"column":14},"end":{"line":720,"column":22}},"296":{"start":{"line":725,"column":8},"end":{"line":725,"column":19}},"297":{"start":{"line":729,"column":6},"end":{"line":809,"column":8}},"298":{"start":{"line":730,"column":8},"end":{"line":730,"column":32}},"299":{"start":{"line":731,"column":8},"end":{"line":734,"column":9}},"300":{"start":{"line":733,"column":10},"end":{"line":733,"column":18}},"301":{"start":{"line":735,"column":8},"end":{"line":807,"column":9}},"302":{"start":{"line":736,"column":10},"end":{"line":739,"column":11}},"303":{"start":{"line":738,"column":12},"end":{"line":738,"column":34}},"304":{"start":{"line":741,"column":10},"end":{"line":804,"column":11}},"305":{"start":{"line":743,"column":12},"end":{"line":743,"column":25}},"306":{"start":{"line":744,"column":12},"end":{"line":770,"column":13}},"307":{"start":{"line":745,"column":14},"end":{"line":745,"column":28}},"308":{"start":{"line":747,"column":14},"end":{"line":749,"column":15}},"309":{"start":{"line":748,"column":16},"end":{"line":748,"column":22}},"310":{"start":{"line":753,"column":14},"end":{"line":764,"column":15}},"311":{"start":{"line":754,"column":16},"end":{"line":763,"column":17}},"312":{"start":{"line":755,"column":18},"end":{"line":755,"column":32}},"313":{"start":{"line":756,"column":18},"end":{"line":759,"column":19}},"314":{"start":{"line":758,"column":20},"end":{"line":758,"column":28}},"315":{"start":{"line":762,"column":18},"end":{"line":762,"column":26}},"316":{"start":{"line":766,"column":14},"end":{"line":768,"column":15}},"317":{"start":{"line":767,"column":16},"end":{"line":767,"column":24}},"318":{"start":{"line":769,"column":14},"end":{"line":769,"column":39}},"319":{"start":{"line":771,"column":12},"end":{"line":771,"column":27}},"320":{"start":{"line":772,"column":17},"end":{"line":804,"column":11}},"321":{"start":{"line":774,"column":12},"end":{"line":774,"column":25}},"322":{"start":{"line":775,"column":12},"end":{"line":802,"column":13}},"323":{"start":{"line":776,"column":14},"end":{"line":776,"column":28}},"324":{"start":{"line":778,"column":14},"end":{"line":780,"column":15}},"325":{"start":{"line":779,"column":16},"end":{"line":779,"column":22}},"326":{"start":{"line":783,"column":14},"end":{"line":794,"column":15}},"327":{"start":{"line":784,"column":16},"end":{"line":793,"column":17}},"328":{"start":{"line":785,"column":18},"end":{"line":785,"column":32}},"329":{"start":{"line":786,"column":18},"end":{"line":789,"column":19}},"330":{"start":{"line":788,"column":20},"end":{"line":788,"column":28}},"331":{"start":{"line":792,"column":18},"end":{"line":792,"column":26}},"332":{"start":{"line":798,"column":14},"end":{"line":800,"column":15}},"333":{"start":{"line":799,"column":16},"end":{"line":799,"column":24}},"334":{"start":{"line":801,"column":14},"end":{"line":801,"column":51}},"335":{"start":{"line":803,"column":12},"end":{"line":803,"column":27}},"336":{"start":{"line":806,"column":10},"end":{"line":806,"column":18}},"337":{"start":{"line":808,"column":8},"end":{"line":808,"column":21}},"338":{"start":{"line":812,"column":6},"end":{"line":819,"column":8}},"339":{"start":{"line":813,"column":8},"end":{"line":813,"column":55}},"340":{"start":{"line":814,"column":8},"end":{"line":818,"column":9}},"341":{"start":{"line":815,"column":10},"end":{"line":815,"column":34}},"342":{"start":{"line":817,"column":10},"end":{"line":817,"column":37}},"343":{"start":{"line":824,"column":6},"end":{"line":841,"column":8}},"344":{"start":{"line":825,"column":8},"end":{"line":825,"column":45}},"345":{"start":{"line":826,"column":8},"end":{"line":839,"column":9}},"346":{"start":{"line":830,"column":10},"end":{"line":838,"column":11}},"347":{"start":{"line":831,"column":12},"end":{"line":833,"column":13}},"348":{"start":{"line":832,"column":14},"end":{"line":832,"column":46}},"349":{"start":{"line":835,"column":12},"end":{"line":837,"column":15}},"350":{"start":{"line":836,"column":14},"end":{"line":836,"column":48}},"351":{"start":{"line":840,"column":8},"end":{"line":840,"column":54}},"352":{"start":{"line":844,"column":6},"end":{"line":856,"column":8}},"353":{"start":{"line":845,"column":8},"end":{"line":845,"column":26}},"354":{"start":{"line":846,"column":8},"end":{"line":846,"column":18}},"355":{"start":{"line":847,"column":8},"end":{"line":847,"column":29}},"356":{"start":{"line":848,"column":8},"end":{"line":848,"column":28}},"357":{"start":{"line":850,"column":8},"end":{"line":852,"column":9}},"358":{"start":{"line":851,"column":10},"end":{"line":851,"column":18}},"359":{"start":{"line":854,"column":8},"end":{"line":854,"column":30}},"360":{"start":{"line":855,"column":8},"end":{"line":855,"column":139}},"361":{"start":{"line":861,"column":2},"end":{"line":865,"column":3}},"362":{"start":{"line":862,"column":4},"end":{"line":864,"column":7}},"363":{"start":{"line":863,"column":6},"end":{"line":863,"column":19}}},"branchMap":{"1":{"line":8,"type":"binary-expr","locations":[{"start":{"line":8,"column":17},"end":{"line":8,"column":45}},{"start":{"line":8,"column":49},"end":{"line":8,"column":59}}]},"2":{"line":11,"type":"binary-expr","locations":[{"start":{"line":11,"column":19},"end":{"line":11,"column":42}},{"start":{"line":11,"column":46},"end":{"line":11,"column":50}}]},"3":{"line":15,"type":"binary-expr","locations":[{"start":{"line":15,"column":14},"end":{"line":15,"column":40}},{"start":{"line":15,"column":44},"end":{"line":15,"column":51}},{"start":{"line":15,"column":55},"end":{"line":15,"column":72}},{"start":{"line":15,"column":76},"end":{"line":15,"column":83}}]},"4":{"line":17,"type":"if","locations":[{"start":{"line":17,"column":2},"end":{"line":17,"column":2}},{"start":{"line":17,"column":2},"end":{"line":17,"column":2}}]},"5":{"line":17,"type":"binary-expr","locations":[{"start":{"line":17,"column":6},"end":{"line":17,"column":11}},{"start":{"line":17,"column":15},"end":{"line":17,"column":25}}]},"6":{"line":25,"type":"binary-expr","locations":[{"start":{"line":25,"column":26},"end":{"line":25,"column":36}},{"start":{"line":25,"column":40},"end":{"line":25,"column":42}}]},"7":{"line":33,"type":"binary-expr","locations":[{"start":{"line":33,"column":17},"end":{"line":33,"column":55}},{"start":{"line":33,"column":59},"end":{"line":33,"column":89}},{"start":{"line":33,"column":93},"end":{"line":33,"column":122}},{"start":{"line":37,"column":6},"end":{"line":37,"column":36}},{"start":{"line":37,"column":40},"end":{"line":37,"column":72}},{"start":{"line":37,"column":76},"end":{"line":37,"column":107}},{"start":{"line":37,"column":111},"end":{"line":37,"column":149}}]},"8":{"line":43,"type":"if","locations":[{"start":{"line":43,"column":4},"end":{"line":43,"column":4}},{"start":{"line":43,"column":4},"end":{"line":43,"column":4}}]},"9":{"line":49,"type":"if","locations":[{"start":{"line":49,"column":4},"end":{"line":49,"column":4}},{"start":{"line":49,"column":4},"end":{"line":49,"column":4}}]},"10":{"line":53,"type":"if","locations":[{"start":{"line":53,"column":11},"end":{"line":53,"column":11}},{"start":{"line":53,"column":11},"end":{"line":53,"column":11}}]},"11":{"line":56,"type":"binary-expr","locations":[{"start":{"line":56,"column":20},"end":{"line":56,"column":41}},{"start":{"line":56,"column":45},"end":{"line":56,"column":62}}]},"12":{"line":60,"type":"if","locations":[{"start":{"line":60,"column":6},"end":{"line":60,"column":6}},{"start":{"line":60,"column":6},"end":{"line":60,"column":6}}]},"13":{"line":61,"type":"binary-expr","locations":[{"start":{"line":61,"column":62},"end":{"line":61,"column":92}},{"start":{"line":61,"column":96},"end":{"line":61,"column":106}}]},"14":{"line":62,"type":"if","locations":[{"start":{"line":62,"column":8},"end":{"line":62,"column":8}},{"start":{"line":62,"column":8},"end":{"line":62,"column":8}}]},"15":{"line":71,"type":"binary-expr","locations":[{"start":{"line":71,"column":14},"end":{"line":71,"column":34}},{"start":{"line":74,"column":14},"end":{"line":74,"column":45}},{"start":{"line":75,"column":14},"end":{"line":75,"column":45}},{"start":{"line":80,"column":14},"end":{"line":80,"column":43}},{"start":{"line":83,"column":14},"end":{"line":83,"column":40}},{"start":{"line":86,"column":14},"end":{"line":86,"column":35}},{"start":{"line":92,"column":14},"end":{"line":92,"column":38}},{"start":{"line":93,"column":14},"end":{"line":93,"column":41}},{"start":{"line":96,"column":14},"end":{"line":96,"column":44}},{"start":{"line":98,"column":14},"end":{"line":98,"column":39}},{"start":{"line":103,"column":14},"end":{"line":103,"column":70}},{"start":{"line":106,"column":14},"end":{"line":106,"column":92}},{"start":{"line":108,"column":14},"end":{"line":108,"column":44}},{"start":{"line":109,"column":14},"end":{"line":109,"column":59}},{"start":{"line":112,"column":14},"end":{"line":112,"column":78}},{"start":{"line":114,"column":14},"end":{"line":114,"column":77}},{"start":{"line":117,"column":14},"end":{"line":117,"column":82}},{"start":{"line":120,"column":14},"end":{"line":120,"column":69}}]},"16":{"line":128,"type":"if","locations":[{"start":{"line":128,"column":6},"end":{"line":128,"column":6}},{"start":{"line":128,"column":6},"end":{"line":128,"column":6}}]},"17":{"line":130,"type":"if","locations":[{"start":{"line":130,"column":8},"end":{"line":130,"column":8}},{"start":{"line":130,"column":8},"end":{"line":130,"column":8}}]},"18":{"line":135,"type":"if","locations":[{"start":{"line":135,"column":12},"end":{"line":135,"column":12}},{"start":{"line":135,"column":12},"end":{"line":135,"column":12}}]},"19":{"line":135,"type":"binary-expr","locations":[{"start":{"line":135,"column":16},"end":{"line":135,"column":32}},{"start":{"line":135,"column":36},"end":{"line":135,"column":49}}]},"20":{"line":138,"type":"binary-expr","locations":[{"start":{"line":138,"column":35},"end":{"line":138,"column":57}},{"start":{"line":138,"column":61},"end":{"line":138,"column":80}}]},"21":{"line":139,"type":"if","locations":[{"start":{"line":139,"column":14},"end":{"line":139,"column":14}},{"start":{"line":139,"column":14},"end":{"line":139,"column":14}}]},"22":{"line":144,"type":"if","locations":[{"start":{"line":144,"column":16},"end":{"line":144,"column":16}},{"start":{"line":144,"column":16},"end":{"line":144,"column":16}}]},"23":{"line":152,"type":"if","locations":[{"start":{"line":152,"column":16},"end":{"line":152,"column":16}},{"start":{"line":152,"column":16},"end":{"line":152,"column":16}}]},"24":{"line":176,"type":"if","locations":[{"start":{"line":176,"column":2},"end":{"line":176,"column":2}},{"start":{"line":176,"column":2},"end":{"line":176,"column":2}}]},"25":{"line":189,"type":"if","locations":[{"start":{"line":189,"column":4},"end":{"line":189,"column":4}},{"start":{"line":189,"column":4},"end":{"line":189,"column":4}}]},"26":{"line":203,"type":"if","locations":[{"start":{"line":203,"column":4},"end":{"line":203,"column":4}},{"start":{"line":203,"column":4},"end":{"line":203,"column":4}}]},"27":{"line":206,"type":"if","locations":[{"start":{"line":206,"column":8},"end":{"line":206,"column":8}},{"start":{"line":206,"column":8},"end":{"line":206,"column":8}}]},"28":{"line":228,"type":"binary-expr","locations":[{"start":{"line":228,"column":26},"end":{"line":228,"column":42}},{"start":{"line":228,"column":46},"end":{"line":228,"column":57}}]},"29":{"line":229,"type":"binary-expr","locations":[{"start":{"line":229,"column":19},"end":{"line":229,"column":35}},{"start":{"line":229,"column":39},"end":{"line":229,"column":99}}]},"30":{"line":229,"type":"binary-expr","locations":[{"start":{"line":229,"column":41},"end":{"line":229,"column":59}},{"start":{"line":229,"column":63},"end":{"line":229,"column":98}}]},"31":{"line":249,"type":"cond-expr","locations":[{"start":{"line":249,"column":32},"end":{"line":249,"column":50}},{"start":{"line":249,"column":53},"end":{"line":249,"column":74}}]},"32":{"line":268,"type":"if","locations":[{"start":{"line":268,"column":8},"end":{"line":268,"column":8}},{"start":{"line":268,"column":8},"end":{"line":268,"column":8}}]},"33":{"line":275,"type":"if","locations":[{"start":{"line":275,"column":6},"end":{"line":275,"column":6}},{"start":{"line":275,"column":6},"end":{"line":275,"column":6}}]},"34":{"line":282,"type":"cond-expr","locations":[{"start":{"line":282,"column":125},"end":{"line":282,"column":146}},{"start":{"line":282,"column":149},"end":{"line":282,"column":159}}]},"35":{"line":282,"type":"binary-expr","locations":[{"start":{"line":282,"column":28},"end":{"line":282,"column":39}},{"start":{"line":282,"column":43},"end":{"line":282,"column":82}},{"start":{"line":282,"column":86},"end":{"line":282,"column":122}}]},"36":{"line":286,"type":"if","locations":[{"start":{"line":286,"column":12},"end":{"line":286,"column":12}},{"start":{"line":286,"column":12},"end":{"line":286,"column":12}}]},"37":{"line":286,"type":"binary-expr","locations":[{"start":{"line":286,"column":16},"end":{"line":286,"column":56}},{"start":{"line":286,"column":60},"end":{"line":286,"column":94}}]},"38":{"line":286,"type":"binary-expr","locations":[{"start":{"line":286,"column":18},"end":{"line":286,"column":28}},{"start":{"line":286,"column":32},"end":{"line":286,"column":55}}]},"39":{"line":291,"type":"binary-expr","locations":[{"start":{"line":291,"column":70},"end":{"line":291,"column":104}},{"start":{"line":291,"column":108},"end":{"line":291,"column":126}}]},"40":{"line":293,"type":"if","locations":[{"start":{"line":293,"column":13},"end":{"line":293,"column":13}},{"start":{"line":293,"column":13},"end":{"line":293,"column":13}}]},"41":{"line":302,"type":"if","locations":[{"start":{"line":302,"column":12},"end":{"line":302,"column":12}},{"start":{"line":302,"column":12},"end":{"line":302,"column":12}}]},"42":{"line":302,"type":"binary-expr","locations":[{"start":{"line":302,"column":16},"end":{"line":302,"column":56}},{"start":{"line":302,"column":60},"end":{"line":302,"column":95}},{"start":{"line":302,"column":100},"end":{"line":302,"column":121}},{"start":{"line":302,"column":126},"end":{"line":302,"column":159}}]},"43":{"line":302,"type":"binary-expr","locations":[{"start":{"line":302,"column":18},"end":{"line":302,"column":28}},{"start":{"line":302,"column":32},"end":{"line":302,"column":55}}]},"44":{"line":312,"type":"if","locations":[{"start":{"line":312,"column":12},"end":{"line":312,"column":12}},{"start":{"line":312,"column":12},"end":{"line":312,"column":12}}]},"45":{"line":312,"type":"binary-expr","locations":[{"start":{"line":312,"column":16},"end":{"line":312,"column":56}},{"start":{"line":312,"column":60},"end":{"line":312,"column":93}},{"start":{"line":312,"column":97},"end":{"line":312,"column":142}}]},"46":{"line":312,"type":"binary-expr","locations":[{"start":{"line":312,"column":18},"end":{"line":312,"column":28}},{"start":{"line":312,"column":32},"end":{"line":312,"column":55}}]},"47":{"line":318,"type":"if","locations":[{"start":{"line":318,"column":10},"end":{"line":318,"column":10}},{"start":{"line":318,"column":10},"end":{"line":318,"column":10}}]},"48":{"line":318,"type":"binary-expr","locations":[{"start":{"line":318,"column":14},"end":{"line":318,"column":27}},{"start":{"line":318,"column":31},"end":{"line":318,"column":82}}]},"49":{"line":332,"type":"if","locations":[{"start":{"line":332,"column":4},"end":{"line":332,"column":4}},{"start":{"line":332,"column":4},"end":{"line":332,"column":4}}]},"50":{"line":350,"type":"binary-expr","locations":[{"start":{"line":350,"column":33},"end":{"line":350,"column":38}},{"start":{"line":350,"column":42},"end":{"line":350,"column":43}}]},"51":{"line":359,"type":"binary-expr","locations":[{"start":{"line":359,"column":70},"end":{"line":359,"column":81}},{"start":{"line":359,"column":85},"end":{"line":359,"column":99}}]},"52":{"line":360,"type":"if","locations":[{"start":{"line":360,"column":8},"end":{"line":360,"column":8}},{"start":{"line":360,"column":8},"end":{"line":360,"column":8}}]},"53":{"line":367,"type":"switch","locations":[{"start":{"line":368,"column":12},"end":{"line":368,"column":19}},{"start":{"line":368,"column":20},"end":{"line":368,"column":27}},{"start":{"line":368,"column":28},"end":{"line":368,"column":36}},{"start":{"line":368,"column":37},"end":{"line":368,"column":45}},{"start":{"line":368,"column":46},"end":{"line":368,"column":54}},{"start":{"line":368,"column":55},"end":{"line":368,"column":63}},{"start":{"line":368,"column":64},"end":{"line":370,"column":20}},{"start":{"line":371,"column":12},"end":{"line":376,"column":103}}]},"54":{"line":372,"type":"if","locations":[{"start":{"line":372,"column":14},"end":{"line":372,"column":14}},{"start":{"line":372,"column":14},"end":{"line":372,"column":14}}]},"55":{"line":376,"type":"cond-expr","locations":[{"start":{"line":376,"column":34},"end":{"line":376,"column":48}},{"start":{"line":376,"column":51},"end":{"line":376,"column":102}}]},"56":{"line":376,"type":"cond-expr","locations":[{"start":{"line":376,"column":68},"end":{"line":376,"column":87}},{"start":{"line":376,"column":90},"end":{"line":376,"column":102}}]},"57":{"line":390,"type":"if","locations":[{"start":{"line":390,"column":8},"end":{"line":390,"column":8}},{"start":{"line":390,"column":8},"end":{"line":390,"column":8}}]},"58":{"line":390,"type":"binary-expr","locations":[{"start":{"line":390,"column":12},"end":{"line":390,"column":36}},{"start":{"line":390,"column":40},"end":{"line":390,"column":45}}]},"59":{"line":392,"type":"if","locations":[{"start":{"line":392,"column":10},"end":{"line":392,"column":10}},{"start":{"line":392,"column":10},"end":{"line":392,"column":10}}]},"60":{"line":392,"type":"binary-expr","locations":[{"start":{"line":392,"column":14},"end":{"line":392,"column":36}},{"start":{"line":392,"column":40},"end":{"line":392,"column":73}}]},"61":{"line":393,"type":"if","locations":[{"start":{"line":393,"column":12},"end":{"line":393,"column":12}},{"start":{"line":393,"column":12},"end":{"line":393,"column":12}}]},"62":{"line":393,"type":"binary-expr","locations":[{"start":{"line":393,"column":16},"end":{"line":393,"column":30}},{"start":{"line":393,"column":34},"end":{"line":393,"column":47}}]},"63":{"line":397,"type":"if","locations":[{"start":{"line":397,"column":14},"end":{"line":397,"column":14}},{"start":{"line":397,"column":14},"end":{"line":397,"column":14}}]},"64":{"line":426,"type":"cond-expr","locations":[{"start":{"line":426,"column":50},"end":{"line":426,"column":117}},{"start":{"line":426,"column":120},"end":{"line":426,"column":143}}]},"65":{"line":426,"type":"binary-expr","locations":[{"start":{"line":426,"column":23},"end":{"line":426,"column":32}},{"start":{"line":426,"column":36},"end":{"line":426,"column":47}}]},"66":{"line":426,"type":"cond-expr","locations":[{"start":{"line":426,"column":62},"end":{"line":426,"column":65}},{"start":{"line":426,"column":68},"end":{"line":426,"column":71}}]},"67":{"line":426,"type":"cond-expr","locations":[{"start":{"line":426,"column":104},"end":{"line":426,"column":109}},{"start":{"line":426,"column":112},"end":{"line":426,"column":116}}]},"68":{"line":436,"type":"if","locations":[{"start":{"line":436,"column":17},"end":{"line":436,"column":17}},{"start":{"line":436,"column":17},"end":{"line":436,"column":17}}]},"69":{"line":436,"type":"binary-expr","locations":[{"start":{"line":436,"column":21},"end":{"line":436,"column":54}},{"start":{"line":436,"column":60},"end":{"line":436,"column":84}},{"start":{"line":436,"column":88},"end":{"line":436,"column":112}},{"start":{"line":436,"column":116},"end":{"line":436,"column":139}},{"start":{"line":436,"column":144},"end":{"line":436,"column":176}}]},"70":{"line":444,"type":"if","locations":[{"start":{"line":444,"column":8},"end":{"line":444,"column":8}},{"start":{"line":444,"column":8},"end":{"line":444,"column":8}}]},"71":{"line":449,"type":"if","locations":[{"start":{"line":449,"column":8},"end":{"line":449,"column":8}},{"start":{"line":449,"column":8},"end":{"line":449,"column":8}}]},"72":{"line":453,"type":"if","locations":[{"start":{"line":453,"column":8},"end":{"line":453,"column":8}},{"start":{"line":453,"column":8},"end":{"line":453,"column":8}}]},"73":{"line":456,"type":"if","locations":[{"start":{"line":456,"column":15},"end":{"line":456,"column":15}},{"start":{"line":456,"column":15},"end":{"line":456,"column":15}}]},"74":{"line":459,"type":"cond-expr","locations":[{"start":{"line":459,"column":51},"end":{"line":459,"column":61}},{"start":{"line":459,"column":64},"end":{"line":459,"column":70}}]},"75":{"line":459,"type":"binary-expr","locations":[{"start":{"line":459,"column":17},"end":{"line":459,"column":31}},{"start":{"line":459,"column":35},"end":{"line":459,"column":48}}]},"76":{"line":460,"type":"if","locations":[{"start":{"line":460,"column":15},"end":{"line":460,"column":15}},{"start":{"line":460,"column":15},"end":{"line":460,"column":15}}]},"77":{"line":465,"type":"if","locations":[{"start":{"line":465,"column":8},"end":{"line":465,"column":8}},{"start":{"line":465,"column":8},"end":{"line":465,"column":8}}]},"78":{"line":469,"type":"if","locations":[{"start":{"line":469,"column":12},"end":{"line":469,"column":12}},{"start":{"line":469,"column":12},"end":{"line":469,"column":12}}]},"79":{"line":480,"type":"if","locations":[{"start":{"line":480,"column":10},"end":{"line":480,"column":10}},{"start":{"line":480,"column":10},"end":{"line":480,"column":10}}]},"80":{"line":482,"type":"binary-expr","locations":[{"start":{"line":482,"column":67},"end":{"line":482,"column":77}},{"start":{"line":482,"column":82},"end":{"line":482,"column":99}}]},"81":{"line":484,"type":"cond-expr","locations":[{"start":{"line":484,"column":47},"end":{"line":484,"column":53}},{"start":{"line":484,"column":56},"end":{"line":484,"column":63}}]},"82":{"line":486,"type":"cond-expr","locations":[{"start":{"line":486,"column":35},"end":{"line":486,"column":159}},{"start":{"line":486,"column":163},"end":{"line":486,"column":167}}]},"83":{"line":486,"type":"cond-expr","locations":[{"start":{"line":486,"column":48},"end":{"line":486,"column":125}},{"start":{"line":486,"column":129},"end":{"line":486,"column":158}}]},"84":{"line":491,"type":"binary-expr","locations":[{"start":{"line":491,"column":20},"end":{"line":491,"column":30}},{"start":{"line":491,"column":34},"end":{"line":491,"column":39}}]},"85":{"line":493,"type":"if","locations":[{"start":{"line":493,"column":14},"end":{"line":493,"column":14}},{"start":{"line":493,"column":14},"end":{"line":493,"column":14}}]},"86":{"line":500,"type":"cond-expr","locations":[{"start":{"line":500,"column":67},"end":{"line":500,"column":70}},{"start":{"line":500,"column":73},"end":{"line":500,"column":75}}]},"87":{"line":502,"type":"binary-expr","locations":[{"start":{"line":502,"column":14},"end":{"line":502,"column":24}},{"start":{"line":502,"column":29},"end":{"line":502,"column":46}}]},"88":{"line":504,"type":"cond-expr","locations":[{"start":{"line":504,"column":35},"end":{"line":504,"column":159}},{"start":{"line":504,"column":163},"end":{"line":504,"column":167}}]},"89":{"line":504,"type":"cond-expr","locations":[{"start":{"line":504,"column":48},"end":{"line":504,"column":125}},{"start":{"line":504,"column":129},"end":{"line":504,"column":158}}]},"90":{"line":515,"type":"if","locations":[{"start":{"line":515,"column":8},"end":{"line":515,"column":8}},{"start":{"line":515,"column":8},"end":{"line":515,"column":8}}]},"91":{"line":515,"type":"binary-expr","locations":[{"start":{"line":515,"column":12},"end":{"line":515,"column":39}},{"start":{"line":515,"column":43},"end":{"line":515,"column":68}},{"start":{"line":515,"column":72},"end":{"line":515,"column":78}}]},"92":{"line":516,"type":"if","locations":[{"start":{"line":516,"column":10},"end":{"line":516,"column":10}},{"start":{"line":516,"column":10},"end":{"line":516,"column":10}}]},"93":{"line":518,"type":"if","locations":[{"start":{"line":518,"column":17},"end":{"line":518,"column":17}},{"start":{"line":518,"column":17},"end":{"line":518,"column":17}}]},"94":{"line":521,"type":"binary-expr","locations":[{"start":{"line":521,"column":106},"end":{"line":521,"column":141}},{"start":{"line":521,"column":145},"end":{"line":521,"column":180}},{"start":{"line":521,"column":186},"end":{"line":521,"column":207}}]},"95":{"line":524,"type":"if","locations":[{"start":{"line":524,"column":8},"end":{"line":524,"column":8}},{"start":{"line":524,"column":8},"end":{"line":524,"column":8}}]},"96":{"line":525,"type":"if","locations":[{"start":{"line":525,"column":10},"end":{"line":525,"column":10}},{"start":{"line":525,"column":10},"end":{"line":525,"column":10}}]},"97":{"line":528,"type":"if","locations":[{"start":{"line":528,"column":12},"end":{"line":528,"column":12}},{"start":{"line":528,"column":12},"end":{"line":528,"column":12}}]},"98":{"line":531,"type":"if","locations":[{"start":{"line":531,"column":17},"end":{"line":531,"column":17}},{"start":{"line":531,"column":17},"end":{"line":531,"column":17}}]},"99":{"line":532,"type":"cond-expr","locations":[{"start":{"line":532,"column":46},"end":{"line":532,"column":51}},{"start":{"line":532,"column":54},"end":{"line":532,"column":72}}]},"100":{"line":543,"type":"if","locations":[{"start":{"line":543,"column":4},"end":{"line":543,"column":4}},{"start":{"line":543,"column":4},"end":{"line":543,"column":4}}]},"101":{"line":575,"type":"switch","locations":[{"start":{"line":576,"column":12},"end":{"line":576,"column":19}},{"start":{"line":576,"column":20},"end":{"line":576,"column":28}},{"start":{"line":576,"column":29},"end":{"line":576,"column":37}},{"start":{"line":576,"column":38},"end":{"line":580,"column":20}},{"start":{"line":581,"column":12},"end":{"line":581,"column":21}},{"start":{"line":581,"column":22},"end":{"line":581,"column":31}},{"start":{"line":581,"column":32},"end":{"line":581,"column":40}},{"start":{"line":581,"column":41},"end":{"line":581,"column":49}},{"start":{"line":581,"column":50},"end":{"line":581,"column":58}},{"start":{"line":581,"column":59},"end":{"line":586,"column":27}},{"start":{"line":587,"column":12},"end":{"line":652,"column":22}},{"start":{"line":653,"column":12},"end":{"line":720,"column":22}}]},"102":{"line":584,"type":"cond-expr","locations":[{"start":{"line":584,"column":39},"end":{"line":584,"column":59}},{"start":{"line":584,"column":62},"end":{"line":584,"column":75}}]},"103":{"line":594,"type":"if","locations":[{"start":{"line":594,"column":16},"end":{"line":594,"column":16}},{"start":{"line":594,"column":16},"end":{"line":594,"column":16}}]},"104":{"line":598,"type":"if","locations":[{"start":{"line":598,"column":23},"end":{"line":598,"column":23}},{"start":{"line":598,"column":23},"end":{"line":598,"column":23}}]},"105":{"line":603,"type":"switch","locations":[{"start":{"line":604,"column":20},"end":{"line":604,"column":28}},{"start":{"line":604,"column":29},"end":{"line":604,"column":37}},{"start":{"line":604,"column":38},"end":{"line":604,"column":46}},{"start":{"line":604,"column":47},"end":{"line":604,"column":55}},{"start":{"line":604,"column":56},"end":{"line":604,"column":65}},{"start":{"line":604,"column":66},"end":{"line":604,"column":75}},{"start":{"line":604,"column":76},"end":{"line":604,"column":85}},{"start":{"line":604,"column":86},"end":{"line":608,"column":28}},{"start":{"line":609,"column":20},"end":{"line":625,"column":28}},{"start":{"line":626,"column":20},"end":{"line":628,"column":30}}]},"106":{"line":618,"type":"if","locations":[{"start":{"line":618,"column":24},"end":{"line":618,"column":24}},{"start":{"line":618,"column":24},"end":{"line":618,"column":24}}]},"107":{"line":618,"type":"binary-expr","locations":[{"start":{"line":618,"column":30},"end":{"line":618,"column":44}},{"start":{"line":618,"column":48},"end":{"line":618,"column":62}},{"start":{"line":618,"column":66},"end":{"line":618,"column":80}},{"start":{"line":618,"column":84},"end":{"line":618,"column":99}},{"start":{"line":618,"column":103},"end":{"line":618,"column":117}},{"start":{"line":618,"column":121},"end":{"line":618,"column":135}}]},"108":{"line":631,"type":"if","locations":[{"start":{"line":631,"column":18},"end":{"line":631,"column":18}},{"start":{"line":631,"column":18},"end":{"line":631,"column":18}}]},"109":{"line":639,"type":"binary-expr","locations":[{"start":{"line":639,"column":25},"end":{"line":639,"column":39}},{"start":{"line":639,"column":43},"end":{"line":639,"column":57}},{"start":{"line":639,"column":61},"end":{"line":639,"column":75}}]},"110":{"line":646,"type":"if","locations":[{"start":{"line":646,"column":14},"end":{"line":646,"column":14}},{"start":{"line":646,"column":14},"end":{"line":646,"column":14}}]},"111":{"line":657,"type":"if","locations":[{"start":{"line":657,"column":14},"end":{"line":657,"column":14}},{"start":{"line":657,"column":14},"end":{"line":657,"column":14}}]},"112":{"line":662,"type":"if","locations":[{"start":{"line":662,"column":14},"end":{"line":662,"column":14}},{"start":{"line":662,"column":14},"end":{"line":662,"column":14}}]},"113":{"line":662,"type":"binary-expr","locations":[{"start":{"line":662,"column":18},"end":{"line":662,"column":32}},{"start":{"line":662,"column":36},"end":{"line":662,"column":50}}]},"114":{"line":664,"type":"if","locations":[{"start":{"line":664,"column":16},"end":{"line":664,"column":16}},{"start":{"line":664,"column":16},"end":{"line":664,"column":16}}]},"115":{"line":664,"type":"binary-expr","locations":[{"start":{"line":664,"column":20},"end":{"line":664,"column":34}},{"start":{"line":664,"column":39},"end":{"line":664,"column":114}}]},"116":{"line":664,"type":"binary-expr","locations":[{"start":{"line":664,"column":82},"end":{"line":664,"column":96}},{"start":{"line":664,"column":100},"end":{"line":664,"column":114}}]},"117":{"line":670,"type":"binary-expr","locations":[{"start":{"line":670,"column":23},"end":{"line":670,"column":37}},{"start":{"line":670,"column":42},"end":{"line":670,"column":113}}]},"118":{"line":670,"type":"binary-expr","locations":[{"start":{"line":670,"column":81},"end":{"line":670,"column":95}},{"start":{"line":670,"column":99},"end":{"line":670,"column":113}}]},"119":{"line":673,"type":"if","locations":[{"start":{"line":673,"column":16},"end":{"line":673,"column":16}},{"start":{"line":673,"column":16},"end":{"line":673,"column":16}}]},"120":{"line":676,"type":"binary-expr","locations":[{"start":{"line":676,"column":25},"end":{"line":676,"column":42}},{"start":{"line":676,"column":47},"end":{"line":676,"column":121}}]},"121":{"line":676,"type":"binary-expr","locations":[{"start":{"line":676,"column":89},"end":{"line":676,"column":103}},{"start":{"line":676,"column":107},"end":{"line":676,"column":121}}]},"122":{"line":677,"type":"if","locations":[{"start":{"line":677,"column":18},"end":{"line":677,"column":18}},{"start":{"line":677,"column":18},"end":{"line":677,"column":18}}]},"123":{"line":686,"type":"if","locations":[{"start":{"line":686,"column":16},"end":{"line":686,"column":16}},{"start":{"line":686,"column":16},"end":{"line":686,"column":16}}]},"124":{"line":686,"type":"binary-expr","locations":[{"start":{"line":686,"column":20},"end":{"line":686,"column":35}},{"start":{"line":686,"column":39},"end":{"line":686,"column":53}}]},"125":{"line":690,"type":"if","locations":[{"start":{"line":690,"column":18},"end":{"line":690,"column":18}},{"start":{"line":690,"column":18},"end":{"line":690,"column":18}}]},"126":{"line":690,"type":"binary-expr","locations":[{"start":{"line":690,"column":22},"end":{"line":690,"column":36}},{"start":{"line":690,"column":40},"end":{"line":690,"column":54}}]},"127":{"line":694,"type":"binary-expr","locations":[{"start":{"line":694,"column":41},"end":{"line":694,"column":58}},{"start":{"line":694,"column":63},"end":{"line":694,"column":137}}]},"128":{"line":694,"type":"binary-expr","locations":[{"start":{"line":694,"column":105},"end":{"line":694,"column":119}},{"start":{"line":694,"column":123},"end":{"line":694,"column":137}}]},"129":{"line":695,"type":"if","locations":[{"start":{"line":695,"column":18},"end":{"line":695,"column":18}},{"start":{"line":695,"column":18},"end":{"line":695,"column":18}}]},"130":{"line":705,"type":"if","locations":[{"start":{"line":705,"column":14},"end":{"line":705,"column":14}},{"start":{"line":705,"column":14},"end":{"line":705,"column":14}}]},"131":{"line":709,"type":"if","locations":[{"start":{"line":709,"column":14},"end":{"line":709,"column":14}},{"start":{"line":709,"column":14},"end":{"line":709,"column":14}}]},"132":{"line":712,"type":"if","locations":[{"start":{"line":712,"column":21},"end":{"line":712,"column":21}},{"start":{"line":712,"column":21},"end":{"line":712,"column":21}}]},"133":{"line":715,"type":"if","locations":[{"start":{"line":715,"column":21},"end":{"line":715,"column":21}},{"start":{"line":715,"column":21},"end":{"line":715,"column":21}}]},"134":{"line":731,"type":"if","locations":[{"start":{"line":731,"column":8},"end":{"line":731,"column":8}},{"start":{"line":731,"column":8},"end":{"line":731,"column":8}}]},"135":{"line":735,"type":"if","locations":[{"start":{"line":735,"column":8},"end":{"line":735,"column":8}},{"start":{"line":735,"column":8},"end":{"line":735,"column":8}}]},"136":{"line":736,"type":"if","locations":[{"start":{"line":736,"column":10},"end":{"line":736,"column":10}},{"start":{"line":736,"column":10},"end":{"line":736,"column":10}}]},"137":{"line":736,"type":"cond-expr","locations":[{"start":{"line":736,"column":32},"end":{"line":736,"column":47}},{"start":{"line":736,"column":50},"end":{"line":736,"column":58}}]},"138":{"line":741,"type":"if","locations":[{"start":{"line":741,"column":10},"end":{"line":741,"column":10}},{"start":{"line":741,"column":10},"end":{"line":741,"column":10}}]},"139":{"line":744,"type":"binary-expr","locations":[{"start":{"line":744,"column":20},"end":{"line":744,"column":30}},{"start":{"line":744,"column":35},"end":{"line":744,"column":52}}]},"140":{"line":747,"type":"if","locations":[{"start":{"line":747,"column":14},"end":{"line":747,"column":14}},{"start":{"line":747,"column":14},"end":{"line":747,"column":14}}]},"141":{"line":753,"type":"if","locations":[{"start":{"line":753,"column":14},"end":{"line":753,"column":14}},{"start":{"line":753,"column":14},"end":{"line":753,"column":14}}]},"142":{"line":754,"type":"if","locations":[{"start":{"line":754,"column":16},"end":{"line":754,"column":16}},{"start":{"line":754,"column":16},"end":{"line":754,"column":16}}]},"143":{"line":756,"type":"if","locations":[{"start":{"line":756,"column":18},"end":{"line":756,"column":18}},{"start":{"line":756,"column":18},"end":{"line":756,"column":18}}]},"144":{"line":766,"type":"if","locations":[{"start":{"line":766,"column":14},"end":{"line":766,"column":14}},{"start":{"line":766,"column":14},"end":{"line":766,"column":14}}]},"145":{"line":772,"type":"if","locations":[{"start":{"line":772,"column":17},"end":{"line":772,"column":17}},{"start":{"line":772,"column":17},"end":{"line":772,"column":17}}]},"146":{"line":775,"type":"binary-expr","locations":[{"start":{"line":775,"column":20},"end":{"line":775,"column":30}},{"start":{"line":775,"column":35},"end":{"line":775,"column":52}}]},"147":{"line":778,"type":"if","locations":[{"start":{"line":778,"column":14},"end":{"line":778,"column":14}},{"start":{"line":778,"column":14},"end":{"line":778,"column":14}}]},"148":{"line":783,"type":"if","locations":[{"start":{"line":783,"column":14},"end":{"line":783,"column":14}},{"start":{"line":783,"column":14},"end":{"line":783,"column":14}}]},"149":{"line":784,"type":"if","locations":[{"start":{"line":784,"column":16},"end":{"line":784,"column":16}},{"start":{"line":784,"column":16},"end":{"line":784,"column":16}}]},"150":{"line":786,"type":"if","locations":[{"start":{"line":786,"column":18},"end":{"line":786,"column":18}},{"start":{"line":786,"column":18},"end":{"line":786,"column":18}}]},"151":{"line":798,"type":"if","locations":[{"start":{"line":798,"column":14},"end":{"line":798,"column":14}},{"start":{"line":798,"column":14},"end":{"line":798,"column":14}}]},"152":{"line":798,"type":"binary-expr","locations":[{"start":{"line":798,"column":18},"end":{"line":798,"column":30}},{"start":{"line":798,"column":34},"end":{"line":798,"column":58}},{"start":{"line":798,"column":62},"end":{"line":798,"column":114}},{"start":{"line":798,"column":118},"end":{"line":798,"column":130}}]},"153":{"line":798,"type":"cond-expr","locations":[{"start":{"line":798,"column":80},"end":{"line":798,"column":95}},{"start":{"line":798,"column":98},"end":{"line":798,"column":106}}]},"154":{"line":814,"type":"if","locations":[{"start":{"line":814,"column":8},"end":{"line":814,"column":8}},{"start":{"line":814,"column":8},"end":{"line":814,"column":8}}]},"155":{"line":826,"type":"if","locations":[{"start":{"line":826,"column":8},"end":{"line":826,"column":8}},{"start":{"line":826,"column":8},"end":{"line":826,"column":8}}]},"156":{"line":826,"type":"binary-expr","locations":[{"start":{"line":826,"column":12},"end":{"line":826,"column":36}},{"start":{"line":826,"column":40},"end":{"line":826,"column":45}}]},"157":{"line":830,"type":"if","locations":[{"start":{"line":830,"column":10},"end":{"line":830,"column":10}},{"start":{"line":830,"column":10},"end":{"line":830,"column":10}}]},"158":{"line":850,"type":"if","locations":[{"start":{"line":850,"column":8},"end":{"line":850,"column":8}},{"start":{"line":850,"column":8},"end":{"line":850,"column":8}}]},"159":{"line":855,"type":"cond-expr","locations":[{"start":{"line":855,"column":70},"end":{"line":855,"column":129}},{"start":{"line":855,"column":132},"end":{"line":855,"column":138}}]},"160":{"line":855,"type":"binary-expr","locations":[{"start":{"line":855,"column":15},"end":{"line":855,"column":23}},{"start":{"line":855,"column":27},"end":{"line":855,"column":67}}]},"161":{"line":861,"type":"if","locations":[{"start":{"line":861,"column":2},"end":{"line":861,"column":2}},{"start":{"line":861,"column":2},"end":{"line":861,"column":2}}]}}}} \ No newline at end of file diff --git a/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/json3/coverage/lcov-report/lib/json3.js.html b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/json3/coverage/lcov-report/lib/json3.js.html new file mode 100644 index 0000000..11c49b4 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/json3/coverage/lcov-report/lib/json3.js.html @@ -0,0 +1,2903 @@ + + + + Code coverage report for lib/json3.js + + + + + + + +
+

Code coverage report for lib/json3.js

+

+ + Statements: 13.77% (50 / 363)      + + + Branches: 15.32% (59 / 385)      + + + Functions: 11.54% (3 / 26)      + + + Lines: 13.77% (50 / 363)      + +

+
All files » lib/ » json3.js
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 +158 +159 +160 +161 +162 +163 +164 +165 +166 +167 +168 +169 +170 +171 +172 +173 +174 +175 +176 +177 +178 +179 +180 +181 +182 +183 +184 +185 +186 +187 +188 +189 +190 +191 +192 +193 +194 +195 +196 +197 +198 +199 +200 +201 +202 +203 +204 +205 +206 +207 +208 +209 +210 +211 +212 +213 +214 +215 +216 +217 +218 +219 +220 +221 +222 +223 +224 +225 +226 +227 +228 +229 +230 +231 +232 +233 +234 +235 +236 +237 +238 +239 +240 +241 +242 +243 +244 +245 +246 +247 +248 +249 +250 +251 +252 +253 +254 +255 +256 +257 +258 +259 +260 +261 +262 +263 +264 +265 +266 +267 +268 +269 +270 +271 +272 +273 +274 +275 +276 +277 +278 +279 +280 +281 +282 +283 +284 +285 +286 +287 +288 +289 +290 +291 +292 +293 +294 +295 +296 +297 +298 +299 +300 +301 +302 +303 +304 +305 +306 +307 +308 +309 +310 +311 +312 +313 +314 +315 +316 +317 +318 +319 +320 +321 +322 +323 +324 +325 +326 +327 +328 +329 +330 +331 +332 +333 +334 +335 +336 +337 +338 +339 +340 +341 +342 +343 +344 +345 +346 +347 +348 +349 +350 +351 +352 +353 +354 +355 +356 +357 +358 +359 +360 +361 +362 +363 +364 +365 +366 +367 +368 +369 +370 +371 +372 +373 +374 +375 +376 +377 +378 +379 +380 +381 +382 +383 +384 +385 +386 +387 +388 +389 +390 +391 +392 +393 +394 +395 +396 +397 +398 +399 +400 +401 +402 +403 +404 +405 +406 +407 +408 +409 +410 +411 +412 +413 +414 +415 +416 +417 +418 +419 +420 +421 +422 +423 +424 +425 +426 +427 +428 +429 +430 +431 +432 +433 +434 +435 +436 +437 +438 +439 +440 +441 +442 +443 +444 +445 +446 +447 +448 +449 +450 +451 +452 +453 +454 +455 +456 +457 +458 +459 +460 +461 +462 +463 +464 +465 +466 +467 +468 +469 +470 +471 +472 +473 +474 +475 +476 +477 +478 +479 +480 +481 +482 +483 +484 +485 +486 +487 +488 +489 +490 +491 +492 +493 +494 +495 +496 +497 +498 +499 +500 +501 +502 +503 +504 +505 +506 +507 +508 +509 +510 +511 +512 +513 +514 +515 +516 +517 +518 +519 +520 +521 +522 +523 +524 +525 +526 +527 +528 +529 +530 +531 +532 +533 +534 +535 +536 +537 +538 +539 +540 +541 +542 +543 +544 +545 +546 +547 +548 +549 +550 +551 +552 +553 +554 +555 +556 +557 +558 +559 +560 +561 +562 +563 +564 +565 +566 +567 +568 +569 +570 +571 +572 +573 +574 +575 +576 +577 +578 +579 +580 +581 +582 +583 +584 +585 +586 +587 +588 +589 +590 +591 +592 +593 +594 +595 +596 +597 +598 +599 +600 +601 +602 +603 +604 +605 +606 +607 +608 +609 +610 +611 +612 +613 +614 +615 +616 +617 +618 +619 +620 +621 +622 +623 +624 +625 +626 +627 +628 +629 +630 +631 +632 +633 +634 +635 +636 +637 +638 +639 +640 +641 +642 +643 +644 +645 +646 +647 +648 +649 +650 +651 +652 +653 +654 +655 +656 +657 +658 +659 +660 +661 +662 +663 +664 +665 +666 +667 +668 +669 +670 +671 +672 +673 +674 +675 +676 +677 +678 +679 +680 +681 +682 +683 +684 +685 +686 +687 +688 +689 +690 +691 +692 +693 +694 +695 +696 +697 +698 +699 +700 +701 +702 +703 +704 +705 +706 +707 +708 +709 +710 +711 +712 +713 +714 +715 +716 +717 +718 +719 +720 +721 +722 +723 +724 +725 +726 +727 +728 +729 +730 +731 +732 +733 +734 +735 +736 +737 +738 +739 +740 +741 +742 +743 +744 +745 +746 +747 +748 +749 +750 +751 +752 +753 +754 +755 +756 +757 +758 +759 +760 +761 +762 +763 +764 +765 +766 +767 +768 +769 +770 +771 +772 +773 +774 +775 +776 +777 +778 +779 +780 +781 +782 +783 +784 +785 +786 +787 +788 +789 +790 +791 +792 +793 +794 +795 +796 +797 +798 +799 +800 +801 +802 +803 +804 +805 +806 +807 +808 +809 +810 +811 +812 +813 +814 +815 +816 +817 +818 +819 +820 +821 +822 +823 +824 +825 +826 +827 +828 +829 +830 +831 +832 +833 +834 +835 +836 +837 +838 +839 +840 +841 +842 +843 +844 +845 +846 +847 +848 +849 +850 +851 +852 +853 +854 +855 +856 +857 +858 +859 +860 +861 +862 +863 +864 +865 +866 +867  +1 +  +1 +  +  +  +1 +  +  +1 +  +  +  +1 +  +1 +  +  +1 +1 +  +  +  +  +  +  +  +1 +1 +  +  +1 +  +  +  +  +  +  +  +  +1 +3 +  +  +  +  +3 +3 +  +  +  +3 +  +  +1 +  +2 +  +2 +1 +1 +  +1 +4 +  +1 +1 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +1 +  +  +2 +1 +1 +1 +  +  +  +1 +  +1 +1 +1 +1 +  +1 +  +1 +1 +  +  +  +1 +  +  +1 +1 +  +  +  +1 +  +  +  +  +  +  +  +  +1 +  +  +3 +  +1 +1 +1 +1 +  +1 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +1 +  +  +  +  +  + 
/*! JSON v3.2.5 | http://bestiejs.github.io/json3 | Copyright 2012-2013, Kit Cambridge | http://kit.mit-license.org */
+;(function (window) {
+  // Convenience aliases.
+  var getClass = {}.toString, isProperty, forEach, undef;
+ 
+  // Detect the `define` function exposed by asynchronous module loaders. The
+  // strict `define` check is necessary for compatibility with `r.js`.
+  var isLoader = typeof define === "function" && define.amd;
+ 
+  // Detect native implementations.
+  var nativeJSON = typeof JSON == "object" && JSON;
+ 
+  // Set up the JSON 3 namespace, preferring the CommonJS `exports` object if
+  // available.
+  var JSON3 = typeof exports == "object" && exports && !exports.nodeType && exports;
+ 
+  Eif (JSON3 && nativeJSON) {
+    // Explicitly delegate to the native `stringify` and `parse`
+    // implementations in CommonJS environments.
+    JSON3.stringify = nativeJSON.stringify;
+    JSON3.parse = nativeJSON.parse;
+  } else {
+    // Export for web browsers, JavaScript engines, and asynchronous module
+    // loaders, using the global `JSON` object if available.
+    JSON3 = window.JSON = nativeJSON || {};
+  }
+ 
+  // Test the `Date#getUTC*` methods. Based on work by @Yaffle.
+  var isExtended = new Date(-3509827334573292);
+  try {
+    // The `getUTCFullYear`, `Month`, and `Date` methods return nonsensical
+    // results for certain dates in Opera >= 10.53.
+    isExtended = isExtended.getUTCFullYear() == -109252 && isExtended.getUTCMonth() === 0 && isExtended.getUTCDate() === 1 &&
+      // Safari < 2.0.2 stores the internal millisecond time value correctly,
+      // but clips the values returned by the date methods to the range of
+      // signed 32-bit integers ([-2 ** 31, 2 ** 31 - 1]).
+      isExtended.getUTCHours() == 10 && isExtended.getUTCMinutes() == 37 && isExtended.getUTCSeconds() == 6 && isExtended.getUTCMilliseconds() == 708;
+  } catch (exception) {}
+ 
+  // Internal: Determines whether the native `JSON.stringify` and `parse`
+  // implementations are spec-compliant. Based on work by Ken Snyder.
+  function has(name) {
+    Iif (has[name] != null) {
+      // Return cached feature test result.
+      return has[name];
+    }
+ 
+    var isSupported;
+    Iif (name == "bug-string-char-index") {
+      // IE <= 7 doesn't support accessing string characters using square
+      // bracket notation. IE 8 only supports this for primitives.
+      isSupported = "a"[0] != "a";
+    } else if (name == "json") {
+      // Indicates whether both `JSON.stringify` and `JSON.parse` are
+      // supported.
+      isSupported = has("json-stringify") && has("json-parse");
+    } else {
+      var value, serialized = '{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}';
+      // Test `JSON.stringify`.
+      if (name == "json-stringify") {
+        var stringify = JSON3.stringify, stringifySupported = typeof stringify == "function" && isExtended;
+        Eif (stringifySupported) {
+          // A test function object with a custom `toJSON` method.
+          (value = function () {
+            return 1;
+          }).toJSON = value;
+          try {
+            stringifySupported =
+              // Firefox 3.1b1 and b2 serialize string, number, and boolean
+              // primitives as object literals.
+              stringify(0) === "0" &&
+              // FF 3.1b1, b2, and JSON 2 serialize wrapped primitives as object
+              // literals.
+              stringify(new Number()) === "0" &&
+              stringify(new String()) == '""' &&
+              // FF 3.1b1, 2 throw an error if the value is `null`, `undefined`, or
+              // does not define a canonical JSON representation (this applies to
+              // objects with `toJSON` properties as well, *unless* they are nested
+              // within an object or array).
+              stringify(getClass) === undef &&
+              // IE 8 serializes `undefined` as `"undefined"`. Safari <= 5.1.7 and
+              // FF 3.1b3 pass this test.
+              stringify(undef) === undef &&
+              // Safari <= 5.1.7 and FF 3.1b3 throw `Error`s and `TypeError`s,
+              // respectively, if the value is omitted entirely.
+              stringify() === undef &&
+              // FF 3.1b1, 2 throw an error if the given value is not a number,
+              // string, array, object, Boolean, or `null` literal. This applies to
+              // objects with custom `toJSON` methods as well, unless they are nested
+              // inside object or array literals. YUI 3.0.0b1 ignores custom `toJSON`
+              // methods entirely.
+              stringify(value) === "1" &&
+              stringify([value]) == "[1]" &&
+              // Prototype <= 1.6.1 serializes `[undefined]` as `"[]"` instead of
+              // `"[null]"`.
+              stringify([undef]) == "[null]" &&
+              // YUI 3.0.0b1 fails to serialize `null` literals.
+              stringify(null) == "null" &&
+              // FF 3.1b1, 2 halts serialization if an array contains a function:
+              // `[1, true, getClass, 1]` serializes as "[1,true,],". FF 3.1b3
+              // elides non-JSON values from objects and arrays, unless they
+              // define custom `toJSON` methods.
+              stringify([undef, getClass, null]) == "[null,null,null]" &&
+              // Simple serialization test. FF 3.1b1 uses Unicode escape sequences
+              // where character escape codes are expected (e.g., `\b` => `\u0008`).
+              stringify({ "a": [value, true, false, null, "\x00\b\n\f\r\t"] }) == serialized &&
+              // FF 3.1b1 and b2 ignore the `filter` and `width` arguments.
+              stringify(null, value) === "1" &&
+              stringify([1, 2], null, 1) == "[\n 1,\n 2\n]" &&
+              // JSON 2, Prototype <= 1.7, and older WebKit builds incorrectly
+              // serialize extended years.
+              stringify(new Date(-8.64e15)) == '"-271821-04-20T00:00:00.000Z"' &&
+              // The milliseconds are optional in ES 5, but required in 5.1.
+              stringify(new Date(8.64e15)) == '"+275760-09-13T00:00:00.000Z"' &&
+              // Firefox <= 11.0 incorrectly serializes years prior to 0 as negative
+              // four-digit years instead of six-digit years. Credits: @Yaffle.
+              stringify(new Date(-621987552e5)) == '"-000001-01-01T00:00:00.000Z"' &&
+              // Safari <= 5.1.5 and Opera >= 10.53 incorrectly serialize millisecond
+              // values less than 1000. Credits: @Yaffle.
+              stringify(new Date(-1)) == '"1969-12-31T23:59:59.999Z"';
+          } catch (exception) {
+            stringifySupported = false;
+          }
+        }
+        isSupported = stringifySupported;
+      }
+      // Test `JSON.parse`.
+      if (name == "json-parse") {
+        var parse = JSON3.parse;
+        Eif (typeof parse == "function") {
+          try {
+            // FF 3.1b1, b2 will throw an exception if a bare literal is provided.
+            // Conforming implementations should also coerce the initial argument to
+            // a string prior to parsing.
+            Eif (parse("0") === 0 && !parse(false)) {
+              // Simple parsing test.
+              value = parse(serialized);
+              var parseSupported = value["a"].length == 5 && value["a"][0] === 1;
+              Eif (parseSupported) {
+                try {
+                  // Safari <= 5.1.2 and FF 3.1b1 allow unescaped tabs in strings.
+                  parseSupported = !parse('"\t"');
+                } catch (exception) {}
+                Eif (parseSupported) {
+                  try {
+                    // FF 4.0 and 4.0.1 allow leading `+` signs and leading
+                    // decimal points. FF 4.0, 4.0.1, and IE 9-10 also allow
+                    // certain octal literals.
+                    parseSupported = parse("01") !== 1;
+                  } catch (exception) {}
+                }
+                Eif (parseSupported) {
+                  try {
+                    // FF 4.0, 4.0.1, and Rhino 1.7R3-R4 allow trailing decimal
+                    // points. These environments, along with FF 3.1b1 and 2,
+                    // also allow trailing commas in JSON objects and arrays.
+                    parseSupported = parse("1.") !== 1;
+                  } catch (exception) {}
+                }
+              }
+            }
+          } catch (exception) {
+            parseSupported = false;
+          }
+        }
+        isSupported = parseSupported;
+      }
+    }
+    return has[name] = !!isSupported;
+  }
+  has["bug-string-char-index"] = null;
+  has["json"] = null;
+  has["json-stringify"] = null;
+  has["json-parse"] = null;
+ 
+  Iif (!has("json")) {
+    // Common `[[Class]]` name aliases.
+    var functionClass = "[object Function]";
+    var dateClass = "[object Date]";
+    var numberClass = "[object Number]";
+    var stringClass = "[object String]";
+    var arrayClass = "[object Array]";
+    var booleanClass = "[object Boolean]";
+ 
+    // Detect incomplete support for accessing string characters by index.
+    var charIndexBuggy = has("bug-string-char-index");
+ 
+    // Define additional utility methods if the `Date` methods are buggy.
+    if (!isExtended) {
+      var floor = Math.floor;
+      // A mapping between the months of the year and the number of days between
+      // January 1st and the first of the respective month.
+      var Months = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334];
+      // Internal: Calculates the number of days between the Unix epoch and the
+      // first day of the given month.
+      var getDay = function (year, month) {
+        return Months[month] + 365 * (year - 1970) + floor((year - 1969 + (month = +(month > 1))) / 4) - floor((year - 1901 + month) / 100) + floor((year - 1601 + month) / 400);
+      };
+    }
+ 
+    // Internal: Determines if a property is a direct property of the given
+    // object. Delegates to the native `Object#hasOwnProperty` method.
+    if (!(isProperty = {}.hasOwnProperty)) {
+      isProperty = function (property) {
+        var members = {}, constructor;
+        if ((members.__proto__ = null, members.__proto__ = {
+          // The *proto* property cannot be set multiple times in recent
+          // versions of Firefox and SeaMonkey.
+          "toString": 1
+        }, members).toString != getClass) {
+          // Safari <= 2.0.3 doesn't implement `Object#hasOwnProperty`, but
+          // supports the mutable *proto* property.
+          isProperty = function (property) {
+            // Capture and break the object's prototype chain (see section 8.6.2
+            // of the ES 5.1 spec). The parenthesized expression prevents an
+            // unsafe transformation by the Closure Compiler.
+            var original = this.__proto__, result = property in (this.__proto__ = null, this);
+            // Restore the original prototype chain.
+            this.__proto__ = original;
+            return result;
+          };
+        } else {
+          // Capture a reference to the top-level `Object` constructor.
+          constructor = members.constructor;
+          // Use the `constructor` property to simulate `Object#hasOwnProperty` in
+          // other environments.
+          isProperty = function (property) {
+            var parent = (this.constructor || constructor).prototype;
+            return property in this && !(property in parent && this[property] === parent[property]);
+          };
+        }
+        members = null;
+        return isProperty.call(this, property);
+      };
+    }
+ 
+    // Internal: A set of primitive types used by `isHostType`.
+    var PrimitiveTypes = {
+      'boolean': 1,
+      'number': 1,
+      'string': 1,
+      'undefined': 1
+    };
+ 
+    // Internal: Determines if the given object `property` value is a
+    // non-primitive.
+    var isHostType = function (object, property) {
+      var type = typeof object[property];
+      return type == 'object' ? !!object[property] : !PrimitiveTypes[type];
+    };
+ 
+    // Internal: Normalizes the `for...in` iteration algorithm across
+    // environments. Each enumerated key is yielded to a `callback` function.
+    forEach = function (object, callback) {
+      var size = 0, Properties, members, property;
+ 
+      // Tests for bugs in the current environment's `for...in` algorithm. The
+      // `valueOf` property inherits the non-enumerable flag from
+      // `Object.prototype` in older versions of IE, Netscape, and Mozilla.
+      (Properties = function () {
+        this.valueOf = 0;
+      }).prototype.valueOf = 0;
+ 
+      // Iterate over a new instance of the `Properties` class.
+      members = new Properties();
+      for (property in members) {
+        // Ignore all properties inherited from `Object.prototype`.
+        if (isProperty.call(members, property)) {
+          size++;
+        }
+      }
+      Properties = members = null;
+ 
+      // Normalize the iteration algorithm.
+      if (!size) {
+        // A list of non-enumerable properties inherited from `Object.prototype`.
+        members = ["valueOf", "toString", "toLocaleString", "propertyIsEnumerable", "isPrototypeOf", "hasOwnProperty", "constructor"];
+        // IE <= 8, Mozilla 1.0, and Netscape 6.2 ignore shadowed non-enumerable
+        // properties.
+        forEach = function (object, callback) {
+          var isFunction = getClass.call(object) == functionClass, property, length;
+          var hasProperty = !isFunction && typeof object.constructor != 'function' && isHostType(object, 'hasOwnProperty') ? object.hasOwnProperty : isProperty;
+          for (property in object) {
+            // Gecko <= 1.0 enumerates the `prototype` property of functions under
+            // certain conditions; IE does not.
+            if (!(isFunction && property == "prototype") && hasProperty.call(object, property)) {
+              callback(property);
+            }
+          }
+          // Manually invoke the callback for each non-enumerable property.
+          for (length = members.length; property = members[--length]; hasProperty.call(object, property) && callback(property));
+        };
+      } else if (size == 2) {
+        // Safari <= 2.0.4 enumerates shadowed properties twice.
+        forEach = function (object, callback) {
+          // Create a set of iterated properties.
+          var members = {}, isFunction = getClass.call(object) == functionClass, property;
+          for (property in object) {
+            // Store each property name to prevent double enumeration. The
+            // `prototype` property of functions is not enumerated due to cross-
+            // environment inconsistencies.
+            if (!(isFunction && property == "prototype") && !isProperty.call(members, property) && (members[property] = 1) && isProperty.call(object, property)) {
+              callback(property);
+            }
+          }
+        };
+      } else {
+        // No bugs detected; use the standard `for...in` algorithm.
+        forEach = function (object, callback) {
+          var isFunction = getClass.call(object) == functionClass, property, isConstructor;
+          for (property in object) {
+            if (!(isFunction && property == "prototype") && isProperty.call(object, property) && !(isConstructor = property === "constructor")) {
+              callback(property);
+            }
+          }
+          // Manually invoke the callback for the `constructor` property due to
+          // cross-environment inconsistencies.
+          if (isConstructor || isProperty.call(object, (property = "constructor"))) {
+            callback(property);
+          }
+        };
+      }
+      return forEach(object, callback);
+    };
+ 
+    // Public: Serializes a JavaScript `value` as a JSON string. The optional
+    // `filter` argument may specify either a function that alters how object and
+    // array members are serialized, or an array of strings and numbers that
+    // indicates which properties should be serialized. The optional `width`
+    // argument may be either a string or number that specifies the indentation
+    // level of the output.
+    if (!has("json-stringify")) {
+      // Internal: A map of control characters and their escaped equivalents.
+      var Escapes = {
+        92: "\\\\",
+        34: '\\"',
+        8: "\\b",
+        12: "\\f",
+        10: "\\n",
+        13: "\\r",
+        9: "\\t"
+      };
+ 
+      // Internal: Converts `value` into a zero-padded string such that its
+      // length is at least equal to `width`. The `width` must be <= 6.
+      var leadingZeroes = "000000";
+      var toPaddedString = function (width, value) {
+        // The `|| 0` expression is necessary to work around a bug in
+        // Opera <= 7.54u2 where `0 == -0`, but `String(-0) !== "0"`.
+        return (leadingZeroes + (value || 0)).slice(-width);
+      };
+ 
+      // Internal: Double-quotes a string `value`, replacing all ASCII control
+      // characters (characters with code unit values between 0 and 31) with
+      // their escaped equivalents. This is an implementation of the
+      // `Quote(value)` operation defined in ES 5.1 section 15.12.3.
+      var unicodePrefix = "\\u00";
+      var quote = function (value) {
+        var result = '"', index = 0, length = value.length, isLarge = length > 10 && charIndexBuggy, symbols;
+        if (isLarge) {
+          symbols = value.split("");
+        }
+        for (; index < length; index++) {
+          var charCode = value.charCodeAt(index);
+          // If the character is a control character, append its Unicode or
+          // shorthand escape sequence; otherwise, append the character as-is.
+          switch (charCode) {
+            case 8: case 9: case 10: case 12: case 13: case 34: case 92:
+              result += Escapes[charCode];
+              break;
+            default:
+              if (charCode < 32) {
+                result += unicodePrefix + toPaddedString(2, charCode.toString(16));
+                break;
+              }
+              result += isLarge ? symbols[index] : charIndexBuggy ? value.charAt(index) : value[index];
+          }
+        }
+        return result + '"';
+      };
+ 
+      // Internal: Recursively serializes an object. Implements the
+      // `Str(key, holder)`, `JO(value)`, and `JA(value)` operations.
+      var serialize = function (property, object, callback, properties, whitespace, indentation, stack) {
+        var value, className, year, month, date, time, hours, minutes, seconds, milliseconds, results, element, index, length, prefix, hasMembers, result;
+        try {
+          // Necessary for host object support.
+          value = object[property];
+        } catch (exception) {}
+        if (typeof value == "object" && value) {
+          className = getClass.call(value);
+          if (className == dateClass && !isProperty.call(value, "toJSON")) {
+            if (value > -1 / 0 && value < 1 / 0) {
+              // Dates are serialized according to the `Date#toJSON` method
+              // specified in ES 5.1 section 15.9.5.44. See section 15.9.1.15
+              // for the ISO 8601 date time string format.
+              if (getDay) {
+                // Manually compute the year, month, date, hours, minutes,
+                // seconds, and milliseconds if the `getUTC*` methods are
+                // buggy. Adapted from @Yaffle's `date-shim` project.
+                date = floor(value / 864e5);
+                for (year = floor(date / 365.2425) + 1970 - 1; getDay(year + 1, 0) <= date; year++);
+                for (month = floor((date - getDay(year, 0)) / 30.42); getDay(year, month + 1) <= date; month++);
+                date = 1 + date - getDay(year, month);
+                // The `time` value specifies the time within the day (see ES
+                // 5.1 section 15.9.1.2). The formula `(A % B + B) % B` is used
+                // to compute `A modulo B`, as the `%` operator does not
+                // correspond to the `modulo` operation for negative numbers.
+                time = (value % 864e5 + 864e5) % 864e5;
+                // The hours, minutes, seconds, and milliseconds are obtained by
+                // decomposing the time within the day. See section 15.9.1.10.
+                hours = floor(time / 36e5) % 24;
+                minutes = floor(time / 6e4) % 60;
+                seconds = floor(time / 1e3) % 60;
+                milliseconds = time % 1e3;
+              } else {
+                year = value.getUTCFullYear();
+                month = value.getUTCMonth();
+                date = value.getUTCDate();
+                hours = value.getUTCHours();
+                minutes = value.getUTCMinutes();
+                seconds = value.getUTCSeconds();
+                milliseconds = value.getUTCMilliseconds();
+              }
+              // Serialize extended years correctly.
+              value = (year <= 0 || year >= 1e4 ? (year < 0 ? "-" : "+") + toPaddedString(6, year < 0 ? -year : year) : toPaddedString(4, year)) +
+                "-" + toPaddedString(2, month + 1) + "-" + toPaddedString(2, date) +
+                // Months, dates, hours, minutes, and seconds should have two
+                // digits; milliseconds should have three.
+                "T" + toPaddedString(2, hours) + ":" + toPaddedString(2, minutes) + ":" + toPaddedString(2, seconds) +
+                // Milliseconds are optional in ES 5.0, but required in 5.1.
+                "." + toPaddedString(3, milliseconds) + "Z";
+            } else {
+              value = null;
+            }
+          } else if (typeof value.toJSON == "function" && ((className != numberClass && className != stringClass && className != arrayClass) || isProperty.call(value, "toJSON"))) {
+            // Prototype <= 1.6.1 adds non-standard `toJSON` methods to the
+            // `Number`, `String`, `Date`, and `Array` prototypes. JSON 3
+            // ignores all `toJSON` methods on these objects unless they are
+            // defined directly on an instance.
+            value = value.toJSON(property);
+          }
+        }
+        if (callback) {
+          // If a replacement function was provided, call it to obtain the value
+          // for serialization.
+          value = callback.call(object, property, value);
+        }
+        if (value === null) {
+          return "null";
+        }
+        className = getClass.call(value);
+        if (className == booleanClass) {
+          // Booleans are represented literally.
+          return "" + value;
+        } else if (className == numberClass) {
+          // JSON numbers must be finite. `Infinity` and `NaN` are serialized as
+          // `"null"`.
+          return value > -1 / 0 && value < 1 / 0 ? "" + value : "null";
+        } else if (className == stringClass) {
+          // Strings are double-quoted and escaped.
+          return quote("" + value);
+        }
+        // Recursively serialize objects and arrays.
+        if (typeof value == "object") {
+          // Check for cyclic structures. This is a linear search; performance
+          // is inversely proportional to the number of unique nested objects.
+          for (length = stack.length; length--;) {
+            if (stack[length] === value) {
+              // Cyclic structures cannot be serialized by `JSON.stringify`.
+              throw TypeError();
+            }
+          }
+          // Add the object to the stack of traversed objects.
+          stack.push(value);
+          results = [];
+          // Save the current indentation level and indent one additional level.
+          prefix = indentation;
+          indentation += whitespace;
+          if (className == arrayClass) {
+            // Recursively serialize array elements.
+            for (index = 0, length = value.length; index < length; hasMembers || (hasMembers = true), index++) {
+              element = serialize(index, value, callback, properties, whitespace, indentation, stack);
+              results.push(element === undef ? "null" : element);
+            }
+            result = hasMembers ? (whitespace ? "[\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "]" : ("[" + results.join(",") + "]")) : "[]";
+          } else {
+            // Recursively serialize object members. Members are selected from
+            // either a user-specified list of property names, or the object
+            // itself.
+            forEach(properties || value, function (property) {
+              var element = serialize(property, value, callback, properties, whitespace, indentation, stack);
+              if (element !== undef) {
+                // According to ES 5.1 section 15.12.3: "If `gap` {whitespace}
+                // is not the empty string, let `member` {quote(property) + ":"}
+                // be the concatenation of `member` and the `space` character."
+                // The "`space` character" refers to the literal space
+                // character, not the `space` {width} argument provided to
+                // `JSON.stringify`.
+                results.push(quote(property) + ":" + (whitespace ? " " : "") + element);
+              }
+              hasMembers || (hasMembers = true);
+            });
+            result = hasMembers ? (whitespace ? "{\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "}" : ("{" + results.join(",") + "}")) : "{}";
+          }
+          // Remove the object from the traversed object stack.
+          stack.pop();
+          return result;
+        }
+      };
+ 
+      // Public: `JSON.stringify`. See ES 5.1 section 15.12.3.
+      JSON3.stringify = function (source, filter, width) {
+        var whitespace, callback, properties, className;
+        if (typeof filter == "function" || typeof filter == "object" && filter) {
+          if ((className = getClass.call(filter)) == functionClass) {
+            callback = filter;
+          } else if (className == arrayClass) {
+            // Convert the property names array into a makeshift set.
+            properties = {};
+            for (var index = 0, length = filter.length, value; index < length; value = filter[index++], ((getClass.call(value) == stringClass || getClass.call(value) == numberClass) && (properties[value] = 1)));
+          }
+        }
+        if (width) {
+          if ((className = getClass.call(width)) == numberClass) {
+            // Convert the `width` to an integer and create a string containing
+            // `width` number of space characters.
+            if ((width -= width % 1) > 0) {
+              for (whitespace = "", width > 10 && (width = 10); whitespace.length < width; whitespace += " ");
+            }
+          } else if (className == stringClass) {
+            whitespace = width.length <= 10 ? width : width.slice(0, 10);
+          }
+        }
+        // Opera <= 7.54u2 discards the values associated with empty string keys
+        // (`""`) only if they are used directly within an object member list
+        // (e.g., `!("" in { "": 1})`).
+        return serialize("", (value = {}, value[""] = source, value), callback, properties, whitespace, "", []);
+      };
+    }
+ 
+    // Public: Parses a JSON source string.
+    if (!has("json-parse")) {
+      var fromCharCode = String.fromCharCode;
+ 
+      // Internal: A map of escaped control characters and their unescaped
+      // equivalents.
+      var Unescapes = {
+        92: "\\",
+        34: '"',
+        47: "/",
+        98: "\b",
+        116: "\t",
+        110: "\n",
+        102: "\f",
+        114: "\r"
+      };
+ 
+      // Internal: Stores the parser state.
+      var Index, Source;
+ 
+      // Internal: Resets the parser state and throws a `SyntaxError`.
+      var abort = function() {
+        Index = Source = null;
+        throw SyntaxError();
+      };
+ 
+      // Internal: Returns the next token, or `"$"` if the parser has reached
+      // the end of the source string. A token may be a string, number, `null`
+      // literal, or Boolean literal.
+      var lex = function () {
+        var source = Source, length = source.length, value, begin, position, isSigned, charCode;
+        while (Index < length) {
+          charCode = source.charCodeAt(Index);
+          switch (charCode) {
+            case 9: case 10: case 13: case 32:
+              // Skip whitespace tokens, including tabs, carriage returns, line
+              // feeds, and space characters.
+              Index++;
+              break;
+            case 123: case 125: case 91: case 93: case 58: case 44:
+              // Parse a punctuator token (`{`, `}`, `[`, `]`, `:`, or `,`) at
+              // the current position.
+              value = charIndexBuggy ? source.charAt(Index) : source[Index];
+              Index++;
+              return value;
+            case 34:
+              // `"` delimits a JSON string; advance to the next character and
+              // begin parsing the string. String tokens are prefixed with the
+              // sentinel `@` character to distinguish them from punctuators and
+              // end-of-string tokens.
+              for (value = "@", Index++; Index < length;) {
+                charCode = source.charCodeAt(Index);
+                if (charCode < 32) {
+                  // Unescaped ASCII control characters (those with a code unit
+                  // less than the space character) are not permitted.
+                  abort();
+                } else if (charCode == 92) {
+                  // A reverse solidus (`\`) marks the beginning of an escaped
+                  // control character (including `"`, `\`, and `/`) or Unicode
+                  // escape sequence.
+                  charCode = source.charCodeAt(++Index);
+                  switch (charCode) {
+                    case 92: case 34: case 47: case 98: case 116: case 110: case 102: case 114:
+                      // Revive escaped control characters.
+                      value += Unescapes[charCode];
+                      Index++;
+                      break;
+                    case 117:
+                      // `\u` marks the beginning of a Unicode escape sequence.
+                      // Advance to the first character and validate the
+                      // four-digit code point.
+                      begin = ++Index;
+                      for (position = Index + 4; Index < position; Index++) {
+                        charCode = source.charCodeAt(Index);
+                        // A valid sequence comprises four hexdigits (case-
+                        // insensitive) that form a single hexadecimal value.
+                        if (!(charCode >= 48 && charCode <= 57 || charCode >= 97 && charCode <= 102 || charCode >= 65 && charCode <= 70)) {
+                          // Invalid Unicode escape sequence.
+                          abort();
+                        }
+                      }
+                      // Revive the escaped character.
+                      value += fromCharCode("0x" + source.slice(begin, Index));
+                      break;
+                    default:
+                      // Invalid escape sequence.
+                      abort();
+                  }
+                } else {
+                  if (charCode == 34) {
+                    // An unescaped double-quote character marks the end of the
+                    // string.
+                    break;
+                  }
+                  charCode = source.charCodeAt(Index);
+                  begin = Index;
+                  // Optimize for the common case where a string is valid.
+                  while (charCode >= 32 && charCode != 92 && charCode != 34) {
+                    charCode = source.charCodeAt(++Index);
+                  }
+                  // Append the string as-is.
+                  value += source.slice(begin, Index);
+                }
+              }
+              if (source.charCodeAt(Index) == 34) {
+                // Advance to the next character and return the revived string.
+                Index++;
+                return value;
+              }
+              // Unterminated string.
+              abort();
+            default:
+              // Parse numbers and literals.
+              begin = Index;
+              // Advance past the negative sign, if one is specified.
+              if (charCode == 45) {
+                isSigned = true;
+                charCode = source.charCodeAt(++Index);
+              }
+              // Parse an integer or floating-point value.
+              if (charCode >= 48 && charCode <= 57) {
+                // Leading zeroes are interpreted as octal literals.
+                if (charCode == 48 && ((charCode = source.charCodeAt(Index + 1)), charCode >= 48 && charCode <= 57)) {
+                  // Illegal octal literal.
+                  abort();
+                }
+                isSigned = false;
+                // Parse the integer component.
+                for (; Index < length && ((charCode = source.charCodeAt(Index)), charCode >= 48 && charCode <= 57); Index++);
+                // Floats cannot contain a leading decimal point; however, this
+                // case is already accounted for by the parser.
+                if (source.charCodeAt(Index) == 46) {
+                  position = ++Index;
+                  // Parse the decimal component.
+                  for (; position < length && ((charCode = source.charCodeAt(position)), charCode >= 48 && charCode <= 57); position++);
+                  if (position == Index) {
+                    // Illegal trailing decimal.
+                    abort();
+                  }
+                  Index = position;
+                }
+                // Parse exponents. The `e` denoting the exponent is
+                // case-insensitive.
+                charCode = source.charCodeAt(Index);
+                if (charCode == 101 || charCode == 69) {
+                  charCode = source.charCodeAt(++Index);
+                  // Skip past the sign following the exponent, if one is
+                  // specified.
+                  if (charCode == 43 || charCode == 45) {
+                    Index++;
+                  }
+                  // Parse the exponential component.
+                  for (position = Index; position < length && ((charCode = source.charCodeAt(position)), charCode >= 48 && charCode <= 57); position++);
+                  if (position == Index) {
+                    // Illegal empty exponent.
+                    abort();
+                  }
+                  Index = position;
+                }
+                // Coerce the parsed value to a JavaScript number.
+                return +source.slice(begin, Index);
+              }
+              // A negative sign may only precede numbers.
+              if (isSigned) {
+                abort();
+              }
+              // `true`, `false`, and `null` literals.
+              if (source.slice(Index, Index + 4) == "true") {
+                Index += 4;
+                return true;
+              } else if (source.slice(Index, Index + 5) == "false") {
+                Index += 5;
+                return false;
+              } else if (source.slice(Index, Index + 4) == "null") {
+                Index += 4;
+                return null;
+              }
+              // Unrecognized token.
+              abort();
+          }
+        }
+        // Return the sentinel `$` character if the parser has reached the end
+        // of the source string.
+        return "$";
+      };
+ 
+      // Internal: Parses a JSON `value` token.
+      var get = function (value) {
+        var results, hasMembers;
+        if (value == "$") {
+          // Unexpected end of input.
+          abort();
+        }
+        if (typeof value == "string") {
+          if ((charIndexBuggy ? value.charAt(0) : value[0]) == "@") {
+            // Remove the sentinel `@` character.
+            return value.slice(1);
+          }
+          // Parse object and array literals.
+          if (value == "[") {
+            // Parses a JSON array, returning a new JavaScript array.
+            results = [];
+            for (;; hasMembers || (hasMembers = true)) {
+              value = lex();
+              // A closing square bracket marks the end of the array literal.
+              if (value == "]") {
+                break;
+              }
+              // If the array literal contains elements, the current token
+              // should be a comma separating the previous element from the
+              // next.
+              if (hasMembers) {
+                if (value == ",") {
+                  value = lex();
+                  if (value == "]") {
+                    // Unexpected trailing `,` in array literal.
+                    abort();
+                  }
+                } else {
+                  // A `,` must separate each array element.
+                  abort();
+                }
+              }
+              // Elisions and leading commas are not permitted.
+              if (value == ",") {
+                abort();
+              }
+              results.push(get(value));
+            }
+            return results;
+          } else if (value == "{") {
+            // Parses a JSON object, returning a new JavaScript object.
+            results = {};
+            for (;; hasMembers || (hasMembers = true)) {
+              value = lex();
+              // A closing curly brace marks the end of the object literal.
+              if (value == "}") {
+                break;
+              }
+              // If the object literal contains members, the current token
+              // should be a comma separator.
+              if (hasMembers) {
+                if (value == ",") {
+                  value = lex();
+                  if (value == "}") {
+                    // Unexpected trailing `,` in object literal.
+                    abort();
+                  }
+                } else {
+                  // A `,` must separate each object member.
+                  abort();
+                }
+              }
+              // Leading commas are not permitted, object property names must be
+              // double-quoted strings, and a `:` must separate each property
+              // name and value.
+              if (value == "," || typeof value != "string" || (charIndexBuggy ? value.charAt(0) : value[0]) != "@" || lex() != ":") {
+                abort();
+              }
+              results[value.slice(1)] = get(lex());
+            }
+            return results;
+          }
+          // Unexpected token encountered.
+          abort();
+        }
+        return value;
+      };
+ 
+      // Internal: Updates a traversed object member.
+      var update = function(source, property, callback) {
+        var element = walk(source, property, callback);
+        if (element === undef) {
+          delete source[property];
+        } else {
+          source[property] = element;
+        }
+      };
+ 
+      // Internal: Recursively traverses a parsed JSON object, invoking the
+      // `callback` function for each value. This is an implementation of the
+      // `Walk(holder, name)` operation defined in ES 5.1 section 15.12.2.
+      var walk = function (source, property, callback) {
+        var value = source[property], length;
+        if (typeof value == "object" && value) {
+          // `forEach` can't be used to traverse an array in Opera <= 8.54
+          // because its `Object#hasOwnProperty` implementation returns `false`
+          // for array indices (e.g., `![1, 2, 3].hasOwnProperty("0")`).
+          if (getClass.call(value) == arrayClass) {
+            for (length = value.length; length--;) {
+              update(value, length, callback);
+            }
+          } else {
+            forEach(value, function (property) {
+              update(value, property, callback);
+            });
+          }
+        }
+        return callback.call(source, property, value);
+      };
+ 
+      // Public: `JSON.parse`. See ES 5.1 section 15.12.2.
+      JSON3.parse = function (source, callback) {
+        var result, value;
+        Index = 0;
+        Source = "" + source;
+        result = get(lex());
+        // If a JSON string contains multiple tokens, it is invalid.
+        if (lex() != "$") {
+          abort();
+        }
+        // Reset the parser state.
+        Index = Source = null;
+        return callback && getClass.call(callback) == functionClass ? walk((value = {}, value[""] = result, value), "", callback) : result;
+      };
+    }
+  }
+ 
+  // Export for asynchronous module loaders.
+  Iif (isLoader) {
+    define(function () {
+      return JSON3;
+    });
+  }
+}(this));
+ 
+ +
+ + + + + + + + diff --git a/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/json3/coverage/lcov-report/prettify.css b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/json3/coverage/lcov-report/prettify.css new file mode 100644 index 0000000..b317a7c --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/json3/coverage/lcov-report/prettify.css @@ -0,0 +1 @@ +.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} diff --git a/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/json3/coverage/lcov-report/prettify.js b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/json3/coverage/lcov-report/prettify.js new file mode 100644 index 0000000..ef51e03 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/json3/coverage/lcov-report/prettify.js @@ -0,0 +1 @@ +window.PR_SHOULD_USE_CONTINUATION=true;(function(){var h=["break,continue,do,else,for,if,return,while"];var u=[h,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"];var p=[u,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"];var l=[p,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"];var x=[p,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"];var R=[x,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"];var r="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes";var w=[p,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"];var s="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END";var I=[h,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"];var f=[h,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"];var H=[h,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"];var A=[l,R,w,s+I,f,H];var e=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/;var C="str";var z="kwd";var j="com";var O="typ";var G="lit";var L="pun";var F="pln";var m="tag";var E="dec";var J="src";var P="atn";var n="atv";var N="nocode";var M="(?:^^\\.?|[+-]|\\!|\\!=|\\!==|\\#|\\%|\\%=|&|&&|&&=|&=|\\(|\\*|\\*=|\\+=|\\,|\\-=|\\->|\\/|\\/=|:|::|\\;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\@|\\[|\\^|\\^=|\\^\\^|\\^\\^=|\\{|\\||\\|=|\\|\\||\\|\\|=|\\~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function k(Z){var ad=0;var S=false;var ac=false;for(var V=0,U=Z.length;V122)){if(!(al<65||ag>90)){af.push([Math.max(65,ag)|32,Math.min(al,90)|32])}if(!(al<97||ag>122)){af.push([Math.max(97,ag)&~32,Math.min(al,122)&~32])}}}}af.sort(function(av,au){return(av[0]-au[0])||(au[1]-av[1])});var ai=[];var ap=[NaN,NaN];for(var ar=0;arat[0]){if(at[1]+1>at[0]){an.push("-")}an.push(T(at[1]))}}an.push("]");return an.join("")}function W(al){var aj=al.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g"));var ah=aj.length;var an=[];for(var ak=0,am=0;ak=2&&ai==="["){aj[ak]=X(ag)}else{if(ai!=="\\"){aj[ak]=ag.replace(/[a-zA-Z]/g,function(ao){var ap=ao.charCodeAt(0);return"["+String.fromCharCode(ap&~32,ap|32)+"]"})}}}}return aj.join("")}var aa=[];for(var V=0,U=Z.length;V=0;){S[ac.charAt(ae)]=Y}}var af=Y[1];var aa=""+af;if(!ag.hasOwnProperty(aa)){ah.push(af);ag[aa]=null}}ah.push(/[\0-\uffff]/);V=k(ah)})();var X=T.length;var W=function(ah){var Z=ah.sourceCode,Y=ah.basePos;var ad=[Y,F];var af=0;var an=Z.match(V)||[];var aj={};for(var ae=0,aq=an.length;ae=5&&"lang-"===ap.substring(0,5);if(am&&!(ai&&typeof ai[1]==="string")){am=false;ap=J}if(!am){aj[ag]=ap}}var ab=af;af+=ag.length;if(!am){ad.push(Y+ab,ap)}else{var al=ai[1];var ak=ag.indexOf(al);var ac=ak+al.length;if(ai[2]){ac=ag.length-ai[2].length;ak=ac-al.length}var ar=ap.substring(5);B(Y+ab,ag.substring(0,ak),W,ad);B(Y+ab+ak,al,q(ar,al),ad);B(Y+ab+ac,ag.substring(ac),W,ad)}}ah.decorations=ad};return W}function i(T){var W=[],S=[];if(T.tripleQuotedStrings){W.push([C,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""])}else{if(T.multiLineStrings){W.push([C,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"])}else{W.push([C,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"])}}if(T.verbatimStrings){S.push([C,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null])}var Y=T.hashComments;if(Y){if(T.cStyleComments){if(Y>1){W.push([j,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"])}else{W.push([j,/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"])}S.push([C,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,null])}else{W.push([j,/^#[^\r\n]*/,null,"#"])}}if(T.cStyleComments){S.push([j,/^\/\/[^\r\n]*/,null]);S.push([j,/^\/\*[\s\S]*?(?:\*\/|$)/,null])}if(T.regexLiterals){var X=("/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/");S.push(["lang-regex",new RegExp("^"+M+"("+X+")")])}var V=T.types;if(V){S.push([O,V])}var U=(""+T.keywords).replace(/^ | $/g,"");if(U.length){S.push([z,new RegExp("^(?:"+U.replace(/[\s,]+/g,"|")+")\\b"),null])}W.push([F,/^\s+/,null," \r\n\t\xA0"]);S.push([G,/^@[a-z_$][a-z_$@0-9]*/i,null],[O,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[F,/^[a-z_$][a-z_$@0-9]*/i,null],[G,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[F,/^\\[\s\S]?/,null],[L,/^.[^\s\w\.$@\'\"\`\/\#\\]*/,null]);return g(W,S)}var K=i({keywords:A,hashComments:true,cStyleComments:true,multiLineStrings:true,regexLiterals:true});function Q(V,ag){var U=/(?:^|\s)nocode(?:\s|$)/;var ab=/\r\n?|\n/;var ac=V.ownerDocument;var S;if(V.currentStyle){S=V.currentStyle.whiteSpace}else{if(window.getComputedStyle){S=ac.defaultView.getComputedStyle(V,null).getPropertyValue("white-space")}}var Z=S&&"pre"===S.substring(0,3);var af=ac.createElement("LI");while(V.firstChild){af.appendChild(V.firstChild)}var W=[af];function ae(al){switch(al.nodeType){case 1:if(U.test(al.className)){break}if("BR"===al.nodeName){ad(al);if(al.parentNode){al.parentNode.removeChild(al)}}else{for(var an=al.firstChild;an;an=an.nextSibling){ae(an)}}break;case 3:case 4:if(Z){var am=al.nodeValue;var aj=am.match(ab);if(aj){var ai=am.substring(0,aj.index);al.nodeValue=ai;var ah=am.substring(aj.index+aj[0].length);if(ah){var ak=al.parentNode;ak.insertBefore(ac.createTextNode(ah),al.nextSibling)}ad(al);if(!ai){al.parentNode.removeChild(al)}}}break}}function ad(ak){while(!ak.nextSibling){ak=ak.parentNode;if(!ak){return}}function ai(al,ar){var aq=ar?al.cloneNode(false):al;var ao=al.parentNode;if(ao){var ap=ai(ao,1);var an=al.nextSibling;ap.appendChild(aq);for(var am=an;am;am=an){an=am.nextSibling;ap.appendChild(am)}}return aq}var ah=ai(ak.nextSibling,0);for(var aj;(aj=ah.parentNode)&&aj.nodeType===1;){ah=aj}W.push(ah)}for(var Y=0;Y=S){ah+=2}if(V>=ap){Z+=2}}}var t={};function c(U,V){for(var S=V.length;--S>=0;){var T=V[S];if(!t.hasOwnProperty(T)){t[T]=U}else{if(window.console){console.warn("cannot override language handler %s",T)}}}}function q(T,S){if(!(T&&t.hasOwnProperty(T))){T=/^\s*]*(?:>|$)/],[j,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[L,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);c(g([[F,/^[\s]+/,null," \t\r\n"],[n,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[[m,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[P,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[L,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]);c(g([],[[n,/^[\s\S]+/]]),["uq.val"]);c(i({keywords:l,hashComments:true,cStyleComments:true,types:e}),["c","cc","cpp","cxx","cyc","m"]);c(i({keywords:"null,true,false"}),["json"]);c(i({keywords:R,hashComments:true,cStyleComments:true,verbatimStrings:true,types:e}),["cs"]);c(i({keywords:x,cStyleComments:true}),["java"]);c(i({keywords:H,hashComments:true,multiLineStrings:true}),["bsh","csh","sh"]);c(i({keywords:I,hashComments:true,multiLineStrings:true,tripleQuotedStrings:true}),["cv","py"]);c(i({keywords:s,hashComments:true,multiLineStrings:true,regexLiterals:true}),["perl","pl","pm"]);c(i({keywords:f,hashComments:true,multiLineStrings:true,regexLiterals:true}),["rb"]);c(i({keywords:w,cStyleComments:true,regexLiterals:true}),["js"]);c(i({keywords:r,hashComments:3,cStyleComments:true,multilineStrings:true,tripleQuotedStrings:true,regexLiterals:true}),["coffee"]);c(g([],[[C,/^[\s\S]+/]]),["regex"]);function d(V){var U=V.langExtension;try{var S=a(V.sourceNode);var T=S.sourceCode;V.sourceCode=T;V.spans=S.spans;V.basePos=0;q(U,T)(V);D(V)}catch(W){if("console" in window){console.log(W&&W.stack?W.stack:W)}}}function y(W,V,U){var S=document.createElement("PRE");S.innerHTML=W;if(U){Q(S,U)}var T={langExtension:V,numberLines:U,sourceNode:S};d(T);return S.innerHTML}function b(ad){function Y(af){return document.getElementsByTagName(af)}var ac=[Y("pre"),Y("code"),Y("xmp")];var T=[];for(var aa=0;aa=0){var ah=ai.match(ab);var am;if(!ah&&(am=o(aj))&&"CODE"===am.tagName){ah=am.className.match(ab)}if(ah){ah=ah[1]}var al=false;for(var ak=aj.parentNode;ak;ak=ak.parentNode){if((ak.tagName==="pre"||ak.tagName==="code"||ak.tagName==="xmp")&&ak.className&&ak.className.indexOf("prettyprint")>=0){al=true;break}}if(!al){var af=aj.className.match(/\blinenums\b(?::(\d+))?/);af=af?af[1]&&af[1].length?+af[1]:true:false;if(af){Q(aj,af)}S={langExtension:ah,sourceNode:aj,numberLines:af};d(S)}}}if(X]*(?:>|$)/],[PR.PR_COMMENT,/^<\!--[\s\S]*?(?:-\->|$)/],[PR.PR_PUNCTUATION,/^(?:<[%?]|[%?]>)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-handlebars",/^]*type\s*=\s*['"]?text\/x-handlebars-template['"]?\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i],[PR.PR_DECLARATION,/^{{[#^>/]?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{&?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{{>?\s*[\w.][^}]*}}}/],[PR.PR_COMMENT,/^{{![^}]*}}/]]),["handlebars","hbs"]);PR.registerLangHandler(PR.createSimpleLexer([[PR.PR_PLAIN,/^[ \t\r\n\f]+/,null," \t\r\n\f"]],[[PR.PR_STRING,/^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/,null],[PR.PR_STRING,/^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/,null],["lang-css-str",/^url\(([^\)\"\']*)\)/i],[PR.PR_KEYWORD,/^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*)\s*:/i],[PR.PR_COMMENT,/^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//],[PR.PR_COMMENT,/^(?:)/],[PR.PR_LITERAL,/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],[PR.PR_LITERAL,/^#(?:[0-9a-f]{3}){1,2}/i],[PR.PR_PLAIN,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i],[PR.PR_PUNCTUATION,/^[^\s\w\'\"]+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_KEYWORD,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_STRING,/^[^\)\"\']+/]]),["css-str"]); diff --git a/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/json3/coverage/lcov.info b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/json3/coverage/lcov.info new file mode 100644 index 0000000..9a4d72d --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/json3/coverage/lcov.info @@ -0,0 +1,2035 @@ +TN: +SF:/Users/kit/Dropbox/Projects/json3/vendor/spec/lib/spec.js +FN:11,(anonymous_1) +FN:20,(anonymous_2) +FN:21,noConflict +FN:31,(anonymous_4) +FN:70,(anonymous_5) +FN:78,hasKey +FN:86,hasKey +FN:102,hasKey +FN:117,(anonymous_9) +FN:123,Properties +FN:145,forOwn +FN:169,forOwn +FN:188,forOwn +FN:210,(anonymous_14) +FN:213,eq +FN:289,(anonymous_16) +FN:297,(anonymous_17) +FN:311,equals +FN:328,forEach +FN:343,(anonymous_20) +FN:347,defer +FN:354,run +FN:361,defer +FN:362,run +FN:370,defer +FN:372,run +FN:387,(anonymous_27) +FN:395,defer +FN:404,rethrow +FN:405,(anonymous_30) +FN:418,Events +FN:429,addListener +FN:431,(anonymous_33) +FN:454,removeListener +FN:459,(anonymous_35) +FN:483,emit +FN:531,Suite +FN:547,(anonymous_38) +FN:555,shuffle +FN:567,addTest +FN:575,index +FN:594,onSuiteEvent +FN:622,runSuite +FN:645,Test +FN:668,onTestEvent +FN:697,assert +FN:698,assertion +FN:710,runTest +FN:720,ok +FN:735,notOk +FN:742,assertEqual +FN:748,assertNotEqual +FN:754,assertStrictEqual +FN:760,assertStrictNotEqual +FN:770,assertNotDeepEqual +FN:776,assertError +FN:793,assertNoError +FN:806,done +FNF:58 +FNH:38 +FNDA:1,(anonymous_1) +FNDA:0,(anonymous_2) +FNDA:0,noConflict +FNDA:1,(anonymous_4) +FNDA:1,(anonymous_5) +FNDA:5538,hasKey +FNDA:0,hasKey +FNDA:0,hasKey +FNDA:1,(anonymous_9) +FNDA:1,Properties +FNDA:0,forOwn +FNDA:0,forOwn +FNDA:26,forOwn +FNDA:1,(anonymous_14) +FNDA:102,eq +FNDA:15,(anonymous_16) +FNDA:15,(anonymous_17) +FNDA:51,equals +FNDA:49,forEach +FNDA:1,(anonymous_20) +FNDA:0,defer +FNDA:0,run +FNDA:0,defer +FNDA:0,run +FNDA:0,defer +FNDA:0,run +FNDA:0,(anonymous_27) +FNDA:11,defer +FNDA:0,rethrow +FNDA:0,(anonymous_30) +FNDA:14,Events +FNDA:34,addListener +FNDA:34,(anonymous_33) +FNDA:11,removeListener +FNDA:11,(anonymous_35) +FNDA:594,emit +FNDA:1,Suite +FNDA:1,(anonymous_38) +FNDA:1,shuffle +FNDA:11,addTest +FNDA:12,index +FNDA:296,onSuiteEvent +FNDA:1,runSuite +FNDA:11,Test +FNDA:296,onTestEvent +FNDA:6,assert +FNDA:117,assertion +FNDA:11,runTest +FNDA:274,ok +FNDA:0,notOk +FNDA:15,assertEqual +FNDA:0,assertNotEqual +FNDA:51,assertStrictEqual +FNDA:0,assertStrictNotEqual +FNDA:0,assertNotDeepEqual +FNDA:156,assertError +FNDA:0,assertNoError +FNDA:11,done +DA:11,1 +DA:12,1 +DA:14,0 +DA:17,1 +DA:21,1 +DA:22,0 +DA:24,0 +DA:25,0 +DA:27,0 +DA:35,1 +DA:41,1 +DA:71,1 +DA:73,1 +DA:74,1 +DA:76,1 +DA:78,1 +DA:79,5538 +DA:80,0 +DA:82,5538 +DA:84,0 +DA:86,0 +DA:87,0 +DA:88,0 +DA:89,0 +DA:93,0 +DA:94,0 +DA:96,0 +DA:97,0 +DA:102,0 +DA:103,0 +DA:104,0 +DA:106,0 +DA:107,0 +DA:110,1 +DA:118,1 +DA:123,1 +DA:124,1 +DA:126,1 +DA:129,1 +DA:130,1 +DA:132,1 +DA:133,1 +DA:136,1 +DA:139,1 +DA:141,0 +DA:144,0 +DA:145,0 +DA:146,0 +DA:147,0 +DA:148,0 +DA:150,0 +DA:151,0 +DA:154,0 +DA:155,0 +DA:159,0 +DA:160,0 +DA:161,0 +DA:162,0 +DA:166,1 +DA:168,0 +DA:169,0 +DA:170,0 +DA:171,0 +DA:172,0 +DA:175,0 +DA:176,0 +DA:177,0 +DA:181,0 +DA:182,0 +DA:188,1 +DA:189,26 +DA:190,26 +DA:191,0 +DA:193,26 +DA:194,26 +DA:195,30 +DA:196,0 +DA:201,26 +DA:202,0 +DA:206,1 +DA:213,1 +DA:214,102 +DA:216,102 +DA:219,72 +DA:222,30 +DA:223,0 +DA:225,30 +DA:226,30 +DA:227,0 +DA:229,30 +DA:234,0 +DA:236,0 +DA:237,0 +DA:240,0 +DA:246,0 +DA:250,0 +DA:256,30 +DA:257,0 +DA:263,30 +DA:264,22 +DA:265,0 +DA:269,30 +DA:270,30 +DA:272,30 +DA:274,17 +DA:275,17 +DA:276,17 +DA:278,17 +DA:280,36 +DA:281,0 +DA:286,13 +DA:288,13 +DA:289,13 +DA:291,15 +DA:293,15 +DA:296,13 +DA:297,13 +DA:298,15 +DA:299,0 +DA:302,13 +DA:306,30 +DA:307,30 +DA:311,1 +DA:312,51 +DA:315,51 +DA:316,0 +DA:319,51 +DA:322,1 +DA:329,49 +DA:330,49 +DA:331,0 +DA:333,49 +DA:334,114 +DA:335,0 +DA:338,49 +DA:344,1 +DA:346,1 +DA:347,1 +DA:354,1 +DA:355,0 +DA:357,0 +DA:360,0 +DA:361,0 +DA:362,1 +DA:363,0 +DA:365,0 +DA:369,0 +DA:370,0 +DA:371,0 +DA:372,1 +DA:376,0 +DA:377,0 +DA:382,0 +DA:386,0 +DA:387,0 +DA:388,0 +DA:390,0 +DA:394,1 +DA:395,1 +DA:396,11 +DA:399,1 +DA:404,1 +DA:405,0 +DA:406,0 +DA:417,1 +DA:418,1 +DA:419,14 +DA:428,1 +DA:429,1 +DA:430,34 +DA:431,34 +DA:432,34 +DA:433,34 +DA:435,34 +DA:436,34 +DA:438,34 +DA:444,34 +DA:453,1 +DA:454,1 +DA:455,11 +DA:457,0 +DA:458,11 +DA:459,11 +DA:460,11 +DA:461,11 +DA:463,11 +DA:464,11 +DA:466,11 +DA:467,11 +DA:468,22 +DA:469,11 +DA:476,11 +DA:482,1 +DA:483,1 +DA:484,594 +DA:486,594 +DA:487,13 +DA:489,594 +DA:491,594 +DA:492,298 +DA:495,594 +DA:496,594 +DA:497,0 +DA:498,0 +DA:500,0 +DA:501,0 +DA:503,0 +DA:508,594 +DA:509,594 +DA:510,594 +DA:511,890 +DA:512,890 +DA:514,0 +DA:518,594 +DA:528,1 +DA:531,1 +DA:532,1 +DA:533,1 +DA:534,1 +DA:536,1 +DA:540,1 +DA:543,1 +DA:544,1 +DA:547,1 +DA:548,1 +DA:549,8 +DA:554,1 +DA:555,1 +DA:556,1 +DA:557,11 +DA:558,11 +DA:559,11 +DA:560,11 +DA:562,1 +DA:566,1 +DA:567,1 +DA:568,11 +DA:569,11 +DA:574,1 +DA:575,1 +DA:576,12 +DA:577,12 +DA:578,12 +DA:579,0 +DA:581,12 +DA:582,11 +DA:583,11 +DA:584,11 +DA:587,1 +DA:593,1 +DA:594,1 +DA:595,296 +DA:597,296 +DA:598,296 +DA:601,274 +DA:602,274 +DA:604,0 +DA:605,0 +DA:608,11 +DA:609,11 +DA:610,10 +DA:612,10 +DA:615,1 +DA:621,1 +DA:622,1 +DA:624,1 +DA:625,1 +DA:627,1 +DA:629,1 +DA:630,1 +DA:632,1 +DA:635,0 +DA:637,1 +DA:644,1 +DA:645,1 +DA:646,11 +DA:647,11 +DA:648,0 +DA:649,0 +DA:651,11 +DA:652,11 +DA:654,11 +DA:656,11 +DA:660,1 +DA:661,1 +DA:664,1 +DA:667,1 +DA:668,1 +DA:669,296 +DA:670,296 +DA:672,11 +DA:673,11 +DA:675,274 +DA:676,274 +DA:678,0 +DA:679,0 +DA:681,11 +DA:683,11 +DA:684,0 +DA:696,1 +DA:697,1 +DA:698,1 +DA:699,117 +DA:705,6 +DA:709,1 +DA:710,1 +DA:711,11 +DA:713,11 +DA:714,11 +DA:719,1 +DA:720,1 +DA:721,274 +DA:722,157 +DA:729,274 +DA:730,274 +DA:734,1 +DA:735,1 +DA:736,0 +DA:741,1 +DA:742,1 +DA:743,15 +DA:747,1 +DA:748,1 +DA:749,0 +DA:753,1 +DA:754,1 +DA:755,51 +DA:759,1 +DA:760,1 +DA:761,0 +DA:766,1 +DA:769,1 +DA:770,1 +DA:771,0 +DA:775,1 +DA:776,1 +DA:777,156 +DA:779,156 +DA:780,0 +DA:781,0 +DA:783,156 +DA:784,156 +DA:786,156 +DA:788,156 +DA:792,1 +DA:793,1 +DA:794,0 +DA:795,0 +DA:796,0 +DA:798,0 +DA:800,0 +DA:805,1 +DA:806,1 +DA:807,11 +DA:812,1 +LF:355 +LH:248 +BRDA:12,1,0,0 +BRDA:12,1,1,1 +BRDA:12,2,0,1 +BRDA:12,2,1,0 +BRDA:17,3,0,1 +BRDA:17,3,1,1 +BRDA:17,3,2,0 +BRDA:59,4,0,1 +BRDA:59,4,1,1 +BRDA:59,4,2,1 +BRDA:63,5,0,1 +BRDA:63,5,1,0 +BRDA:63,5,2,0 +BRDA:63,5,3,0 +BRDA:76,6,0,1 +BRDA:76,6,1,0 +BRDA:79,7,0,0 +BRDA:79,7,1,5538 +BRDA:84,8,0,0 +BRDA:84,8,1,0 +BRDA:88,9,0,0 +BRDA:88,9,1,0 +BRDA:103,10,0,0 +BRDA:103,10,1,0 +BRDA:106,11,0,0 +BRDA:106,11,1,0 +BRDA:107,12,0,0 +BRDA:107,12,1,0 +BRDA:107,13,0,0 +BRDA:107,13,1,0 +BRDA:132,14,0,1 +BRDA:132,14,1,0 +BRDA:139,15,0,0 +BRDA:139,15,1,1 +BRDA:147,16,0,0 +BRDA:147,16,1,0 +BRDA:154,17,0,0 +BRDA:154,17,1,0 +BRDA:154,18,0,0 +BRDA:154,18,1,0 +BRDA:154,18,2,0 +BRDA:154,19,0,0 +BRDA:154,19,1,0 +BRDA:161,20,0,0 +BRDA:161,20,1,0 +BRDA:161,21,0,0 +BRDA:161,21,1,0 +BRDA:166,22,0,0 +BRDA:166,22,1,1 +BRDA:171,23,0,0 +BRDA:171,23,1,0 +BRDA:181,24,0,0 +BRDA:181,24,1,0 +BRDA:181,25,0,0 +BRDA:181,25,1,0 +BRDA:181,25,2,0 +BRDA:181,25,3,0 +BRDA:181,25,4,0 +BRDA:181,26,0,0 +BRDA:181,26,1,0 +BRDA:190,27,0,0 +BRDA:190,27,1,26 +BRDA:195,28,0,0 +BRDA:195,28,1,30 +BRDA:195,29,0,30 +BRDA:195,29,1,30 +BRDA:195,29,2,30 +BRDA:195,29,3,30 +BRDA:195,30,0,30 +BRDA:195,30,1,0 +BRDA:201,31,0,0 +BRDA:201,31,1,26 +BRDA:201,32,0,26 +BRDA:201,32,1,26 +BRDA:216,33,0,72 +BRDA:216,33,1,30 +BRDA:219,34,0,72 +BRDA:219,34,1,15 +BRDA:222,35,0,0 +BRDA:222,35,1,30 +BRDA:226,36,0,0 +BRDA:226,36,1,30 +BRDA:229,37,0,0 +BRDA:229,37,1,0 +BRDA:229,37,2,0 +BRDA:229,37,3,0 +BRDA:229,37,4,0 +BRDA:240,38,0,0 +BRDA:240,38,1,0 +BRDA:240,39,0,0 +BRDA:240,39,1,0 +BRDA:250,40,0,0 +BRDA:250,40,1,0 +BRDA:250,40,2,0 +BRDA:250,40,3,0 +BRDA:250,40,4,0 +BRDA:256,41,0,0 +BRDA:256,41,1,30 +BRDA:256,42,0,30 +BRDA:256,42,1,30 +BRDA:264,43,0,0 +BRDA:264,43,1,22 +BRDA:272,44,0,17 +BRDA:272,44,1,13 +BRDA:276,45,0,17 +BRDA:276,45,1,0 +BRDA:280,46,0,0 +BRDA:280,46,1,36 +BRDA:280,47,0,36 +BRDA:280,47,1,36 +BRDA:293,48,0,15 +BRDA:293,48,1,15 +BRDA:296,49,0,13 +BRDA:296,49,1,0 +BRDA:298,50,0,0 +BRDA:298,50,1,15 +BRDA:315,51,0,0 +BRDA:315,51,1,51 +BRDA:330,52,0,0 +BRDA:330,52,1,49 +BRDA:334,53,0,0 +BRDA:334,53,1,114 +BRDA:346,54,0,1 +BRDA:346,54,1,0 +BRDA:360,55,0,0 +BRDA:360,55,1,0 +BRDA:369,56,0,0 +BRDA:369,56,1,0 +BRDA:394,57,0,1 +BRDA:394,57,1,0 +BRDA:394,58,0,1 +BRDA:394,58,1,1 +BRDA:430,59,0,34 +BRDA:430,59,1,0 +BRDA:430,60,0,34 +BRDA:430,60,1,34 +BRDA:432,61,0,34 +BRDA:432,61,1,11 +BRDA:432,62,0,11 +BRDA:432,62,1,23 +BRDA:440,63,0,11 +BRDA:440,63,1,23 +BRDA:455,64,0,0 +BRDA:455,64,1,11 +BRDA:458,65,0,11 +BRDA:458,65,1,0 +BRDA:460,66,0,11 +BRDA:460,66,1,11 +BRDA:461,67,0,11 +BRDA:461,67,1,0 +BRDA:464,68,0,11 +BRDA:464,68,1,0 +BRDA:466,69,0,11 +BRDA:466,69,1,11 +BRDA:467,70,0,33 +BRDA:467,70,1,33 +BRDA:468,71,0,11 +BRDA:468,71,1,11 +BRDA:468,72,0,22 +BRDA:468,72,1,22 +BRDA:468,72,2,11 +BRDA:468,72,3,11 +BRDA:468,72,4,11 +BRDA:486,73,0,13 +BRDA:486,73,1,581 +BRDA:486,74,0,594 +BRDA:486,74,1,581 +BRDA:489,75,0,594 +BRDA:489,75,1,594 +BRDA:491,76,0,298 +BRDA:491,76,1,296 +BRDA:495,77,0,594 +BRDA:495,77,1,594 +BRDA:495,77,2,594 +BRDA:496,78,0,0 +BRDA:496,78,1,594 +BRDA:496,79,0,594 +BRDA:496,79,1,0 +BRDA:497,80,0,0 +BRDA:497,80,1,0 +BRDA:498,81,0,0 +BRDA:498,81,1,0 +BRDA:501,82,0,0 +BRDA:501,82,1,0 +BRDA:501,82,2,0 +BRDA:508,83,0,594 +BRDA:508,83,1,0 +BRDA:509,84,0,594 +BRDA:509,84,1,594 +BRDA:510,85,0,1484 +BRDA:510,85,1,1484 +BRDA:512,86,0,890 +BRDA:512,86,1,890 +BRDA:512,86,2,298 +BRDA:533,87,0,1 +BRDA:533,87,1,0 +BRDA:577,88,0,12 +BRDA:577,88,1,1 +BRDA:578,89,0,0 +BRDA:578,89,1,12 +BRDA:582,90,0,11 +BRDA:582,90,1,11 +BRDA:583,91,0,11 +BRDA:583,91,1,0 +BRDA:583,92,0,11 +BRDA:583,92,1,11 +BRDA:583,92,2,11 +BRDA:598,93,0,274 +BRDA:598,93,1,0 +BRDA:598,93,2,11 +BRDA:609,94,0,10 +BRDA:609,94,1,1 +BRDA:629,95,0,1 +BRDA:629,95,1,0 +BRDA:647,96,0,0 +BRDA:647,96,1,11 +BRDA:647,97,0,11 +BRDA:647,97,1,11 +BRDA:651,98,0,11 +BRDA:651,98,1,0 +BRDA:670,99,0,11 +BRDA:670,99,1,274 +BRDA:670,99,2,0 +BRDA:670,99,3,11 +BRDA:683,100,0,0 +BRDA:683,100,1,11 +BRDA:683,101,0,11 +BRDA:683,101,1,0 +BRDA:683,101,2,11 +BRDA:702,102,0,0 +BRDA:702,102,1,117 +BRDA:721,103,0,157 +BRDA:721,103,1,117 +BRDA:725,104,0,0 +BRDA:725,104,1,157 +BRDA:729,105,0,274 +BRDA:729,105,1,0 +BRDA:736,106,0,0 +BRDA:736,106,1,0 +BRDA:779,107,0,0 +BRDA:779,107,1,156 +BRDA:779,108,0,156 +BRDA:779,108,1,0 +BRDA:786,109,0,156 +BRDA:786,109,1,156 +BRDA:786,109,2,156 +BRDA:788,110,0,0 +BRDA:788,110,1,156 +BRDA:800,111,0,0 +BRDA:800,111,1,0 +BRF:250 +BRH:133 +end_of_record +TN: +SF:/Users/kit/Dropbox/Projects/json3/vendor/spec/lib/newton.js +FN:8,(anonymous_1) +FN:26,(anonymous_2) +FN:42,(anonymous_3) +FN:43,noConflict +FN:52,(anonymous_5) +FN:61,(anonymous_6) +FN:62,stringify +FN:68,toPaddedString +FN:85,quote +FN:99,serialize +FN:155,(anonymous_11) +FN:172,all +FN:174,(anonymous_13) +FN:181,toQueryPair +FN:200,serializeQuery +FN:202,(anonymous_16) +FN:204,(anonymous_17) +FN:223,parseQuery +FN:256,isEmpty +FN:275,(anonymous_20) +FN:283,substitute +FN:333,createConsole +FN:334,onEvent +FN:359,createTAP +FN:362,description +FN:365,onEvent +FN:391,onClick +FN:401,(anonymous_28) +FN:405,(anonymous_29) +FN:427,serializeAttribute +FN:433,buildNode +FN:458,(anonymous_32) +FN:464,(anonymous_33) +FN:470,(anonymous_34) +FN:480,clearElement +FN:489,createReport +FN:490,onEvent +FNF:37 +FNH:6 +FNDA:1,(anonymous_1) +FNDA:0,(anonymous_2) +FNDA:0,(anonymous_3) +FNDA:0,noConflict +FNDA:1,(anonymous_5) +FNDA:1,(anonymous_6) +FNDA:0,stringify +FNDA:0,toPaddedString +FNDA:0,quote +FNDA:0,serialize +FNDA:0,(anonymous_11) +FNDA:0,all +FNDA:0,(anonymous_13) +FNDA:0,toQueryPair +FNDA:0,serializeQuery +FNDA:0,(anonymous_16) +FNDA:0,(anonymous_17) +FNDA:0,parseQuery +FNDA:0,isEmpty +FNDA:0,(anonymous_20) +FNDA:298,substitute +FNDA:1,createConsole +FNDA:298,onEvent +FNDA:0,createTAP +FNDA:0,description +FNDA:0,onEvent +FNDA:0,onClick +FNDA:0,(anonymous_28) +FNDA:0,(anonymous_29) +FNDA:0,serializeAttribute +FNDA:0,buildNode +FNDA:0,(anonymous_32) +FNDA:0,(anonymous_33) +FNDA:0,(anonymous_34) +FNDA:0,clearElement +FNDA:0,createReport +FNDA:0,onEvent +DA:8,1 +DA:10,1 +DA:24,1 +DA:26,0 +DA:27,0 +DA:29,1 +DA:31,1 +DA:33,1 +DA:35,1 +DA:38,0 +DA:39,0 +DA:41,0 +DA:43,1 +DA:44,0 +DA:45,0 +DA:46,0 +DA:48,0 +DA:56,1 +DA:62,1 +DA:63,0 +DA:68,1 +DA:69,0 +DA:73,1 +DA:85,1 +DA:86,0 +DA:87,0 +DA:90,0 +DA:95,0 +DA:99,1 +DA:100,0 +DA:101,0 +DA:102,0 +DA:104,0 +DA:105,0 +DA:110,0 +DA:113,0 +DA:115,0 +DA:116,0 +DA:121,0 +DA:123,0 +DA:131,0 +DA:134,0 +DA:138,0 +DA:139,0 +DA:140,0 +DA:144,0 +DA:145,0 +DA:146,0 +DA:148,0 +DA:149,0 +DA:150,0 +DA:153,0 +DA:155,0 +DA:157,0 +DA:159,0 +DA:162,0 +DA:164,0 +DA:167,1 +DA:173,0 +DA:174,0 +DA:175,0 +DA:177,0 +DA:182,0 +DA:183,0 +DA:184,0 +DA:186,0 +DA:190,0 +DA:201,0 +DA:202,0 +DA:203,0 +DA:204,0 +DA:205,0 +DA:206,0 +DA:207,0 +DA:210,0 +DA:211,0 +DA:214,0 +DA:224,0 +DA:226,0 +DA:227,0 +DA:229,0 +DA:230,0 +DA:231,0 +DA:232,0 +DA:233,0 +DA:234,0 +DA:235,0 +DA:236,0 +DA:237,0 +DA:240,0 +DA:242,0 +DA:243,0 +DA:244,0 +DA:246,0 +DA:248,0 +DA:252,0 +DA:257,0 +DA:258,0 +DA:259,0 +DA:261,0 +DA:265,0 +DA:266,0 +DA:270,0 +DA:273,0 +DA:275,0 +DA:276,0 +DA:284,298 +DA:285,298 +DA:286,298 +DA:287,0 +DA:289,298 +DA:290,4294 +DA:291,4294 +DA:292,322 +DA:293,322 +DA:295,0 +DA:297,322 +DA:299,322 +DA:303,24 +DA:304,24 +DA:307,0 +DA:308,0 +DA:311,0 +DA:312,0 +DA:315,298 +DA:319,0 +DA:322,322 +DA:324,322 +DA:326,3972 +DA:329,298 +DA:334,1 +DA:335,298 +DA:337,1 +DA:338,1 +DA:340,11 +DA:341,11 +DA:343,274 +DA:344,274 +DA:346,0 +DA:347,0 +DA:349,11 +DA:350,11 +DA:352,1 +DA:355,1 +DA:360,0 +DA:362,1 +DA:363,0 +DA:365,1 +DA:366,0 +DA:368,0 +DA:369,0 +DA:371,0 +DA:372,0 +DA:373,0 +DA:374,0 +DA:376,0 +DA:377,0 +DA:378,0 +DA:379,0 +DA:380,0 +DA:383,0 +DA:389,1 +DA:391,0 +DA:393,0 +DA:394,0 +DA:395,0 +DA:401,0 +DA:405,0 +DA:406,0 +DA:407,0 +DA:408,0 +DA:409,0 +DA:411,0 +DA:412,0 +DA:428,0 +DA:429,0 +DA:434,0 +DA:435,0 +DA:436,0 +DA:437,0 +DA:439,0 +DA:442,0 +DA:443,0 +DA:444,0 +DA:445,0 +DA:446,0 +DA:448,0 +DA:449,0 +DA:450,0 +DA:452,0 +DA:454,0 +DA:456,0 +DA:457,0 +DA:458,0 +DA:460,0 +DA:462,0 +DA:464,0 +DA:465,0 +DA:469,0 +DA:470,0 +DA:471,0 +DA:474,0 +DA:476,0 +DA:480,0 +DA:481,0 +DA:482,0 +DA:484,0 +DA:489,0 +DA:490,1 +DA:491,0 +DA:492,0 +DA:493,0 +DA:495,0 +DA:496,0 +DA:498,0 +DA:502,0 +DA:504,0 +DA:513,0 +DA:517,0 +DA:520,0 +DA:523,0 +DA:524,0 +DA:528,0 +DA:530,0 +DA:532,0 +DA:533,0 +DA:537,0 +DA:539,0 +DA:540,0 +DA:543,0 +DA:566,0 +DA:569,0 +DA:574,1 +DA:576,1 +LF:234 +LH:50 +BRDA:10,1,0,1 +BRDA:10,1,1,0 +BRDA:11,2,0,1 +BRDA:11,2,1,1 +BRDA:11,2,2,1 +BRDA:11,2,3,1 +BRDA:14,3,0,1 +BRDA:14,3,1,0 +BRDA:14,3,2,0 +BRDA:15,4,0,1 +BRDA:15,4,1,1 +BRDA:15,4,2,0 +BRDA:24,5,0,0 +BRDA:24,5,1,1 +BRDA:29,6,0,1 +BRDA:29,6,1,0 +BRDA:35,7,0,1 +BRDA:35,7,1,0 +BRDA:38,8,0,0 +BRDA:38,8,1,0 +BRDA:50,9,0,0 +BRDA:50,9,1,0 +BRDA:90,10,0,0 +BRDA:90,10,1,0 +BRDA:93,11,0,0 +BRDA:93,11,1,0 +BRDA:101,12,0,0 +BRDA:101,12,1,0 +BRDA:105,13,0,0 +BRDA:105,13,1,0 +BRDA:105,13,2,0 +BRDA:105,13,3,0 +BRDA:105,13,4,0 +BRDA:110,14,0,0 +BRDA:110,14,1,0 +BRDA:115,15,0,0 +BRDA:115,15,1,0 +BRDA:123,16,0,0 +BRDA:123,16,1,0 +BRDA:123,17,0,0 +BRDA:123,17,1,0 +BRDA:123,18,0,0 +BRDA:123,18,1,0 +BRDA:134,19,0,0 +BRDA:134,19,1,0 +BRDA:139,20,0,0 +BRDA:139,20,1,0 +BRDA:146,21,0,0 +BRDA:146,21,1,0 +BRDA:149,22,0,0 +BRDA:149,22,1,0 +BRDA:183,23,0,0 +BRDA:183,23,1,0 +BRDA:186,24,0,0 +BRDA:186,24,1,0 +BRDA:186,24,2,0 +BRDA:203,25,0,0 +BRDA:203,25,1,0 +BRDA:203,26,0,0 +BRDA:203,26,1,0 +BRDA:206,27,0,0 +BRDA:206,27,1,0 +BRDA:210,28,0,0 +BRDA:210,28,1,0 +BRDA:214,29,0,0 +BRDA:214,29,1,0 +BRDA:226,30,0,0 +BRDA:226,30,1,0 +BRDA:226,31,0,0 +BRDA:226,31,1,0 +BRDA:226,31,2,0 +BRDA:226,32,0,0 +BRDA:226,32,1,0 +BRDA:226,33,0,0 +BRDA:226,33,1,0 +BRDA:229,34,0,0 +BRDA:229,34,1,0 +BRDA:233,35,0,0 +BRDA:233,35,1,0 +BRDA:233,36,0,0 +BRDA:233,36,1,0 +BRDA:234,37,0,0 +BRDA:234,37,1,0 +BRDA:236,38,0,0 +BRDA:236,38,1,0 +BRDA:242,39,0,0 +BRDA:242,39,1,0 +BRDA:243,40,0,0 +BRDA:243,40,1,0 +BRDA:258,41,0,0 +BRDA:258,41,1,0 +BRDA:261,42,0,0 +BRDA:261,42,1,0 +BRDA:261,42,2,0 +BRDA:261,42,3,0 +BRDA:261,42,4,0 +BRDA:261,42,5,0 +BRDA:261,42,6,0 +BRDA:261,42,7,0 +BRDA:266,43,0,0 +BRDA:266,43,1,0 +BRDA:286,44,0,0 +BRDA:286,44,1,298 +BRDA:286,45,0,298 +BRDA:286,45,1,298 +BRDA:291,46,0,322 +BRDA:291,46,1,3972 +BRDA:293,47,0,0 +BRDA:293,47,1,322 +BRDA:297,48,0,322 +BRDA:297,48,1,0 +BRDA:299,49,0,0 +BRDA:299,49,1,24 +BRDA:299,49,2,0 +BRDA:299,49,3,0 +BRDA:299,49,4,298 +BRDA:303,50,0,24 +BRDA:303,50,1,12 +BRDA:307,51,0,0 +BRDA:307,51,1,0 +BRDA:335,52,0,1 +BRDA:335,52,1,11 +BRDA:335,52,2,274 +BRDA:335,52,3,0 +BRDA:335,52,4,11 +BRDA:335,52,5,1 +BRDA:366,53,0,0 +BRDA:366,53,1,0 +BRDA:366,53,2,0 +BRDA:389,54,0,0 +BRDA:389,54,1,1 +BRDA:393,55,0,0 +BRDA:393,55,1,0 +BRDA:394,56,0,0 +BRDA:394,56,1,0 +BRDA:395,57,0,0 +BRDA:395,57,1,0 +BRDA:409,58,0,0 +BRDA:409,58,1,0 +BRDA:418,59,0,0 +BRDA:418,59,1,0 +BRDA:435,60,0,0 +BRDA:435,60,1,0 +BRDA:435,61,0,0 +BRDA:435,61,1,0 +BRDA:442,62,0,0 +BRDA:442,62,1,0 +BRDA:442,63,0,0 +BRDA:442,63,1,0 +BRDA:444,64,0,0 +BRDA:444,64,1,0 +BRDA:448,65,0,0 +BRDA:448,65,1,0 +BRDA:456,66,0,0 +BRDA:456,66,1,0 +BRDA:457,67,0,0 +BRDA:457,67,1,0 +BRDA:460,68,0,0 +BRDA:460,68,1,0 +BRDA:469,69,0,0 +BRDA:469,69,1,0 +BRDA:492,70,0,0 +BRDA:492,70,1,0 +BRDA:495,71,0,0 +BRDA:495,71,1,0 +BRDA:498,72,0,0 +BRDA:498,72,1,0 +BRDA:498,72,2,0 +BRDA:498,72,3,0 +BRDA:498,72,4,0 +BRDA:498,72,5,0 +BRDA:523,73,0,0 +BRDA:523,73,1,0 +BRDA:528,74,0,0 +BRDA:528,74,1,0 +BRDA:537,75,0,0 +BRDA:537,75,1,0 +BRDA:543,76,0,0 +BRDA:543,76,1,0 +BRF:179 +BRH:28 +end_of_record +TN: +SF:/Users/kit/Dropbox/Projects/json3/lib/json3.js +FN:2,(anonymous_1) +FN:42,has +FN:64,(anonymous_3) +FN:196,(anonymous_4) +FN:204,(anonymous_5) +FN:213,(anonymous_6) +FN:227,(anonymous_7) +FN:247,(anonymous_8) +FN:254,(anonymous_9) +FN:260,(anonymous_10) +FN:280,(anonymous_11) +FN:295,(anonymous_12) +FN:309,(anonymous_13) +FN:347,(anonymous_14) +FN:358,(anonymous_15) +FN:384,(anonymous_16) +FN:491,(anonymous_17) +FN:513,(anonymous_18) +FN:563,(anonymous_19) +FN:571,(anonymous_20) +FN:729,(anonymous_21) +FN:812,(anonymous_22) +FN:824,(anonymous_23) +FN:835,(anonymous_24) +FN:844,(anonymous_25) +FN:862,(anonymous_26) +FNF:26 +FNH:3 +FNDA:1,(anonymous_1) +FNDA:3,has +FNDA:4,(anonymous_3) +FNDA:0,(anonymous_4) +FNDA:0,(anonymous_5) +FNDA:0,(anonymous_6) +FNDA:0,(anonymous_7) +FNDA:0,(anonymous_8) +FNDA:0,(anonymous_9) +FNDA:0,(anonymous_10) +FNDA:0,(anonymous_11) +FNDA:0,(anonymous_12) +FNDA:0,(anonymous_13) +FNDA:0,(anonymous_14) +FNDA:0,(anonymous_15) +FNDA:0,(anonymous_16) +FNDA:0,(anonymous_17) +FNDA:0,(anonymous_18) +FNDA:0,(anonymous_19) +FNDA:0,(anonymous_20) +FNDA:0,(anonymous_21) +FNDA:0,(anonymous_22) +FNDA:0,(anonymous_23) +FNDA:0,(anonymous_24) +FNDA:0,(anonymous_25) +FNDA:0,(anonymous_26) +DA:2,1 +DA:4,1 +DA:8,1 +DA:11,1 +DA:15,1 +DA:17,1 +DA:20,1 +DA:21,1 +DA:25,0 +DA:29,1 +DA:30,1 +DA:33,1 +DA:42,1 +DA:43,3 +DA:45,0 +DA:48,3 +DA:49,3 +DA:52,0 +DA:53,3 +DA:56,1 +DA:58,2 +DA:60,2 +DA:61,1 +DA:62,1 +DA:64,1 +DA:65,4 +DA:67,1 +DA:68,1 +DA:122,0 +DA:125,1 +DA:128,2 +DA:129,1 +DA:130,1 +DA:131,1 +DA:135,1 +DA:137,1 +DA:138,1 +DA:139,1 +DA:140,1 +DA:142,1 +DA:144,1 +DA:145,1 +DA:149,1 +DA:152,1 +DA:153,1 +DA:157,1 +DA:163,0 +DA:166,1 +DA:169,3 +DA:171,1 +DA:172,1 +DA:173,1 +DA:174,1 +DA:176,1 +DA:178,0 +DA:179,0 +DA:180,0 +DA:181,0 +DA:182,0 +DA:183,0 +DA:186,0 +DA:189,0 +DA:190,0 +DA:193,0 +DA:196,0 +DA:197,0 +DA:203,0 +DA:204,0 +DA:205,0 +DA:206,0 +DA:213,0 +DA:217,0 +DA:219,0 +DA:220,0 +DA:224,0 +DA:227,0 +DA:228,0 +DA:229,0 +DA:232,0 +DA:233,0 +DA:238,0 +DA:247,0 +DA:248,0 +DA:249,0 +DA:254,0 +DA:255,0 +DA:260,0 +DA:261,0 +DA:265,0 +DA:266,0 +DA:268,0 +DA:269,0 +DA:272,0 +DA:275,0 +DA:277,0 +DA:280,0 +DA:281,0 +DA:282,0 +DA:283,0 +DA:286,0 +DA:287,0 +DA:291,0 +DA:293,0 +DA:295,0 +DA:297,0 +DA:298,0 +DA:302,0 +DA:303,0 +DA:309,0 +DA:310,0 +DA:311,0 +DA:312,0 +DA:313,0 +DA:318,0 +DA:319,0 +DA:323,0 +DA:332,0 +DA:334,0 +DA:346,0 +DA:347,0 +DA:350,0 +DA:357,0 +DA:358,0 +DA:359,0 +DA:360,0 +DA:361,0 +DA:363,0 +DA:364,0 +DA:367,0 +DA:369,0 +DA:370,0 +DA:372,0 +DA:373,0 +DA:374,0 +DA:376,0 +DA:379,0 +DA:384,0 +DA:385,0 +DA:386,0 +DA:388,0 +DA:390,0 +DA:391,0 +DA:392,0 +DA:393,0 +DA:397,0 +DA:401,0 +DA:402,0 +DA:403,0 +DA:404,0 +DA:409,0 +DA:412,0 +DA:413,0 +DA:414,0 +DA:415,0 +DA:417,0 +DA:418,0 +DA:419,0 +DA:420,0 +DA:421,0 +DA:422,0 +DA:423,0 +DA:426,0 +DA:434,0 +DA:436,0 +DA:441,0 +DA:444,0 +DA:447,0 +DA:449,0 +DA:450,0 +DA:452,0 +DA:453,0 +DA:455,0 +DA:456,0 +DA:459,0 +DA:460,0 +DA:462,0 +DA:465,0 +DA:468,0 +DA:469,0 +DA:471,0 +DA:475,0 +DA:476,0 +DA:478,0 +DA:479,0 +DA:480,0 +DA:482,0 +DA:483,0 +DA:484,0 +DA:486,0 +DA:491,0 +DA:492,0 +DA:493,0 +DA:500,0 +DA:502,0 +DA:504,0 +DA:507,0 +DA:508,0 +DA:513,0 +DA:514,0 +DA:515,0 +DA:516,0 +DA:517,0 +DA:518,0 +DA:520,0 +DA:521,0 +DA:524,0 +DA:525,0 +DA:528,0 +DA:529,0 +DA:531,0 +DA:532,0 +DA:538,0 +DA:543,0 +DA:544,0 +DA:548,0 +DA:560,0 +DA:563,0 +DA:564,0 +DA:565,0 +DA:571,0 +DA:572,0 +DA:573,0 +DA:574,0 +DA:575,0 +DA:579,0 +DA:580,0 +DA:584,0 +DA:585,0 +DA:586,0 +DA:592,0 +DA:593,0 +DA:594,0 +DA:597,0 +DA:598,0 +DA:602,0 +DA:603,0 +DA:606,0 +DA:607,0 +DA:608,0 +DA:613,0 +DA:614,0 +DA:615,0 +DA:618,0 +DA:620,0 +DA:624,0 +DA:625,0 +DA:628,0 +DA:631,0 +DA:634,0 +DA:636,0 +DA:637,0 +DA:639,0 +DA:640,0 +DA:643,0 +DA:646,0 +DA:648,0 +DA:649,0 +DA:652,0 +DA:655,0 +DA:657,0 +DA:658,0 +DA:659,0 +DA:662,0 +DA:664,0 +DA:666,0 +DA:668,0 +DA:670,0 +DA:673,0 +DA:674,0 +DA:676,0 +DA:677,0 +DA:679,0 +DA:681,0 +DA:685,0 +DA:686,0 +DA:687,0 +DA:690,0 +DA:691,0 +DA:694,0 +DA:695,0 +DA:697,0 +DA:699,0 +DA:702,0 +DA:705,0 +DA:706,0 +DA:709,0 +DA:710,0 +DA:711,0 +DA:712,0 +DA:713,0 +DA:714,0 +DA:715,0 +DA:716,0 +DA:717,0 +DA:720,0 +DA:725,0 +DA:729,0 +DA:730,0 +DA:731,0 +DA:733,0 +DA:735,0 +DA:736,0 +DA:738,0 +DA:741,0 +DA:743,0 +DA:744,0 +DA:745,0 +DA:747,0 +DA:748,0 +DA:753,0 +DA:754,0 +DA:755,0 +DA:756,0 +DA:758,0 +DA:762,0 +DA:766,0 +DA:767,0 +DA:769,0 +DA:771,0 +DA:772,0 +DA:774,0 +DA:775,0 +DA:776,0 +DA:778,0 +DA:779,0 +DA:783,0 +DA:784,0 +DA:785,0 +DA:786,0 +DA:788,0 +DA:792,0 +DA:798,0 +DA:799,0 +DA:801,0 +DA:803,0 +DA:806,0 +DA:808,0 +DA:812,0 +DA:813,0 +DA:814,0 +DA:815,0 +DA:817,0 +DA:824,0 +DA:825,0 +DA:826,0 +DA:830,0 +DA:831,0 +DA:832,0 +DA:835,0 +DA:836,0 +DA:840,0 +DA:844,0 +DA:845,0 +DA:846,0 +DA:847,0 +DA:848,0 +DA:850,0 +DA:851,0 +DA:854,0 +DA:855,0 +DA:861,1 +DA:862,0 +DA:863,0 +LF:363 +LH:50 +BRDA:8,1,0,1 +BRDA:8,1,1,0 +BRDA:11,2,0,1 +BRDA:11,2,1,1 +BRDA:15,3,0,1 +BRDA:15,3,1,1 +BRDA:15,3,2,1 +BRDA:15,3,3,1 +BRDA:17,4,0,1 +BRDA:17,4,1,0 +BRDA:17,5,0,1 +BRDA:17,5,1,1 +BRDA:25,6,0,0 +BRDA:25,6,1,0 +BRDA:33,7,0,1 +BRDA:33,7,1,1 +BRDA:33,7,2,1 +BRDA:33,7,3,1 +BRDA:33,7,4,1 +BRDA:33,7,5,1 +BRDA:33,7,6,1 +BRDA:43,8,0,0 +BRDA:43,8,1,3 +BRDA:49,9,0,0 +BRDA:49,9,1,3 +BRDA:53,10,0,1 +BRDA:53,10,1,2 +BRDA:56,11,0,1 +BRDA:56,11,1,1 +BRDA:60,12,0,1 +BRDA:60,12,1,1 +BRDA:61,13,0,1 +BRDA:61,13,1,1 +BRDA:62,14,0,1 +BRDA:62,14,1,0 +BRDA:71,15,0,1 +BRDA:71,15,1,1 +BRDA:71,15,2,1 +BRDA:71,15,3,1 +BRDA:71,15,4,1 +BRDA:71,15,5,1 +BRDA:71,15,6,1 +BRDA:71,15,7,1 +BRDA:71,15,8,1 +BRDA:71,15,9,1 +BRDA:71,15,10,1 +BRDA:71,15,11,1 +BRDA:71,15,12,1 +BRDA:71,15,13,1 +BRDA:71,15,14,1 +BRDA:71,15,15,1 +BRDA:71,15,16,1 +BRDA:71,15,17,1 +BRDA:128,16,0,1 +BRDA:128,16,1,1 +BRDA:130,17,0,1 +BRDA:130,17,1,0 +BRDA:135,18,0,1 +BRDA:135,18,1,0 +BRDA:135,19,0,1 +BRDA:135,19,1,1 +BRDA:138,20,0,1 +BRDA:138,20,1,1 +BRDA:139,21,0,1 +BRDA:139,21,1,0 +BRDA:144,22,0,1 +BRDA:144,22,1,0 +BRDA:152,23,0,1 +BRDA:152,23,1,0 +BRDA:176,24,0,0 +BRDA:176,24,1,1 +BRDA:189,25,0,0 +BRDA:189,25,1,0 +BRDA:203,26,0,0 +BRDA:203,26,1,0 +BRDA:206,27,0,0 +BRDA:206,27,1,0 +BRDA:228,28,0,0 +BRDA:228,28,1,0 +BRDA:229,29,0,0 +BRDA:229,29,1,0 +BRDA:229,30,0,0 +BRDA:229,30,1,0 +BRDA:249,31,0,0 +BRDA:249,31,1,0 +BRDA:268,32,0,0 +BRDA:268,32,1,0 +BRDA:275,33,0,0 +BRDA:275,33,1,0 +BRDA:282,34,0,0 +BRDA:282,34,1,0 +BRDA:282,35,0,0 +BRDA:282,35,1,0 +BRDA:282,35,2,0 +BRDA:286,36,0,0 +BRDA:286,36,1,0 +BRDA:286,37,0,0 +BRDA:286,37,1,0 +BRDA:286,38,0,0 +BRDA:286,38,1,0 +BRDA:291,39,0,0 +BRDA:291,39,1,0 +BRDA:293,40,0,0 +BRDA:293,40,1,0 +BRDA:302,41,0,0 +BRDA:302,41,1,0 +BRDA:302,42,0,0 +BRDA:302,42,1,0 +BRDA:302,42,2,0 +BRDA:302,42,3,0 +BRDA:302,43,0,0 +BRDA:302,43,1,0 +BRDA:312,44,0,0 +BRDA:312,44,1,0 +BRDA:312,45,0,0 +BRDA:312,45,1,0 +BRDA:312,45,2,0 +BRDA:312,46,0,0 +BRDA:312,46,1,0 +BRDA:318,47,0,0 +BRDA:318,47,1,0 +BRDA:318,48,0,0 +BRDA:318,48,1,0 +BRDA:332,49,0,0 +BRDA:332,49,1,0 +BRDA:350,50,0,0 +BRDA:350,50,1,0 +BRDA:359,51,0,0 +BRDA:359,51,1,0 +BRDA:360,52,0,0 +BRDA:360,52,1,0 +BRDA:367,53,0,0 +BRDA:367,53,1,0 +BRDA:367,53,2,0 +BRDA:367,53,3,0 +BRDA:367,53,4,0 +BRDA:367,53,5,0 +BRDA:367,53,6,0 +BRDA:367,53,7,0 +BRDA:372,54,0,0 +BRDA:372,54,1,0 +BRDA:376,55,0,0 +BRDA:376,55,1,0 +BRDA:376,56,0,0 +BRDA:376,56,1,0 +BRDA:390,57,0,0 +BRDA:390,57,1,0 +BRDA:390,58,0,0 +BRDA:390,58,1,0 +BRDA:392,59,0,0 +BRDA:392,59,1,0 +BRDA:392,60,0,0 +BRDA:392,60,1,0 +BRDA:393,61,0,0 +BRDA:393,61,1,0 +BRDA:393,62,0,0 +BRDA:393,62,1,0 +BRDA:397,63,0,0 +BRDA:397,63,1,0 +BRDA:426,64,0,0 +BRDA:426,64,1,0 +BRDA:426,65,0,0 +BRDA:426,65,1,0 +BRDA:426,66,0,0 +BRDA:426,66,1,0 +BRDA:426,67,0,0 +BRDA:426,67,1,0 +BRDA:436,68,0,0 +BRDA:436,68,1,0 +BRDA:436,69,0,0 +BRDA:436,69,1,0 +BRDA:436,69,2,0 +BRDA:436,69,3,0 +BRDA:436,69,4,0 +BRDA:444,70,0,0 +BRDA:444,70,1,0 +BRDA:449,71,0,0 +BRDA:449,71,1,0 +BRDA:453,72,0,0 +BRDA:453,72,1,0 +BRDA:456,73,0,0 +BRDA:456,73,1,0 +BRDA:459,74,0,0 +BRDA:459,74,1,0 +BRDA:459,75,0,0 +BRDA:459,75,1,0 +BRDA:460,76,0,0 +BRDA:460,76,1,0 +BRDA:465,77,0,0 +BRDA:465,77,1,0 +BRDA:469,78,0,0 +BRDA:469,78,1,0 +BRDA:480,79,0,0 +BRDA:480,79,1,0 +BRDA:482,80,0,0 +BRDA:482,80,1,0 +BRDA:484,81,0,0 +BRDA:484,81,1,0 +BRDA:486,82,0,0 +BRDA:486,82,1,0 +BRDA:486,83,0,0 +BRDA:486,83,1,0 +BRDA:491,84,0,0 +BRDA:491,84,1,0 +BRDA:493,85,0,0 +BRDA:493,85,1,0 +BRDA:500,86,0,0 +BRDA:500,86,1,0 +BRDA:502,87,0,0 +BRDA:502,87,1,0 +BRDA:504,88,0,0 +BRDA:504,88,1,0 +BRDA:504,89,0,0 +BRDA:504,89,1,0 +BRDA:515,90,0,0 +BRDA:515,90,1,0 +BRDA:515,91,0,0 +BRDA:515,91,1,0 +BRDA:515,91,2,0 +BRDA:516,92,0,0 +BRDA:516,92,1,0 +BRDA:518,93,0,0 +BRDA:518,93,1,0 +BRDA:521,94,0,0 +BRDA:521,94,1,0 +BRDA:521,94,2,0 +BRDA:524,95,0,0 +BRDA:524,95,1,0 +BRDA:525,96,0,0 +BRDA:525,96,1,0 +BRDA:528,97,0,0 +BRDA:528,97,1,0 +BRDA:531,98,0,0 +BRDA:531,98,1,0 +BRDA:532,99,0,0 +BRDA:532,99,1,0 +BRDA:543,100,0,0 +BRDA:543,100,1,0 +BRDA:575,101,0,0 +BRDA:575,101,1,0 +BRDA:575,101,2,0 +BRDA:575,101,3,0 +BRDA:575,101,4,0 +BRDA:575,101,5,0 +BRDA:575,101,6,0 +BRDA:575,101,7,0 +BRDA:575,101,8,0 +BRDA:575,101,9,0 +BRDA:575,101,10,0 +BRDA:575,101,11,0 +BRDA:584,102,0,0 +BRDA:584,102,1,0 +BRDA:594,103,0,0 +BRDA:594,103,1,0 +BRDA:598,104,0,0 +BRDA:598,104,1,0 +BRDA:603,105,0,0 +BRDA:603,105,1,0 +BRDA:603,105,2,0 +BRDA:603,105,3,0 +BRDA:603,105,4,0 +BRDA:603,105,5,0 +BRDA:603,105,6,0 +BRDA:603,105,7,0 +BRDA:603,105,8,0 +BRDA:603,105,9,0 +BRDA:618,106,0,0 +BRDA:618,106,1,0 +BRDA:618,107,0,0 +BRDA:618,107,1,0 +BRDA:618,107,2,0 +BRDA:618,107,3,0 +BRDA:618,107,4,0 +BRDA:618,107,5,0 +BRDA:631,108,0,0 +BRDA:631,108,1,0 +BRDA:639,109,0,0 +BRDA:639,109,1,0 +BRDA:639,109,2,0 +BRDA:646,110,0,0 +BRDA:646,110,1,0 +BRDA:657,111,0,0 +BRDA:657,111,1,0 +BRDA:662,112,0,0 +BRDA:662,112,1,0 +BRDA:662,113,0,0 +BRDA:662,113,1,0 +BRDA:664,114,0,0 +BRDA:664,114,1,0 +BRDA:664,115,0,0 +BRDA:664,115,1,0 +BRDA:664,116,0,0 +BRDA:664,116,1,0 +BRDA:670,117,0,0 +BRDA:670,117,1,0 +BRDA:670,118,0,0 +BRDA:670,118,1,0 +BRDA:673,119,0,0 +BRDA:673,119,1,0 +BRDA:676,120,0,0 +BRDA:676,120,1,0 +BRDA:676,121,0,0 +BRDA:676,121,1,0 +BRDA:677,122,0,0 +BRDA:677,122,1,0 +BRDA:686,123,0,0 +BRDA:686,123,1,0 +BRDA:686,124,0,0 +BRDA:686,124,1,0 +BRDA:690,125,0,0 +BRDA:690,125,1,0 +BRDA:690,126,0,0 +BRDA:690,126,1,0 +BRDA:694,127,0,0 +BRDA:694,127,1,0 +BRDA:694,128,0,0 +BRDA:694,128,1,0 +BRDA:695,129,0,0 +BRDA:695,129,1,0 +BRDA:705,130,0,0 +BRDA:705,130,1,0 +BRDA:709,131,0,0 +BRDA:709,131,1,0 +BRDA:712,132,0,0 +BRDA:712,132,1,0 +BRDA:715,133,0,0 +BRDA:715,133,1,0 +BRDA:731,134,0,0 +BRDA:731,134,1,0 +BRDA:735,135,0,0 +BRDA:735,135,1,0 +BRDA:736,136,0,0 +BRDA:736,136,1,0 +BRDA:736,137,0,0 +BRDA:736,137,1,0 +BRDA:741,138,0,0 +BRDA:741,138,1,0 +BRDA:744,139,0,0 +BRDA:744,139,1,0 +BRDA:747,140,0,0 +BRDA:747,140,1,0 +BRDA:753,141,0,0 +BRDA:753,141,1,0 +BRDA:754,142,0,0 +BRDA:754,142,1,0 +BRDA:756,143,0,0 +BRDA:756,143,1,0 +BRDA:766,144,0,0 +BRDA:766,144,1,0 +BRDA:772,145,0,0 +BRDA:772,145,1,0 +BRDA:775,146,0,0 +BRDA:775,146,1,0 +BRDA:778,147,0,0 +BRDA:778,147,1,0 +BRDA:783,148,0,0 +BRDA:783,148,1,0 +BRDA:784,149,0,0 +BRDA:784,149,1,0 +BRDA:786,150,0,0 +BRDA:786,150,1,0 +BRDA:798,151,0,0 +BRDA:798,151,1,0 +BRDA:798,152,0,0 +BRDA:798,152,1,0 +BRDA:798,152,2,0 +BRDA:798,152,3,0 +BRDA:798,153,0,0 +BRDA:798,153,1,0 +BRDA:814,154,0,0 +BRDA:814,154,1,0 +BRDA:826,155,0,0 +BRDA:826,155,1,0 +BRDA:826,156,0,0 +BRDA:826,156,1,0 +BRDA:830,157,0,0 +BRDA:830,157,1,0 +BRDA:850,158,0,0 +BRDA:850,158,1,0 +BRDA:855,159,0,0 +BRDA:855,159,1,0 +BRDA:855,160,0,0 +BRDA:855,160,1,0 +BRDA:861,161,0,0 +BRDA:861,161,1,1 +BRF:385 +BRH:59 +end_of_record diff --git a/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/json3/lib/json3.js b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/json3/lib/json3.js new file mode 100644 index 0000000..ea4a0ea --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/json3/lib/json3.js @@ -0,0 +1,861 @@ +/*! JSON v3.2.6 | http://bestiejs.github.io/json3 | Copyright 2012-2013, Kit Cambridge | http://kit.mit-license.org */ +;(function (window) { + // Convenience aliases. + var getClass = {}.toString, isProperty, forEach, undef; + + // Detect the `define` function exposed by asynchronous module loaders. The + // strict `define` check is necessary for compatibility with `r.js`. + var isLoader = typeof define === "function" && define.amd; + + // Detect native implementations. + var nativeJSON = typeof JSON == "object" && JSON; + + // Set up the JSON 3 namespace, preferring the CommonJS `exports` object if + // available. + var JSON3 = typeof exports == "object" && exports && !exports.nodeType && exports; + + if (JSON3 && nativeJSON) { + // Explicitly delegate to the native `stringify` and `parse` + // implementations in CommonJS environments. + JSON3.stringify = nativeJSON.stringify; + JSON3.parse = nativeJSON.parse; + } else { + // Export for web browsers, JavaScript engines, and asynchronous module + // loaders, using the global `JSON` object if available. + JSON3 = window.JSON = nativeJSON || {}; + } + + // Test the `Date#getUTC*` methods. Based on work by @Yaffle. + var isExtended = new Date(-3509827334573292); + try { + // The `getUTCFullYear`, `Month`, and `Date` methods return nonsensical + // results for certain dates in Opera >= 10.53. + isExtended = isExtended.getUTCFullYear() == -109252 && isExtended.getUTCMonth() === 0 && isExtended.getUTCDate() === 1 && + // Safari < 2.0.2 stores the internal millisecond time value correctly, + // but clips the values returned by the date methods to the range of + // signed 32-bit integers ([-2 ** 31, 2 ** 31 - 1]). + isExtended.getUTCHours() == 10 && isExtended.getUTCMinutes() == 37 && isExtended.getUTCSeconds() == 6 && isExtended.getUTCMilliseconds() == 708; + } catch (exception) {} + + // Internal: Determines whether the native `JSON.stringify` and `parse` + // implementations are spec-compliant. Based on work by Ken Snyder. + function has(name) { + if (has[name] !== undef) { + // Return cached feature test result. + return has[name]; + } + + var isSupported; + if (name == "bug-string-char-index") { + // IE <= 7 doesn't support accessing string characters using square + // bracket notation. IE 8 only supports this for primitives. + isSupported = "a"[0] != "a"; + } else if (name == "json") { + // Indicates whether both `JSON.stringify` and `JSON.parse` are + // supported. + isSupported = has("json-stringify") && has("json-parse"); + } else { + var value, serialized = '{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}'; + // Test `JSON.stringify`. + if (name == "json-stringify") { + var stringify = JSON3.stringify, stringifySupported = typeof stringify == "function" && isExtended; + if (stringifySupported) { + // A test function object with a custom `toJSON` method. + (value = function () { + return 1; + }).toJSON = value; + try { + stringifySupported = + // Firefox 3.1b1 and b2 serialize string, number, and boolean + // primitives as object literals. + stringify(0) === "0" && + // FF 3.1b1, b2, and JSON 2 serialize wrapped primitives as object + // literals. + stringify(new Number()) === "0" && + stringify(new String()) == '""' && + // FF 3.1b1, 2 throw an error if the value is `null`, `undefined`, or + // does not define a canonical JSON representation (this applies to + // objects with `toJSON` properties as well, *unless* they are nested + // within an object or array). + stringify(getClass) === undef && + // IE 8 serializes `undefined` as `"undefined"`. Safari <= 5.1.7 and + // FF 3.1b3 pass this test. + stringify(undef) === undef && + // Safari <= 5.1.7 and FF 3.1b3 throw `Error`s and `TypeError`s, + // respectively, if the value is omitted entirely. + stringify() === undef && + // FF 3.1b1, 2 throw an error if the given value is not a number, + // string, array, object, Boolean, or `null` literal. This applies to + // objects with custom `toJSON` methods as well, unless they are nested + // inside object or array literals. YUI 3.0.0b1 ignores custom `toJSON` + // methods entirely. + stringify(value) === "1" && + stringify([value]) == "[1]" && + // Prototype <= 1.6.1 serializes `[undefined]` as `"[]"` instead of + // `"[null]"`. + stringify([undef]) == "[null]" && + // YUI 3.0.0b1 fails to serialize `null` literals. + stringify(null) == "null" && + // FF 3.1b1, 2 halts serialization if an array contains a function: + // `[1, true, getClass, 1]` serializes as "[1,true,],". FF 3.1b3 + // elides non-JSON values from objects and arrays, unless they + // define custom `toJSON` methods. + stringify([undef, getClass, null]) == "[null,null,null]" && + // Simple serialization test. FF 3.1b1 uses Unicode escape sequences + // where character escape codes are expected (e.g., `\b` => `\u0008`). + stringify({ "a": [value, true, false, null, "\x00\b\n\f\r\t"] }) == serialized && + // FF 3.1b1 and b2 ignore the `filter` and `width` arguments. + stringify(null, value) === "1" && + stringify([1, 2], null, 1) == "[\n 1,\n 2\n]" && + // JSON 2, Prototype <= 1.7, and older WebKit builds incorrectly + // serialize extended years. + stringify(new Date(-8.64e15)) == '"-271821-04-20T00:00:00.000Z"' && + // The milliseconds are optional in ES 5, but required in 5.1. + stringify(new Date(8.64e15)) == '"+275760-09-13T00:00:00.000Z"' && + // Firefox <= 11.0 incorrectly serializes years prior to 0 as negative + // four-digit years instead of six-digit years. Credits: @Yaffle. + stringify(new Date(-621987552e5)) == '"-000001-01-01T00:00:00.000Z"' && + // Safari <= 5.1.5 and Opera >= 10.53 incorrectly serialize millisecond + // values less than 1000. Credits: @Yaffle. + stringify(new Date(-1)) == '"1969-12-31T23:59:59.999Z"'; + } catch (exception) { + stringifySupported = false; + } + } + isSupported = stringifySupported; + } + // Test `JSON.parse`. + if (name == "json-parse") { + var parse = JSON3.parse; + if (typeof parse == "function") { + try { + // FF 3.1b1, b2 will throw an exception if a bare literal is provided. + // Conforming implementations should also coerce the initial argument to + // a string prior to parsing. + if (parse("0") === 0 && !parse(false)) { + // Simple parsing test. + value = parse(serialized); + var parseSupported = value["a"].length == 5 && value["a"][0] === 1; + if (parseSupported) { + try { + // Safari <= 5.1.2 and FF 3.1b1 allow unescaped tabs in strings. + parseSupported = !parse('"\t"'); + } catch (exception) {} + if (parseSupported) { + try { + // FF 4.0 and 4.0.1 allow leading `+` signs and leading + // decimal points. FF 4.0, 4.0.1, and IE 9-10 also allow + // certain octal literals. + parseSupported = parse("01") !== 1; + } catch (exception) {} + } + if (parseSupported) { + try { + // FF 4.0, 4.0.1, and Rhino 1.7R3-R4 allow trailing decimal + // points. These environments, along with FF 3.1b1 and 2, + // also allow trailing commas in JSON objects and arrays. + parseSupported = parse("1.") !== 1; + } catch (exception) {} + } + } + } + } catch (exception) { + parseSupported = false; + } + } + isSupported = parseSupported; + } + } + return has[name] = !!isSupported; + } + + if (!has("json")) { + // Common `[[Class]]` name aliases. + var functionClass = "[object Function]"; + var dateClass = "[object Date]"; + var numberClass = "[object Number]"; + var stringClass = "[object String]"; + var arrayClass = "[object Array]"; + var booleanClass = "[object Boolean]"; + + // Detect incomplete support for accessing string characters by index. + var charIndexBuggy = has("bug-string-char-index"); + + // Define additional utility methods if the `Date` methods are buggy. + if (!isExtended) { + var floor = Math.floor; + // A mapping between the months of the year and the number of days between + // January 1st and the first of the respective month. + var Months = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334]; + // Internal: Calculates the number of days between the Unix epoch and the + // first day of the given month. + var getDay = function (year, month) { + return Months[month] + 365 * (year - 1970) + floor((year - 1969 + (month = +(month > 1))) / 4) - floor((year - 1901 + month) / 100) + floor((year - 1601 + month) / 400); + }; + } + + // Internal: Determines if a property is a direct property of the given + // object. Delegates to the native `Object#hasOwnProperty` method. + if (!(isProperty = {}.hasOwnProperty)) { + isProperty = function (property) { + var members = {}, constructor; + if ((members.__proto__ = null, members.__proto__ = { + // The *proto* property cannot be set multiple times in recent + // versions of Firefox and SeaMonkey. + "toString": 1 + }, members).toString != getClass) { + // Safari <= 2.0.3 doesn't implement `Object#hasOwnProperty`, but + // supports the mutable *proto* property. + isProperty = function (property) { + // Capture and break the object's prototype chain (see section 8.6.2 + // of the ES 5.1 spec). The parenthesized expression prevents an + // unsafe transformation by the Closure Compiler. + var original = this.__proto__, result = property in (this.__proto__ = null, this); + // Restore the original prototype chain. + this.__proto__ = original; + return result; + }; + } else { + // Capture a reference to the top-level `Object` constructor. + constructor = members.constructor; + // Use the `constructor` property to simulate `Object#hasOwnProperty` in + // other environments. + isProperty = function (property) { + var parent = (this.constructor || constructor).prototype; + return property in this && !(property in parent && this[property] === parent[property]); + }; + } + members = null; + return isProperty.call(this, property); + }; + } + + // Internal: A set of primitive types used by `isHostType`. + var PrimitiveTypes = { + 'boolean': 1, + 'number': 1, + 'string': 1, + 'undefined': 1 + }; + + // Internal: Determines if the given object `property` value is a + // non-primitive. + var isHostType = function (object, property) { + var type = typeof object[property]; + return type == 'object' ? !!object[property] : !PrimitiveTypes[type]; + }; + + // Internal: Normalizes the `for...in` iteration algorithm across + // environments. Each enumerated key is yielded to a `callback` function. + forEach = function (object, callback) { + var size = 0, Properties, members, property; + + // Tests for bugs in the current environment's `for...in` algorithm. The + // `valueOf` property inherits the non-enumerable flag from + // `Object.prototype` in older versions of IE, Netscape, and Mozilla. + (Properties = function () { + this.valueOf = 0; + }).prototype.valueOf = 0; + + // Iterate over a new instance of the `Properties` class. + members = new Properties(); + for (property in members) { + // Ignore all properties inherited from `Object.prototype`. + if (isProperty.call(members, property)) { + size++; + } + } + Properties = members = null; + + // Normalize the iteration algorithm. + if (!size) { + // A list of non-enumerable properties inherited from `Object.prototype`. + members = ["valueOf", "toString", "toLocaleString", "propertyIsEnumerable", "isPrototypeOf", "hasOwnProperty", "constructor"]; + // IE <= 8, Mozilla 1.0, and Netscape 6.2 ignore shadowed non-enumerable + // properties. + forEach = function (object, callback) { + var isFunction = getClass.call(object) == functionClass, property, length; + var hasProperty = !isFunction && typeof object.constructor != 'function' && isHostType(object, 'hasOwnProperty') ? object.hasOwnProperty : isProperty; + for (property in object) { + // Gecko <= 1.0 enumerates the `prototype` property of functions under + // certain conditions; IE does not. + if (!(isFunction && property == "prototype") && hasProperty.call(object, property)) { + callback(property); + } + } + // Manually invoke the callback for each non-enumerable property. + for (length = members.length; property = members[--length]; hasProperty.call(object, property) && callback(property)); + }; + } else if (size == 2) { + // Safari <= 2.0.4 enumerates shadowed properties twice. + forEach = function (object, callback) { + // Create a set of iterated properties. + var members = {}, isFunction = getClass.call(object) == functionClass, property; + for (property in object) { + // Store each property name to prevent double enumeration. The + // `prototype` property of functions is not enumerated due to cross- + // environment inconsistencies. + if (!(isFunction && property == "prototype") && !isProperty.call(members, property) && (members[property] = 1) && isProperty.call(object, property)) { + callback(property); + } + } + }; + } else { + // No bugs detected; use the standard `for...in` algorithm. + forEach = function (object, callback) { + var isFunction = getClass.call(object) == functionClass, property, isConstructor; + for (property in object) { + if (!(isFunction && property == "prototype") && isProperty.call(object, property) && !(isConstructor = property === "constructor")) { + callback(property); + } + } + // Manually invoke the callback for the `constructor` property due to + // cross-environment inconsistencies. + if (isConstructor || isProperty.call(object, (property = "constructor"))) { + callback(property); + } + }; + } + return forEach(object, callback); + }; + + // Public: Serializes a JavaScript `value` as a JSON string. The optional + // `filter` argument may specify either a function that alters how object and + // array members are serialized, or an array of strings and numbers that + // indicates which properties should be serialized. The optional `width` + // argument may be either a string or number that specifies the indentation + // level of the output. + if (!has("json-stringify")) { + // Internal: A map of control characters and their escaped equivalents. + var Escapes = { + 92: "\\\\", + 34: '\\"', + 8: "\\b", + 12: "\\f", + 10: "\\n", + 13: "\\r", + 9: "\\t" + }; + + // Internal: Converts `value` into a zero-padded string such that its + // length is at least equal to `width`. The `width` must be <= 6. + var leadingZeroes = "000000"; + var toPaddedString = function (width, value) { + // The `|| 0` expression is necessary to work around a bug in + // Opera <= 7.54u2 where `0 == -0`, but `String(-0) !== "0"`. + return (leadingZeroes + (value || 0)).slice(-width); + }; + + // Internal: Double-quotes a string `value`, replacing all ASCII control + // characters (characters with code unit values between 0 and 31) with + // their escaped equivalents. This is an implementation of the + // `Quote(value)` operation defined in ES 5.1 section 15.12.3. + var unicodePrefix = "\\u00"; + var quote = function (value) { + var result = '"', index = 0, length = value.length, isLarge = length > 10 && charIndexBuggy, symbols; + if (isLarge) { + symbols = value.split(""); + } + for (; index < length; index++) { + var charCode = value.charCodeAt(index); + // If the character is a control character, append its Unicode or + // shorthand escape sequence; otherwise, append the character as-is. + switch (charCode) { + case 8: case 9: case 10: case 12: case 13: case 34: case 92: + result += Escapes[charCode]; + break; + default: + if (charCode < 32) { + result += unicodePrefix + toPaddedString(2, charCode.toString(16)); + break; + } + result += isLarge ? symbols[index] : charIndexBuggy ? value.charAt(index) : value[index]; + } + } + return result + '"'; + }; + + // Internal: Recursively serializes an object. Implements the + // `Str(key, holder)`, `JO(value)`, and `JA(value)` operations. + var serialize = function (property, object, callback, properties, whitespace, indentation, stack) { + var value, className, year, month, date, time, hours, minutes, seconds, milliseconds, results, element, index, length, prefix, result; + try { + // Necessary for host object support. + value = object[property]; + } catch (exception) {} + if (typeof value == "object" && value) { + className = getClass.call(value); + if (className == dateClass && !isProperty.call(value, "toJSON")) { + if (value > -1 / 0 && value < 1 / 0) { + // Dates are serialized according to the `Date#toJSON` method + // specified in ES 5.1 section 15.9.5.44. See section 15.9.1.15 + // for the ISO 8601 date time string format. + if (getDay) { + // Manually compute the year, month, date, hours, minutes, + // seconds, and milliseconds if the `getUTC*` methods are + // buggy. Adapted from @Yaffle's `date-shim` project. + date = floor(value / 864e5); + for (year = floor(date / 365.2425) + 1970 - 1; getDay(year + 1, 0) <= date; year++); + for (month = floor((date - getDay(year, 0)) / 30.42); getDay(year, month + 1) <= date; month++); + date = 1 + date - getDay(year, month); + // The `time` value specifies the time within the day (see ES + // 5.1 section 15.9.1.2). The formula `(A % B + B) % B` is used + // to compute `A modulo B`, as the `%` operator does not + // correspond to the `modulo` operation for negative numbers. + time = (value % 864e5 + 864e5) % 864e5; + // The hours, minutes, seconds, and milliseconds are obtained by + // decomposing the time within the day. See section 15.9.1.10. + hours = floor(time / 36e5) % 24; + minutes = floor(time / 6e4) % 60; + seconds = floor(time / 1e3) % 60; + milliseconds = time % 1e3; + } else { + year = value.getUTCFullYear(); + month = value.getUTCMonth(); + date = value.getUTCDate(); + hours = value.getUTCHours(); + minutes = value.getUTCMinutes(); + seconds = value.getUTCSeconds(); + milliseconds = value.getUTCMilliseconds(); + } + // Serialize extended years correctly. + value = (year <= 0 || year >= 1e4 ? (year < 0 ? "-" : "+") + toPaddedString(6, year < 0 ? -year : year) : toPaddedString(4, year)) + + "-" + toPaddedString(2, month + 1) + "-" + toPaddedString(2, date) + + // Months, dates, hours, minutes, and seconds should have two + // digits; milliseconds should have three. + "T" + toPaddedString(2, hours) + ":" + toPaddedString(2, minutes) + ":" + toPaddedString(2, seconds) + + // Milliseconds are optional in ES 5.0, but required in 5.1. + "." + toPaddedString(3, milliseconds) + "Z"; + } else { + value = null; + } + } else if (typeof value.toJSON == "function" && ((className != numberClass && className != stringClass && className != arrayClass) || isProperty.call(value, "toJSON"))) { + // Prototype <= 1.6.1 adds non-standard `toJSON` methods to the + // `Number`, `String`, `Date`, and `Array` prototypes. JSON 3 + // ignores all `toJSON` methods on these objects unless they are + // defined directly on an instance. + value = value.toJSON(property); + } + } + if (callback) { + // If a replacement function was provided, call it to obtain the value + // for serialization. + value = callback.call(object, property, value); + } + if (value === null) { + return "null"; + } + className = getClass.call(value); + if (className == booleanClass) { + // Booleans are represented literally. + return "" + value; + } else if (className == numberClass) { + // JSON numbers must be finite. `Infinity` and `NaN` are serialized as + // `"null"`. + return value > -1 / 0 && value < 1 / 0 ? "" + value : "null"; + } else if (className == stringClass) { + // Strings are double-quoted and escaped. + return quote("" + value); + } + // Recursively serialize objects and arrays. + if (typeof value == "object") { + // Check for cyclic structures. This is a linear search; performance + // is inversely proportional to the number of unique nested objects. + for (length = stack.length; length--;) { + if (stack[length] === value) { + // Cyclic structures cannot be serialized by `JSON.stringify`. + throw TypeError(); + } + } + // Add the object to the stack of traversed objects. + stack.push(value); + results = []; + // Save the current indentation level and indent one additional level. + prefix = indentation; + indentation += whitespace; + if (className == arrayClass) { + // Recursively serialize array elements. + for (index = 0, length = value.length; index < length; index++) { + element = serialize(index, value, callback, properties, whitespace, indentation, stack); + results.push(element === undef ? "null" : element); + } + result = results.length ? (whitespace ? "[\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "]" : ("[" + results.join(",") + "]")) : "[]"; + } else { + // Recursively serialize object members. Members are selected from + // either a user-specified list of property names, or the object + // itself. + forEach(properties || value, function (property) { + var element = serialize(property, value, callback, properties, whitespace, indentation, stack); + if (element !== undef) { + // According to ES 5.1 section 15.12.3: "If `gap` {whitespace} + // is not the empty string, let `member` {quote(property) + ":"} + // be the concatenation of `member` and the `space` character." + // The "`space` character" refers to the literal space + // character, not the `space` {width} argument provided to + // `JSON.stringify`. + results.push(quote(property) + ":" + (whitespace ? " " : "") + element); + } + }); + result = results.length ? (whitespace ? "{\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "}" : ("{" + results.join(",") + "}")) : "{}"; + } + // Remove the object from the traversed object stack. + stack.pop(); + return result; + } + }; + + // Public: `JSON.stringify`. See ES 5.1 section 15.12.3. + JSON3.stringify = function (source, filter, width) { + var whitespace, callback, properties, className; + if (typeof filter == "function" || typeof filter == "object" && filter) { + if ((className = getClass.call(filter)) == functionClass) { + callback = filter; + } else if (className == arrayClass) { + // Convert the property names array into a makeshift set. + properties = {}; + for (var index = 0, length = filter.length, value; index < length; value = filter[index++], ((className = getClass.call(value)), className == stringClass || className == numberClass) && (properties[value] = 1)); + } + } + if (width) { + if ((className = getClass.call(width)) == numberClass) { + // Convert the `width` to an integer and create a string containing + // `width` number of space characters. + if ((width -= width % 1) > 0) { + for (whitespace = "", width > 10 && (width = 10); whitespace.length < width; whitespace += " "); + } + } else if (className == stringClass) { + whitespace = width.length <= 10 ? width : width.slice(0, 10); + } + } + // Opera <= 7.54u2 discards the values associated with empty string keys + // (`""`) only if they are used directly within an object member list + // (e.g., `!("" in { "": 1})`). + return serialize("", (value = {}, value[""] = source, value), callback, properties, whitespace, "", []); + }; + } + + // Public: Parses a JSON source string. + if (!has("json-parse")) { + var fromCharCode = String.fromCharCode; + + // Internal: A map of escaped control characters and their unescaped + // equivalents. + var Unescapes = { + 92: "\\", + 34: '"', + 47: "/", + 98: "\b", + 116: "\t", + 110: "\n", + 102: "\f", + 114: "\r" + }; + + // Internal: Stores the parser state. + var Index, Source; + + // Internal: Resets the parser state and throws a `SyntaxError`. + var abort = function() { + Index = Source = null; + throw SyntaxError(); + }; + + // Internal: Returns the next token, or `"$"` if the parser has reached + // the end of the source string. A token may be a string, number, `null` + // literal, or Boolean literal. + var lex = function () { + var source = Source, length = source.length, value, begin, position, isSigned, charCode; + while (Index < length) { + charCode = source.charCodeAt(Index); + switch (charCode) { + case 9: case 10: case 13: case 32: + // Skip whitespace tokens, including tabs, carriage returns, line + // feeds, and space characters. + Index++; + break; + case 123: case 125: case 91: case 93: case 58: case 44: + // Parse a punctuator token (`{`, `}`, `[`, `]`, `:`, or `,`) at + // the current position. + value = charIndexBuggy ? source.charAt(Index) : source[Index]; + Index++; + return value; + case 34: + // `"` delimits a JSON string; advance to the next character and + // begin parsing the string. String tokens are prefixed with the + // sentinel `@` character to distinguish them from punctuators and + // end-of-string tokens. + for (value = "@", Index++; Index < length;) { + charCode = source.charCodeAt(Index); + if (charCode < 32) { + // Unescaped ASCII control characters (those with a code unit + // less than the space character) are not permitted. + abort(); + } else if (charCode == 92) { + // A reverse solidus (`\`) marks the beginning of an escaped + // control character (including `"`, `\`, and `/`) or Unicode + // escape sequence. + charCode = source.charCodeAt(++Index); + switch (charCode) { + case 92: case 34: case 47: case 98: case 116: case 110: case 102: case 114: + // Revive escaped control characters. + value += Unescapes[charCode]; + Index++; + break; + case 117: + // `\u` marks the beginning of a Unicode escape sequence. + // Advance to the first character and validate the + // four-digit code point. + begin = ++Index; + for (position = Index + 4; Index < position; Index++) { + charCode = source.charCodeAt(Index); + // A valid sequence comprises four hexdigits (case- + // insensitive) that form a single hexadecimal value. + if (!(charCode >= 48 && charCode <= 57 || charCode >= 97 && charCode <= 102 || charCode >= 65 && charCode <= 70)) { + // Invalid Unicode escape sequence. + abort(); + } + } + // Revive the escaped character. + value += fromCharCode("0x" + source.slice(begin, Index)); + break; + default: + // Invalid escape sequence. + abort(); + } + } else { + if (charCode == 34) { + // An unescaped double-quote character marks the end of the + // string. + break; + } + charCode = source.charCodeAt(Index); + begin = Index; + // Optimize for the common case where a string is valid. + while (charCode >= 32 && charCode != 92 && charCode != 34) { + charCode = source.charCodeAt(++Index); + } + // Append the string as-is. + value += source.slice(begin, Index); + } + } + if (source.charCodeAt(Index) == 34) { + // Advance to the next character and return the revived string. + Index++; + return value; + } + // Unterminated string. + abort(); + default: + // Parse numbers and literals. + begin = Index; + // Advance past the negative sign, if one is specified. + if (charCode == 45) { + isSigned = true; + charCode = source.charCodeAt(++Index); + } + // Parse an integer or floating-point value. + if (charCode >= 48 && charCode <= 57) { + // Leading zeroes are interpreted as octal literals. + if (charCode == 48 && ((charCode = source.charCodeAt(Index + 1)), charCode >= 48 && charCode <= 57)) { + // Illegal octal literal. + abort(); + } + isSigned = false; + // Parse the integer component. + for (; Index < length && ((charCode = source.charCodeAt(Index)), charCode >= 48 && charCode <= 57); Index++); + // Floats cannot contain a leading decimal point; however, this + // case is already accounted for by the parser. + if (source.charCodeAt(Index) == 46) { + position = ++Index; + // Parse the decimal component. + for (; position < length && ((charCode = source.charCodeAt(position)), charCode >= 48 && charCode <= 57); position++); + if (position == Index) { + // Illegal trailing decimal. + abort(); + } + Index = position; + } + // Parse exponents. The `e` denoting the exponent is + // case-insensitive. + charCode = source.charCodeAt(Index); + if (charCode == 101 || charCode == 69) { + charCode = source.charCodeAt(++Index); + // Skip past the sign following the exponent, if one is + // specified. + if (charCode == 43 || charCode == 45) { + Index++; + } + // Parse the exponential component. + for (position = Index; position < length && ((charCode = source.charCodeAt(position)), charCode >= 48 && charCode <= 57); position++); + if (position == Index) { + // Illegal empty exponent. + abort(); + } + Index = position; + } + // Coerce the parsed value to a JavaScript number. + return +source.slice(begin, Index); + } + // A negative sign may only precede numbers. + if (isSigned) { + abort(); + } + // `true`, `false`, and `null` literals. + if (source.slice(Index, Index + 4) == "true") { + Index += 4; + return true; + } else if (source.slice(Index, Index + 5) == "false") { + Index += 5; + return false; + } else if (source.slice(Index, Index + 4) == "null") { + Index += 4; + return null; + } + // Unrecognized token. + abort(); + } + } + // Return the sentinel `$` character if the parser has reached the end + // of the source string. + return "$"; + }; + + // Internal: Parses a JSON `value` token. + var get = function (value) { + var results, hasMembers; + if (value == "$") { + // Unexpected end of input. + abort(); + } + if (typeof value == "string") { + if ((charIndexBuggy ? value.charAt(0) : value[0]) == "@") { + // Remove the sentinel `@` character. + return value.slice(1); + } + // Parse object and array literals. + if (value == "[") { + // Parses a JSON array, returning a new JavaScript array. + results = []; + for (;; hasMembers || (hasMembers = true)) { + value = lex(); + // A closing square bracket marks the end of the array literal. + if (value == "]") { + break; + } + // If the array literal contains elements, the current token + // should be a comma separating the previous element from the + // next. + if (hasMembers) { + if (value == ",") { + value = lex(); + if (value == "]") { + // Unexpected trailing `,` in array literal. + abort(); + } + } else { + // A `,` must separate each array element. + abort(); + } + } + // Elisions and leading commas are not permitted. + if (value == ",") { + abort(); + } + results.push(get(value)); + } + return results; + } else if (value == "{") { + // Parses a JSON object, returning a new JavaScript object. + results = {}; + for (;; hasMembers || (hasMembers = true)) { + value = lex(); + // A closing curly brace marks the end of the object literal. + if (value == "}") { + break; + } + // If the object literal contains members, the current token + // should be a comma separator. + if (hasMembers) { + if (value == ",") { + value = lex(); + if (value == "}") { + // Unexpected trailing `,` in object literal. + abort(); + } + } else { + // A `,` must separate each object member. + abort(); + } + } + // Leading commas are not permitted, object property names must be + // double-quoted strings, and a `:` must separate each property + // name and value. + if (value == "," || typeof value != "string" || (charIndexBuggy ? value.charAt(0) : value[0]) != "@" || lex() != ":") { + abort(); + } + results[value.slice(1)] = get(lex()); + } + return results; + } + // Unexpected token encountered. + abort(); + } + return value; + }; + + // Internal: Updates a traversed object member. + var update = function(source, property, callback) { + var element = walk(source, property, callback); + if (element === undef) { + delete source[property]; + } else { + source[property] = element; + } + }; + + // Internal: Recursively traverses a parsed JSON object, invoking the + // `callback` function for each value. This is an implementation of the + // `Walk(holder, name)` operation defined in ES 5.1 section 15.12.2. + var walk = function (source, property, callback) { + var value = source[property], length; + if (typeof value == "object" && value) { + // `forEach` can't be used to traverse an array in Opera <= 8.54 + // because its `Object#hasOwnProperty` implementation returns `false` + // for array indices (e.g., `![1, 2, 3].hasOwnProperty("0")`). + if (getClass.call(value) == arrayClass) { + for (length = value.length; length--;) { + update(value, length, callback); + } + } else { + forEach(value, function (property) { + update(value, property, callback); + }); + } + } + return callback.call(source, property, value); + }; + + // Public: `JSON.parse`. See ES 5.1 section 15.12.2. + JSON3.parse = function (source, callback) { + var result, value; + Index = 0; + Source = "" + source; + result = get(lex()); + // If a JSON string contains multiple tokens, it is invalid. + if (lex() != "$") { + abort(); + } + // Reset the parser state. + Index = Source = null; + return callback && getClass.call(callback) == functionClass ? walk((value = {}, value[""] = result, value), "", callback) : result; + }; + } + } + + // Export for asynchronous module loaders. + if (isLoader) { + define(function () { + return JSON3; + }); + } +}(this)); diff --git a/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/json3/lib/json3.min.js b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/json3/lib/json3.min.js new file mode 100644 index 0000000..f9a45ce --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/json3/lib/json3.min.js @@ -0,0 +1,18 @@ +/*! JSON v3.2.6 | http://bestiejs.github.io/json3 | Copyright 2012-2013, Kit Cambridge | http://kit.mit-license.org */ +;(function(){var n=null; +(function(G){function m(a){if(m[a]!==s)return m[a];var c;if("bug-string-char-index"==a)c="a"!="a"[0];else if("json"==a)c=m("json-stringify")&&m("json-parse");else{var e;if("json-stringify"==a){c=o.stringify;var b="function"==typeof c&&l;if(b){(e=function(){return 1}).toJSON=e;try{b="0"===c(0)&&"0"===c(new Number)&&'""'==c(new String)&&c(p)===s&&c(s)===s&&c()===s&&"1"===c(e)&&"[1]"==c([e])&&"[null]"==c([s])&&"null"==c(n)&&"[null,null,null]"==c([s,p,n])&&'{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}'==c({a:[e, +!0,!1,n,"\x00\u0008\n\u000c\r\t"]})&&"1"===c(n,e)&&"[\n 1,\n 2\n]"==c([1,2],n,1)&&'"-271821-04-20T00:00:00.000Z"'==c(new Date(-864E13))&&'"+275760-09-13T00:00:00.000Z"'==c(new Date(864E13))&&'"-000001-01-01T00:00:00.000Z"'==c(new Date(-621987552E5))&&'"1969-12-31T23:59:59.999Z"'==c(new Date(-1))}catch(f){b=!1}}c=b}if("json-parse"==a){c=o.parse;if("function"==typeof c)try{if(0===c("0")&&!c(!1)){e=c('{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}');var j=5==e.a.length&&1===e.a[0];if(j){try{j=!c('"\t"')}catch(d){}if(j)try{j= +1!==c("01")}catch(h){}if(j)try{j=1!==c("1.")}catch(k){}}}}catch(N){j=!1}c=j}}return m[a]=!!c}var p={}.toString,q,x,s,H=typeof define==="function"&&define.amd,y="object"==typeof JSON&&JSON,o="object"==typeof exports&&exports&&!exports.nodeType&&exports;o&&y?(o.stringify=y.stringify,o.parse=y.parse):o=G.JSON=y||{};var l=new Date(-3509827334573292);try{l=-109252==l.getUTCFullYear()&&0===l.getUTCMonth()&&1===l.getUTCDate()&&10==l.getUTCHours()&&37==l.getUTCMinutes()&&6==l.getUTCSeconds()&&708==l.getUTCMilliseconds()}catch(O){}if(!m("json")){var t= +m("bug-string-char-index");if(!l)var u=Math.floor,I=[0,31,59,90,120,151,181,212,243,273,304,334],z=function(a,c){return I[c]+365*(a-1970)+u((a-1969+(c=+(c>1)))/4)-u((a-1901+c)/100)+u((a-1601+c)/400)};if(!(q={}.hasOwnProperty))q=function(a){var c={},e;if((c.__proto__=n,c.__proto__={toString:1},c).toString!=p)q=function(a){var c=this.__proto__,a=a in(this.__proto__=n,this);this.__proto__=c;return a};else{e=c.constructor;q=function(a){var c=(this.constructor||e).prototype;return a in this&&!(a in c&& +this[a]===c[a])}}c=n;return q.call(this,a)};var J={"boolean":1,number:1,string:1,undefined:1};x=function(a,c){var e=0,b,f,j;(b=function(){this.valueOf=0}).prototype.valueOf=0;f=new b;for(j in f)q.call(f,j)&&e++;b=f=n;if(e)x=e==2?function(a,c){var e={},b=p.call(a)=="[object Function]",f;for(f in a)!(b&&f=="prototype")&&!q.call(e,f)&&(e[f]=1)&&q.call(a,f)&&c(f)}:function(a,c){var e=p.call(a)=="[object Function]",b,f;for(b in a)!(e&&b=="prototype")&&q.call(a,b)&&!(f=b==="constructor")&&c(b);(f||q.call(a, +b="constructor"))&&c(b)};else{f=["valueOf","toString","toLocaleString","propertyIsEnumerable","isPrototypeOf","hasOwnProperty","constructor"];x=function(a,c){var e=p.call(a)=="[object Function]",b,g;if(g=!e)if(g=typeof a.constructor!="function"){g=typeof a.hasOwnProperty;g=g=="object"?!!a.hasOwnProperty:!J[g]}g=g?a.hasOwnProperty:q;for(b in a)!(e&&b=="prototype")&&g.call(a,b)&&c(b);for(e=f.length;b=f[--e];g.call(a,b)&&c(b));}}return x(a,c)};if(!m("json-stringify")){var K={92:"\\\\",34:'\\"',8:"\\b", +12:"\\f",10:"\\n",13:"\\r",9:"\\t"},v=function(a,c){return("000000"+(c||0)).slice(-a)},D=function(a){var c='"',b=0,g=a.length,f=g>10&&t,j;for(f&&(j=a.split(""));b-1/0&&h<1/0){if(z){l=u(h/864E5);for(k=u(l/365.2425)+1970-1;z(k+1,0)<=l;k++);for(i=u((l-z(k,0))/30.42);z(k,i+1)<=l;i++);l=1+l-z(k,i);m=(h%864E5+864E5)%864E5;o=u(m/36E5)%24;r=u(m/6E4)%60;t=u(m/1E3)%60;m=m%1E3}else{k=h.getUTCFullYear();i=h.getUTCMonth();l=h.getUTCDate();o=h.getUTCHours();r=h.getUTCMinutes();t=h.getUTCSeconds();m=h.getUTCMilliseconds()}h=(k<=0||k>=1E4?(k<0?"-":"+")+v(6,k<0?-k:k):v(4,k))+"-"+v(2,i+1)+"-"+v(2,l)+"T"+v(2,o)+":"+v(2,r)+":"+v(2,t)+"."+v(3,m)+"Z"}else h= +n;else if(typeof h.toJSON=="function"&&(k!="[object Number]"&&k!="[object String]"&&k!="[object Array]"||q.call(h,"toJSON")))h=h.toJSON(a)}b&&(h=b.call(c,a,h));if(h===n)return"null";k=p.call(h);if(k=="[object Boolean]")return""+h;if(k=="[object Number]")return h>-1/0&&h<1/0?""+h:"null";if(k=="[object String]")return D(""+h);if(typeof h=="object"){for(a=d.length;a--;)if(d[a]===h)throw TypeError();d.push(h);w=[];c=j;j=j+f;if(k=="[object Array]"){i=0;for(a=h.length;i0){g="";for(b>10&&(b=10);g.length=48&&d<=57||d>=97&&d<=102||d>=65&&d<=70||i()}e=e+L("0x"+a.slice(g,b));break;default:i()}}else{if(d==34)break;d=a.charCodeAt(b);for(g=b;d>=32&&d!=92&&d!=34;)d=a.charCodeAt(++b); +e=e+a.slice(g,b)}}if(a.charCodeAt(b)==34){b++;return e}i();default:g=b;if(d==45){j=true;d=a.charCodeAt(++b)}if(d>=48&&d<=57){for(d==48&&(d=a.charCodeAt(b+1),d>=48&&d<=57)&&i();b=48&&d<=57);b++);if(a.charCodeAt(b)==46){for(f=++b;f=48&&d<=57);f++);f==b&&i();b=f}d=a.charCodeAt(b);if(d==101||d==69){d=a.charCodeAt(++b);(d==43||d==45)&&b++;for(f=b;f=48&&d<=57);f++);f==b&&i();b=f}return+a.slice(g,b)}j&&i();if(a.slice(b,b+4)=="true"){b= +b+4;return true}if(a.slice(b,b+5)=="false"){b=b+5;return false}if(a.slice(b,b+4)=="null"){b=b+4;return n}i()}}return"$"},C=function(a){var c,b;a=="$"&&i();if(typeof a=="string"){if((t?a.charAt(0):a[0])=="@")return a.slice(1);if(a=="["){for(c=[];;b||(b=true)){a=r();if(a=="]")break;if(b)if(a==","){a=r();a=="]"&&i()}else i();a==","&&i();c.push(C(a))}return c}if(a=="{"){for(c={};;b||(b=true)){a=r();if(a=="}")break;if(b)if(a==","){a=r();a=="}"&&i()}else i();(a==","||typeof a!="string"||(t?a.charAt(0): +a[0])!="@"||r()!=":")&&i();c[a.slice(1)]=C(r())}return c}i()}return a},F=function(a,b,e){e=E(a,b,e);e===s?delete a[b]:a[b]=e},E=function(a,b,e){var g=a[b],f;if(typeof g=="object"&&g)if(p.call(g)=="[object Array]")for(f=g.length;f--;)F(g,f,e);else x(g,function(a){F(g,a,e)});return e.call(a,b,g)};o.parse=function(a,c){var e,g;b=0;A=""+a;e=C(r());r()!="$"&&i();b=A=n;return c&&p.call(c)=="[object Function]"?E((g={},g[""]=e,g),"",c):e}}}H&&define(function(){return o})})(this); +}()); \ No newline at end of file diff --git a/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/json3/package.json b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/json3/package.json new file mode 100644 index 0000000..3ec35ce --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/node_modules/json3/package.json @@ -0,0 +1,101 @@ +{ + "name": "json3", + "version": "3.2.6", + "description": "A modern JSON implementation compatible with nearly all JavaScript platforms.", + "homepage": "http://bestiejs.github.io/json3", + "main": "./lib/json3", + "keywords": [ + "json", + "spec", + "ecma", + "es5", + "lexer", + "parser", + "stringify" + ], + "licenses": [ + { + "type": "MIT", + "url": "http://kit.mit-license.org/" + } + ], + "author": { + "name": "Kit Cambridge", + "email": "github@kitcambridge.be", + "url": "http://kitcambridge.be/" + }, + "maintainers": [ + { + "name": "kitcambridge", + "email": "kitcambridge@me.com" + } + ], + "contributors": [ + { + "name": "Mangled Deutz", + "email": "olivier@webitup.fr", + "url": "http://tech.roxee.tv/" + }, + { + "name": "Øyvind Sean Kinsey", + "email": "oyvind@kinsey.no", + "url": "http://fb.me/ok" + }, + { + "name": "Oskar Schöldström", + "email": "public@oxy.fi", + "url": "http://oxy.fi/" + }, + { + "name": "Benjamin Tan", + "email": "demoneaux@gmail.com", + "url": "http://d10.github.io/" + }, + { + "name": "Kiryl Yermakou", + "email": "rma4ok@gmail.com", + "url": "https://github.com/rma4ok" + } + ], + "bugs": { + "url": "https://github.com/bestiejs/json3/issues" + }, + "scripts": { + "test": "node test/test_*.js" + }, + "repository": { + "type": "git", + "url": "git://github.com/bestiejs/json3.git" + }, + "jam": { + "main": "./lib/json3.js" + }, + "volo": { + "type": "directory", + "ignore": [ + ".*", + "build.js", + "index.html", + "component.json", + "bower.json", + "benchmark", + "page", + "test", + "vendor" + ] + }, + "_id": "json3@3.2.6", + "dist": { + "shasum": "f6efc93c06a04de9aec53053df2559bb19e2038b", + "tarball": "http://registry.npmjs.org/json3/-/json3-3.2.6.tgz" + }, + "_from": "json3@3.2.6", + "_npmVersion": "1.3.8", + "_npmUser": { + "name": "kitcambridge", + "email": "github@kitcambridge.be" + }, + "directories": {}, + "_shasum": "f6efc93c06a04de9aec53053df2559bb19e2038b", + "_resolved": "https://registry.npmjs.org/json3/-/json3-3.2.6.tgz" +} diff --git a/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/package.json b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/package.json new file mode 100644 index 0000000..4548d05 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/package.json @@ -0,0 +1,38 @@ +{ + "name": "socket.io-parser", + "version": "2.1.2", + "description": "socket.io protocol parser", + "repository": { + "type": "git", + "url": "https://github.com/LearnBoost/socket.io-parser.git" + }, + "dependencies": { + "debug": "0.7.4", + "json3": "3.2.6", + "emitter": "http://github.com/component/emitter/archive/1.0.1.tar.gz", + "isarray": "0.0.1" + }, + "devDependencies": { + "mocha": "1.16.2", + "expect.js": "0.2.0", + "zuul": "1.5.4" + }, + "component": { + "scripts": [ + "index.js" + ] + }, + "scripts": { + "test": "make test" + }, + "readme": "\n# socket.io-parser\n\n[![Build Status](https://secure.travis-ci.org/LearnBoost/socket.io-parser.png)](http://travis-ci.org/LearnBoost/socket.io-parser)\n[![NPM version](https://badge.fury.io/js/socket.io-parser.png)](http://badge.fury.io/js/socket.io-parser)\n", + "readmeFilename": "Readme.md", + "bugs": { + "url": "https://github.com/LearnBoost/socket.io-parser/issues" + }, + "homepage": "https://github.com/LearnBoost/socket.io-parser", + "_id": "socket.io-parser@2.1.2", + "_shasum": "876655b9edd555c5bdf7301cedf30a436c67b8b0", + "_from": "socket.io-parser@2.1.2", + "_resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-2.1.2.tgz" +} diff --git a/node_modules/socket.io/node_modules/socket.io-adapter/package.json b/node_modules/socket.io/node_modules/socket.io-adapter/package.json new file mode 100644 index 0000000..ab17af8 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-adapter/package.json @@ -0,0 +1,29 @@ +{ + "name": "socket.io-adapter", + "version": "0.2.0", + "description": "Default socket.io in-memory adapter class.", + "dependencies": { + "debug": "0.7.4", + "socket.io-parser": "2.1.2" + }, + "_id": "socket.io-adapter@0.2.0", + "dist": { + "shasum": "bd39329b8961371787e24f345b074ec9cf000e33", + "tarball": "http://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-0.2.0.tgz" + }, + "_from": "socket.io-adapter@0.2.0", + "_npmVersion": "1.4.3", + "_npmUser": { + "name": "rauchg", + "email": "rauchg@gmail.com" + }, + "maintainers": [ + { + "name": "rauchg", + "email": "rauchg@gmail.com" + } + ], + "directories": {}, + "_shasum": "bd39329b8961371787e24f345b074ec9cf000e33", + "_resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-0.2.0.tgz" +} diff --git a/node_modules/socket.io/node_modules/socket.io-client/.npmignore b/node_modules/socket.io/node_modules/socket.io-client/.npmignore new file mode 100644 index 0000000..eb949ae --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-client/.npmignore @@ -0,0 +1,2 @@ +test +support diff --git a/node_modules/socket.io/node_modules/socket.io-client/.travis.yml b/node_modules/socket.io/node_modules/socket.io-client/.travis.yml new file mode 100644 index 0000000..fb7faf3 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-client/.travis.yml @@ -0,0 +1,16 @@ +language: node_js +node_js: +- '0.10' +- '0.11' +matrix: + fast_finish: true + allow_failures: + - node_js: '0.11' +notifications: + irc: irc.freenode.org#socket.io +env: + global: + - secure: wn0UtEtmR0+5ecvr8mXaLJey5XZ4a3j2f5EDoBW0ItALKixqRR6wCrdplwp9MMEDGuer11byIy2YJ+HRazgpcdf+3IuHmSvLb5IItbAaEwcjskawarGcYQO8Gy6GffkbYLFsjEhlkFk9+yXPJuws9msY2+9Y0IymgY8rT9O4D98= + - secure: f5EAsqnJNW//oUgShxSGcDQsz6NUbwfkZCKoPymTamjyK69N5/Q70MQ5UrF3gih3ZiwWDK7Cd6T394vU+Jdrf+LdOdzgef3sz8YJbF3HiOOLp5tYuFVOtOMCBkefdJ/JkqFvrBQUgo3klSD6jUz2SdRlwi33iYlYO8mleO8IxRo= + - secure: 0ah52GLAyJYZwJpnYbTscXgSuSoRLQBj/X0mZeeNGofPbQdWyhQoyBJMq77cTZJQ0mPKd3acojRH5DzYO5q0sMMPkN5mW3couqlyMk94PoYgaiTYRj7dzPnegi1myeVTioX9jomwkh1j+kg1diIHz+VHOgp9n7u595F0HnVXRwA= + - secure: MFEtLhbKZKQDsU9h6dXLRSSZfBUWRJgVV4pucS0bSVA4SZ3Cqq405mg83EiUCww0L0jMXkKKojxcbNl5aHHIzWtTDJTiDw1ifQrIWsbSZ4IPFixd98hU9N7fI4BkEiNhN2j5W4iF+52GDr6Msuy9+6bbuUXEWcJnhjrJ4ePNlBs= diff --git a/node_modules/socket.io/node_modules/socket.io-client/.zuul.yml b/node_modules/socket.io/node_modules/socket.io-client/.zuul.yml new file mode 100644 index 0000000..97c7b00 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-client/.zuul.yml @@ -0,0 +1,19 @@ +ui: mocha-bdd +server: ./test/support/server.js +browsers: + - name: chrome + version: 29..latest + - name: firefox + version: latest + - name: safari + version: latest + - name: ie + version: 10 + platform: Windows 2012 + - name: ie + version: [6..9, latest] + - name: iphone + version: 6.0..latest + - name: android + version: oldest..latest + version: 5.1 diff --git a/node_modules/socket.io/node_modules/socket.io-client/History.md b/node_modules/socket.io/node_modules/socket.io-client/History.md new file mode 100644 index 0000000..7f45b2b --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-client/History.md @@ -0,0 +1,306 @@ + +1.0.6 / 2014-06-19 +================== + + * test fixes on internet explorer + * fixes for duplicate event propagation from manager instance [Rase-] + +1.0.5 / 2014-06-16 +================== + + * package: bump `engine.io-client` for better deps and smaller build + * handle io.connect(null, opts) correctly [audreyt] + * url: fix incorrect ports in certain connections [holic] + * manager: propagate all reconnection events to sockets [Rase-] + * index: added BC for `force new connection` + * socket: fix event buffering while in disconnected state [kevin-roark] + * package: stop using tarballs in dependencies [reid] + * manager: relay `connect_error` and `connect_timeout` to sockets + +1.0.4 / 2014-06-02 +================== + + * update build + +1.0.3 / 2014-05-31 +================== + + * package; bump `socket.io-parser` for binary ACK fix + * package: bump `engine.io-client` for binary UTF8 fix + +1.0.2 / 2014-05-28 +================== + + * package: bump `socket.io-parser` for windows fix + +1.0.1 / 2014-05-28 +================== + + * override npm tag + +1.0.0 / 2014-05-28 +================== + + * stable release + +1.0.0-pre5 / 2014-05-22 +======================= + + * package: bump `engine.io-client` for parser fixes + +1.0.0-pre4 / 2014-05-19 +======================= + + * build + +1.0.0-pre3 / 2014-05-17 +======================= + + * package: bump parser + * package: bump engine.io-client + +1.0.0-pre2 / 2014-04-27 +======================= + + * package: bump `engine.io-client` + * package: bump `zuul` + * allows user-level query string parameters to be in socket.request + * package: bump `socket.io-parser` + * package: bump `engine.io-client` for android fix + * tidy up .gitignore + +1.0.0-pre / 2014-03-14 +====================== + + * implemented `engine.io-client` + * implemented `socket.io-parser` + * implemented `json3` to avoid env pollution + * implemented `debug` + * added binary support + * added `browserify` support + +0.9.11 / 2012-11-02 +=================== + + * Enable use of 'xhr' transport in Node.js + * Fix the problem with disconnecting xhr-polling users + * Add should to devDependencies + * Prefer XmlHttpRequest if CORS is available + * Make client compatible with AMD loaders. + +0.9.10 / 2012-08-10 +=================== + + * fix removeAllListeners to behave as expected. + * set withCredentials to true only if xdomain. + * socket: disable disconnect on unload by default. + +0.9.9 / 2012-08-01 +================== + + * socket: fixed disconnect xhr url and made it actually sync + * *: bump xmlhttprequest dep + +0.9.8 / 2012-07-24 +================== + + * Fixed build. + +0.9.7 / 2012-07-24 +================== + + * iOS websocket crash fix. + * Fixed potential `open` collision. + * Fixed disconnectSync. + +0.9.6 / 2012-04-17 +================== + + * Don't position the jsonp form off the screen (android fix). + +0.9.5 / 2012-04-05 +================== + + * Bumped version. + +0.9.4 / 2012-04-01 +================== + + * Fixes polling loop upon reconnect advice (fixes #438). + +0.9.3 / 2012-03-28 +================== + + * Fix XHR.check, which was throwing an error transparently and causing non-IE browsers to fall back to JSONP [mikito] + * Fixed forced disconnect on window close [zzzaaa] + +0.9.2 / 2012-03-13 +================== + + * Transport order set by "options" [zzzaaa] + +0.9.1-1 / 2012-03-02 +==================== + + * Fixed active-x-obfuscator NPM dependency. + +0.9.1 / 2012-03-02 +================== + + * Misc corrections. + * Added warning within Firefox about webworker test in test runner. + * Update ws dependency [einaros] + * Implemented client side heartbeat checks. [felixge] + * Improved Firewall support with ActiveX obfuscation. [felixge] + * Fixed error handling during connection process. [Outsideris] + +0.9.0 / 2012-02-26 +================== + + * Added DS_Store to gitignore. + * Updated depedencies. + * Bumped uglify + * Tweaking code so it doesn't throw an exception when used inside a WebWorker in Firefox + * Do not rely on Array.prototype.indexOf as it breaks with pages that use the Prototype.js library. + * Windows support landed + * Use @einaros ws module instead of the old crap one + * Fix for broken closeTimeout and 'IE + xhr' goes into infinite loop on disconnection + * Disabled reconnection on error if reconnect option is set to false + * Set withCredentials to true before xhr to fix authentication + * Clears the timeout from reconnection attempt when there is a successful or failed reconnection. + This fixes the issue of setTimeout's carrying over from previous reconnection + and changing (skipping) values of self.reconnectionDelay in the newer reconnection. + * Removed decoding of parameters when chunking the query string. + This was used later on to construct the url to post to the socket.io server + for connection and if we're adding custom parameters of our own to this url + (for example for OAuth authentication) they were being sent decoded, which is wrong. + +0.8.7 / 2011-11-05 +================== + + * Bumped client + +0.8.6 / 2011-10-27 +================== + + * Added WebWorker support. + * Fixed swfobject and web_socket.js to not assume window. + * Fixed CORS detection for webworker. + * Fix `defer` for webkit in a webworker. + * Fixed io.util.request to not rely on window. + * FIxed; use global instead of window and dont rely on document. + * Fixed; JSON-P handshake if CORS is not available. + * Made underlying Transport disconnection trigger immediate socket.io disconnect. + * Fixed warning when compressing with Google Closure Compiler. + * Fixed builder's uglify utf-8 support. + * Added workaround for loading indicator in FF jsonp-polling. [3rd-Eden] + * Fixed host discovery lookup. [holic] + * Fixed close timeout when disconnected/reconnecting. [jscharlach] + * Fixed jsonp-polling feature detection. + * Fixed jsonp-polling client POSTing of \n. + * Fixed test runner on IE6/7 + +0.8.5 / 2011-10-07 +================== + + * Bumped client + +0.8.4 / 2011-09-06 +================== + + * Corrected build + +0.8.3 / 2011-09-03 +================== + + * Fixed `\n` parsing for non-JSON packets. + * Fixed; make Socket.IO XHTML doctype compatible (fixes #460 from server) + * Fixed support for Node.JS running `socket.io-client`. + * Updated repository name in `package.json`. + * Added support for different policy file ports without having to port + forward 843 on the server side [3rd-Eden] + +0.8.2 / 2011-08-29 +================== + + * Fixed flashsocket detection. + +0.8.1 / 2011-08-29 +================== + + * Bump version. + +0.8.0 / 2011-08-28 +================== + + * Added MozWebSocket support (hybi-10 doesn't require API changes) [einaros]. + +0.7.11 / 2011-08-27 +=================== + + * Corrected previous release (missing build). + +0.7.10 / 2011-08-27 +=================== + + * Fix for failing fallback in websockets + +0.7.9 / 2011-08-12 +================== + + * Added check on `Socket#onConnect` to prevent double `connect` events on the main manager. + * Fixed socket namespace connect test. Remove broken alternative namespace connect test. + * Removed test handler for removed test. + * Bumped version to match `socket.io` server. + +0.7.5 / 2011-08-08 +================== + + * Added querystring support for `connect` [3rd-Eden] + * Added partial Node.JS transports support [3rd-Eden, josephg] + * Fixed builder test. + * Changed `util.inherit` to replicate Object.create / __proto__. + * Changed and cleaned up some acceptance tests. + * Fixed race condition with a test that could not be run multiple times. + * Added test for encoding a payload. + * Added the ability to override the transport to use in acceptance test [3rd-Eden] + * Fixed multiple connect packets [DanielBaulig] + * Fixed jsonp-polling over-buffering [3rd-Eden] + * Fixed ascii preservation in minified socket.io client [3rd-Eden] + * Fixed socket.io in situations where the page is not served through utf8. + * Fixed namespaces not reconnecting after disconnect [3rd-Eden] + * Fixed default port for secure connections. + +0.7.4 / 2011-07-12 +================== + + * Added `SocketNamespace#of` shortcut. [3rd-Eden] + * Fixed a IE payload decoding bug. [3rd-Eden] + * Honor document protocol, unless overriden. [dvv] + * Fixed new builder dependencies. [3rd-Eden] + +0.7.3 / 2011-06-30 +================== + + * Fixed; acks don't depend on arity. They're automatic for `.send` and + callback based for `.emit`. [dvv] + * Added support for sub-sockets authorization. [3rd-Eden] + * Added BC support for `new io.connect`. [fat] + * Fixed double `connect` events. [3rd-Eden] + * Fixed reconnection with jsonp-polling maintaining old sessionid. [franck34] + +0.7.2 / 2011-06-22 +================== + + * Added `noop` message type. + +0.7.1 / 2011-06-21 +================== + + * Bumped socket.io dependency version for acceptance tests. + +0.7.0 / 2011-06-21 +================== + + * http://socket.io/announcement.html + diff --git a/node_modules/socket.io/node_modules/socket.io-client/Makefile b/node_modules/socket.io/node_modules/socket.io-client/Makefile new file mode 100644 index 0000000..5c0771b --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-client/Makefile @@ -0,0 +1,21 @@ + +REPORTER = dot + +build: socket.io.js + +socket.io.js: lib/*.js package.json + @./support/browserify.sh > socket.io.js + +test: + @./node_modules/.bin/mocha \ + --reporter $(REPORTER) \ + --bail \ + test/index.js + @./node_modules/.bin/zuul -- test/index.js + +test-cov: + @./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha -- \ + --reporter $(REPORTER) \ + test/ + +.PHONY: test diff --git a/node_modules/socket.io/node_modules/socket.io-client/README.md b/node_modules/socket.io/node_modules/socket.io-client/README.md new file mode 100644 index 0000000..f8152c5 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-client/README.md @@ -0,0 +1,163 @@ + +# socket.io-client + +[![Build Status](https://secure.travis-ci.org/Automattic/socket.io-client.png)](http://travis-ci.org/Automattic/socket.io-client) +[![NPM version](https://badge.fury.io/js/socket.io-client.png)](http://badge.fury.io/js/socket.io-client) + +## How to use + +A standalone build of `socket.io-client` is exposed automatically by the +socket.io server as `/socket.io/socket.io.js`. Alternatively you can +serve the file `socket.io.js` found at the root of this repository. + +```html + + +``` + +Socket.IO is compatible with [browserify](http://browserify.org/). + +### Node.JS (server-side usage) + + Add `socket.io-client` to your `package.json` and then: + + ```js + var socket = require('socket.io-client')('http://localhost'); + socket.on('connect', function(){ + socket.on('event', function(data){}); + socket.on('disconnect', function(){}); + }); + ``` + +## API + +### IO(url:String, opts:Object):Socket + + Exposed as the `io` namespace in the standalone build, or the result + of calling `require('socket.io-client')`. + + When called, it creates a new `Manager` for the given URL, and attempts + to reuse an existing `Manager` for subsequent calls, unless the + `multiplex` option is passed with `false`. + + The rest of the options are passed to the `Manager` constructor (see below + for details). + + A `Socket` instance is returned for the namespace specified by the + pathname in the URL, defaulting to `/`. For example, if the `url` is + `http://localhost/users`, a transport connection will be established to + `http://localhost` and a Socket.IO connection will be established to + `/users`. + +### IO#protocol + + Socket.io protocol revision number this client works with. + +### IO#Socket + + Reference to the `Socket` constructor. + +### IO#Manager + + Reference to the `Manager` constructor. + +### IO#Emitter + + Reference to the `Emitter` constructor. + +### Manager(url:String, opts:Object) + + A `Manager` represents a connection to a given Socket.IO server. One or + more `Socket` instances are associated with the manager. The manager + can be accessed through the `io` property of each `Socket` instance. + + The `opts` are also passed to `engine.io` upon initialization of the + underlying `Socket`. + + Options: + - `reconnection` whether to reconnect automatically (`true`) + - `reconnectionDelay` how long to wait before attempting a new + reconnection (`1000`) + - `reconnectionDelayMax` maximum amount of time to wait between + reconnections (`5000`). Each attempt increases the reconnection by + the amount specified by `reconnectionDelay`. + - `timeout` connection timeout before a `connect_error` + and `connect_timeout` events are emitted (`20000`) + +#### Events + + - `connect`. Fired upon a successful connection. + - `connect_error`. Fired upon a connection error. + Parameters: + - `Object` error object + - `connect_timeout`. Fired upon a connection timeout. + - `reconnect`. Fired upon a successful reconnection. + Parameters: + - `Number` reconnection attempt number + - `reconnect_attempt`. Fired upon an attempt to reconnect. + - `reconnecting`. Fired upon an attempt to reconnect. + Parameters: + - `Number` reconnection attempt number + - `reconnect_error`. Fired upon a reconnection attempt error. + Parameters: + - `Object` error object + - `reconnect_failed`. Fired when couldn't reconnect within `reconnectionAttempts` + +The events above are also emitted on the individual sockets that +reconnect that depend on this `Manager`. + +### Manager#reconnection(v:Boolean):Manager + + Sets the `reconnection` option, or returns it if no parameters + are passed. + +### Manager#reconnectionAttempts(v:Boolean):Manager + + Sets the `reconnectionAttempts` option, or returns it if no parameters + are passed. + +### Manager#reconnectionDelay(v:Boolean):Manager + + Sets the `reconectionDelay` option, or returns it if no parameters + are passed. + +### Manager#reconnectionDelayMax(v:Boolean):Manager + + Sets the `reconectionDelayMax` option, or returns it if no parameters + are passed. + +### Manager#timeout(v:Boolean):Manager + + Sets the `timeout` option, or returns it if no parameters + are passed. + +### Socket + +#### Events + + - `connect`. Fired upon connecting. + - `error`. Fired upon a connection error + Parameters: + - `Object` error data + - `disconnect`. Fired upon a disconnection. + - `reconnect`. Fired upon a successful reconnection. + Parameters: + - `Number` reconnection attempt number + - `reconnect_attempt`. Fired upon an attempt to reconnect. + - `reconnecting`. Fired upon an attempt to reconnect. + Parameters: + - `Number` reconnection attempt number + - `reconnect_error`. Fired upon a reconnection attempt error. + Parameters: + - `Object` error object + - `reconnect_failed`. Fired when couldn't reconnect within `reconnectionAttempts` + +## License + +MIT diff --git a/node_modules/socket.io/node_modules/socket.io-client/coverage/coverage.json b/node_modules/socket.io/node_modules/socket.io-client/coverage/coverage.json new file mode 100644 index 0000000..e896f6a --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-client/coverage/coverage.json @@ -0,0 +1 @@ +{"/Users/guillermorauch/Projects/socket.io-client/index.js":{"path":"/Users/guillermorauch/Projects/socket.io-client/index.js","s":{"1":1},"b":{},"f":{},"fnMap":{},"statementMap":{"1":{"start":{"line":2,"column":0},"end":{"line":2,"column":35}}},"branchMap":{}},"/Users/guillermorauch/Projects/socket.io-client/lib/index.js":{"path":"/Users/guillermorauch/Projects/socket.io-client/lib/index.js","s":{"1":1,"2":1,"3":1,"4":1,"5":1,"6":1,"7":1,"8":12,"9":0,"10":0,"11":12,"12":12,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":1,"25":1,"26":1,"27":1},"b":{"1":[0,12],"2":[12,12],"3":[0,0],"4":[0,0],"5":[0,0]},"f":{"1":12},"fnMap":{"1":{"name":"lookup","line":36,"loc":{"start":{"line":36,"column":0},"end":{"line":36,"column":27}}}},"statementMap":{"1":{"start":{"line":6,"column":0},"end":{"line":6,"column":27}},"2":{"start":{"line":7,"column":0},"end":{"line":7,"column":41}},"3":{"start":{"line":8,"column":0},"end":{"line":8,"column":35}},"4":{"start":{"line":9,"column":0},"end":{"line":9,"column":49}},"5":{"start":{"line":15,"column":0},"end":{"line":15,"column":34}},"6":{"start":{"line":21,"column":0},"end":{"line":21,"column":34}},"7":{"start":{"line":36,"column":0},"end":{"line":61,"column":1}},"8":{"start":{"line":37,"column":2},"end":{"line":40,"column":3}},"9":{"start":{"line":38,"column":4},"end":{"line":38,"column":15}},"10":{"start":{"line":39,"column":4},"end":{"line":39,"column":20}},"11":{"start":{"line":42,"column":2},"end":{"line":42,"column":20}},"12":{"start":{"line":44,"column":2},"end":{"line":44,"column":24}},"13":{"start":{"line":45,"column":2},"end":{"line":45,"column":29}},"14":{"start":{"line":46,"column":2},"end":{"line":46,"column":21}},"15":{"start":{"line":47,"column":2},"end":{"line":47,"column":9}},"16":{"start":{"line":49,"column":2},"end":{"line":58,"column":3}},"17":{"start":{"line":50,"column":4},"end":{"line":50,"column":50}},"18":{"start":{"line":51,"column":4},"end":{"line":51,"column":31}},"19":{"start":{"line":53,"column":4},"end":{"line":56,"column":5}},"20":{"start":{"line":54,"column":6},"end":{"line":54,"column":46}},"21":{"start":{"line":55,"column":6},"end":{"line":55,"column":40}},"22":{"start":{"line":57,"column":4},"end":{"line":57,"column":19}},"23":{"start":{"line":60,"column":2},"end":{"line":60,"column":32}},"24":{"start":{"line":69,"column":0},"end":{"line":69,"column":35}},"25":{"start":{"line":78,"column":0},"end":{"line":78,"column":25}},"26":{"start":{"line":86,"column":0},"end":{"line":86,"column":39}},"27":{"start":{"line":87,"column":0},"end":{"line":87,"column":37}}},"branchMap":{"1":{"line":37,"type":"if","locations":[{"start":{"line":37,"column":2},"end":{"line":37,"column":2}},{"start":{"line":37,"column":2},"end":{"line":37,"column":2}}]},"2":{"line":42,"type":"binary-expr","locations":[{"start":{"line":42,"column":9},"end":{"line":42,"column":13}},{"start":{"line":42,"column":17},"end":{"line":42,"column":19}}]},"3":{"line":49,"type":"if","locations":[{"start":{"line":49,"column":2},"end":{"line":49,"column":2}},{"start":{"line":49,"column":2},"end":{"line":49,"column":2}}]},"4":{"line":49,"type":"binary-expr","locations":[{"start":{"line":49,"column":6},"end":{"line":49,"column":19}},{"start":{"line":49,"column":23},"end":{"line":49,"column":47}}]},"5":{"line":53,"type":"if","locations":[{"start":{"line":53,"column":4},"end":{"line":53,"column":4}},{"start":{"line":53,"column":4},"end":{"line":53,"column":4}}]}}},"/Users/guillermorauch/Projects/socket.io-client/lib/url.js":{"path":"/Users/guillermorauch/Projects/socket.io-client/lib/url.js","s":{"1":1,"2":1,"3":1,"4":1,"5":20,"6":20,"7":20,"8":12,"9":8,"10":8,"11":2,"12":1,"13":8,"14":3,"15":3,"16":2,"17":1,"18":8,"19":8,"20":8,"21":1,"22":8,"23":8,"24":8,"25":8},"b":{"1":[20,18],"2":[12,8],"3":[8,0],"4":[2,6],"5":[1,1],"6":[3,5],"7":[2,1],"8":[1,7],"9":[8,8,7,3],"10":[8,2],"11":[1,7],"12":[1,7]},"f":{"1":20},"fnMap":{"1":{"name":"url","line":24,"loc":{"start":{"line":24,"column":0},"end":{"line":24,"column":22}}}},"statementMap":{"1":{"start":{"line":6,"column":0},"end":{"line":6,"column":35}},"2":{"start":{"line":7,"column":0},"end":{"line":7,"column":53}},"3":{"start":{"line":13,"column":0},"end":{"line":13,"column":21}},"4":{"start":{"line":24,"column":0},"end":{"line":68,"column":1}},"5":{"start":{"line":25,"column":2},"end":{"line":25,"column":16}},"6":{"start":{"line":28,"column":2},"end":{"line":28,"column":35}},"7":{"start":{"line":29,"column":2},"end":{"line":29,"column":60}},"8":{"start":{"line":29,"column":19},"end":{"line":29,"column":60}},"9":{"start":{"line":32,"column":2},"end":{"line":51,"column":3}},"10":{"start":{"line":33,"column":4},"end":{"line":37,"column":5}},"11":{"start":{"line":34,"column":6},"end":{"line":36,"column":7}},"12":{"start":{"line":35,"column":8},"end":{"line":35,"column":33}},"13":{"start":{"line":39,"column":4},"end":{"line":46,"column":5}},"14":{"start":{"line":40,"column":6},"end":{"line":40,"column":41}},"15":{"start":{"line":41,"column":6},"end":{"line":45,"column":7}},"16":{"start":{"line":42,"column":8},"end":{"line":42,"column":40}},"17":{"start":{"line":44,"column":8},"end":{"line":44,"column":31}},"18":{"start":{"line":49,"column":4},"end":{"line":49,"column":27}},"19":{"start":{"line":50,"column":4},"end":{"line":50,"column":24}},"20":{"start":{"line":54,"column":2},"end":{"line":57,"column":3}},"21":{"start":{"line":56,"column":4},"end":{"line":56,"column":20}},"22":{"start":{"line":59,"column":2},"end":{"line":59,"column":29}},"23":{"start":{"line":62,"column":2},"end":{"line":62,"column":72}},"24":{"start":{"line":65,"column":2},"end":{"line":65,"column":82}},"25":{"start":{"line":67,"column":2},"end":{"line":67,"column":13}}},"branchMap":{"1":{"line":28,"type":"binary-expr","locations":[{"start":{"line":28,"column":12},"end":{"line":28,"column":15}},{"start":{"line":28,"column":19},"end":{"line":28,"column":34}}]},"2":{"line":29,"type":"if","locations":[{"start":{"line":29,"column":2},"end":{"line":29,"column":2}},{"start":{"line":29,"column":2},"end":{"line":29,"column":2}}]},"3":{"line":32,"type":"if","locations":[{"start":{"line":32,"column":2},"end":{"line":32,"column":2}},{"start":{"line":32,"column":2},"end":{"line":32,"column":2}}]},"4":{"line":33,"type":"if","locations":[{"start":{"line":33,"column":4},"end":{"line":33,"column":4}},{"start":{"line":33,"column":4},"end":{"line":33,"column":4}}]},"5":{"line":34,"type":"if","locations":[{"start":{"line":34,"column":6},"end":{"line":34,"column":6}},{"start":{"line":34,"column":6},"end":{"line":34,"column":6}}]},"6":{"line":39,"type":"if","locations":[{"start":{"line":39,"column":4},"end":{"line":39,"column":4}},{"start":{"line":39,"column":4},"end":{"line":39,"column":4}}]},"7":{"line":41,"type":"if","locations":[{"start":{"line":41,"column":6},"end":{"line":41,"column":6}},{"start":{"line":41,"column":6},"end":{"line":41,"column":6}}]},"8":{"line":54,"type":"if","locations":[{"start":{"line":54,"column":2},"end":{"line":54,"column":2}},{"start":{"line":54,"column":2},"end":{"line":54,"column":2}}]},"9":{"line":54,"type":"binary-expr","locations":[{"start":{"line":54,"column":7},"end":{"line":54,"column":37}},{"start":{"line":54,"column":41},"end":{"line":54,"column":55}},{"start":{"line":55,"column":6},"end":{"line":55,"column":37}},{"start":{"line":55,"column":41},"end":{"line":55,"column":56}}]},"10":{"line":59,"type":"binary-expr","locations":[{"start":{"line":59,"column":13},"end":{"line":59,"column":21}},{"start":{"line":59,"column":25},"end":{"line":59,"column":28}}]},"11":{"line":62,"type":"cond-expr","locations":[{"start":{"line":62,"column":50},"end":{"line":62,"column":64}},{"start":{"line":62,"column":68},"end":{"line":62,"column":70}}]},"12":{"line":65,"type":"cond-expr","locations":[{"start":{"line":65,"column":60},"end":{"line":65,"column":74}},{"start":{"line":65,"column":78},"end":{"line":65,"column":80}}]}}},"/Users/guillermorauch/Projects/socket.io-client/lib/manager.js":{"path":"/Users/guillermorauch/Projects/socket.io-client/lib/manager.js","s":{"1":1,"2":1,"3":1,"4":1,"5":1,"6":1,"7":1,"8":1,"9":1,"10":1,"11":1,"12":10,"13":5,"14":5,"15":2,"16":2,"17":5,"18":5,"19":5,"20":5,"21":5,"22":5,"23":5,"24":5,"25":5,"26":5,"27":5,"28":5,"29":5,"30":5,"31":5,"32":5,"33":5,"34":5,"35":5,"36":1,"37":1,"38":5,"39":0,"40":5,"41":5,"42":1,"43":5,"44":0,"45":5,"46":5,"47":1,"48":17,"49":12,"50":5,"51":5,"52":1,"53":17,"54":12,"55":5,"56":5,"57":1,"58":5,"59":0,"60":5,"61":5,"62":1,"63":15,"64":4,"65":4,"66":1,"67":20,"68":20,"69":5,"70":15,"71":15,"72":15,"73":15,"74":15,"75":15,"76":0,"77":0,"78":15,"79":15,"80":15,"81":15,"82":15,"83":15,"84":10,"85":10,"86":10,"87":15,"88":15,"89":15,"90":15,"91":15,"92":3,"93":3,"94":3,"95":3,"96":3,"97":15,"98":15,"99":15,"100":15,"101":15,"102":1,"103":0,"104":0,"105":0,"106":0,"107":0,"108":0,"109":0,"110":0,"111":0,"112":1,"113":0,"114":1,"115":0,"116":1,"117":0,"118":0,"119":1,"120":5,"121":5,"122":5,"123":5,"124":5,"125":5,"126":0,"127":5,"128":1,"129":0,"130":1,"131":0,"132":0,"133":0,"134":0,"135":0,"136":0,"137":0,"138":0,"139":0,"140":0,"141":1,"142":0,"143":0,"144":0,"145":1,"146":15,"147":15,"148":55,"149":15,"150":15,"151":15,"152":1,"153":0,"154":0,"155":1,"156":0,"157":0,"158":0,"159":0,"160":0,"161":0,"162":1,"163":14,"164":0,"165":14,"166":14,"167":14,"168":2,"169":2,"170":2,"171":12,"172":12,"173":12,"174":12,"175":12,"176":11,"177":11,"178":10,"179":10,"180":10,"181":10,"182":10,"183":10,"184":0,"185":0,"186":12,"187":10,"188":1,"189":0,"190":0,"191":0,"192":0},"b":{"1":[5,5],"2":[2,3],"3":[5,1],"4":[5,5],"5":[5,3],"6":[5,2],"7":[5,5],"8":[4,1],"9":[0,5],"10":[0,5],"11":[12,5],"12":[12,5],"13":[0,5],"14":[4,11],"15":[15,5,5],"16":[5,15],"17":[0,0],"18":[10,5],"19":[15,0],"20":[5,0],"21":[0,0],"22":[0,0],"23":[0,0],"24":[0,0],"25":[0,0],"26":[0,0],"27":[0,14],"28":[2,12],"29":[10,0]},"f":{"1":10,"2":5,"3":5,"4":17,"5":17,"6":5,"7":15,"8":20,"9":0,"10":15,"11":3,"12":15,"13":0,"14":0,"15":0,"16":0,"17":5,"18":0,"19":0,"20":0,"21":0,"22":0,"23":15,"24":0,"25":0,"26":14,"27":11,"28":10,"29":10,"30":0},"fnMap":{"1":{"name":"Manager","line":30,"loc":{"start":{"line":30,"column":0},"end":{"line":30,"column":27}}},"2":{"name":"(anonymous_2)","line":72,"loc":{"start":{"line":72,"column":33},"end":{"line":72,"column":44}}},"3":{"name":"(anonymous_3)","line":86,"loc":{"start":{"line":86,"column":41},"end":{"line":86,"column":52}}},"4":{"name":"(anonymous_4)","line":100,"loc":{"start":{"line":100,"column":38},"end":{"line":100,"column":49}}},"5":{"name":"(anonymous_5)","line":114,"loc":{"start":{"line":114,"column":41},"end":{"line":114,"column":52}}},"6":{"name":"(anonymous_6)","line":127,"loc":{"start":{"line":127,"column":28},"end":{"line":127,"column":39}}},"7":{"name":"(anonymous_7)","line":140,"loc":{"start":{"line":140,"column":41},"end":{"line":140,"column":52}}},"8":{"name":"(anonymous_8)","line":158,"loc":{"start":{"line":158,"column":28},"end":{"line":158,"column":40}}},"9":{"name":"(anonymous_9)","line":169,"loc":{"start":{"line":169,"column":35},"end":{"line":169,"column":46}}},"10":{"name":"(anonymous_10)","line":175,"loc":{"start":{"line":175,"column":37},"end":{"line":175,"column":51}}},"11":{"name":"(anonymous_11)","line":195,"loc":{"start":{"line":195,"column":27},"end":{"line":195,"column":37}}},"12":{"name":"(anonymous_12)","line":204,"loc":{"start":{"line":204,"column":15},"end":{"line":204,"column":25}}},"13":{"name":"(anonymous_13)","line":222,"loc":{"start":{"line":222,"column":27},"end":{"line":222,"column":37}}},"14":{"name":"(anonymous_14)","line":246,"loc":{"start":{"line":246,"column":27},"end":{"line":246,"column":41}}},"15":{"name":"(anonymous_15)","line":256,"loc":{"start":{"line":256,"column":30},"end":{"line":256,"column":47}}},"16":{"name":"(anonymous_16)","line":266,"loc":{"start":{"line":266,"column":28},"end":{"line":266,"column":41}}},"17":{"name":"(anonymous_17)","line":278,"loc":{"start":{"line":278,"column":27},"end":{"line":278,"column":40}}},"18":{"name":"(anonymous_18)","line":284,"loc":{"start":{"line":284,"column":25},"end":{"line":284,"column":35}}},"19":{"name":"(anonymous_19)","line":297,"loc":{"start":{"line":297,"column":28},"end":{"line":297,"column":44}}},"20":{"name":"(anonymous_20)","line":308,"loc":{"start":{"line":308,"column":27},"end":{"line":308,"column":43}}},"21":{"name":"(anonymous_21)","line":315,"loc":{"start":{"line":315,"column":32},"end":{"line":315,"column":57}}},"22":{"name":"(anonymous_22)","line":334,"loc":{"start":{"line":334,"column":39},"end":{"line":334,"column":50}}},"23":{"name":"(anonymous_23)","line":347,"loc":{"start":{"line":347,"column":28},"end":{"line":347,"column":38}}},"24":{"name":"(anonymous_24)","line":364,"loc":{"start":{"line":364,"column":31},"end":{"line":364,"column":41}}},"25":{"name":"(anonymous_25)","line":375,"loc":{"start":{"line":375,"column":28},"end":{"line":375,"column":44}}},"26":{"name":"(anonymous_26)","line":391,"loc":{"start":{"line":391,"column":30},"end":{"line":391,"column":40}}},"27":{"name":"(anonymous_27)","line":407,"loc":{"start":{"line":407,"column":27},"end":{"line":407,"column":37}}},"28":{"name":"(anonymous_28)","line":410,"loc":{"start":{"line":410,"column":16},"end":{"line":410,"column":29}}},"29":{"name":"(anonymous_29)","line":424,"loc":{"start":{"line":424,"column":15},"end":{"line":424,"column":25}}},"30":{"name":"(anonymous_30)","line":437,"loc":{"start":{"line":437,"column":32},"end":{"line":437,"column":42}}}},"statementMap":{"1":{"start":{"line":6,"column":0},"end":{"line":6,"column":27}},"2":{"start":{"line":7,"column":0},"end":{"line":7,"column":38}},"3":{"start":{"line":8,"column":0},"end":{"line":8,"column":33}},"4":{"start":{"line":9,"column":0},"end":{"line":9,"column":33}},"5":{"start":{"line":10,"column":0},"end":{"line":10,"column":41}},"6":{"start":{"line":11,"column":0},"end":{"line":11,"column":25}},"7":{"start":{"line":12,"column":0},"end":{"line":12,"column":27}},"8":{"start":{"line":13,"column":0},"end":{"line":13,"column":41}},"9":{"start":{"line":14,"column":0},"end":{"line":14,"column":57}},"10":{"start":{"line":20,"column":0},"end":{"line":20,"column":25}},"11":{"start":{"line":30,"column":0},"end":{"line":56,"column":1}},"12":{"start":{"line":31,"column":2},"end":{"line":31,"column":64}},"13":{"start":{"line":31,"column":34},"end":{"line":31,"column":64}},"14":{"start":{"line":32,"column":2},"end":{"line":35,"column":3}},"15":{"start":{"line":33,"column":4},"end":{"line":33,"column":15}},"16":{"start":{"line":34,"column":4},"end":{"line":34,"column":20}},"17":{"start":{"line":36,"column":2},"end":{"line":36,"column":20}},"18":{"start":{"line":38,"column":2},"end":{"line":38,"column":40}},"19":{"start":{"line":39,"column":2},"end":{"line":39,"column":17}},"20":{"start":{"line":40,"column":2},"end":{"line":40,"column":17}},"21":{"start":{"line":41,"column":2},"end":{"line":41,"column":19}},"22":{"start":{"line":42,"column":2},"end":{"line":42,"column":49}},"23":{"start":{"line":43,"column":2},"end":{"line":43,"column":67}},"24":{"start":{"line":44,"column":2},"end":{"line":44,"column":57}},"25":{"start":{"line":45,"column":2},"end":{"line":45,"column":63}},"26":{"start":{"line":46,"column":2},"end":{"line":46,"column":60}},"27":{"start":{"line":47,"column":2},"end":{"line":47,"column":29}},"28":{"start":{"line":48,"column":2},"end":{"line":48,"column":17}},"29":{"start":{"line":49,"column":2},"end":{"line":49,"column":21}},"30":{"start":{"line":50,"column":2},"end":{"line":50,"column":20}},"31":{"start":{"line":51,"column":2},"end":{"line":51,"column":24}},"32":{"start":{"line":52,"column":2},"end":{"line":52,"column":25}},"33":{"start":{"line":53,"column":2},"end":{"line":53,"column":38}},"34":{"start":{"line":54,"column":2},"end":{"line":54,"column":38}},"35":{"start":{"line":55,"column":2},"end":{"line":55,"column":14}},"36":{"start":{"line":62,"column":0},"end":{"line":62,"column":27}},"37":{"start":{"line":72,"column":0},"end":{"line":76,"column":2}},"38":{"start":{"line":73,"column":2},"end":{"line":73,"column":51}},"39":{"start":{"line":73,"column":25},"end":{"line":73,"column":51}},"40":{"start":{"line":74,"column":2},"end":{"line":74,"column":27}},"41":{"start":{"line":75,"column":2},"end":{"line":75,"column":14}},"42":{"start":{"line":86,"column":0},"end":{"line":90,"column":2}},"43":{"start":{"line":87,"column":2},"end":{"line":87,"column":59}},"44":{"start":{"line":87,"column":25},"end":{"line":87,"column":59}},"45":{"start":{"line":88,"column":2},"end":{"line":88,"column":33}},"46":{"start":{"line":89,"column":2},"end":{"line":89,"column":14}},"47":{"start":{"line":100,"column":0},"end":{"line":104,"column":2}},"48":{"start":{"line":101,"column":2},"end":{"line":101,"column":56}},"49":{"start":{"line":101,"column":25},"end":{"line":101,"column":56}},"50":{"start":{"line":102,"column":2},"end":{"line":102,"column":30}},"51":{"start":{"line":103,"column":2},"end":{"line":103,"column":14}},"52":{"start":{"line":114,"column":0},"end":{"line":118,"column":2}},"53":{"start":{"line":115,"column":2},"end":{"line":115,"column":59}},"54":{"start":{"line":115,"column":25},"end":{"line":115,"column":59}},"55":{"start":{"line":116,"column":2},"end":{"line":116,"column":33}},"56":{"start":{"line":117,"column":2},"end":{"line":117,"column":14}},"57":{"start":{"line":127,"column":0},"end":{"line":131,"column":2}},"58":{"start":{"line":128,"column":2},"end":{"line":128,"column":46}},"59":{"start":{"line":128,"column":25},"end":{"line":128,"column":46}},"60":{"start":{"line":129,"column":2},"end":{"line":129,"column":20}},"61":{"start":{"line":130,"column":2},"end":{"line":130,"column":14}},"62":{"start":{"line":140,"column":0},"end":{"line":146,"column":2}},"63":{"start":{"line":141,"column":2},"end":{"line":145,"column":3}},"64":{"start":{"line":143,"column":4},"end":{"line":143,"column":30}},"65":{"start":{"line":144,"column":4},"end":{"line":144,"column":21}},"66":{"start":{"line":157,"column":0},"end":{"line":214,"column":2}},"67":{"start":{"line":159,"column":2},"end":{"line":159,"column":42}},"68":{"start":{"line":160,"column":2},"end":{"line":160,"column":52}},"69":{"start":{"line":160,"column":40},"end":{"line":160,"column":52}},"70":{"start":{"line":162,"column":2},"end":{"line":162,"column":32}},"71":{"start":{"line":163,"column":2},"end":{"line":163,"column":41}},"72":{"start":{"line":164,"column":2},"end":{"line":164,"column":27}},"73":{"start":{"line":165,"column":2},"end":{"line":165,"column":18}},"74":{"start":{"line":166,"column":2},"end":{"line":166,"column":30}},"75":{"start":{"line":169,"column":2},"end":{"line":172,"column":5}},"76":{"start":{"line":170,"column":4},"end":{"line":170,"column":18}},"77":{"start":{"line":171,"column":4},"end":{"line":171,"column":15}},"78":{"start":{"line":175,"column":2},"end":{"line":187,"column":5}},"79":{"start":{"line":176,"column":4},"end":{"line":176,"column":27}},"80":{"start":{"line":177,"column":4},"end":{"line":177,"column":19}},"81":{"start":{"line":178,"column":4},"end":{"line":178,"column":31}},"82":{"start":{"line":179,"column":4},"end":{"line":179,"column":37}},"83":{"start":{"line":180,"column":4},"end":{"line":184,"column":5}},"84":{"start":{"line":181,"column":6},"end":{"line":181,"column":46}},"85":{"start":{"line":182,"column":6},"end":{"line":182,"column":22}},"86":{"start":{"line":183,"column":6},"end":{"line":183,"column":14}},"87":{"start":{"line":186,"column":4},"end":{"line":186,"column":32}},"88":{"start":{"line":190,"column":2},"end":{"line":208,"column":3}},"89":{"start":{"line":191,"column":4},"end":{"line":191,"column":32}},"90":{"start":{"line":192,"column":4},"end":{"line":192,"column":60}},"91":{"start":{"line":195,"column":4},"end":{"line":201,"column":16}},"92":{"start":{"line":196,"column":6},"end":{"line":196,"column":59}},"93":{"start":{"line":197,"column":6},"end":{"line":197,"column":24}},"94":{"start":{"line":198,"column":6},"end":{"line":198,"column":21}},"95":{"start":{"line":199,"column":6},"end":{"line":199,"column":38}},"96":{"start":{"line":200,"column":6},"end":{"line":200,"column":44}},"97":{"start":{"line":203,"column":4},"end":{"line":207,"column":7}},"98":{"start":{"line":205,"column":8},"end":{"line":205,"column":28}},"99":{"start":{"line":210,"column":2},"end":{"line":210,"column":26}},"100":{"start":{"line":211,"column":2},"end":{"line":211,"column":27}},"101":{"start":{"line":213,"column":2},"end":{"line":213,"column":14}},"102":{"start":{"line":222,"column":0},"end":{"line":238,"column":2}},"103":{"start":{"line":223,"column":2},"end":{"line":223,"column":16}},"104":{"start":{"line":226,"column":2},"end":{"line":226,"column":17}},"105":{"start":{"line":229,"column":2},"end":{"line":229,"column":27}},"106":{"start":{"line":230,"column":2},"end":{"line":230,"column":20}},"107":{"start":{"line":233,"column":2},"end":{"line":233,"column":27}},"108":{"start":{"line":234,"column":2},"end":{"line":234,"column":59}},"109":{"start":{"line":235,"column":2},"end":{"line":235,"column":71}},"110":{"start":{"line":236,"column":2},"end":{"line":236,"column":61}},"111":{"start":{"line":237,"column":2},"end":{"line":237,"column":61}},"112":{"start":{"line":246,"column":0},"end":{"line":248,"column":2}},"113":{"start":{"line":247,"column":2},"end":{"line":247,"column":25}},"114":{"start":{"line":256,"column":0},"end":{"line":258,"column":2}},"115":{"start":{"line":257,"column":2},"end":{"line":257,"column":30}},"116":{"start":{"line":266,"column":0},"end":{"line":269,"column":2}},"117":{"start":{"line":267,"column":2},"end":{"line":267,"column":22}},"118":{"start":{"line":268,"column":2},"end":{"line":268,"column":26}},"119":{"start":{"line":278,"column":0},"end":{"line":289,"column":2}},"120":{"start":{"line":279,"column":2},"end":{"line":279,"column":30}},"121":{"start":{"line":280,"column":2},"end":{"line":287,"column":3}},"122":{"start":{"line":281,"column":4},"end":{"line":281,"column":35}},"123":{"start":{"line":282,"column":4},"end":{"line":282,"column":28}},"124":{"start":{"line":283,"column":4},"end":{"line":283,"column":20}},"125":{"start":{"line":284,"column":4},"end":{"line":286,"column":7}},"126":{"start":{"line":285,"column":6},"end":{"line":285,"column":23}},"127":{"start":{"line":288,"column":2},"end":{"line":288,"column":16}},"128":{"start":{"line":297,"column":0},"end":{"line":299,"column":2}},"129":{"start":{"line":298,"column":2},"end":{"line":298,"column":35}},"130":{"start":{"line":308,"column":0},"end":{"line":325,"column":2}},"131":{"start":{"line":309,"column":2},"end":{"line":309,"column":37}},"132":{"start":{"line":310,"column":2},"end":{"line":310,"column":18}},"133":{"start":{"line":312,"column":2},"end":{"line":324,"column":3}},"134":{"start":{"line":314,"column":4},"end":{"line":314,"column":25}},"135":{"start":{"line":315,"column":4},"end":{"line":321,"column":7}},"136":{"start":{"line":316,"column":6},"end":{"line":318,"column":7}},"137":{"start":{"line":317,"column":8},"end":{"line":317,"column":45}},"138":{"start":{"line":319,"column":6},"end":{"line":319,"column":28}},"139":{"start":{"line":320,"column":6},"end":{"line":320,"column":32}},"140":{"start":{"line":323,"column":4},"end":{"line":323,"column":35}},"141":{"start":{"line":334,"column":0},"end":{"line":339,"column":2}},"142":{"start":{"line":335,"column":2},"end":{"line":338,"column":3}},"143":{"start":{"line":336,"column":4},"end":{"line":336,"column":41}},"144":{"start":{"line":337,"column":4},"end":{"line":337,"column":22}},"145":{"start":{"line":347,"column":0},"end":{"line":355,"column":2}},"146":{"start":{"line":348,"column":2},"end":{"line":348,"column":10}},"147":{"start":{"line":349,"column":2},"end":{"line":349,"column":48}},"148":{"start":{"line":349,"column":34},"end":{"line":349,"column":48}},"149":{"start":{"line":351,"column":2},"end":{"line":351,"column":25}},"150":{"start":{"line":352,"column":2},"end":{"line":352,"column":24}},"151":{"start":{"line":354,"column":2},"end":{"line":354,"column":25}},"152":{"start":{"line":363,"column":0},"end":{"line":367,"column":2}},"153":{"start":{"line":365,"column":2},"end":{"line":365,"column":28}},"154":{"start":{"line":366,"column":2},"end":{"line":366,"column":22}},"155":{"start":{"line":375,"column":0},"end":{"line":383,"column":2}},"156":{"start":{"line":376,"column":2},"end":{"line":376,"column":17}},"157":{"start":{"line":377,"column":2},"end":{"line":377,"column":17}},"158":{"start":{"line":378,"column":2},"end":{"line":378,"column":29}},"159":{"start":{"line":379,"column":2},"end":{"line":379,"column":29}},"160":{"start":{"line":380,"column":2},"end":{"line":382,"column":3}},"161":{"start":{"line":381,"column":4},"end":{"line":381,"column":21}},"162":{"start":{"line":391,"column":0},"end":{"line":429,"column":2}},"163":{"start":{"line":392,"column":2},"end":{"line":392,"column":37}},"164":{"start":{"line":392,"column":25},"end":{"line":392,"column":37}},"165":{"start":{"line":394,"column":2},"end":{"line":394,"column":18}},"166":{"start":{"line":395,"column":2},"end":{"line":395,"column":18}},"167":{"start":{"line":397,"column":2},"end":{"line":428,"column":3}},"168":{"start":{"line":398,"column":4},"end":{"line":398,"column":30}},"169":{"start":{"line":399,"column":4},"end":{"line":399,"column":34}},"170":{"start":{"line":400,"column":4},"end":{"line":400,"column":30}},"171":{"start":{"line":402,"column":4},"end":{"line":402,"column":57}},"172":{"start":{"line":403,"column":4},"end":{"line":403,"column":57}},"173":{"start":{"line":404,"column":4},"end":{"line":404,"column":60}},"174":{"start":{"line":406,"column":4},"end":{"line":406,"column":29}},"175":{"start":{"line":407,"column":4},"end":{"line":421,"column":14}},"176":{"start":{"line":408,"column":6},"end":{"line":408,"column":36}},"177":{"start":{"line":409,"column":6},"end":{"line":409,"column":37}},"178":{"start":{"line":410,"column":6},"end":{"line":420,"column":9}},"179":{"start":{"line":411,"column":8},"end":{"line":419,"column":9}},"180":{"start":{"line":412,"column":10},"end":{"line":412,"column":43}},"181":{"start":{"line":413,"column":10},"end":{"line":413,"column":36}},"182":{"start":{"line":414,"column":10},"end":{"line":414,"column":27}},"183":{"start":{"line":415,"column":10},"end":{"line":415,"column":49}},"184":{"start":{"line":417,"column":10},"end":{"line":417,"column":37}},"185":{"start":{"line":418,"column":10},"end":{"line":418,"column":29}},"186":{"start":{"line":423,"column":4},"end":{"line":427,"column":7}},"187":{"start":{"line":425,"column":8},"end":{"line":425,"column":28}},"188":{"start":{"line":437,"column":0},"end":{"line":442,"column":2}},"189":{"start":{"line":438,"column":2},"end":{"line":438,"column":30}},"190":{"start":{"line":439,"column":2},"end":{"line":439,"column":20}},"191":{"start":{"line":440,"column":2},"end":{"line":440,"column":28}},"192":{"start":{"line":441,"column":2},"end":{"line":441,"column":34}}},"branchMap":{"1":{"line":31,"type":"if","locations":[{"start":{"line":31,"column":2},"end":{"line":31,"column":2}},{"start":{"line":31,"column":2},"end":{"line":31,"column":2}}]},"2":{"line":32,"type":"if","locations":[{"start":{"line":32,"column":2},"end":{"line":32,"column":2}},{"start":{"line":32,"column":2},"end":{"line":32,"column":2}}]},"3":{"line":36,"type":"binary-expr","locations":[{"start":{"line":36,"column":9},"end":{"line":36,"column":13}},{"start":{"line":36,"column":17},"end":{"line":36,"column":19}}]},"4":{"line":38,"type":"binary-expr","locations":[{"start":{"line":38,"column":14},"end":{"line":38,"column":23}},{"start":{"line":38,"column":27},"end":{"line":38,"column":39}}]},"5":{"line":43,"type":"binary-expr","locations":[{"start":{"line":43,"column":28},"end":{"line":43,"column":53}},{"start":{"line":43,"column":57},"end":{"line":43,"column":65}}]},"6":{"line":44,"type":"binary-expr","locations":[{"start":{"line":44,"column":25},"end":{"line":44,"column":47}},{"start":{"line":44,"column":51},"end":{"line":44,"column":55}}]},"7":{"line":45,"type":"binary-expr","locations":[{"start":{"line":45,"column":28},"end":{"line":45,"column":53}},{"start":{"line":45,"column":57},"end":{"line":45,"column":61}}]},"8":{"line":46,"type":"cond-expr","locations":[{"start":{"line":46,"column":38},"end":{"line":46,"column":43}},{"start":{"line":46,"column":46},"end":{"line":46,"column":58}}]},"9":{"line":73,"type":"if","locations":[{"start":{"line":73,"column":2},"end":{"line":73,"column":2}},{"start":{"line":73,"column":2},"end":{"line":73,"column":2}}]},"10":{"line":87,"type":"if","locations":[{"start":{"line":87,"column":2},"end":{"line":87,"column":2}},{"start":{"line":87,"column":2},"end":{"line":87,"column":2}}]},"11":{"line":101,"type":"if","locations":[{"start":{"line":101,"column":2},"end":{"line":101,"column":2}},{"start":{"line":101,"column":2},"end":{"line":101,"column":2}}]},"12":{"line":115,"type":"if","locations":[{"start":{"line":115,"column":2},"end":{"line":115,"column":2}},{"start":{"line":115,"column":2},"end":{"line":115,"column":2}}]},"13":{"line":128,"type":"if","locations":[{"start":{"line":128,"column":2},"end":{"line":128,"column":2}},{"start":{"line":128,"column":2},"end":{"line":128,"column":2}}]},"14":{"line":141,"type":"if","locations":[{"start":{"line":141,"column":2},"end":{"line":141,"column":2}},{"start":{"line":141,"column":2},"end":{"line":141,"column":2}}]},"15":{"line":141,"type":"binary-expr","locations":[{"start":{"line":141,"column":6},"end":{"line":141,"column":25}},{"start":{"line":141,"column":29},"end":{"line":141,"column":47}},{"start":{"line":141,"column":51},"end":{"line":141,"column":69}}]},"16":{"line":160,"type":"if","locations":[{"start":{"line":160,"column":2},"end":{"line":160,"column":2}},{"start":{"line":160,"column":2},"end":{"line":160,"column":2}}]},"17":{"line":171,"type":"binary-expr","locations":[{"start":{"line":171,"column":4},"end":{"line":171,"column":6}},{"start":{"line":171,"column":10},"end":{"line":171,"column":14}}]},"18":{"line":180,"type":"if","locations":[{"start":{"line":180,"column":4},"end":{"line":180,"column":4}},{"start":{"line":180,"column":4},"end":{"line":180,"column":4}}]},"19":{"line":190,"type":"if","locations":[{"start":{"line":190,"column":2},"end":{"line":190,"column":2}},{"start":{"line":190,"column":2},"end":{"line":190,"column":2}}]},"20":{"line":280,"type":"if","locations":[{"start":{"line":280,"column":2},"end":{"line":280,"column":2}},{"start":{"line":280,"column":2},"end":{"line":280,"column":2}}]},"21":{"line":298,"type":"binary-expr","locations":[{"start":{"line":298,"column":2},"end":{"line":298,"column":18}},{"start":{"line":298,"column":22},"end":{"line":298,"column":34}}]},"22":{"line":312,"type":"if","locations":[{"start":{"line":312,"column":2},"end":{"line":312,"column":2}},{"start":{"line":312,"column":2},"end":{"line":312,"column":2}}]},"23":{"line":335,"type":"if","locations":[{"start":{"line":335,"column":2},"end":{"line":335,"column":2}},{"start":{"line":335,"column":2},"end":{"line":335,"column":2}}]},"24":{"line":335,"type":"binary-expr","locations":[{"start":{"line":335,"column":6},"end":{"line":335,"column":34}},{"start":{"line":335,"column":38},"end":{"line":335,"column":52}}]},"25":{"line":380,"type":"if","locations":[{"start":{"line":380,"column":2},"end":{"line":380,"column":2}},{"start":{"line":380,"column":2},"end":{"line":380,"column":2}}]},"26":{"line":380,"type":"binary-expr","locations":[{"start":{"line":380,"column":6},"end":{"line":380,"column":24}},{"start":{"line":380,"column":28},"end":{"line":380,"column":47}}]},"27":{"line":392,"type":"if","locations":[{"start":{"line":392,"column":2},"end":{"line":392,"column":2}},{"start":{"line":392,"column":2},"end":{"line":392,"column":2}}]},"28":{"line":397,"type":"if","locations":[{"start":{"line":397,"column":2},"end":{"line":397,"column":2}},{"start":{"line":397,"column":2},"end":{"line":397,"column":2}}]},"29":{"line":411,"type":"if","locations":[{"start":{"line":411,"column":8},"end":{"line":411,"column":8}},{"start":{"line":411,"column":8},"end":{"line":411,"column":8}}]}}},"/Users/guillermorauch/Projects/socket.io-client/lib/socket.js":{"path":"/Users/guillermorauch/Projects/socket.io-client/lib/socket.js","s":{"1":1,"2":1,"3":1,"4":1,"5":1,"6":1,"7":1,"8":1,"9":1,"10":1,"11":1,"12":1,"13":5,"14":5,"15":5,"16":5,"17":5,"18":5,"19":5,"20":5,"21":5,"22":1,"23":1,"24":5,"25":0,"26":5,"27":5,"28":5,"29":5,"30":0,"31":5,"32":1,"33":0,"34":0,"35":0,"36":0,"37":1,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":1,"53":0,"54":0,"55":1,"56":0,"57":1,"58":0,"59":0,"60":0,"61":1,"62":0,"63":0,"64":0,"65":0,"66":1,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":1,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":1,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0,"104":1,"105":0,"106":0,"107":0,"108":0,"109":1,"110":0,"111":0,"112":0,"113":0,"114":1,"115":0,"116":0,"117":0,"118":1,"119":0,"120":0,"121":0,"122":1,"123":0,"124":0,"125":0,"126":1,"127":2,"128":2,"129":0,"130":0,"131":0,"132":0,"133":0},"b":{"1":[0,5],"2":[0,5],"3":[0,0],"4":[0,0],"5":[0,0],"6":[0,0],"7":[0,0],"8":[0,0,0,0,0,0,0],"9":[0,0],"10":[0,0],"11":[0,0],"12":[0,0],"13":[0,0],"14":[2,0]},"f":{"1":5,"2":5,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":2},"fnMap":{"1":{"name":"Socket","line":46,"loc":{"start":{"line":46,"column":0},"end":{"line":46,"column":24}}},"2":{"name":"(anonymous_2)","line":71,"loc":{"start":{"line":71,"column":27},"end":{"line":71,"column":37}}},"3":{"name":"(anonymous_3)","line":92,"loc":{"start":{"line":92,"column":24},"end":{"line":92,"column":34}}},"4":{"name":"(anonymous_4)","line":108,"loc":{"start":{"line":108,"column":24},"end":{"line":108,"column":36}}},"5":{"name":"(anonymous_5)","line":138,"loc":{"start":{"line":138,"column":26},"end":{"line":138,"column":42}}},"6":{"name":"(anonymous_6)","line":150,"loc":{"start":{"line":150,"column":27},"end":{"line":150,"column":41}}},"7":{"name":"(anonymous_7)","line":160,"loc":{"start":{"line":160,"column":26},"end":{"line":160,"column":36}}},"8":{"name":"(anonymous_8)","line":176,"loc":{"start":{"line":176,"column":27},"end":{"line":176,"column":43}}},"9":{"name":"(anonymous_9)","line":190,"loc":{"start":{"line":190,"column":28},"end":{"line":190,"column":44}}},"10":{"name":"(anonymous_10)","line":231,"loc":{"start":{"line":231,"column":27},"end":{"line":231,"column":43}}},"11":{"name":"(anonymous_11)","line":253,"loc":{"start":{"line":253,"column":23},"end":{"line":253,"column":35}}},"12":{"name":"(anonymous_12)","line":256,"loc":{"start":{"line":256,"column":9},"end":{"line":256,"column":19}}},"13":{"name":"(anonymous_13)","line":279,"loc":{"start":{"line":279,"column":25},"end":{"line":279,"column":41}}},"14":{"name":"(anonymous_14)","line":292,"loc":{"start":{"line":292,"column":29},"end":{"line":292,"column":39}}},"15":{"name":"(anonymous_15)","line":305,"loc":{"start":{"line":305,"column":32},"end":{"line":305,"column":42}}},"16":{"name":"(anonymous_16)","line":318,"loc":{"start":{"line":318,"column":32},"end":{"line":318,"column":42}}},"17":{"name":"(anonymous_17)","line":332,"loc":{"start":{"line":332,"column":27},"end":{"line":332,"column":37}}},"18":{"name":"(anonymous_18)","line":349,"loc":{"start":{"line":349,"column":30},"end":{"line":349,"column":40}}}},"statementMap":{"1":{"start":{"line":6,"column":0},"end":{"line":6,"column":41}},"2":{"start":{"line":7,"column":0},"end":{"line":7,"column":33}},"3":{"start":{"line":8,"column":0},"end":{"line":8,"column":34}},"4":{"start":{"line":9,"column":0},"end":{"line":9,"column":25}},"5":{"start":{"line":10,"column":0},"end":{"line":10,"column":27}},"6":{"start":{"line":11,"column":0},"end":{"line":11,"column":56}},"7":{"start":{"line":12,"column":0},"end":{"line":12,"column":40}},"8":{"start":{"line":13,"column":0},"end":{"line":13,"column":33}},"9":{"start":{"line":19,"column":0},"end":{"line":19,"column":34}},"10":{"start":{"line":28,"column":0},"end":{"line":32,"column":2}},"11":{"start":{"line":38,"column":0},"end":{"line":38,"column":34}},"12":{"start":{"line":46,"column":0},"end":{"line":56,"column":1}},"13":{"start":{"line":47,"column":2},"end":{"line":47,"column":15}},"14":{"start":{"line":48,"column":2},"end":{"line":48,"column":17}},"15":{"start":{"line":49,"column":2},"end":{"line":49,"column":19}},"16":{"start":{"line":50,"column":2},"end":{"line":50,"column":15}},"17":{"start":{"line":51,"column":2},"end":{"line":51,"column":17}},"18":{"start":{"line":52,"column":2},"end":{"line":52,"column":14}},"19":{"start":{"line":53,"column":2},"end":{"line":53,"column":19}},"20":{"start":{"line":54,"column":2},"end":{"line":54,"column":25}},"21":{"start":{"line":55,"column":2},"end":{"line":55,"column":27}},"22":{"start":{"line":62,"column":0},"end":{"line":62,"column":26}},"23":{"start":{"line":70,"column":0},"end":{"line":83,"column":2}},"24":{"start":{"line":72,"column":2},"end":{"line":72,"column":34}},"25":{"start":{"line":72,"column":22},"end":{"line":72,"column":34}},"26":{"start":{"line":73,"column":2},"end":{"line":73,"column":19}},"27":{"start":{"line":74,"column":2},"end":{"line":74,"column":12}},"28":{"start":{"line":75,"column":2},"end":{"line":80,"column":4}},"29":{"start":{"line":81,"column":2},"end":{"line":81,"column":50}},"30":{"start":{"line":81,"column":36},"end":{"line":81,"column":50}},"31":{"start":{"line":82,"column":2},"end":{"line":82,"column":14}},"32":{"start":{"line":92,"column":0},"end":{"line":97,"column":2}},"33":{"start":{"line":93,"column":2},"end":{"line":93,"column":32}},"34":{"start":{"line":94,"column":2},"end":{"line":94,"column":26}},"35":{"start":{"line":95,"column":2},"end":{"line":95,"column":30}},"36":{"start":{"line":96,"column":2},"end":{"line":96,"column":14}},"37":{"start":{"line":108,"column":0},"end":{"line":129,"column":2}},"38":{"start":{"line":109,"column":2},"end":{"line":112,"column":3}},"39":{"start":{"line":110,"column":4},"end":{"line":110,"column":32}},"40":{"start":{"line":111,"column":4},"end":{"line":111,"column":16}},"41":{"start":{"line":114,"column":2},"end":{"line":114,"column":32}},"42":{"start":{"line":115,"column":2},"end":{"line":115,"column":32}},"43":{"start":{"line":116,"column":2},"end":{"line":116,"column":57}},"44":{"start":{"line":116,"column":22},"end":{"line":116,"column":55}},"45":{"start":{"line":117,"column":2},"end":{"line":117,"column":48}},"46":{"start":{"line":120,"column":2},"end":{"line":124,"column":3}},"47":{"start":{"line":121,"column":4},"end":{"line":121,"column":54}},"48":{"start":{"line":122,"column":4},"end":{"line":122,"column":37}},"49":{"start":{"line":123,"column":4},"end":{"line":123,"column":27}},"50":{"start":{"line":126,"column":2},"end":{"line":126,"column":22}},"51":{"start":{"line":128,"column":2},"end":{"line":128,"column":14}},"52":{"start":{"line":138,"column":0},"end":{"line":141,"column":2}},"53":{"start":{"line":139,"column":2},"end":{"line":139,"column":24}},"54":{"start":{"line":140,"column":2},"end":{"line":140,"column":25}},"55":{"start":{"line":150,"column":0},"end":{"line":152,"column":2}},"56":{"start":{"line":151,"column":2},"end":{"line":151,"column":27}},"57":{"start":{"line":160,"column":0},"end":{"line":167,"column":2}},"58":{"start":{"line":161,"column":2},"end":{"line":161,"column":42}},"59":{"start":{"line":164,"column":2},"end":{"line":166,"column":3}},"60":{"start":{"line":165,"column":4},"end":{"line":165,"column":42}},"61":{"start":{"line":176,"column":0},"end":{"line":181,"column":2}},"62":{"start":{"line":177,"column":2},"end":{"line":177,"column":30}},"63":{"start":{"line":178,"column":2},"end":{"line":178,"column":25}},"64":{"start":{"line":179,"column":2},"end":{"line":179,"column":27}},"65":{"start":{"line":180,"column":2},"end":{"line":180,"column":34}},"66":{"start":{"line":190,"column":0},"end":{"line":222,"column":2}},"67":{"start":{"line":191,"column":2},"end":{"line":191,"column":37}},"68":{"start":{"line":191,"column":30},"end":{"line":191,"column":37}},"69":{"start":{"line":193,"column":2},"end":{"line":221,"column":3}},"70":{"start":{"line":195,"column":6},"end":{"line":195,"column":23}},"71":{"start":{"line":196,"column":6},"end":{"line":196,"column":12}},"72":{"start":{"line":199,"column":6},"end":{"line":199,"column":27}},"73":{"start":{"line":200,"column":6},"end":{"line":200,"column":12}},"74":{"start":{"line":203,"column":6},"end":{"line":203,"column":27}},"75":{"start":{"line":204,"column":6},"end":{"line":204,"column":12}},"76":{"start":{"line":207,"column":6},"end":{"line":207,"column":25}},"77":{"start":{"line":208,"column":6},"end":{"line":208,"column":12}},"78":{"start":{"line":211,"column":6},"end":{"line":211,"column":25}},"79":{"start":{"line":212,"column":6},"end":{"line":212,"column":12}},"80":{"start":{"line":215,"column":6},"end":{"line":215,"column":26}},"81":{"start":{"line":216,"column":6},"end":{"line":216,"column":12}},"82":{"start":{"line":219,"column":6},"end":{"line":219,"column":38}},"83":{"start":{"line":220,"column":6},"end":{"line":220,"column":12}},"84":{"start":{"line":231,"column":0},"end":{"line":245,"column":2}},"85":{"start":{"line":232,"column":2},"end":{"line":232,"column":31}},"86":{"start":{"line":233,"column":2},"end":{"line":233,"column":35}},"87":{"start":{"line":235,"column":2},"end":{"line":238,"column":3}},"88":{"start":{"line":236,"column":4},"end":{"line":236,"column":45}},"89":{"start":{"line":237,"column":4},"end":{"line":237,"column":35}},"90":{"start":{"line":240,"column":2},"end":{"line":244,"column":3}},"91":{"start":{"line":241,"column":4},"end":{"line":241,"column":27}},"92":{"start":{"line":243,"column":4},"end":{"line":243,"column":27}},"93":{"start":{"line":253,"column":0},"end":{"line":270,"column":2}},"94":{"start":{"line":254,"column":2},"end":{"line":254,"column":18}},"95":{"start":{"line":255,"column":2},"end":{"line":255,"column":19}},"96":{"start":{"line":256,"column":2},"end":{"line":269,"column":4}},"97":{"start":{"line":258,"column":4},"end":{"line":258,"column":21}},"98":{"start":{"line":258,"column":14},"end":{"line":258,"column":21}},"99":{"start":{"line":259,"column":4},"end":{"line":259,"column":16}},"100":{"start":{"line":260,"column":4},"end":{"line":260,"column":34}},"101":{"start":{"line":261,"column":4},"end":{"line":261,"column":34}},"102":{"start":{"line":263,"column":4},"end":{"line":263,"column":61}},"103":{"start":{"line":264,"column":4},"end":{"line":268,"column":7}},"104":{"start":{"line":279,"column":0},"end":{"line":284,"column":2}},"105":{"start":{"line":280,"column":2},"end":{"line":280,"column":58}},"106":{"start":{"line":281,"column":2},"end":{"line":281,"column":32}},"107":{"start":{"line":282,"column":2},"end":{"line":282,"column":30}},"108":{"start":{"line":283,"column":2},"end":{"line":283,"column":30}},"109":{"start":{"line":292,"column":0},"end":{"line":297,"column":2}},"110":{"start":{"line":293,"column":2},"end":{"line":293,"column":24}},"111":{"start":{"line":294,"column":2},"end":{"line":294,"column":28}},"112":{"start":{"line":295,"column":2},"end":{"line":295,"column":23}},"113":{"start":{"line":296,"column":2},"end":{"line":296,"column":22}},"114":{"start":{"line":305,"column":0},"end":{"line":310,"column":2}},"115":{"start":{"line":306,"column":2},"end":{"line":308,"column":3}},"116":{"start":{"line":307,"column":4},"end":{"line":307,"column":37}},"117":{"start":{"line":309,"column":2},"end":{"line":309,"column":19}},"118":{"start":{"line":318,"column":0},"end":{"line":322,"column":2}},"119":{"start":{"line":319,"column":2},"end":{"line":319,"column":44}},"120":{"start":{"line":320,"column":2},"end":{"line":320,"column":17}},"121":{"start":{"line":321,"column":2},"end":{"line":321,"column":39}},"122":{"start":{"line":332,"column":0},"end":{"line":339,"column":2}},"123":{"start":{"line":334,"column":2},"end":{"line":336,"column":3}},"124":{"start":{"line":335,"column":4},"end":{"line":335,"column":27}},"125":{"start":{"line":338,"column":2},"end":{"line":338,"column":24}},"126":{"start":{"line":348,"column":0},"end":{"line":361,"column":2}},"127":{"start":{"line":350,"column":2},"end":{"line":350,"column":35}},"128":{"start":{"line":350,"column":23},"end":{"line":350,"column":35}},"129":{"start":{"line":352,"column":2},"end":{"line":352,"column":48}},"130":{"start":{"line":353,"column":2},"end":{"line":353,"column":43}},"131":{"start":{"line":356,"column":2},"end":{"line":356,"column":17}},"132":{"start":{"line":359,"column":2},"end":{"line":359,"column":39}},"133":{"start":{"line":360,"column":2},"end":{"line":360,"column":14}}},"branchMap":{"1":{"line":72,"type":"if","locations":[{"start":{"line":72,"column":2},"end":{"line":72,"column":2}},{"start":{"line":72,"column":2},"end":{"line":72,"column":2}}]},"2":{"line":81,"type":"if","locations":[{"start":{"line":81,"column":2},"end":{"line":81,"column":2}},{"start":{"line":81,"column":2},"end":{"line":81,"column":2}}]},"3":{"line":109,"type":"if","locations":[{"start":{"line":109,"column":2},"end":{"line":109,"column":2}},{"start":{"line":109,"column":2},"end":{"line":109,"column":2}}]},"4":{"line":116,"type":"if","locations":[{"start":{"line":116,"column":2},"end":{"line":116,"column":2}},{"start":{"line":116,"column":2},"end":{"line":116,"column":2}}]},"5":{"line":120,"type":"if","locations":[{"start":{"line":120,"column":2},"end":{"line":120,"column":2}},{"start":{"line":120,"column":2},"end":{"line":120,"column":2}}]},"6":{"line":164,"type":"if","locations":[{"start":{"line":164,"column":2},"end":{"line":164,"column":2}},{"start":{"line":164,"column":2},"end":{"line":164,"column":2}}]},"7":{"line":191,"type":"if","locations":[{"start":{"line":191,"column":2},"end":{"line":191,"column":2}},{"start":{"line":191,"column":2},"end":{"line":191,"column":2}}]},"8":{"line":193,"type":"switch","locations":[{"start":{"line":194,"column":4},"end":{"line":196,"column":12}},{"start":{"line":198,"column":4},"end":{"line":200,"column":12}},{"start":{"line":202,"column":4},"end":{"line":204,"column":12}},{"start":{"line":206,"column":4},"end":{"line":208,"column":12}},{"start":{"line":210,"column":4},"end":{"line":212,"column":12}},{"start":{"line":214,"column":4},"end":{"line":216,"column":12}},{"start":{"line":218,"column":4},"end":{"line":220,"column":12}}]},"9":{"line":232,"type":"binary-expr","locations":[{"start":{"line":232,"column":13},"end":{"line":232,"column":24}},{"start":{"line":232,"column":28},"end":{"line":232,"column":30}}]},"10":{"line":235,"type":"if","locations":[{"start":{"line":235,"column":2},"end":{"line":235,"column":2}},{"start":{"line":235,"column":2},"end":{"line":235,"column":2}}]},"11":{"line":240,"type":"if","locations":[{"start":{"line":240,"column":2},"end":{"line":240,"column":2}},{"start":{"line":240,"column":2},"end":{"line":240,"column":2}}]},"12":{"line":258,"type":"if","locations":[{"start":{"line":258,"column":4},"end":{"line":258,"column":4}},{"start":{"line":258,"column":4},"end":{"line":258,"column":4}}]},"13":{"line":263,"type":"cond-expr","locations":[{"start":{"line":263,"column":30},"end":{"line":263,"column":47}},{"start":{"line":263,"column":50},"end":{"line":263,"column":60}}]},"14":{"line":350,"type":"if","locations":[{"start":{"line":350,"column":2},"end":{"line":350,"column":2}},{"start":{"line":350,"column":2},"end":{"line":350,"column":2}}]}}},"/Users/guillermorauch/Projects/socket.io-client/lib/on.js":{"path":"/Users/guillermorauch/Projects/socket.io-client/lib/on.js","s":{"1":1,"2":1,"3":50,"4":50,"5":33},"b":{},"f":{"1":50,"2":33},"fnMap":{"1":{"name":"on","line":17,"loc":{"start":{"line":17,"column":0},"end":{"line":17,"column":25}}},"2":{"name":"(anonymous_2)","line":20,"loc":{"start":{"line":20,"column":13},"end":{"line":20,"column":23}}}},"statementMap":{"1":{"start":{"line":6,"column":0},"end":{"line":6,"column":20}},"2":{"start":{"line":17,"column":0},"end":{"line":24,"column":1}},"3":{"start":{"line":18,"column":2},"end":{"line":18,"column":17}},"4":{"start":{"line":19,"column":2},"end":{"line":23,"column":4}},"5":{"start":{"line":21,"column":6},"end":{"line":21,"column":33}}},"branchMap":{}}} \ No newline at end of file diff --git a/node_modules/socket.io/node_modules/socket.io-client/coverage/lcov-report/index.html b/node_modules/socket.io/node_modules/socket.io-client/coverage/lcov-report/index.html new file mode 100644 index 0000000..19a18d2 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-client/coverage/lcov-report/index.html @@ -0,0 +1,363 @@ + + + + Code coverage report for All files + + + + + + + +
+

Code coverage report for All files

+

+ + Statements: 61.36% (235 / 383)      + + + Branches: 53.91% (69 / 128)      + + + Functions: 46.15% (24 / 52)      + + + Lines: 62.13% (228 / 367)      + + Ignored: none      +

+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
socket.io-client/100%(1 / 1)100%(0 / 0)100%(0 / 0)100%(1 / 1)
socket.io-client/lib/61.26%(234 / 382)53.91%(69 / 128)46.15%(24 / 52)62.02%(227 / 366)
+
+
+ + + + + + + + diff --git a/node_modules/socket.io/node_modules/socket.io-client/coverage/lcov-report/lib/index.html b/node_modules/socket.io/node_modules/socket.io-client/coverage/lcov-report/lib/index.html new file mode 100644 index 0000000..9a1e120 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-client/coverage/lcov-report/lib/index.html @@ -0,0 +1,350 @@ + + + + Code coverage report for lib/ + + + + + + + +
+

Code coverage report for lib/

+

+ + Statements: 90.48% (19 / 21)      + + + Branches: 80% (16 / 20)      + + + Functions: 100% (1 / 1)      + + + Lines: 95% (19 / 20)      + + Ignored: none      +

+
All files » lib/
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
url.js90.48%(19 / 21)80%(16 / 20)100%(1 / 1)95%(19 / 20)
+
+
+ + + + + + + + diff --git a/node_modules/socket.io/node_modules/socket.io-client/coverage/lcov-report/lib/url.js.html b/node_modules/socket.io/node_modules/socket.io-client/coverage/lcov-report/lib/url.js.html new file mode 100644 index 0000000..f20b042 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-client/coverage/lcov-report/lib/url.js.html @@ -0,0 +1,499 @@ + + + + Code coverage report for lib/url.js + + + + + + + +
+

Code coverage report for lib/url.js

+

+ + Statements: 90.48% (19 / 21)      + + + Branches: 80% (16 / 20)      + + + Functions: 100% (1 / 1)      + + + Lines: 95% (19 / 20)      + + Ignored: none      +

+
All files » lib/ » url.js
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60  +  +  +  +  +1 +  +  +  +  +  +  +1 +  +  +  +  +  +  +  +  +1 +8 +  +8 +  +8 +8 +2 +2 +  +  +  +  +8 +3 +3 +3 +  +  +  +  +  +  +8 +8 +  +  +  +8 +  +1 +  +  +  +8 +  +8 +  + 
 
+/**
+ * Module dependencies.
+ */
+ 
+var url = require('url')
+  , debug = require('debug')('socket.io-client:url');
+ 
+/**
+ * Module exports.
+ */
+ 
+module.exports = parse;
+ 
+/**
+ * URL parser.
+ *
+ * @param {String} url
+ * @api public
+ */
+ 
+function parse(uri){
+  var obj = uri;
+ 
+  Iif (null == url) url = location.protocol + '//' + location.hostname;
+ 
+  Eif ('string' == typeof uri) {
+    if ('/' == uri.charAt(0)) {
+      Eif ('undefined' != typeof location) {
+        uri = location.hostname + uri;
+      }
+    }
+ 
+    // allow for `localhost:3000`
+    if (!/^(https?|wss?):\/\//.test(uri)) {
+      debug('protocol-less url %s', uri);
+      Eif ('undefined' != typeof location) {
+        uri = location.protocol + '//' + uri;
+      } else {
+        uri = 'https://' + uri;
+      }
+    }
+ 
+    // parse
+    debug('parse %s', uri);
+    obj = url.parse(uri);
+  }
+ 
+  // make sure we treat `localhost:80` and `localhost` equally
+  if ((/(http|ws):/.test(obj.protocol) && 80 == obj.port) ||
+     (/(http|ws)s:/.test(obj.protocol) && 443 == obj.port)) {
+    delete obj.port;
+  }
+ 
+  // define unique id
+  obj.id = obj.protocol + obj.hostname + (obj.port ? (':' + obj.port) : '');
+ 
+  return obj;
+}
+ 
+ +
+ + + + + + + + diff --git a/node_modules/socket.io/node_modules/socket.io-client/coverage/lcov-report/prettify.css b/node_modules/socket.io/node_modules/socket.io-client/coverage/lcov-report/prettify.css new file mode 100644 index 0000000..b317a7c --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-client/coverage/lcov-report/prettify.css @@ -0,0 +1 @@ +.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} diff --git a/node_modules/socket.io/node_modules/socket.io-client/coverage/lcov-report/prettify.js b/node_modules/socket.io/node_modules/socket.io-client/coverage/lcov-report/prettify.js new file mode 100644 index 0000000..ef51e03 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-client/coverage/lcov-report/prettify.js @@ -0,0 +1 @@ +window.PR_SHOULD_USE_CONTINUATION=true;(function(){var h=["break,continue,do,else,for,if,return,while"];var u=[h,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"];var p=[u,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"];var l=[p,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"];var x=[p,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"];var R=[x,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"];var r="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes";var w=[p,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"];var s="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END";var I=[h,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"];var f=[h,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"];var H=[h,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"];var A=[l,R,w,s+I,f,H];var e=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/;var C="str";var z="kwd";var j="com";var O="typ";var G="lit";var L="pun";var F="pln";var m="tag";var E="dec";var J="src";var P="atn";var n="atv";var N="nocode";var M="(?:^^\\.?|[+-]|\\!|\\!=|\\!==|\\#|\\%|\\%=|&|&&|&&=|&=|\\(|\\*|\\*=|\\+=|\\,|\\-=|\\->|\\/|\\/=|:|::|\\;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\@|\\[|\\^|\\^=|\\^\\^|\\^\\^=|\\{|\\||\\|=|\\|\\||\\|\\|=|\\~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function k(Z){var ad=0;var S=false;var ac=false;for(var V=0,U=Z.length;V122)){if(!(al<65||ag>90)){af.push([Math.max(65,ag)|32,Math.min(al,90)|32])}if(!(al<97||ag>122)){af.push([Math.max(97,ag)&~32,Math.min(al,122)&~32])}}}}af.sort(function(av,au){return(av[0]-au[0])||(au[1]-av[1])});var ai=[];var ap=[NaN,NaN];for(var ar=0;arat[0]){if(at[1]+1>at[0]){an.push("-")}an.push(T(at[1]))}}an.push("]");return an.join("")}function W(al){var aj=al.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g"));var ah=aj.length;var an=[];for(var ak=0,am=0;ak=2&&ai==="["){aj[ak]=X(ag)}else{if(ai!=="\\"){aj[ak]=ag.replace(/[a-zA-Z]/g,function(ao){var ap=ao.charCodeAt(0);return"["+String.fromCharCode(ap&~32,ap|32)+"]"})}}}}return aj.join("")}var aa=[];for(var V=0,U=Z.length;V=0;){S[ac.charAt(ae)]=Y}}var af=Y[1];var aa=""+af;if(!ag.hasOwnProperty(aa)){ah.push(af);ag[aa]=null}}ah.push(/[\0-\uffff]/);V=k(ah)})();var X=T.length;var W=function(ah){var Z=ah.sourceCode,Y=ah.basePos;var ad=[Y,F];var af=0;var an=Z.match(V)||[];var aj={};for(var ae=0,aq=an.length;ae=5&&"lang-"===ap.substring(0,5);if(am&&!(ai&&typeof ai[1]==="string")){am=false;ap=J}if(!am){aj[ag]=ap}}var ab=af;af+=ag.length;if(!am){ad.push(Y+ab,ap)}else{var al=ai[1];var ak=ag.indexOf(al);var ac=ak+al.length;if(ai[2]){ac=ag.length-ai[2].length;ak=ac-al.length}var ar=ap.substring(5);B(Y+ab,ag.substring(0,ak),W,ad);B(Y+ab+ak,al,q(ar,al),ad);B(Y+ab+ac,ag.substring(ac),W,ad)}}ah.decorations=ad};return W}function i(T){var W=[],S=[];if(T.tripleQuotedStrings){W.push([C,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""])}else{if(T.multiLineStrings){W.push([C,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"])}else{W.push([C,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"])}}if(T.verbatimStrings){S.push([C,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null])}var Y=T.hashComments;if(Y){if(T.cStyleComments){if(Y>1){W.push([j,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"])}else{W.push([j,/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"])}S.push([C,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,null])}else{W.push([j,/^#[^\r\n]*/,null,"#"])}}if(T.cStyleComments){S.push([j,/^\/\/[^\r\n]*/,null]);S.push([j,/^\/\*[\s\S]*?(?:\*\/|$)/,null])}if(T.regexLiterals){var X=("/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/");S.push(["lang-regex",new RegExp("^"+M+"("+X+")")])}var V=T.types;if(V){S.push([O,V])}var U=(""+T.keywords).replace(/^ | $/g,"");if(U.length){S.push([z,new RegExp("^(?:"+U.replace(/[\s,]+/g,"|")+")\\b"),null])}W.push([F,/^\s+/,null," \r\n\t\xA0"]);S.push([G,/^@[a-z_$][a-z_$@0-9]*/i,null],[O,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[F,/^[a-z_$][a-z_$@0-9]*/i,null],[G,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[F,/^\\[\s\S]?/,null],[L,/^.[^\s\w\.$@\'\"\`\/\#\\]*/,null]);return g(W,S)}var K=i({keywords:A,hashComments:true,cStyleComments:true,multiLineStrings:true,regexLiterals:true});function Q(V,ag){var U=/(?:^|\s)nocode(?:\s|$)/;var ab=/\r\n?|\n/;var ac=V.ownerDocument;var S;if(V.currentStyle){S=V.currentStyle.whiteSpace}else{if(window.getComputedStyle){S=ac.defaultView.getComputedStyle(V,null).getPropertyValue("white-space")}}var Z=S&&"pre"===S.substring(0,3);var af=ac.createElement("LI");while(V.firstChild){af.appendChild(V.firstChild)}var W=[af];function ae(al){switch(al.nodeType){case 1:if(U.test(al.className)){break}if("BR"===al.nodeName){ad(al);if(al.parentNode){al.parentNode.removeChild(al)}}else{for(var an=al.firstChild;an;an=an.nextSibling){ae(an)}}break;case 3:case 4:if(Z){var am=al.nodeValue;var aj=am.match(ab);if(aj){var ai=am.substring(0,aj.index);al.nodeValue=ai;var ah=am.substring(aj.index+aj[0].length);if(ah){var ak=al.parentNode;ak.insertBefore(ac.createTextNode(ah),al.nextSibling)}ad(al);if(!ai){al.parentNode.removeChild(al)}}}break}}function ad(ak){while(!ak.nextSibling){ak=ak.parentNode;if(!ak){return}}function ai(al,ar){var aq=ar?al.cloneNode(false):al;var ao=al.parentNode;if(ao){var ap=ai(ao,1);var an=al.nextSibling;ap.appendChild(aq);for(var am=an;am;am=an){an=am.nextSibling;ap.appendChild(am)}}return aq}var ah=ai(ak.nextSibling,0);for(var aj;(aj=ah.parentNode)&&aj.nodeType===1;){ah=aj}W.push(ah)}for(var Y=0;Y=S){ah+=2}if(V>=ap){Z+=2}}}var t={};function c(U,V){for(var S=V.length;--S>=0;){var T=V[S];if(!t.hasOwnProperty(T)){t[T]=U}else{if(window.console){console.warn("cannot override language handler %s",T)}}}}function q(T,S){if(!(T&&t.hasOwnProperty(T))){T=/^\s*]*(?:>|$)/],[j,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[L,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);c(g([[F,/^[\s]+/,null," \t\r\n"],[n,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[[m,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[P,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[L,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]);c(g([],[[n,/^[\s\S]+/]]),["uq.val"]);c(i({keywords:l,hashComments:true,cStyleComments:true,types:e}),["c","cc","cpp","cxx","cyc","m"]);c(i({keywords:"null,true,false"}),["json"]);c(i({keywords:R,hashComments:true,cStyleComments:true,verbatimStrings:true,types:e}),["cs"]);c(i({keywords:x,cStyleComments:true}),["java"]);c(i({keywords:H,hashComments:true,multiLineStrings:true}),["bsh","csh","sh"]);c(i({keywords:I,hashComments:true,multiLineStrings:true,tripleQuotedStrings:true}),["cv","py"]);c(i({keywords:s,hashComments:true,multiLineStrings:true,regexLiterals:true}),["perl","pl","pm"]);c(i({keywords:f,hashComments:true,multiLineStrings:true,regexLiterals:true}),["rb"]);c(i({keywords:w,cStyleComments:true,regexLiterals:true}),["js"]);c(i({keywords:r,hashComments:3,cStyleComments:true,multilineStrings:true,tripleQuotedStrings:true,regexLiterals:true}),["coffee"]);c(g([],[[C,/^[\s\S]+/]]),["regex"]);function d(V){var U=V.langExtension;try{var S=a(V.sourceNode);var T=S.sourceCode;V.sourceCode=T;V.spans=S.spans;V.basePos=0;q(U,T)(V);D(V)}catch(W){if("console" in window){console.log(W&&W.stack?W.stack:W)}}}function y(W,V,U){var S=document.createElement("PRE");S.innerHTML=W;if(U){Q(S,U)}var T={langExtension:V,numberLines:U,sourceNode:S};d(T);return S.innerHTML}function b(ad){function Y(af){return document.getElementsByTagName(af)}var ac=[Y("pre"),Y("code"),Y("xmp")];var T=[];for(var aa=0;aa=0){var ah=ai.match(ab);var am;if(!ah&&(am=o(aj))&&"CODE"===am.tagName){ah=am.className.match(ab)}if(ah){ah=ah[1]}var al=false;for(var ak=aj.parentNode;ak;ak=ak.parentNode){if((ak.tagName==="pre"||ak.tagName==="code"||ak.tagName==="xmp")&&ak.className&&ak.className.indexOf("prettyprint")>=0){al=true;break}}if(!al){var af=aj.className.match(/\blinenums\b(?::(\d+))?/);af=af?af[1]&&af[1].length?+af[1]:true:false;if(af){Q(aj,af)}S={langExtension:ah,sourceNode:aj,numberLines:af};d(S)}}}if(X]*(?:>|$)/],[PR.PR_COMMENT,/^<\!--[\s\S]*?(?:-\->|$)/],[PR.PR_PUNCTUATION,/^(?:<[%?]|[%?]>)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-handlebars",/^]*type\s*=\s*['"]?text\/x-handlebars-template['"]?\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i],[PR.PR_DECLARATION,/^{{[#^>/]?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{&?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{{>?\s*[\w.][^}]*}}}/],[PR.PR_COMMENT,/^{{![^}]*}}/]]),["handlebars","hbs"]);PR.registerLangHandler(PR.createSimpleLexer([[PR.PR_PLAIN,/^[ \t\r\n\f]+/,null," \t\r\n\f"]],[[PR.PR_STRING,/^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/,null],[PR.PR_STRING,/^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/,null],["lang-css-str",/^url\(([^\)\"\']*)\)/i],[PR.PR_KEYWORD,/^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*)\s*:/i],[PR.PR_COMMENT,/^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//],[PR.PR_COMMENT,/^(?:)/],[PR.PR_LITERAL,/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],[PR.PR_LITERAL,/^#(?:[0-9a-f]{3}){1,2}/i],[PR.PR_PLAIN,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i],[PR.PR_PUNCTUATION,/^[^\s\w\'\"]+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_KEYWORD,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_STRING,/^[^\)\"\']+/]]),["css-str"]); diff --git a/node_modules/socket.io/node_modules/socket.io-client/coverage/lcov-report/socket.io-client/index.html b/node_modules/socket.io/node_modules/socket.io-client/coverage/lcov-report/socket.io-client/index.html new file mode 100644 index 0000000..9ef9107 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-client/coverage/lcov-report/socket.io-client/index.html @@ -0,0 +1,350 @@ + + + + Code coverage report for socket.io-client/ + + + + + + + +
+

Code coverage report for socket.io-client/

+

+ + Statements: 100% (1 / 1)      + + + Branches: 100% (0 / 0)      + + + Functions: 100% (0 / 0)      + + + Lines: 100% (1 / 1)      + + Ignored: none      +

+
All files » socket.io-client/
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
index.js100%(1 / 1)100%(0 / 0)100%(0 / 0)100%(1 / 1)
+
+
+ + + + + + + + diff --git a/node_modules/socket.io/node_modules/socket.io-client/coverage/lcov-report/socket.io-client/index.js.html b/node_modules/socket.io/node_modules/socket.io-client/coverage/lcov-report/socket.io-client/index.js.html new file mode 100644 index 0000000..e1be5ce --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-client/coverage/lcov-report/socket.io-client/index.js.html @@ -0,0 +1,328 @@ + + + + Code coverage report for socket.io-client/index.js + + + + + + + +
+

Code coverage report for socket.io-client/index.js

+

+ + Statements: 100% (1 / 1)      + + + Branches: 100% (0 / 0)      + + + Functions: 100% (0 / 0)      + + + Lines: 100% (1 / 1)      + + Ignored: none      +

+ +
+
+

+
+
1 +2 +3  +1 + 
 
+module.exports = require('./lib/');
+ 
+ +
+ + + + + + + + diff --git a/node_modules/socket.io/node_modules/socket.io-client/coverage/lcov-report/socket.io-client/lib/index.html b/node_modules/socket.io/node_modules/socket.io-client/coverage/lcov-report/socket.io-client/lib/index.html new file mode 100644 index 0000000..0a95bbd --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-client/coverage/lcov-report/socket.io-client/lib/index.html @@ -0,0 +1,402 @@ + + + + Code coverage report for socket.io-client/lib/ + + + + + + + +
+

Code coverage report for socket.io-client/lib/

+

+ + Statements: 61.26% (234 / 382)      + + + Branches: 53.91% (69 / 128)      + + + Functions: 46.15% (24 / 52)      + + + Lines: 62.02% (227 / 366)      + + Ignored: none      +

+
All files » socket.io-client/lib/
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
index.js51.85%(14 / 27)30%(3 / 10)100%(1 / 1)51.85%(14 / 27)
manager.js75%(144 / 192)64.41%(38 / 59)56.67%(17 / 30)75.96%(139 / 183)
on.js100%(5 / 5)100%(0 / 0)100%(2 / 2)100%(5 / 5)
socket.js34.59%(46 / 133)9.09%(3 / 33)16.67%(3 / 18)35.43%(45 / 127)
url.js100%(25 / 25)96.15%(25 / 26)100%(1 / 1)100%(24 / 24)
+
+
+ + + + + + + + diff --git a/node_modules/socket.io/node_modules/socket.io-client/coverage/lcov-report/socket.io-client/lib/index.js.html b/node_modules/socket.io/node_modules/socket.io-client/coverage/lcov-report/socket.io-client/lib/index.js.html new file mode 100644 index 0000000..2f027c7 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-client/coverage/lcov-report/socket.io-client/lib/index.js.html @@ -0,0 +1,583 @@ + + + + Code coverage report for socket.io-client/lib/index.js + + + + + + + +
+

Code coverage report for socket.io-client/lib/index.js

+

+ + Statements: 51.85% (14 / 27)      + + + Branches: 30% (3 / 10)      + + + Functions: 100% (1 / 1)      + + + Lines: 51.85% (14 / 27)      + + Ignored: none      +

+ +
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88  +  +  +  +  +1 +1 +1 +1 +  +  +  +  +  +1 +  +  +  +  +  +1 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +1 +12 +  +  +  +  +12 +  +12 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +1 +  +  +  +  +  +  +  +  +1 +  +  +  +  +  +  +  +1 +1 + 
 
+/**
+ * Module dependencies.
+ */
+ 
+var url = require('./url');
+var parser = require('socket.io-parser');
+var Manager = require('./manager');
+var debug = require('debug')('socket.io-client');
+ 
+/**
+ * Module exports.
+ */
+ 
+module.exports = exports = lookup;
+ 
+/**
+ * Managers cache.
+ */
+ 
+var cache = exports.managers = {};
+ 
+/**
+ * Looks up an existing `Manager` for multiplexing.
+ * If the user summons:
+ *
+ *   `io('http://localhost/a');`
+ *   `io('http://localhost/b');`
+ *
+ * We reuse the existing instance based on same scheme/port/host,
+ * and we initialize sockets for each namespace.
+ *
+ * @api public
+ */
+ 
+function lookup(uri, opts) {
+  Iif (typeof uri == 'object') {
+    opts = uri;
+    uri = undefined;
+  }
+ 
+  opts = opts || {};
+ 
+  var parsed = url(uri);
+  var source = parsed.source;
+  var id = parsed.id;
+  var io;
+ 
+  if (opts.forceNew || false === opts.multiplex) {
+    debug('ignoring socket cache for %s', source);
+    io = Manager(source, opts);
+  } else {
+    if (!cache[id]) {
+      debug('new io instance for %s', source);
+      cache[id] = Manager(source, opts);
+    }
+    io = cache[id];
+  }
+ 
+  return io.socket(parsed.path);
+}
+ 
+/**
+ * Protocol version.
+ *
+ * @api public
+ */
+ 
+exports.protocol = parser.protocol;
+ 
+/**
+ * `connect`.
+ *
+ * @param {String} uri
+ * @api public
+ */
+ 
+exports.connect = lookup;
+ 
+/**
+ * Expose constructors for standalone build.
+ *
+ * @api public
+ */
+ 
+exports.Manager = require('./manager');
+exports.Socket = require('./socket');
+ 
+ +
+ + + + + + + + diff --git a/node_modules/socket.io/node_modules/socket.io-client/coverage/lcov-report/socket.io-client/lib/manager.js.html b/node_modules/socket.io/node_modules/socket.io-client/coverage/lcov-report/socket.io-client/lib/manager.js.html new file mode 100644 index 0000000..9cc01d9 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-client/coverage/lcov-report/socket.io-client/lib/manager.js.html @@ -0,0 +1,1648 @@ + + + + Code coverage report for socket.io-client/lib/manager.js + + + + + + + +
+

Code coverage report for socket.io-client/lib/manager.js

+

+ + Statements: 75% (144 / 192)      + + + Branches: 64.41% (38 / 59)      + + + Functions: 56.67% (17 / 30)      + + + Lines: 75.96% (139 / 183)      + + Ignored: none      +

+ +
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 +158 +159 +160 +161 +162 +163 +164 +165 +166 +167 +168 +169 +170 +171 +172 +173 +174 +175 +176 +177 +178 +179 +180 +181 +182 +183 +184 +185 +186 +187 +188 +189 +190 +191 +192 +193 +194 +195 +196 +197 +198 +199 +200 +201 +202 +203 +204 +205 +206 +207 +208 +209 +210 +211 +212 +213 +214 +215 +216 +217 +218 +219 +220 +221 +222 +223 +224 +225 +226 +227 +228 +229 +230 +231 +232 +233 +234 +235 +236 +237 +238 +239 +240 +241 +242 +243 +244 +245 +246 +247 +248 +249 +250 +251 +252 +253 +254 +255 +256 +257 +258 +259 +260 +261 +262 +263 +264 +265 +266 +267 +268 +269 +270 +271 +272 +273 +274 +275 +276 +277 +278 +279 +280 +281 +282 +283 +284 +285 +286 +287 +288 +289 +290 +291 +292 +293 +294 +295 +296 +297 +298 +299 +300 +301 +302 +303 +304 +305 +306 +307 +308 +309 +310 +311 +312 +313 +314 +315 +316 +317 +318 +319 +320 +321 +322 +323 +324 +325 +326 +327 +328 +329 +330 +331 +332 +333 +334 +335 +336 +337 +338 +339 +340 +341 +342 +343 +344 +345 +346 +347 +348 +349 +350 +351 +352 +353 +354 +355 +356 +357 +358 +359 +360 +361 +362 +363 +364 +365 +366 +367 +368 +369 +370 +371 +372 +373 +374 +375 +376 +377 +378 +379 +380 +381 +382 +383 +384 +385 +386 +387 +388 +389 +390 +391 +392 +393 +394 +395 +396 +397 +398 +399 +400 +401 +402 +403 +404 +405 +406 +407 +408 +409 +410 +411 +412 +413 +414 +415 +416 +417 +418 +419 +420 +421 +422 +423 +424 +425 +426 +427 +428 +429 +430 +431 +432 +433 +434 +435 +436 +437 +438 +439 +440 +441 +442 +443  +  +  +  +  +1 +1 +1 +1 +1 +1 +1 +1 +1 +  +  +  +  +  +1 +  +  +  +  +  +  +  +  +  +1 +10 +5 +2 +2 +  +5 +  +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +  +  +  +  +  +  +1 +  +  +  +  +  +  +  +  +  +1 +5 +5 +5 +  +  +  +  +  +  +  +  +  +  +1 +5 +5 +5 +  +  +  +  +  +  +  +  +  +  +1 +17 +5 +5 +  +  +  +  +  +  +  +  +  +  +1 +17 +5 +5 +  +  +  +  +  +  +  +  +  +1 +5 +5 +5 +  +  +  +  +  +  +  +  +  +1 +15 +  +4 +4 +  +  +  +  +  +  +  +  +  +  +  +  +1 +  +20 +20 +  +15 +15 +15 +15 +15 +  +  +15 +  +  +  +  +  +15 +15 +15 +15 +15 +15 +10 +10 +10 +  +  +15 +  +  +  +15 +15 +15 +  +  +15 +3 +3 +3 +3 +3 +  +  +15 +  +15 +  +  +  +  +15 +15 +  +15 +  +  +  +  +  +  +  +  +1 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +1 +  +  +  +  +  +  +  +  +  +1 +  +  +  +  +  +  +  +  +  +1 +  +  +  +  +  +  +  +  +  +  +  +1 +5 +5 +5 +5 +5 +5 +  +  +  +5 +  +  +  +  +  +  +  +  +1 +  +  +  +  +  +  +  +  +  +  +1 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +1 +  +  +  +  +  +  +  +  +  +  +  +  +1 +15 +55 +  +15 +15 +  +15 +  +  +  +  +  +  +  +  +1 +  +  +  +  +  +  +  +  +  +  +  +1 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +1 +14 +  +14 +14 +  +14 +2 +2 +2 +  +12 +12 +12 +  +12 +12 +11 +11 +10 +10 +10 +10 +10 +10 +  +  +  +  +  +  +  +12 +  +10 +  +  +  +  +  +  +  +  +  +  +  +1 +  +  +  +  +  + 
 
+/**
+ * Module dependencies.
+ */
+ 
+var url = require('./url');
+var eio = require('engine.io-client');
+var Socket = require('./socket');
+var Emitter = require('emitter');
+var parser = require('socket.io-parser');
+var on = require('./on');
+var bind = require('bind');
+var object = require('object-component');
+var debug = require('debug')('socket.io-client:manager');
+ 
+/**
+ * Module exports
+ */
+ 
+module.exports = Manager;
+ 
+/**
+ * `Manager` constructor.
+ *
+ * @param {String} engine instance or engine uri/opts
+ * @param {Object} options
+ * @api public
+ */
+ 
+function Manager(uri, opts){
+  if (!(this instanceof Manager)) return new Manager(uri, opts);
+  if ('object' == typeof uri) {
+    opts = uri;
+    uri = undefined;
+  }
+  opts = opts || {};
+ 
+  opts.path = opts.path || '/socket.io';
+  this.nsps = {};
+  this.subs = [];
+  this.opts = opts;
+  this.reconnection(opts.reconnection !== false);
+  this.reconnectionAttempts(opts.reconnectionAttempts || Infinity);
+  this.reconnectionDelay(opts.reconnectionDelay || 1000);
+  this.reconnectionDelayMax(opts.reconnectionDelayMax || 5000);
+  this.timeout(null == opts.timeout ? 20000 : opts.timeout);
+  this.readyState = 'closed';
+  this.uri = uri;
+  this.connected = 0;
+  this.attempts = 0;
+  this.encoding = false;
+  this.packetBuffer = [];
+  this.encoder = new parser.Encoder();
+  this.decoder = new parser.Decoder();
+  this.open();
+}
+ 
+/**
+ * Mix in `Emitter`.
+ */
+ 
+Emitter(Manager.prototype);
+ 
+/**
+ * Sets the `reconnection` config.
+ *
+ * @param {Boolean} true/false if it should automatically reconnect
+ * @return {Manager} self or value
+ * @api public
+ */
+ 
+Manager.prototype.reconnection = function(v){
+  Iif (!arguments.length) return this._reconnection;
+  this._reconnection = !!v;
+  return this;
+};
+ 
+/**
+ * Sets the reconnection attempts config.
+ *
+ * @param {Number} max reconnection attempts before giving up
+ * @return {Manager} self or value
+ * @api public
+ */
+ 
+Manager.prototype.reconnectionAttempts = function(v){
+  Iif (!arguments.length) return this._reconnectionAttempts;
+  this._reconnectionAttempts = v;
+  return this;
+};
+ 
+/**
+ * Sets the delay between reconnections.
+ *
+ * @param {Number} delay
+ * @return {Manager} self or value
+ * @api public
+ */
+ 
+Manager.prototype.reconnectionDelay = function(v){
+  if (!arguments.length) return this._reconnectionDelay;
+  this._reconnectionDelay = v;
+  return this;
+};
+ 
+/**
+ * Sets the maximum delay between reconnections.
+ *
+ * @param {Number} delay
+ * @return {Manager} self or value
+ * @api public
+ */
+ 
+Manager.prototype.reconnectionDelayMax = function(v){
+  if (!arguments.length) return this._reconnectionDelayMax;
+  this._reconnectionDelayMax = v;
+  return this;
+};
+ 
+/**
+ * Sets the connection timeout. `false` to disable
+ *
+ * @return {Manager} self or value
+ * @api public
+ */
+ 
+Manager.prototype.timeout = function(v){
+  Iif (!arguments.length) return this._timeout;
+  this._timeout = v;
+  return this;
+};
+ 
+/**
+ * Starts trying to reconnect if reconnection is enabled and we have not
+ * started reconnecting yet
+ *
+ * @api private
+ */
+ 
+Manager.prototype.maybeReconnectOnOpen = function() {
+  if (!this.openReconnect && !this.reconnecting && this._reconnection) {
+    // keeps reconnection from firing twice for the same reconnection loop
+    this.openReconnect = true;
+    this.reconnect();
+  }
+};
+ 
+ 
+/**
+ * Sets the current transport `socket`.
+ *
+ * @param {Function} optional, callback
+ * @return {Manager} self
+ * @api public
+ */
+ 
+Manager.prototype.open =
+Manager.prototype.connect = function(fn){
+  debug('readyState %s', this.readyState);
+  if (~this.readyState.indexOf('open')) return this;
+ 
+  debug('opening %s', this.uri);
+  this.engine = eio(this.uri, this.opts);
+  var socket = this.engine;
+  var self = this;
+  this.readyState = 'opening';
+ 
+  // emit `open`
+  var openSub = on(socket, 'open', function() {
+    self.onopen();
+    fn && fn();
+  });
+ 
+  // emit `connect_error`
+  var errorSub = on(socket, 'error', function(data){
+    debug('connect_error');
+    self.cleanup();
+    self.readyState = 'closed';
+    self.emit('connect_error', data);
+    if (fn) {
+      var err = new Error('Connection error');
+      err.data = data;
+      fn(err);
+    }
+ 
+    self.maybeReconnectOnOpen();
+  });
+ 
+  // emit `connect_timeout`
+  Eif (false !== this._timeout) {
+    var timeout = this._timeout;
+    debug('connect attempt will timeout after %d', timeout);
+ 
+    // set timer
+    var timer = setTimeout(function(){
+      debug('connect attempt timed out after %d', timeout);
+      openSub.destroy();
+      socket.close();
+      socket.emit('error', 'timeout');
+      self.emit('connect_timeout', timeout);
+    }, timeout);
+ 
+    this.subs.push({
+      destroy: function(){
+        clearTimeout(timer);
+      }
+    });
+  }
+ 
+  this.subs.push(openSub);
+  this.subs.push(errorSub);
+ 
+  return this;
+};
+ 
+/**
+ * Called upon transport open.
+ *
+ * @api private
+ */
+ 
+Manager.prototype.onopen = function(){
+  debug('open');
+ 
+  // clear old subs
+  this.cleanup();
+ 
+  // mark as open
+  this.readyState = 'open';
+  this.emit('open');
+ 
+  // add new subs
+  var socket = this.engine;
+  this.subs.push(on(socket, 'data', bind(this, 'ondata')));
+  this.subs.push(on(this.decoder, 'decoded', bind(this, 'ondecoded')));
+  this.subs.push(on(socket, 'error', bind(this, 'onerror')));
+  this.subs.push(on(socket, 'close', bind(this, 'onclose')));
+};
+ 
+/**
+ * Called with data.
+ *
+ * @api private
+ */
+ 
+Manager.prototype.ondata = function(data){
+  this.decoder.add(data);
+};
+ 
+/**
+ * Called when parser fully decodes a packet.
+ *
+ * @api private
+ */
+ 
+Manager.prototype.ondecoded = function(packet) {
+  this.emit('packet', packet);
+};
+ 
+/**
+ * Called upon socket error.
+ *
+ * @api private
+ */
+ 
+Manager.prototype.onerror = function(err){
+  debug('error', err);
+  this.emit('error', err);
+};
+ 
+/**
+ * Creates a new socket for the given `nsp`.
+ *
+ * @return {Socket}
+ * @api public
+ */
+ 
+Manager.prototype.socket = function(nsp){
+  var socket = this.nsps[nsp];
+  Eif (!socket) {
+    socket = new Socket(this, nsp);
+    this.nsps[nsp] = socket;
+    var self = this;
+    socket.on('connect', function(){
+      self.connected++;
+    });
+  }
+  return socket;
+};
+ 
+/**
+ * Called upon a socket close.
+ *
+ * @param {Socket} socket
+ */
+ 
+Manager.prototype.destroy = function(socket){
+  --this.connected || this.close();
+};
+ 
+/**
+ * Writes a packet.
+ *
+ * @param {Object} packet
+ * @api private
+ */
+ 
+Manager.prototype.packet = function(packet){
+  debug('writing packet %j', packet);
+  var self = this;
+ 
+  if (!self.encoding) {
+    // encode, then write to engine with result
+    self.encoding = true;
+    this.encoder.encode(packet, function(encodedPackets) {
+      for (var i = 0; i < encodedPackets.length; i++) {
+        self.engine.write(encodedPackets[i]);
+      }
+      self.encoding = false;
+      self.processPacketQueue();
+    });
+  } else { // add packet to the queue
+    self.packetBuffer.push(packet);
+  }
+};
+ 
+/**
+ * If packet buffer is non-empty, begins encoding the
+ * next packet in line.
+ *
+ * @api private
+ */
+ 
+Manager.prototype.processPacketQueue = function() {
+  if (this.packetBuffer.length > 0 && !this.encoding) {
+    var pack = this.packetBuffer.shift();
+    this.packet(pack);
+  }
+};
+ 
+/**
+ * Clean up transport subscriptions and packet buffer.
+ *
+ * @api private
+ */
+ 
+Manager.prototype.cleanup = function(){
+  var sub;
+  while (sub = this.subs.shift()) sub.destroy();
+ 
+  this.packetBuffer = [];
+  this.encoding = false;
+ 
+  this.decoder.destroy();
+};
+ 
+/**
+ * Close the current socket.
+ *
+ * @api private
+ */
+ 
+Manager.prototype.close =
+Manager.prototype.disconnect = function(){
+  this.skipReconnect = true;
+  this.engine.close();
+};
+ 
+/**
+ * Called upon engine close.
+ *
+ * @api private
+ */
+ 
+Manager.prototype.onclose = function(reason){
+  debug('close');
+  this.cleanup();
+  this.readyState = 'closed';
+  this.emit('close', reason);
+  if (this._reconnection && !this.skipReconnect) {
+    this.reconnect();
+  }
+};
+ 
+/**
+ * Attempt a reconnection.
+ *
+ * @api private
+ */
+ 
+Manager.prototype.reconnect = function(){
+  Iif (this.reconnecting) return this;
+ 
+  var self = this;
+  this.attempts++;
+ 
+  if (this.attempts > this._reconnectionAttempts) {
+    debug('reconnect failed');
+    this.emit('reconnect_failed');
+    this.reconnecting = false;
+  } else {
+    var delay = this.attempts * this.reconnectionDelay();
+    delay = Math.min(delay, this.reconnectionDelayMax());
+    debug('will wait %dms before reconnect attempt', delay);
+ 
+    this.reconnecting = true;
+    var timer = setTimeout(function(){
+      debug('attempting reconnect');
+      self.emit('reconnect_attempt');
+      self.open(function(err){
+        Eif (err) {
+          debug('reconnect attempt error');
+          self.reconnecting = false;
+          self.reconnect();
+          self.emit('reconnect_error', err.data);
+        } else {
+          debug('reconnect success');
+          self.onreconnect();
+        }
+      });
+    }, delay);
+ 
+    this.subs.push({
+      destroy: function(){
+        clearTimeout(timer);
+      }
+    });
+  }
+};
+ 
+/**
+ * Called upon successful reconnect.
+ *
+ * @api private
+ */
+ 
+Manager.prototype.onreconnect = function(){
+  var attempt = this.attempts;
+  this.attempts = 0;
+  this.reconnecting = false;
+  this.emit('reconnect', attempt);
+};
+ 
+ +
+ + + + + + + + diff --git a/node_modules/socket.io/node_modules/socket.io-client/coverage/lcov-report/socket.io-client/lib/on.js.html b/node_modules/socket.io/node_modules/socket.io-client/coverage/lcov-report/socket.io-client/lib/on.js.html new file mode 100644 index 0000000..69968e1 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-client/coverage/lcov-report/socket.io-client/lib/on.js.html @@ -0,0 +1,394 @@ + + + + Code coverage report for socket.io-client/lib/on.js + + + + + + + +
+

Code coverage report for socket.io-client/lib/on.js

+

+ + Statements: 100% (5 / 5)      + + + Branches: 100% (0 / 0)      + + + Functions: 100% (2 / 2)      + + + Lines: 100% (5 / 5)      + + Ignored: none      +

+ +
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25  +  +  +  +  +1 +  +  +  +  +  +  +  +  +  +  +1 +50 +50 +  +33 +  +  +  + 
 
+/**
+ * Module exports.
+ */
+ 
+module.exports = on;
+ 
+/**
+ * Helper for subscriptions.
+ *
+ * @param {Object|EventEmitter} obj with `Emitter` mixin or `EventEmitter`
+ * @param {String} event name
+ * @param {Function} callback
+ * @api public
+ */
+ 
+function on(obj, ev, fn) {
+  obj.on(ev, fn);
+  return {
+    destroy: function(){
+      obj.removeListener(ev, fn);
+    }
+  };
+}
+ 
+ +
+ + + + + + + + diff --git a/node_modules/socket.io/node_modules/socket.io-client/coverage/lcov-report/socket.io-client/lib/socket.js.html b/node_modules/socket.io/node_modules/socket.io-client/coverage/lcov-report/socket.io-client/lib/socket.js.html new file mode 100644 index 0000000..3156404 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-client/coverage/lcov-report/socket.io-client/lib/socket.js.html @@ -0,0 +1,1405 @@ + + + + Code coverage report for socket.io-client/lib/socket.js + + + + + + + +
+

Code coverage report for socket.io-client/lib/socket.js

+

+ + Statements: 34.59% (46 / 133)      + + + Branches: 9.09% (3 / 33)      + + + Functions: 16.67% (3 / 18)      + + + Lines: 35.43% (45 / 127)      + + Ignored: none      +

+ +
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 +158 +159 +160 +161 +162 +163 +164 +165 +166 +167 +168 +169 +170 +171 +172 +173 +174 +175 +176 +177 +178 +179 +180 +181 +182 +183 +184 +185 +186 +187 +188 +189 +190 +191 +192 +193 +194 +195 +196 +197 +198 +199 +200 +201 +202 +203 +204 +205 +206 +207 +208 +209 +210 +211 +212 +213 +214 +215 +216 +217 +218 +219 +220 +221 +222 +223 +224 +225 +226 +227 +228 +229 +230 +231 +232 +233 +234 +235 +236 +237 +238 +239 +240 +241 +242 +243 +244 +245 +246 +247 +248 +249 +250 +251 +252 +253 +254 +255 +256 +257 +258 +259 +260 +261 +262 +263 +264 +265 +266 +267 +268 +269 +270 +271 +272 +273 +274 +275 +276 +277 +278 +279 +280 +281 +282 +283 +284 +285 +286 +287 +288 +289 +290 +291 +292 +293 +294 +295 +296 +297 +298 +299 +300 +301 +302 +303 +304 +305 +306 +307 +308 +309 +310 +311 +312 +313 +314 +315 +316 +317 +318 +319 +320 +321 +322 +323 +324 +325 +326 +327 +328 +329 +330 +331 +332 +333 +334 +335 +336 +337 +338 +339 +340 +341 +342 +343 +344 +345 +346 +347 +348 +349 +350 +351 +352 +353 +354 +355 +356 +357 +358 +359 +360 +361 +362  +  +  +  +  +1 +1 +1 +1 +1 +1 +1 +1 +  +  +  +  +  +1 +  +  +  +  +  +  +  +  +1 +  +  +  +  +  +  +  +  +  +1 +  +  +  +  +  +  +  +1 +5 +5 +5 +5 +5 +5 +5 +5 +5 +  +  +  +  +  +  +1 +  +  +  +  +  +  +  +1 +  +5 +5 +5 +5 +  +  +  +  +  +5 +5 +  +  +  +  +  +  +  +  +  +1 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +1 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +1 +  +  +  +  +  +  +  +  +  +  +  +1 +  +  +  +  +  +  +  +  +  +1 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +1 +  +  +  +  +  +  +  +  +  +  +  +  +  +1 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +1 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +1 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +1 +  +  +  +  +  +  +  +  +  +  +  +  +1 +  +  +  +  +  +  +  +  +  +  +  +  +1 +  +  +  +  +  +  +  +  +  +  +  +  +1 +  +  +  +  +  +  +  +  +  +  +  +  +  +1 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +1 +  +2 +  +  +  +  +  +  +  +  +  +  +  + 
 
+/**
+ * Module dependencies.
+ */
+ 
+var parser = require('socket.io-parser');
+var Emitter = require('emitter');
+var toArray = require('to-array');
+var on = require('./on');
+var bind = require('bind');
+var debug = require('debug')('socket.io-client:socket');
+var hasBin = require('has-binary-data');
+var indexOf = require('indexof');
+ 
+/**
+ * Module exports.
+ */
+ 
+module.exports = exports = Socket;
+ 
+/**
+ * Internal events (blacklisted).
+ * These events can't be emitted by the user.
+ *
+ * @api private
+ */
+ 
+var events = {
+  connect: 1,
+  disconnect: 1,
+  error: 1
+};
+ 
+/**
+ * Shortcut to `Emitter#emit`.
+ */
+ 
+var emit = Emitter.prototype.emit;
+ 
+/**
+ * `Socket` constructor.
+ *
+ * @api public
+ */
+ 
+function Socket(io, nsp){
+  this.io = io;
+  this.nsp = nsp;
+  this.json = this; // compat
+  this.ids = 0;
+  this.acks = {};
+  this.open();
+  this.buffer = [];
+  this.connected = false;
+  this.disconnected = true;
+}
+ 
+/**
+ * Mix in `Emitter`.
+ */
+ 
+Emitter(Socket.prototype);
+ 
+/**
+ * Called upon engine `open`.
+ *
+ * @api private
+ */
+ 
+Socket.prototype.open =
+Socket.prototype.connect = function(){
+  Iif (this.connected) return this;
+  var io = this.io;
+  io.open(); // ensure open
+  this.subs = [
+    on(io, 'open', bind(this, 'onopen')),
+    on(io, 'error', bind(this, 'onerror')),
+    on(io, 'packet', bind(this, 'onpacket')),
+    on(io, 'close', bind(this, 'onclose'))
+  ];
+  Iif ('open' == this.io.readyState) this.onopen();
+  return this;
+};
+ 
+/**
+ * Sends a `message` event.
+ *
+ * @return {Socket} self
+ * @api public
+ */
+ 
+Socket.prototype.send = function(){
+  var args = toArray(arguments);
+  args.unshift('message');
+  this.emit.apply(this, args);
+  return this;
+};
+ 
+/**
+ * Override `emit`.
+ * If the event is in `events`, it's emitted normally.
+ *
+ * @param {String} event name
+ * @return {Socket} self
+ * @api public
+ */
+ 
+Socket.prototype.emit = function(ev){
+  if (events.hasOwnProperty(ev)) {
+    emit.apply(this, arguments);
+    return this;
+  }
+ 
+  var args = toArray(arguments);
+  var parserType = parser.EVENT; // default
+  if (hasBin(args)) { parserType = parser.BINARY_EVENT; } // binary
+  var packet = { type: parserType, data: args };
+ 
+  // event ack callback
+  if ('function' == typeof args[args.length - 1]) {
+    debug('emitting packet with ack id %d', this.ids);
+    this.acks[this.ids] = args.pop();
+    packet.id = this.ids++;
+  }
+ 
+  this.packet(packet);
+ 
+  return this;
+};
+ 
+/**
+ * Sends a packet.
+ *
+ * @param {Object} packet
+ * @api private
+ */
+ 
+Socket.prototype.packet = function(packet){
+  packet.nsp = this.nsp;
+  this.io.packet(packet);
+};
+ 
+/**
+ * Called upon `error`.
+ *
+ * @param {Object} data
+ * @api private
+ */
+ 
+Socket.prototype.onerror = function(data){
+  this.emit('error', data);
+};
+ 
+/**
+ * "Opens" the socket.
+ *
+ * @api private
+ */
+ 
+Socket.prototype.onopen = function(){
+  debug('transport is open - connecting');
+ 
+  // write connect packet if necessary
+  if ('/' != this.nsp) {
+    this.packet({ type: parser.CONNECT });
+  }
+};
+ 
+/**
+ * Called upon engine `close`.
+ *
+ * @param {String} reason
+ * @api private
+ */
+ 
+Socket.prototype.onclose = function(reason){
+  debug('close (%s)', reason);
+  this.connected = false;
+  this.disconnected = true;
+  this.emit('disconnect', reason);
+};
+ 
+/**
+ * Called with socket packet.
+ *
+ * @param {Object} packet
+ * @api private
+ */
+ 
+Socket.prototype.onpacket = function(packet){
+  if (packet.nsp != this.nsp) return;
+ 
+  switch (packet.type) {
+    case parser.CONNECT:
+      this.onconnect();
+      break;
+ 
+    case parser.EVENT:
+      this.onevent(packet);
+      break;
+ 
+    case parser.BINARY_EVENT:
+      this.onevent(packet);
+      break;
+ 
+    case parser.ACK:
+      this.onack(packet);
+      break;
+ 
+    case parser.BINARY_ACK:
+      this.onack(packet);
+      break;
+ 
+    case parser.DISCONNECT:
+      this.ondisconnect();
+      break;
+ 
+    case parser.ERROR:
+      this.emit('error', packet.data);
+      break;
+  }
+};
+ 
+/**
+ * Called upon a server event.
+ *
+ * @param {Object} packet
+ * @api private
+ */
+ 
+Socket.prototype.onevent = function(packet){
+  var args = packet.data || [];
+  debug('emitting event %j', args);
+ 
+  if (null != packet.id) {
+    debug('attaching ack callback to event');
+    args.push(this.ack(packet.id));
+  }
+ 
+  if (this.connected) {
+    emit.apply(this, args);
+  } else {
+    this.buffer.push(args);
+  }
+};
+ 
+/**
+ * Produces an ack callback to emit with an event.
+ *
+ * @api private
+ */
+ 
+Socket.prototype.ack = function(id){
+  var self = this;
+  var sent = false;
+  return function(){
+    // prevent double callbacks
+    if (sent) return;
+    sent = true;
+    var args = toArray(arguments);
+    debug('sending ack %j', args);
+ 
+    var type = hasBin(args) ? parser.BINARY_ACK : parser.ACK;
+    self.packet({
+      type: type,
+      id: id,
+      data: args
+    });
+  };
+};
+ 
+/**
+ * Called upon a server acknowlegement.
+ *
+ * @param {Object} packet
+ * @api private
+ */
+ 
+Socket.prototype.onack = function(packet){
+  debug('calling ack %s with %j', packet.id, packet.data);
+  var fn = this.acks[packet.id];
+  fn.apply(this, packet.data);
+  delete this.acks[packet.id];
+};
+ 
+/**
+ * Called upon server connect.
+ *
+ * @api private
+ */
+ 
+Socket.prototype.onconnect = function(){
+  this.connected = true;
+  this.disconnected = false;
+  this.emit('connect');
+  this.emitBuffered();
+};
+ 
+/**
+ * Emit buffered events.
+ *
+ * @api private
+ */
+ 
+Socket.prototype.emitBuffered = function(){
+  for (var i = 0; i < this.buffer.length; i++) {
+    emit.apply(this, this.buffer[i]);
+  }
+  this.buffer = [];
+};
+ 
+/**
+ * Called upon server disconnect.
+ *
+ * @api private
+ */
+ 
+Socket.prototype.ondisconnect = function(){
+  debug('server disconnect (%s)', this.nsp);
+  this.destroy();
+  this.onclose('io server disconnect');
+};
+ 
+/**
+ * Called upon forced client/server side disconnections,
+ * this method ensures the manager stops tracking us and
+ * that reconnections don't get triggered for this.
+ *
+ * @api private.
+ */
+ 
+Socket.prototype.destroy = function(){
+  // clean subscriptions to avoid reconnections
+  for (var i = 0; i < this.subs.length; i++) {
+    this.subs[i].destroy();
+  }
+ 
+  this.io.destroy(this);
+};
+ 
+/**
+ * Disconnects the socket manually.
+ *
+ * @return {Socket} self
+ * @api public
+ */
+ 
+Socket.prototype.close =
+Socket.prototype.disconnect = function(){
+  Eif (!this.connected) return this;
+ 
+  debug('performing disconnect (%s)', this.nsp);
+  this.packet({ type: parser.DISCONNECT });
+ 
+  // remove socket from pool
+  this.destroy();
+ 
+  // fire events
+  this.onclose('io client disconnect');
+  return this;
+};
+ 
+ +
+ + + + + + + + diff --git a/node_modules/socket.io/node_modules/socket.io-client/coverage/lcov-report/socket.io-client/lib/url.js.html b/node_modules/socket.io/node_modules/socket.io-client/coverage/lcov-report/socket.io-client/lib/url.js.html new file mode 100644 index 0000000..7d99577 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-client/coverage/lcov-report/socket.io-client/lib/url.js.html @@ -0,0 +1,526 @@ + + + + Code coverage report for socket.io-client/lib/url.js + + + + + + + +
+

Code coverage report for socket.io-client/lib/url.js

+

+ + Statements: 100% (25 / 25)      + + + Branches: 96.15% (25 / 26)      + + + Functions: 100% (1 / 1)      + + + Lines: 100% (24 / 24)      + + Ignored: none      +

+ +
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69  +  +  +  +  +1 +1 +  +  +  +  +  +1 +  +  +  +  +  +  +  +  +  +  +1 +20 +  +  +20 +20 +  +  +8 +8 +2 +1 +  +  +  +8 +3 +3 +2 +  +1 +  +  +  +  +8 +8 +  +  +  +8 +  +1 +  +  +8 +  +  +8 +  +  +8 +  +8 +  + 
 
+/**
+ * Module dependencies.
+ */
+ 
+var parseuri = require('parseuri');
+var debug = require('debug')('socket.io-client:url');
+ 
+/**
+ * Module exports.
+ */
+ 
+module.exports = url;
+ 
+/**
+ * URL parser.
+ *
+ * @param {String} url
+ * @param {Object} An object meant to mimic window.location.
+ *                 Defaults to window.location.
+ * @api public
+ */
+ 
+function url(uri, loc){
+  var obj = uri;
+ 
+  // default to window.location
+  var loc = loc || global.location;
+  if (null == uri) uri = loc.protocol + '//' + loc.hostname;
+ 
+  // relative path support
+  Eif ('string' == typeof uri) {
+    if ('/' == uri.charAt(0)) {
+      if ('undefined' != typeof loc) {
+        uri = loc.hostname + uri;
+      }
+    }
+ 
+    if (!/^(https?|wss?):\/\//.test(uri)) {
+      debug('protocol-less url %s', uri);
+      if ('undefined' != typeof loc) {
+        uri = loc.protocol + '//' + uri;
+      } else {
+        uri = 'https://' + uri;
+      }
+    }
+ 
+    // parse
+    debug('parse %s', uri);
+    obj = parseuri(uri);
+  }
+ 
+  // make sure we treat `localhost:80` and `localhost` equally
+  if ((/(http|ws)/.test(obj.protocol) && 80 == obj.port) ||
+     (/(http|ws)s/.test(obj.protocol) && 443 == obj.port)) {
+    delete obj.port;
+  }
+ 
+  obj.path = obj.path || '/';
+ 
+  // define unique id
+  obj.id = obj.protocol + obj.host + (obj.port ? (':' + obj.port) : '');
+ 
+  // define href
+  obj.href = obj.protocol + '://' + obj.host + (obj.port ? (':' + obj.port) : '');
+ 
+  return obj;
+}
+ 
+ +
+ + + + + + + + diff --git a/node_modules/socket.io/node_modules/socket.io-client/coverage/lcov.info b/node_modules/socket.io/node_modules/socket.io-client/coverage/lcov.info new file mode 100644 index 0000000..25fea74 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-client/coverage/lcov.info @@ -0,0 +1,653 @@ +TN: +SF:/Users/guillermorauch/Projects/socket.io-client/index.js +FNF:0 +FNH:0 +DA:2,1 +LF:1 +LH:1 +BRF:0 +BRH:0 +end_of_record +TN: +SF:/Users/guillermorauch/Projects/socket.io-client/lib/index.js +FN:36,lookup +FNF:1 +FNH:1 +FNDA:12,lookup +DA:6,1 +DA:7,1 +DA:8,1 +DA:9,1 +DA:15,1 +DA:21,1 +DA:36,1 +DA:37,12 +DA:38,0 +DA:39,0 +DA:42,12 +DA:44,12 +DA:45,0 +DA:46,0 +DA:47,0 +DA:49,0 +DA:50,0 +DA:51,0 +DA:53,0 +DA:54,0 +DA:55,0 +DA:57,0 +DA:60,0 +DA:69,1 +DA:78,1 +DA:86,1 +DA:87,1 +LF:27 +LH:14 +BRDA:37,1,0,0 +BRDA:37,1,1,12 +BRDA:42,2,0,12 +BRDA:42,2,1,12 +BRDA:49,3,0,0 +BRDA:49,3,1,0 +BRDA:49,4,0,0 +BRDA:49,4,1,0 +BRDA:53,5,0,0 +BRDA:53,5,1,0 +BRF:10 +BRH:3 +end_of_record +TN: +SF:/Users/guillermorauch/Projects/socket.io-client/lib/url.js +FN:24,url +FNF:1 +FNH:1 +FNDA:20,url +DA:6,1 +DA:7,1 +DA:13,1 +DA:24,1 +DA:25,20 +DA:28,20 +DA:29,20 +DA:32,8 +DA:33,8 +DA:34,2 +DA:35,1 +DA:39,8 +DA:40,3 +DA:41,3 +DA:42,2 +DA:44,1 +DA:49,8 +DA:50,8 +DA:54,8 +DA:56,1 +DA:59,8 +DA:62,8 +DA:65,8 +DA:67,8 +LF:24 +LH:24 +BRDA:28,1,0,20 +BRDA:28,1,1,18 +BRDA:29,2,0,12 +BRDA:29,2,1,8 +BRDA:32,3,0,8 +BRDA:32,3,1,0 +BRDA:33,4,0,2 +BRDA:33,4,1,6 +BRDA:34,5,0,1 +BRDA:34,5,1,1 +BRDA:39,6,0,3 +BRDA:39,6,1,5 +BRDA:41,7,0,2 +BRDA:41,7,1,1 +BRDA:54,8,0,1 +BRDA:54,8,1,7 +BRDA:54,9,0,8 +BRDA:54,9,1,8 +BRDA:54,9,2,7 +BRDA:54,9,3,3 +BRDA:59,10,0,8 +BRDA:59,10,1,2 +BRDA:62,11,0,1 +BRDA:62,11,1,7 +BRDA:65,12,0,1 +BRDA:65,12,1,7 +BRF:26 +BRH:25 +end_of_record +TN: +SF:/Users/guillermorauch/Projects/socket.io-client/lib/manager.js +FN:30,Manager +FN:72,(anonymous_2) +FN:86,(anonymous_3) +FN:100,(anonymous_4) +FN:114,(anonymous_5) +FN:127,(anonymous_6) +FN:140,(anonymous_7) +FN:158,(anonymous_8) +FN:169,(anonymous_9) +FN:175,(anonymous_10) +FN:195,(anonymous_11) +FN:204,(anonymous_12) +FN:222,(anonymous_13) +FN:246,(anonymous_14) +FN:256,(anonymous_15) +FN:266,(anonymous_16) +FN:278,(anonymous_17) +FN:284,(anonymous_18) +FN:297,(anonymous_19) +FN:308,(anonymous_20) +FN:315,(anonymous_21) +FN:334,(anonymous_22) +FN:347,(anonymous_23) +FN:364,(anonymous_24) +FN:375,(anonymous_25) +FN:391,(anonymous_26) +FN:407,(anonymous_27) +FN:410,(anonymous_28) +FN:424,(anonymous_29) +FN:437,(anonymous_30) +FNF:30 +FNH:17 +FNDA:10,Manager +FNDA:5,(anonymous_2) +FNDA:5,(anonymous_3) +FNDA:17,(anonymous_4) +FNDA:17,(anonymous_5) +FNDA:5,(anonymous_6) +FNDA:15,(anonymous_7) +FNDA:20,(anonymous_8) +FNDA:0,(anonymous_9) +FNDA:15,(anonymous_10) +FNDA:3,(anonymous_11) +FNDA:15,(anonymous_12) +FNDA:0,(anonymous_13) +FNDA:0,(anonymous_14) +FNDA:0,(anonymous_15) +FNDA:0,(anonymous_16) +FNDA:5,(anonymous_17) +FNDA:0,(anonymous_18) +FNDA:0,(anonymous_19) +FNDA:0,(anonymous_20) +FNDA:0,(anonymous_21) +FNDA:0,(anonymous_22) +FNDA:15,(anonymous_23) +FNDA:0,(anonymous_24) +FNDA:0,(anonymous_25) +FNDA:14,(anonymous_26) +FNDA:11,(anonymous_27) +FNDA:10,(anonymous_28) +FNDA:10,(anonymous_29) +FNDA:0,(anonymous_30) +DA:6,1 +DA:7,1 +DA:8,1 +DA:9,1 +DA:10,1 +DA:11,1 +DA:12,1 +DA:13,1 +DA:14,1 +DA:20,1 +DA:30,1 +DA:31,10 +DA:32,5 +DA:33,2 +DA:34,2 +DA:36,5 +DA:38,5 +DA:39,5 +DA:40,5 +DA:41,5 +DA:42,5 +DA:43,5 +DA:44,5 +DA:45,5 +DA:46,5 +DA:47,5 +DA:48,5 +DA:49,5 +DA:50,5 +DA:51,5 +DA:52,5 +DA:53,5 +DA:54,5 +DA:55,5 +DA:62,1 +DA:72,1 +DA:73,5 +DA:74,5 +DA:75,5 +DA:86,1 +DA:87,5 +DA:88,5 +DA:89,5 +DA:100,1 +DA:101,17 +DA:102,5 +DA:103,5 +DA:114,1 +DA:115,17 +DA:116,5 +DA:117,5 +DA:127,1 +DA:128,5 +DA:129,5 +DA:130,5 +DA:140,1 +DA:141,15 +DA:143,4 +DA:144,4 +DA:157,1 +DA:159,20 +DA:160,20 +DA:162,15 +DA:163,15 +DA:164,15 +DA:165,15 +DA:166,15 +DA:169,15 +DA:170,0 +DA:171,0 +DA:175,15 +DA:176,15 +DA:177,15 +DA:178,15 +DA:179,15 +DA:180,15 +DA:181,10 +DA:182,10 +DA:183,10 +DA:186,15 +DA:190,15 +DA:191,15 +DA:192,15 +DA:195,15 +DA:196,3 +DA:197,3 +DA:198,3 +DA:199,3 +DA:200,3 +DA:203,15 +DA:205,15 +DA:210,15 +DA:211,15 +DA:213,15 +DA:222,1 +DA:223,0 +DA:226,0 +DA:229,0 +DA:230,0 +DA:233,0 +DA:234,0 +DA:235,0 +DA:236,0 +DA:237,0 +DA:246,1 +DA:247,0 +DA:256,1 +DA:257,0 +DA:266,1 +DA:267,0 +DA:268,0 +DA:278,1 +DA:279,5 +DA:280,5 +DA:281,5 +DA:282,5 +DA:283,5 +DA:284,5 +DA:285,0 +DA:288,5 +DA:297,1 +DA:298,0 +DA:308,1 +DA:309,0 +DA:310,0 +DA:312,0 +DA:314,0 +DA:315,0 +DA:316,0 +DA:317,0 +DA:319,0 +DA:320,0 +DA:323,0 +DA:334,1 +DA:335,0 +DA:336,0 +DA:337,0 +DA:347,1 +DA:348,15 +DA:349,55 +DA:351,15 +DA:352,15 +DA:354,15 +DA:363,1 +DA:365,0 +DA:366,0 +DA:375,1 +DA:376,0 +DA:377,0 +DA:378,0 +DA:379,0 +DA:380,0 +DA:381,0 +DA:391,1 +DA:392,14 +DA:394,14 +DA:395,14 +DA:397,14 +DA:398,2 +DA:399,2 +DA:400,2 +DA:402,12 +DA:403,12 +DA:404,12 +DA:406,12 +DA:407,12 +DA:408,11 +DA:409,11 +DA:410,10 +DA:411,10 +DA:412,10 +DA:413,10 +DA:414,10 +DA:415,10 +DA:417,0 +DA:418,0 +DA:423,12 +DA:425,10 +DA:437,1 +DA:438,0 +DA:439,0 +DA:440,0 +DA:441,0 +LF:183 +LH:139 +BRDA:31,1,0,5 +BRDA:31,1,1,5 +BRDA:32,2,0,2 +BRDA:32,2,1,3 +BRDA:36,3,0,5 +BRDA:36,3,1,1 +BRDA:38,4,0,5 +BRDA:38,4,1,5 +BRDA:43,5,0,5 +BRDA:43,5,1,3 +BRDA:44,6,0,5 +BRDA:44,6,1,2 +BRDA:45,7,0,5 +BRDA:45,7,1,5 +BRDA:46,8,0,4 +BRDA:46,8,1,1 +BRDA:73,9,0,0 +BRDA:73,9,1,5 +BRDA:87,10,0,0 +BRDA:87,10,1,5 +BRDA:101,11,0,12 +BRDA:101,11,1,5 +BRDA:115,12,0,12 +BRDA:115,12,1,5 +BRDA:128,13,0,0 +BRDA:128,13,1,5 +BRDA:141,14,0,4 +BRDA:141,14,1,11 +BRDA:141,15,0,15 +BRDA:141,15,1,5 +BRDA:141,15,2,5 +BRDA:160,16,0,5 +BRDA:160,16,1,15 +BRDA:171,17,0,0 +BRDA:171,17,1,0 +BRDA:180,18,0,10 +BRDA:180,18,1,5 +BRDA:190,19,0,15 +BRDA:190,19,1,0 +BRDA:280,20,0,5 +BRDA:280,20,1,0 +BRDA:298,21,0,0 +BRDA:298,21,1,0 +BRDA:312,22,0,0 +BRDA:312,22,1,0 +BRDA:335,23,0,0 +BRDA:335,23,1,0 +BRDA:335,24,0,0 +BRDA:335,24,1,0 +BRDA:380,25,0,0 +BRDA:380,25,1,0 +BRDA:380,26,0,0 +BRDA:380,26,1,0 +BRDA:392,27,0,0 +BRDA:392,27,1,14 +BRDA:397,28,0,2 +BRDA:397,28,1,12 +BRDA:411,29,0,10 +BRDA:411,29,1,0 +BRF:59 +BRH:38 +end_of_record +TN: +SF:/Users/guillermorauch/Projects/socket.io-client/lib/socket.js +FN:46,Socket +FN:71,(anonymous_2) +FN:92,(anonymous_3) +FN:108,(anonymous_4) +FN:138,(anonymous_5) +FN:150,(anonymous_6) +FN:160,(anonymous_7) +FN:176,(anonymous_8) +FN:190,(anonymous_9) +FN:231,(anonymous_10) +FN:253,(anonymous_11) +FN:256,(anonymous_12) +FN:279,(anonymous_13) +FN:292,(anonymous_14) +FN:305,(anonymous_15) +FN:318,(anonymous_16) +FN:332,(anonymous_17) +FN:349,(anonymous_18) +FNF:18 +FNH:3 +FNDA:5,Socket +FNDA:5,(anonymous_2) +FNDA:0,(anonymous_3) +FNDA:0,(anonymous_4) +FNDA:0,(anonymous_5) +FNDA:0,(anonymous_6) +FNDA:0,(anonymous_7) +FNDA:0,(anonymous_8) +FNDA:0,(anonymous_9) +FNDA:0,(anonymous_10) +FNDA:0,(anonymous_11) +FNDA:0,(anonymous_12) +FNDA:0,(anonymous_13) +FNDA:0,(anonymous_14) +FNDA:0,(anonymous_15) +FNDA:0,(anonymous_16) +FNDA:0,(anonymous_17) +FNDA:2,(anonymous_18) +DA:6,1 +DA:7,1 +DA:8,1 +DA:9,1 +DA:10,1 +DA:11,1 +DA:12,1 +DA:13,1 +DA:19,1 +DA:28,1 +DA:38,1 +DA:46,1 +DA:47,5 +DA:48,5 +DA:49,5 +DA:50,5 +DA:51,5 +DA:52,5 +DA:53,5 +DA:54,5 +DA:55,5 +DA:62,1 +DA:70,1 +DA:72,5 +DA:73,5 +DA:74,5 +DA:75,5 +DA:81,5 +DA:82,5 +DA:92,1 +DA:93,0 +DA:94,0 +DA:95,0 +DA:96,0 +DA:108,1 +DA:109,0 +DA:110,0 +DA:111,0 +DA:114,0 +DA:115,0 +DA:116,0 +DA:117,0 +DA:120,0 +DA:121,0 +DA:122,0 +DA:123,0 +DA:126,0 +DA:128,0 +DA:138,1 +DA:139,0 +DA:140,0 +DA:150,1 +DA:151,0 +DA:160,1 +DA:161,0 +DA:164,0 +DA:165,0 +DA:176,1 +DA:177,0 +DA:178,0 +DA:179,0 +DA:180,0 +DA:190,1 +DA:191,0 +DA:193,0 +DA:195,0 +DA:196,0 +DA:199,0 +DA:200,0 +DA:203,0 +DA:204,0 +DA:207,0 +DA:208,0 +DA:211,0 +DA:212,0 +DA:215,0 +DA:216,0 +DA:219,0 +DA:220,0 +DA:231,1 +DA:232,0 +DA:233,0 +DA:235,0 +DA:236,0 +DA:237,0 +DA:240,0 +DA:241,0 +DA:243,0 +DA:253,1 +DA:254,0 +DA:255,0 +DA:256,0 +DA:258,0 +DA:259,0 +DA:260,0 +DA:261,0 +DA:263,0 +DA:264,0 +DA:279,1 +DA:280,0 +DA:281,0 +DA:282,0 +DA:283,0 +DA:292,1 +DA:293,0 +DA:294,0 +DA:295,0 +DA:296,0 +DA:305,1 +DA:306,0 +DA:307,0 +DA:309,0 +DA:318,1 +DA:319,0 +DA:320,0 +DA:321,0 +DA:332,1 +DA:334,0 +DA:335,0 +DA:338,0 +DA:348,1 +DA:350,2 +DA:352,0 +DA:353,0 +DA:356,0 +DA:359,0 +DA:360,0 +LF:127 +LH:45 +BRDA:72,1,0,0 +BRDA:72,1,1,5 +BRDA:81,2,0,0 +BRDA:81,2,1,5 +BRDA:109,3,0,0 +BRDA:109,3,1,0 +BRDA:116,4,0,0 +BRDA:116,4,1,0 +BRDA:120,5,0,0 +BRDA:120,5,1,0 +BRDA:164,6,0,0 +BRDA:164,6,1,0 +BRDA:191,7,0,0 +BRDA:191,7,1,0 +BRDA:193,8,0,0 +BRDA:193,8,1,0 +BRDA:193,8,2,0 +BRDA:193,8,3,0 +BRDA:193,8,4,0 +BRDA:193,8,5,0 +BRDA:193,8,6,0 +BRDA:232,9,0,0 +BRDA:232,9,1,0 +BRDA:235,10,0,0 +BRDA:235,10,1,0 +BRDA:240,11,0,0 +BRDA:240,11,1,0 +BRDA:258,12,0,0 +BRDA:258,12,1,0 +BRDA:263,13,0,0 +BRDA:263,13,1,0 +BRDA:350,14,0,2 +BRDA:350,14,1,0 +BRF:33 +BRH:3 +end_of_record +TN: +SF:/Users/guillermorauch/Projects/socket.io-client/lib/on.js +FN:17,on +FN:20,(anonymous_2) +FNF:2 +FNH:2 +FNDA:50,on +FNDA:33,(anonymous_2) +DA:6,1 +DA:17,1 +DA:18,50 +DA:19,50 +DA:21,33 +LF:5 +LH:5 +BRF:0 +BRH:0 +end_of_record diff --git a/node_modules/socket.io/node_modules/socket.io-client/index.js b/node_modules/socket.io/node_modules/socket.io-client/index.js new file mode 100644 index 0000000..887727f --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-client/index.js @@ -0,0 +1,2 @@ + +module.exports = require('./lib/'); diff --git a/node_modules/socket.io/node_modules/socket.io-client/lib/index.js b/node_modules/socket.io/node_modules/socket.io-client/lib/index.js new file mode 100644 index 0000000..17d81f1 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-client/lib/index.js @@ -0,0 +1,87 @@ + +/** + * Module dependencies. + */ + +var url = require('./url'); +var parser = require('socket.io-parser'); +var Manager = require('./manager'); +var debug = require('debug')('socket.io-client'); + +/** + * Module exports. + */ + +module.exports = exports = lookup; + +/** + * Managers cache. + */ + +var cache = exports.managers = {}; + +/** + * Looks up an existing `Manager` for multiplexing. + * If the user summons: + * + * `io('http://localhost/a');` + * `io('http://localhost/b');` + * + * We reuse the existing instance based on same scheme/port/host, + * and we initialize sockets for each namespace. + * + * @api public + */ + +function lookup(uri, opts) { + if (typeof uri == 'object') { + opts = uri; + uri = undefined; + } + + opts = opts || {}; + + var parsed = url(uri); + var source = parsed.source; + var id = parsed.id; + var io; + + if (opts.forceNew || opts['force new connection'] || false === opts.multiplex) { + debug('ignoring socket cache for %s', source); + io = Manager(source, opts); + } else { + if (!cache[id]) { + debug('new io instance for %s', source); + cache[id] = Manager(source, opts); + } + io = cache[id]; + } + + return io.socket(parsed.path); +} + +/** + * Protocol version. + * + * @api public + */ + +exports.protocol = parser.protocol; + +/** + * `connect`. + * + * @param {String} uri + * @api public + */ + +exports.connect = lookup; + +/** + * Expose constructors for standalone build. + * + * @api public + */ + +exports.Manager = require('./manager'); +exports.Socket = require('./socket'); diff --git a/node_modules/socket.io/node_modules/socket.io-client/lib/manager.js b/node_modules/socket.io/node_modules/socket.io-client/lib/manager.js new file mode 100644 index 0000000..81b9362 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-client/lib/manager.js @@ -0,0 +1,456 @@ + +/** + * Module dependencies. + */ + +var url = require('./url'); +var eio = require('engine.io-client'); +var Socket = require('./socket'); +var Emitter = require('component-emitter'); +var parser = require('socket.io-parser'); +var on = require('./on'); +var bind = require('component-bind'); +var object = require('object-component'); +var debug = require('debug')('socket.io-client:manager'); + +/** + * Module exports + */ + +module.exports = Manager; + +/** + * `Manager` constructor. + * + * @param {String} engine instance or engine uri/opts + * @param {Object} options + * @api public + */ + +function Manager(uri, opts){ + if (!(this instanceof Manager)) return new Manager(uri, opts); + if (uri && ('object' == typeof uri)) { + opts = uri; + uri = undefined; + } + opts = opts || {}; + + opts.path = opts.path || '/socket.io'; + this.nsps = {}; + this.subs = []; + this.opts = opts; + this.reconnection(opts.reconnection !== false); + this.reconnectionAttempts(opts.reconnectionAttempts || Infinity); + this.reconnectionDelay(opts.reconnectionDelay || 1000); + this.reconnectionDelayMax(opts.reconnectionDelayMax || 5000); + this.timeout(null == opts.timeout ? 20000 : opts.timeout); + this.readyState = 'closed'; + this.uri = uri; + this.connected = 0; + this.attempts = 0; + this.encoding = false; + this.packetBuffer = []; + this.encoder = new parser.Encoder(); + this.decoder = new parser.Decoder(); + this.open(); +} + +/** + * Propagate given event to sockets and emit on `this` + * + * @api private + */ + +Manager.prototype.emitAll = function() { + this.emit.apply(this, arguments); + for (var nsp in this.nsps) { + this.nsps[nsp].emit.apply(this.nsps[nsp], arguments); + } +}; + +/** + * Mix in `Emitter`. + */ + +Emitter(Manager.prototype); + +/** + * Sets the `reconnection` config. + * + * @param {Boolean} true/false if it should automatically reconnect + * @return {Manager} self or value + * @api public + */ + +Manager.prototype.reconnection = function(v){ + if (!arguments.length) return this._reconnection; + this._reconnection = !!v; + return this; +}; + +/** + * Sets the reconnection attempts config. + * + * @param {Number} max reconnection attempts before giving up + * @return {Manager} self or value + * @api public + */ + +Manager.prototype.reconnectionAttempts = function(v){ + if (!arguments.length) return this._reconnectionAttempts; + this._reconnectionAttempts = v; + return this; +}; + +/** + * Sets the delay between reconnections. + * + * @param {Number} delay + * @return {Manager} self or value + * @api public + */ + +Manager.prototype.reconnectionDelay = function(v){ + if (!arguments.length) return this._reconnectionDelay; + this._reconnectionDelay = v; + return this; +}; + +/** + * Sets the maximum delay between reconnections. + * + * @param {Number} delay + * @return {Manager} self or value + * @api public + */ + +Manager.prototype.reconnectionDelayMax = function(v){ + if (!arguments.length) return this._reconnectionDelayMax; + this._reconnectionDelayMax = v; + return this; +}; + +/** + * Sets the connection timeout. `false` to disable + * + * @return {Manager} self or value + * @api public + */ + +Manager.prototype.timeout = function(v){ + if (!arguments.length) return this._timeout; + this._timeout = v; + return this; +}; + +/** + * Starts trying to reconnect if reconnection is enabled and we have not + * started reconnecting yet + * + * @api private + */ + +Manager.prototype.maybeReconnectOnOpen = function() { + if (!this.openReconnect && !this.reconnecting && this._reconnection) { + // keeps reconnection from firing twice for the same reconnection loop + this.openReconnect = true; + this.reconnect(); + } +}; + + +/** + * Sets the current transport `socket`. + * + * @param {Function} optional, callback + * @return {Manager} self + * @api public + */ + +Manager.prototype.open = +Manager.prototype.connect = function(fn){ + debug('readyState %s', this.readyState); + if (~this.readyState.indexOf('open')) return this; + + debug('opening %s', this.uri); + this.engine = eio(this.uri, this.opts); + var socket = this.engine; + var self = this; + this.readyState = 'opening'; + + // emit `open` + var openSub = on(socket, 'open', function() { + self.onopen(); + fn && fn(); + }); + + // emit `connect_error` + var errorSub = on(socket, 'error', function(data){ + debug('connect_error'); + self.cleanup(); + self.readyState = 'closed'; + self.emitAll('connect_error', data); + if (fn) { + var err = new Error('Connection error'); + err.data = data; + fn(err); + } + + self.maybeReconnectOnOpen(); + }); + + // emit `connect_timeout` + if (false !== this._timeout) { + var timeout = this._timeout; + debug('connect attempt will timeout after %d', timeout); + + // set timer + var timer = setTimeout(function(){ + debug('connect attempt timed out after %d', timeout); + openSub.destroy(); + socket.close(); + socket.emit('error', 'timeout'); + self.emitAll('connect_timeout', timeout); + }, timeout); + + this.subs.push({ + destroy: function(){ + clearTimeout(timer); + } + }); + } + + this.subs.push(openSub); + this.subs.push(errorSub); + + return this; +}; + +/** + * Called upon transport open. + * + * @api private + */ + +Manager.prototype.onopen = function(){ + debug('open'); + + // clear old subs + this.cleanup(); + + // mark as open + this.readyState = 'open'; + this.emit('open'); + + // add new subs + var socket = this.engine; + this.subs.push(on(socket, 'data', bind(this, 'ondata'))); + this.subs.push(on(this.decoder, 'decoded', bind(this, 'ondecoded'))); + this.subs.push(on(socket, 'error', bind(this, 'onerror'))); + this.subs.push(on(socket, 'close', bind(this, 'onclose'))); +}; + +/** + * Called with data. + * + * @api private + */ + +Manager.prototype.ondata = function(data){ + this.decoder.add(data); +}; + +/** + * Called when parser fully decodes a packet. + * + * @api private + */ + +Manager.prototype.ondecoded = function(packet) { + this.emit('packet', packet); +}; + +/** + * Called upon socket error. + * + * @api private + */ + +Manager.prototype.onerror = function(err){ + debug('error', err); + this.emitAll('error', err); +}; + +/** + * Creates a new socket for the given `nsp`. + * + * @return {Socket} + * @api public + */ + +Manager.prototype.socket = function(nsp){ + var socket = this.nsps[nsp]; + if (!socket) { + socket = new Socket(this, nsp); + this.nsps[nsp] = socket; + var self = this; + socket.on('connect', function(){ + self.connected++; + }); + } + return socket; +}; + +/** + * Called upon a socket close. + * + * @param {Socket} socket + */ + +Manager.prototype.destroy = function(socket){ + --this.connected || this.close(); +}; + +/** + * Writes a packet. + * + * @param {Object} packet + * @api private + */ + +Manager.prototype.packet = function(packet){ + debug('writing packet %j', packet); + var self = this; + + if (!self.encoding) { + // encode, then write to engine with result + self.encoding = true; + this.encoder.encode(packet, function(encodedPackets) { + for (var i = 0; i < encodedPackets.length; i++) { + self.engine.write(encodedPackets[i]); + } + self.encoding = false; + self.processPacketQueue(); + }); + } else { // add packet to the queue + self.packetBuffer.push(packet); + } +}; + +/** + * If packet buffer is non-empty, begins encoding the + * next packet in line. + * + * @api private + */ + +Manager.prototype.processPacketQueue = function() { + if (this.packetBuffer.length > 0 && !this.encoding) { + var pack = this.packetBuffer.shift(); + this.packet(pack); + } +}; + +/** + * Clean up transport subscriptions and packet buffer. + * + * @api private + */ + +Manager.prototype.cleanup = function(){ + var sub; + while (sub = this.subs.shift()) sub.destroy(); + + this.packetBuffer = []; + this.encoding = false; + + this.decoder.destroy(); +}; + +/** + * Close the current socket. + * + * @api private + */ + +Manager.prototype.close = +Manager.prototype.disconnect = function(){ + this.skipReconnect = true; + this.engine.close(); +}; + +/** + * Called upon engine close. + * + * @api private + */ + +Manager.prototype.onclose = function(reason){ + debug('close'); + this.cleanup(); + this.readyState = 'closed'; + this.emit('close', reason); + if (this._reconnection && !this.skipReconnect) { + this.reconnect(); + } +}; + +/** + * Attempt a reconnection. + * + * @api private + */ + +Manager.prototype.reconnect = function(){ + if (this.reconnecting) return this; + + var self = this; + this.attempts++; + + if (this.attempts > this._reconnectionAttempts) { + debug('reconnect failed'); + this.emitAll('reconnect_failed'); + this.reconnecting = false; + } else { + var delay = this.attempts * this.reconnectionDelay(); + delay = Math.min(delay, this.reconnectionDelayMax()); + debug('will wait %dms before reconnect attempt', delay); + + this.reconnecting = true; + var timer = setTimeout(function(){ + debug('attempting reconnect'); + self.emitAll('reconnect_attempt', self.attempts); + self.emitAll('reconnecting', self.attempts); + self.open(function(err){ + if (err) { + debug('reconnect attempt error'); + self.reconnecting = false; + self.reconnect(); + self.emitAll('reconnect_error', err.data); + } else { + debug('reconnect success'); + self.onreconnect(); + } + }); + }, delay); + + this.subs.push({ + destroy: function(){ + clearTimeout(timer); + } + }); + } +}; + +/** + * Called upon successful reconnect. + * + * @api private + */ + +Manager.prototype.onreconnect = function(){ + var attempt = this.attempts; + this.attempts = 0; + this.reconnecting = false; + this.emitAll('reconnect', attempt); +}; diff --git a/node_modules/socket.io/node_modules/socket.io-client/lib/on.js b/node_modules/socket.io/node_modules/socket.io-client/lib/on.js new file mode 100644 index 0000000..6be286d --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-client/lib/on.js @@ -0,0 +1,24 @@ + +/** + * Module exports. + */ + +module.exports = on; + +/** + * Helper for subscriptions. + * + * @param {Object|EventEmitter} obj with `Emitter` mixin or `EventEmitter` + * @param {String} event name + * @param {Function} callback + * @api public + */ + +function on(obj, ev, fn) { + obj.on(ev, fn); + return { + destroy: function(){ + obj.removeListener(ev, fn); + } + }; +} diff --git a/node_modules/socket.io/node_modules/socket.io-client/lib/socket.js b/node_modules/socket.io/node_modules/socket.io-client/lib/socket.js new file mode 100644 index 0000000..3ea9d52 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-client/lib/socket.js @@ -0,0 +1,378 @@ + +/** + * Module dependencies. + */ + +var parser = require('socket.io-parser'); +var Emitter = require('component-emitter'); +var toArray = require('to-array'); +var on = require('./on'); +var bind = require('component-bind'); +var debug = require('debug')('socket.io-client:socket'); +var hasBin = require('has-binary-data'); +var indexOf = require('indexof'); + +/** + * Module exports. + */ + +module.exports = exports = Socket; + +/** + * Internal events (blacklisted). + * These events can't be emitted by the user. + * + * @api private + */ + +var events = { + connect: 1, + connect_error: 1, + connect_timeout: 1, + disconnect: 1, + error: 1, + reconnect: 1, + reconnect_attempt: 1, + reconnect_failed: 1, + reconnect_error: 1, + reconnecting: 1 +}; + +/** + * Shortcut to `Emitter#emit`. + */ + +var emit = Emitter.prototype.emit; + +/** + * `Socket` constructor. + * + * @api public + */ + +function Socket(io, nsp){ + this.io = io; + this.nsp = nsp; + this.json = this; // compat + this.ids = 0; + this.acks = {}; + this.open(); + this.receiveBuffer = []; + this.sendBuffer = []; + this.connected = false; + this.disconnected = true; + this.subEvents(); +} + +/** + * Mix in `Emitter`. + */ + +Emitter(Socket.prototype); + +/** + * Subscribe to open, close and packet events + * + * @api private + */ + +Socket.prototype.subEvents = function() { + var io = this.io; + this.subs = [ + on(io, 'open', bind(this, 'onopen')), + on(io, 'packet', bind(this, 'onpacket')), + on(io, 'close', bind(this, 'onclose')) + ]; +}; + +/** + * Called upon engine `open`. + * + * @api private + */ + +Socket.prototype.open = +Socket.prototype.connect = function(){ + if (this.connected) return this; + + this.io.open(); // ensure open + if ('open' == this.io.readyState) this.onopen(); + return this; +}; + +/** + * Sends a `message` event. + * + * @return {Socket} self + * @api public + */ + +Socket.prototype.send = function(){ + var args = toArray(arguments); + args.unshift('message'); + this.emit.apply(this, args); + return this; +}; + +/** + * Override `emit`. + * If the event is in `events`, it's emitted normally. + * + * @param {String} event name + * @return {Socket} self + * @api public + */ + +Socket.prototype.emit = function(ev){ + if (events.hasOwnProperty(ev)) { + emit.apply(this, arguments); + return this; + } + + var args = toArray(arguments); + var parserType = parser.EVENT; // default + if (hasBin(args)) { parserType = parser.BINARY_EVENT; } // binary + var packet = { type: parserType, data: args }; + + // event ack callback + if ('function' == typeof args[args.length - 1]) { + debug('emitting packet with ack id %d', this.ids); + this.acks[this.ids] = args.pop(); + packet.id = this.ids++; + } + + if (this.connected) { + this.packet(packet); + } else { + this.sendBuffer.push(packet); + } + + return this; +}; + +/** + * Sends a packet. + * + * @param {Object} packet + * @api private + */ + +Socket.prototype.packet = function(packet){ + packet.nsp = this.nsp; + this.io.packet(packet); +}; + +/** + * "Opens" the socket. + * + * @api private + */ + +Socket.prototype.onopen = function(){ + debug('transport is open - connecting'); + + // write connect packet if necessary + if ('/' != this.nsp) { + this.packet({ type: parser.CONNECT }); + } +}; + +/** + * Called upon engine `close`. + * + * @param {String} reason + * @api private + */ + +Socket.prototype.onclose = function(reason){ + debug('close (%s)', reason); + this.connected = false; + this.disconnected = true; + this.emit('disconnect', reason); +}; + +/** + * Called with socket packet. + * + * @param {Object} packet + * @api private + */ + +Socket.prototype.onpacket = function(packet){ + if (packet.nsp != this.nsp) return; + + switch (packet.type) { + case parser.CONNECT: + this.onconnect(); + break; + + case parser.EVENT: + this.onevent(packet); + break; + + case parser.BINARY_EVENT: + this.onevent(packet); + break; + + case parser.ACK: + this.onack(packet); + break; + + case parser.BINARY_ACK: + this.onack(packet); + break; + + case parser.DISCONNECT: + this.ondisconnect(); + break; + + case parser.ERROR: + this.emit('error', packet.data); + break; + } +}; + +/** + * Called upon a server event. + * + * @param {Object} packet + * @api private + */ + +Socket.prototype.onevent = function(packet){ + var args = packet.data || []; + debug('emitting event %j', args); + + if (null != packet.id) { + debug('attaching ack callback to event'); + args.push(this.ack(packet.id)); + } + + if (this.connected) { + emit.apply(this, args); + } else { + this.receiveBuffer.push(args); + } +}; + +/** + * Produces an ack callback to emit with an event. + * + * @api private + */ + +Socket.prototype.ack = function(id){ + var self = this; + var sent = false; + return function(){ + // prevent double callbacks + if (sent) return; + sent = true; + var args = toArray(arguments); + debug('sending ack %j', args); + + var type = hasBin(args) ? parser.BINARY_ACK : parser.ACK; + self.packet({ + type: type, + id: id, + data: args + }); + }; +}; + +/** + * Called upon a server acknowlegement. + * + * @param {Object} packet + * @api private + */ + +Socket.prototype.onack = function(packet){ + debug('calling ack %s with %j', packet.id, packet.data); + var fn = this.acks[packet.id]; + fn.apply(this, packet.data); + delete this.acks[packet.id]; +}; + +/** + * Called upon server connect. + * + * @api private + */ + +Socket.prototype.onconnect = function(){ + this.connected = true; + this.disconnected = false; + this.emit('connect'); + this.emitBuffered(); +}; + +/** + * Emit buffered events (received and emitted). + * + * @api private + */ + +Socket.prototype.emitBuffered = function(){ + var i; + for (i = 0; i < this.receiveBuffer.length; i++) { + emit.apply(this, this.receiveBuffer[i]); + } + this.receiveBuffer = []; + + for (i = 0; i < this.sendBuffer.length; i++) { + this.packet(this.sendBuffer[i]); + } + this.sendBuffer = []; +}; + +/** + * Called upon server disconnect. + * + * @api private + */ + +Socket.prototype.ondisconnect = function(){ + debug('server disconnect (%s)', this.nsp); + this.destroy(); + this.onclose('io server disconnect'); +}; + +/** + * Called upon forced client/server side disconnections, + * this method ensures the manager stops tracking us and + * that reconnections don't get triggered for this. + * + * @api private. + */ + +Socket.prototype.destroy = function(){ + // clean subscriptions to avoid reconnections + for (var i = 0; i < this.subs.length; i++) { + this.subs[i].destroy(); + } + + this.io.destroy(this); +}; + +/** + * Disconnects the socket manually. + * + * @return {Socket} self + * @api public + */ + +Socket.prototype.close = +Socket.prototype.disconnect = function(){ + if (!this.connected) return this; + + debug('performing disconnect (%s)', this.nsp); + this.packet({ type: parser.DISCONNECT }); + + // remove socket from pool + this.destroy(); + + // fire events + this.onclose('io client disconnect'); + return this; +}; diff --git a/node_modules/socket.io/node_modules/socket.io-client/lib/url.js b/node_modules/socket.io/node_modules/socket.io-client/lib/url.js new file mode 100644 index 0000000..7779c8b --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-client/lib/url.js @@ -0,0 +1,71 @@ + +/** + * Module dependencies. + */ + +var parseuri = require('parseuri'); +var debug = require('debug')('socket.io-client:url'); + +/** + * Module exports. + */ + +module.exports = url; + +/** + * URL parser. + * + * @param {String} url + * @param {Object} An object meant to mimic window.location. + * Defaults to window.location. + * @api public + */ + +function url(uri, loc){ + var obj = uri; + + // default to window.location + var loc = loc || global.location; + if (null == uri) uri = loc.protocol + '//' + loc.hostname; + + // relative path support + if ('string' == typeof uri) { + if ('/' == uri.charAt(0)) { + if ('undefined' != typeof loc) { + uri = loc.hostname + uri; + } + } + + if (!/^(https?|wss?):\/\//.test(uri)) { + debug('protocol-less url %s', uri); + if ('undefined' != typeof loc) { + uri = loc.protocol + '//' + uri; + } else { + uri = 'https://' + uri; + } + } + + // parse + debug('parse %s', uri); + obj = parseuri(uri); + } + + // make sure we treat `localhost:80` and `localhost` equally + if (!obj.port) { + if (/^(http|ws)$/.test(obj.protocol)) { + obj.port = '80'; + } + else if (/^(http|ws)s$/.test(obj.protocol)) { + obj.port = '443'; + } + } + + obj.path = obj.path || '/'; + + // define unique id + obj.id = obj.protocol + '://' + obj.host + ':' + obj.port; + // define href + obj.href = obj.protocol + '://' + obj.host + (loc && loc.port == obj.port ? '' : (':' + obj.port)); + + return obj; +} diff --git a/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-bind/.npmignore b/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-bind/.npmignore new file mode 100644 index 0000000..f1250e5 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-bind/.npmignore @@ -0,0 +1,4 @@ +support +test +examples +*.sock diff --git a/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-bind/History.md b/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-bind/History.md new file mode 100644 index 0000000..2795fdb --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-bind/History.md @@ -0,0 +1,13 @@ + +1.0.0 / 2014-05-27 +================== + + * index: use slice ref (#7, @viatropos) + * package: rename package to "component-bind" + * package: add "repository" field (#6, @repoify) + * package: add "component" section + +0.0.1 / 2010-01-03 +================== + + * Initial release diff --git a/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-bind/Makefile b/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-bind/Makefile new file mode 100644 index 0000000..4e9c8d3 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-bind/Makefile @@ -0,0 +1,7 @@ + +test: + @./node_modules/.bin/mocha \ + --require should \ + --reporter spec + +.PHONY: test \ No newline at end of file diff --git a/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-bind/Readme.md b/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-bind/Readme.md new file mode 100644 index 0000000..6a8febc --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-bind/Readme.md @@ -0,0 +1,64 @@ +# bind + + Function binding utility. + +## Installation + +``` +$ component install component/bind +``` + +## API + + - [bind(obj, fn)](#bindobj-fn) + - [bind(obj, fn, ...)](#bindobj-fn-) + - [bind(obj, name)](#bindobj-name) + + + +### bind(obj, fn) +should bind the function to the given object. + +```js +var tobi = { name: 'tobi' }; + +function name() { + return this.name; +} + +var fn = bind(tobi, name); +fn().should.equal('tobi'); +``` + + +### bind(obj, fn, ...) +should curry the remaining arguments. + +```js +function add(a, b) { + return a + b; +} + +bind(null, add)(1, 2).should.equal(3); +bind(null, add, 1)(2).should.equal(3); +bind(null, add, 1, 2)().should.equal(3); +``` + + +### bind(obj, name) +should bind the method of the given name. + +```js +var tobi = { name: 'tobi' }; + +tobi.getName = function() { + return this.name; +}; + +var fn = bind(tobi, 'getName'); +fn().should.equal('tobi'); +``` + +## License + + MIT \ No newline at end of file diff --git a/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-bind/component.json b/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-bind/component.json new file mode 100644 index 0000000..4e1e93f --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-bind/component.json @@ -0,0 +1,13 @@ +{ + "name": "bind", + "version": "1.0.0", + "description": "function binding utility", + "keywords": [ + "bind", + "utility" + ], + "dependencies": {}, + "scripts": [ + "index.js" + ] +} diff --git a/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-bind/index.js b/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-bind/index.js new file mode 100644 index 0000000..4eeb2c0 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-bind/index.js @@ -0,0 +1,23 @@ +/** + * Slice reference. + */ + +var slice = [].slice; + +/** + * Bind `obj` to `fn`. + * + * @param {Object} obj + * @param {Function|String} fn or string + * @return {Function} + * @api public + */ + +module.exports = function(obj, fn){ + if ('string' == typeof fn) fn = obj[fn]; + if ('function' != typeof fn) throw new Error('bind() requires a function'); + var args = slice.call(arguments, 2); + return function(){ + return fn.apply(obj, args.concat(slice.call(arguments))); + } +}; diff --git a/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-bind/package.json b/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-bind/package.json new file mode 100644 index 0000000..817991c --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-bind/package.json @@ -0,0 +1,46 @@ +{ + "name": "component-bind", + "version": "1.0.0", + "description": "function binding utility", + "keywords": [ + "bind", + "utility" + ], + "devDependencies": { + "mocha": "*", + "should": "*" + }, + "component": { + "scripts": { + "bind/index.js": "index.js" + } + }, + "repository": { + "type": "git", + "url": "https://github.com/component/bind.git" + }, + "bugs": { + "url": "https://github.com/component/bind/issues" + }, + "homepage": "https://github.com/component/bind", + "_id": "component-bind@1.0.0", + "_shasum": "00c608ab7dcd93897c0009651b1d3a8e1e73bbd1", + "_from": "component-bind@1.0.0", + "_npmVersion": "1.4.9", + "_npmUser": { + "name": "tootallnate", + "email": "nathan@tootallnate.net" + }, + "maintainers": [ + { + "name": "tootallnate", + "email": "nathan@tootallnate.net" + } + ], + "dist": { + "shasum": "00c608ab7dcd93897c0009651b1d3a8e1e73bbd1", + "tarball": "http://registry.npmjs.org/component-bind/-/component-bind-1.0.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/component-bind/-/component-bind-1.0.0.tgz" +} diff --git a/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-emitter/.npmignore b/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-emitter/.npmignore new file mode 100644 index 0000000..f05b1f2 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-emitter/.npmignore @@ -0,0 +1,2 @@ +node_modules +test diff --git a/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-emitter/.travis.yml b/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-emitter/.travis.yml new file mode 100644 index 0000000..8750e3b --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-emitter/.travis.yml @@ -0,0 +1,4 @@ +node_js: +- "0.8" +- "0.10" +language: node_js \ No newline at end of file diff --git a/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-emitter/History.md b/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-emitter/History.md new file mode 100644 index 0000000..b898ca6 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-emitter/History.md @@ -0,0 +1,52 @@ + +1.1.2 / 2014-02-10 +================== + + * package: rename to "component-emitter" + * package: update "main" and "component" fields + * Add license to Readme (same format as the other components) + * created .npmignore + * travis stuff + +1.1.1 / 2013-12-01 +================== + + * fix .once adding .on to the listener + * docs: Emitter#off() + * component: add `.repo` prop + +1.1.0 / 2013-10-20 +================== + + * add `.addEventListener()` and `.removeEventListener()` aliases + +1.0.1 / 2013-06-27 +================== + + * add support for legacy ie + +1.0.0 / 2013-02-26 +================== + + * add `.off()` support for removing all listeners + +0.0.6 / 2012-10-08 +================== + + * add `this._callbacks` initialization to prevent funky gotcha + +0.0.5 / 2012-09-07 +================== + + * fix `Emitter.call(this)` usage + +0.0.3 / 2012-07-11 +================== + + * add `.listeners()` + * rename `.has()` to `.hasListeners()` + +0.0.2 / 2012-06-28 +================== + + * fix `.off()` with `.once()`-registered callbacks diff --git a/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-emitter/Makefile b/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-emitter/Makefile new file mode 100644 index 0000000..4e9c8d3 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-emitter/Makefile @@ -0,0 +1,7 @@ + +test: + @./node_modules/.bin/mocha \ + --require should \ + --reporter spec + +.PHONY: test \ No newline at end of file diff --git a/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-emitter/Readme.md b/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-emitter/Readme.md new file mode 100644 index 0000000..0f3f9b9 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-emitter/Readme.md @@ -0,0 +1,74 @@ +# Emitter [![Build Status](https://travis-ci.org/component/emitter.png)](https://travis-ci.org/component/emitter) + + Event emitter component. + +## Installation + +``` +$ component install component/emitter +``` + +## API + +### Emitter(obj) + + The `Emitter` may also be used as a mixin. For example + a "plain" object may become an emitter, or you may + extend an existing prototype. + + As an `Emitter` instance: + +```js +var Emitter = require('emitter'); +var emitter = new Emitter; +emitter.emit('something'); +``` + + As a mixin: + +```js +var Emitter = require('emitter'); +var user = { name: 'tobi' }; +Emitter(user); + +user.emit('im a user'); +``` + + As a prototype mixin: + +```js +var Emitter = require('emitter'); +Emitter(User.prototype); +``` + +### Emitter#on(event, fn) + + Register an `event` handler `fn`. + +### Emitter#once(event, fn) + + Register a single-shot `event` handler `fn`, + removed immediately after it is invoked the + first time. + +### Emitter#off(event, fn) + + * Pass `event` and `fn` to remove a listener. + * Pass `event` to remove all listeners on that event. + * Pass nothing to remove all listeners on all events. + +### Emitter#emit(event, ...) + + Emit an `event` with variable option args. + +### Emitter#listeners(event) + + Return an array of callbacks, or an empty array. + +### Emitter#hasListeners(event) + + Check if this emitter has `event` handlers. + +## License + +MIT diff --git a/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-emitter/bower.json b/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-emitter/bower.json new file mode 100644 index 0000000..c618d41 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-emitter/bower.json @@ -0,0 +1,21 @@ +{ + "name": "emitter", + "description": "Event emitter", + "keywords": [ + "emitter", + "events" + ], + "version": "1.1.2", + "license": "MIT", + "main": "index.js", + "homepage": "https://github.com/component/emitter", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "Makefile", + "package.json", + "component.json" + ] +} diff --git a/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-emitter/component.json b/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-emitter/component.json new file mode 100644 index 0000000..68ba0b1 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-emitter/component.json @@ -0,0 +1,14 @@ +{ + "name": "emitter", + "repo": "component/emitter", + "description": "Event emitter", + "keywords": [ + "emitter", + "events" + ], + "version": "1.1.2", + "scripts": [ + "index.js" + ], + "license": "MIT" +} diff --git a/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-emitter/index.js b/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-emitter/index.js new file mode 100644 index 0000000..ad71163 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-emitter/index.js @@ -0,0 +1,164 @@ + +/** + * Expose `Emitter`. + */ + +module.exports = Emitter; + +/** + * Initialize a new `Emitter`. + * + * @api public + */ + +function Emitter(obj) { + if (obj) return mixin(obj); +}; + +/** + * Mixin the emitter properties. + * + * @param {Object} obj + * @return {Object} + * @api private + */ + +function mixin(obj) { + for (var key in Emitter.prototype) { + obj[key] = Emitter.prototype[key]; + } + return obj; +} + +/** + * Listen on the given `event` with `fn`. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + +Emitter.prototype.on = +Emitter.prototype.addEventListener = function(event, fn){ + this._callbacks = this._callbacks || {}; + (this._callbacks[event] = this._callbacks[event] || []) + .push(fn); + return this; +}; + +/** + * Adds an `event` listener that will be invoked a single + * time then automatically removed. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + +Emitter.prototype.once = function(event, fn){ + var self = this; + this._callbacks = this._callbacks || {}; + + function on() { + self.off(event, on); + fn.apply(this, arguments); + } + + on.fn = fn; + this.on(event, on); + return this; +}; + +/** + * Remove the given callback for `event` or all + * registered callbacks. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + +Emitter.prototype.off = +Emitter.prototype.removeListener = +Emitter.prototype.removeAllListeners = +Emitter.prototype.removeEventListener = function(event, fn){ + this._callbacks = this._callbacks || {}; + + // all + if (0 == arguments.length) { + this._callbacks = {}; + return this; + } + + // specific event + var callbacks = this._callbacks[event]; + if (!callbacks) return this; + + // remove all handlers + if (1 == arguments.length) { + delete this._callbacks[event]; + return this; + } + + // remove specific handler + var cb; + for (var i = 0; i < callbacks.length; i++) { + cb = callbacks[i]; + if (cb === fn || cb.fn === fn) { + callbacks.splice(i, 1); + break; + } + } + return this; +}; + +/** + * Emit `event` with the given args. + * + * @param {String} event + * @param {Mixed} ... + * @return {Emitter} + */ + +Emitter.prototype.emit = function(event){ + this._callbacks = this._callbacks || {}; + var args = [].slice.call(arguments, 1) + , callbacks = this._callbacks[event]; + + if (callbacks) { + callbacks = callbacks.slice(0); + for (var i = 0, len = callbacks.length; i < len; ++i) { + callbacks[i].apply(this, args); + } + } + + return this; +}; + +/** + * Return array of callbacks for `event`. + * + * @param {String} event + * @return {Array} + * @api public + */ + +Emitter.prototype.listeners = function(event){ + this._callbacks = this._callbacks || {}; + return this._callbacks[event] || []; +}; + +/** + * Check if this emitter has `event` handlers. + * + * @param {String} event + * @return {Boolean} + * @api public + */ + +Emitter.prototype.hasListeners = function(event){ + return !! this.listeners(event).length; +}; diff --git a/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-emitter/package.json b/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-emitter/package.json new file mode 100644 index 0000000..f2919f8 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-emitter/package.json @@ -0,0 +1,46 @@ +{ + "name": "component-emitter", + "description": "Event emitter", + "version": "1.1.2", + "devDependencies": { + "mocha": "*", + "should": "*" + }, + "component": { + "scripts": { + "emitter/index.js": "index.js" + } + }, + "main": "index.js", + "repository": { + "type": "git", + "url": "https://github.com/component/emitter.git" + }, + "scripts": { + "test": "make test" + }, + "bugs": { + "url": "https://github.com/component/emitter/issues" + }, + "homepage": "https://github.com/component/emitter", + "_id": "component-emitter@1.1.2", + "dist": { + "shasum": "296594f2753daa63996d2af08d15a95116c9aec3", + "tarball": "http://registry.npmjs.org/component-emitter/-/component-emitter-1.1.2.tgz" + }, + "_from": "component-emitter@1.1.2", + "_npmVersion": "1.3.24", + "_npmUser": { + "name": "tootallnate", + "email": "nathan@tootallnate.net" + }, + "maintainers": [ + { + "name": "tootallnate", + "email": "nathan@tootallnate.net" + } + ], + "directories": {}, + "_shasum": "296594f2753daa63996d2af08d15a95116c9aec3", + "_resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.1.2.tgz" +} diff --git a/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/.npmignore b/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/.npmignore new file mode 100644 index 0000000..3957910 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/.npmignore @@ -0,0 +1,2 @@ +support/ +test diff --git a/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/.travis.yml b/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/.travis.yml new file mode 100644 index 0000000..0443319 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/.travis.yml @@ -0,0 +1,9 @@ +language: node_js +node_js: + - "0.10" +notifications: + irc: "irc.freenode.org#socket.io" +env: + global: + - secure: v76/Y3hGIGsANoFAW0US3X8cuDFY7g8stMFrwGUxiQnm4HN3j83w+FfoZay0mESKhNIpqk4nCJQwMCd1gJnLL7ybjGOt5LeEuQVlLDXkRVrXSViy2XwAW+mLj7H/++/LTHWo/Ma6pOa1YC2o4SbSsiK1NdhdAK5ZGluonPBIG18= + - secure: P2zFTMeI9duoPBXhAZZLddqeJS+dUI27Q02tTdr+AjvUkr8f7Zga57SZxP6Jbn8bxUPI3ZQzAm1KMsyUo4IAegXLJ4j9VCF6ab65NkE1k8UH99kXXS30Ha27NS1aQafCbaOTxxQfqQHmnjt2HJtvk04nqCEDhoZCdDUZNVSGCOc= diff --git a/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/.zuul.yml b/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/.zuul.yml new file mode 100644 index 0000000..5337ec7 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/.zuul.yml @@ -0,0 +1,20 @@ +ui: mocha-bdd +server: ./test/support/server.js +browsers: + - name: chrome + version: 29..latest +# Firefox disabled for now because it can cause infinite wait loops when +# running any tests +# - name: firefox +# version: latest + - name: safari + version: latest + - name: ie + version: 10 + platform: Windows 2012 + - name: ie + version: [6..9, latest] + - name: iphone + version: oldest..latest + - name: android + version: oldest..latest diff --git a/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/History.md b/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/History.md new file mode 100644 index 0000000..cc1030e --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/History.md @@ -0,0 +1,421 @@ + +1.3.1 / 2014-06-19 +================== + + * transport: catch utf8 decode errors + +1.3.0 / 2014-06-13 +================== + + * smaller inherits utility + * fix a test for ws + * upgrade emitter dep to not rely on tarball + +1.2.2 / 2014-05-30 +================== + + * package: bump `engine.io-parser` for binary utf8 fix + +1.2.1 / 2014-05-22 +================== + + * build + +1.2.0 / 2014-05-18 +================== + + * removed flashsocket, moving to userland + * new build + +1.1.1 / 2014-05-14 +================== + + * jsonp-polling: fixed newline double escaping + * package: bump parser + * remove legacy Socket#onopen call + * added tests for multibyte strings + +1.1.0 / 2014-04-27 +================== + + * bump zuul version + * renamed removeAllListeners to cleanup + * use inherits package instead of inherit + * removed all references to util.js + * fix if statement in FlashWS.ready method + * polling-jsonp: prevent spurious errors from being emitted when the window is unloaded + * polling-xhr: fix a comment and remove unneeded `document` reference + * enforce cache busting for all user agents + * JSONP and test fixes for fails in IE + * package: bump `engine.io-parser` + * polling-xhr: abort the request when the window is unloaded + +1.0.5 / 2014-03-18 +================== + + * package: bump `engine.io-parser` for android binary fix + +1.0.4 / 2014-03-14 +================== + + * no base64 encoding for no reason when using websockets + +1.0.3 / 2014-03-12 +================== + + * fix browserify + +1.0.2 / 2014-03-12 +================== + + * bump `engine.io-parser` + * made `parseJSON` and `parseURI` from `util` their own modules [gkoren] + * clean up tests + * clean up browserify + +1.0.1 / 2014-03-06 +================== + + * package: bump `engine.io-parser` + +1.0.0 / 2014-03-06 +================== + + * run browserify without shims + * emit socket upgrade event after upgrade done + * better feature detection for XHR2 + * added `rememberUpgrade` option + * binary support + +0.9.0 / 2014-02-09 +================== + + * Fix simple `host:port` URLs and IPV6 [bmalehorn] + * Fix XHR cleanup method [poohlty] + * Match semantics of `close` event with `WebSocket`. If an error occurs + and `open` hadn't fired before, we still emit `close` as per + WebSocket spec [mokesmokes]. + * Removed SPEC (now in `engine.io-protocol` repository) + * Remove `Socket#open` docs (private API) [mokesmokes] + +0.8.2 / 2014-01-18 +================== + + * polling-xhr: avoid catching user-thrown errors + * util: remove unused `hasCORS` + * polling: remove deferring for faster startup (fixes #174) + * engine now works perfectly on workers + +0.8.1 / 2014-01-17 +================== + + * package: bump debug to fix `localStorage` issue (fixes #213) + * remove duplicate xmlhttprequest code + * add iphone automated testing + * bump zuul to 1.3.0 to improve tests performance + * use invalid ip address for incorrect connection test + * Fix GH-224, remove sockets array + +0.8.0 / 2014-01-05 +================== + + * socket: emit upgrade errors as `upgradeError` instead of `error` + +0.7.14 / 2014-01-01 +=================== + + * test: increase timeouts for network tests + * test: whitelist globals + * test: improve socket closing test + * polling: improve url timestamp for ie11 and allow force disabling + * polling-xhr: handle errors for xhr creation (fixes `access denied` issues) + * polling-xhr: style + * socket: more instrumentation for transport creation + * socket: allow explicit `false` for `timestampRequests` + * socket: accept `null` as first argument + * Makefile: cleanup + * .travis: deprecate 0.6 + +0.7.13 / 2013-12-20 +=================== + + * use `jsonp` in favor of `XDomainRequest` to preserve `Cookie` + headers in all situations [3rd-eden] (fixes #217) + * run zuul tests after node tests [defunctzombie] + * add zuul support for easier browser testing [defunctzombie] + +0.7.12 / 2013-11-11 +=================== + + * engine.io: updated build to fix WebSocket constructor issue + * package: move browserify into devDeps + +0.7.11 / 2013-11-06 +=================== + + * AMD support + * Makefile: build now smaller thanks to browserify + * add browserify support + +0.7.10 / 2013-10-28 +=================== + + * fixed issue which prevented IE9 and under to pass Cookies to server during handshake + * package: update "ws" to v0.4.31 + * fixed - there is no host property only hostname + * fixed - flash socket creation + * fixed - emit errors thrown by xhr.send() + +0.7.9 / 2013-08-30 +================== + + * websocket: pass `undefined` as the WebSocket "protocols" + +0.7.8 / 2013-08-30 +================== + + * package: update "ws" + +0.7.7 / 2013-08-30 +================== + + * package: bump ws to 0.4.30 + * websocket: no more env sniffing, just require `ws` [TooTallNate] + * websocket: remove the "bufferedAmount" checking logic [TooTallNate] + +0.7.6 / 2013-08-30 +================== + + * package: revert ws to avoid upgrade fail now + +0.7.5 / 2013-08-30 +================== + + * package: bump ws to 0.4.30 + +0.7.4 / 2013-08-25 +================== + + * package: rolling back to `ws` `0.4.25` due to disconnection bug + +0.7.3 / 2013-08-23 +================== + + * noop bump + +0.7.2 / 2013-08-23 +================== + + * transports: fix WebSocket transport in the web browser (again) + +0.7.1 / 2013-08-23 +================== + + * transports: fix WebSocket transport in the web browser + * package: upgrade "ws" to v0.4.29 + +0.7.0 / 2013-08-23 +================== + + * socket: add `agent` option + * package: point "xmlhttprequest" to our LearnBoost fork for agent support + * package: specify a newer version of "ws" that includes `agent` support + * util: use "component/has-cors" + * transport: fix whitespace + * util: use "component/global" + * package: Add repository field to readme + * socket: Don't lose packets writen during upgrade after a re-open + * socket: use a consistent "debug" name for socket.js + * package: Update emitter dep to 1.0.1 for old IE support + +0.6.3 / 2013-06-21 +================== + + * fix check readyState in polling transport (Naoyuki Kanezawa) + * use http url in npm dependencies for emitter (Eric Schoffstall) + +0.6.2 / 2013-06-15 +================== + + * transports: improve polling orderly close (fixes #164) + * socket: ignore further transport communication upon `onClose` + * socket: added missing `socket#onerror` support + * socket: don't call `socket#onclose` if previous state was not `open` + * transports: fix iOS5 crash issue + * Makefile: extra precaution when building to avoid 0.6.0 build problem + +0.6.1 / 2013-06-06 +================== + + * engine.io: fixed build + +0.6.0 / 2013-05-31 +================== + + * does not emit close on incorrect socket connection + * use indexof component for ie8 and below + * improved x-domain handling + * introduce public `ping` api + * added drain event + * fix `flush` and `flushComplete` events + * fixed `drain` bug splicing with upgrading + * add support for callbacks with socket.send() + +0.5.0 / 2013-03-16 +================== + + * socket: implement qs support for `string` + * added query.EIO to take protocol version from parser + * use istanbul for code coverage + * integrated engine.io-protocol 0.3.0 + * updated ws + * fixed JSONPPolling iframe removal error + * changed error message to match xhr error message on jsonp transport script tag + * Added onerror handler for script tag in jsonp transport + * remove uid qs + * Added missing colon in payload. Thanks @lsm + +0.4.3 / 2013-02-08 +================== + + * package: removed unusued `parser.js` + +0.4.2 / 2013-02-08 +================== + + * polling-jsonp: fix ie6 JSONP on SSL + * close also if socket.readyState is on "opening" + * parser.js: removed the file package.json: added the engine.io-parser dependency everything else: switched to engine.io-parser + * fix "TypeError: Object # has no method 'global'" + * client now ignores unsupported upgrades + +0.4.1 / 2013-01-18 +================== + + * do not shadow global XMLHttpRequest + * socket: added `data` event (as synonym to `message`) + * socket: remove `resource` and fix `path` + * socket: fixed access to `opts` + * test: fixed transports tests + * socket: constructor can accept uri/opts simultaneously + * SPEC: simplified: removed resource from SPEC + * socket: proper `host`/`hostname` support + * socket: ensure `onclose` idempotency + * socket: added `onerror` instrumentation + * socket: fix style + * use window to detect platform and fix global reference + * *: fix references to `global` (fixes #79) + +0.4.0 / 2012-12-09 +================== + + * *: now based on `component(1)` + * *: module now exports `Socket` + * socket: export constructors, utils and `protocol` + * *: implemented `emitter` component + * *: removed browserbuild and preprocessor instructions + +0.3.10 / 2012-12-03 +=================== + + * socket: fix closing the socket in an `open` listener [mmastrac] + * socket: perform ping interval/timer cleanup [mmastrac] + * fix SPEC (packages -> packets) [jxck] + * socket: handle probe's transport errors [indutny] + +0.3.9 / 2012-10-23 +================== + + * socket: fix `hostname` instead of `host` + * socket: avoid duplicate `port` defaults + +0.3.8 / 2012-10-23 +================== + + * socket: introduce introspection hooks + * socket: introduced `host` and `port` `location` defaults + * flashsocket: obfuscate activex (fixes #31) + * README: documented reconnect (closes #45) + * socket: unset `id` upon close + * socket: clear transport listeners upon force close + +0.3.7 / 2012-10-21 +================== + + * fix `version` [quackingduck] + * ping timeout gets reset upon any packet received [indutny] + * timeout fixes [cadorn, indutny] + * transport: fix xdomain detection in absence of location.port (GH-38) + * socket: fix passing `false` as secure getting overridden + * socket: default `secure` to `true` for SSL-served pages + * socket: fix default port for SSL when `secure` is not supplied + +0.3.6 / 2012-10-16 +================== + + * socket: reset timeout on any incoming data [indutny] + +0.3.5 / 2012-10-14 +================== + + * new build + +0.3.4 / 2012-10-14 +================== + + * package: fix `component` exports + +0.3.3 / 2012-10-10 +================== + + * socket: fix `secure` default value discovery [quackingduck] + +0.3.2 / 2012-10-08 +================== + + * Bump + +0.3.1 / 2012-10-08 +================== + + * socket: added `write` alias for `send` + * package: added `component` + +0.3.0 / 2012-09-04 +================== + + * IE's XDomainRequest cannot do requests that go from HTTPS to HTTP or HTTP to HTTPS [mixu] + * Switch to client-initiated ping, and set interval in handshake [cadorn] + +0.2.2 / 2012-08-26 +================== + + * polling-jsonp: allow unneeded global leak (fixes #41) + * polling-jsonp: allow for multiple eio's in the same page + +0.2.1 / 2012-08-13 +================== + + * Bump + +0.2.0 / 2012-08-06 +================== + + * polling: introduced `poll` and `pollComplete` (formerly `poll`) events + +0.1.2 / 2012-08-02 +================== + + * Bump + +0.1.1 / 2012-08-01 +================== + + * Added options for request timestamping + * Made timestamp query param customizable + * Added automatic timestamping for Android + +0.1.0 / 2012-07-03 +================== + + * Initial release. diff --git a/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/Makefile b/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/Makefile new file mode 100644 index 0000000..00c6670 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/Makefile @@ -0,0 +1,21 @@ + +REPORTER = dot + +build: engine.io.js + +engine.io.js: lib/*.js lib/transports/*.js package.json + @./support/browserify.sh > engine.io.js + +test: + @./node_modules/.bin/mocha \ + --reporter $(REPORTER) \ + test/index.js + @./node_modules/.bin/zuul -- test/index.js + +test-cov: + @./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha -- \ + --require ./test/common \ + --reporter $(REPORTER) \ + $(TESTS) + +.PHONY: test build diff --git a/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/README.md b/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/README.md new file mode 100644 index 0000000..908be1e --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/README.md @@ -0,0 +1,236 @@ + +# Engine.IO client + +[![Build Status](https://secure.travis-ci.org/Automattic/engine.io-client.png)](http://travis-ci.org/Automattic/engine.io-client) +[![NPM version](https://badge.fury.io/js/engine.io-client.png)](http://badge.fury.io/js/engine.io-client) + +This is the client for [Engine.IO](http://github.com/automattic/engine.io), +the implementation of transport-based cross-browser/cross-device +bi-directional communication layer for [Socket.IO](http://github.com/automattic/socket.io). + +## How to use + +### Standalone + +You can find an `engine.io.js` file in this repository, which is a +standalone build you can use as follows: + +```html + + +``` + +### With browserify + +Engine.IO is a commonjs module, which means you can include it by using +`require` on the browser and package using [browserify](http://browserify.org/): + +1. install the client package + + ```bash + $ npm install engine.io-client + ``` + +1. write your app code + + ```js + var socket = require('engine.io-client')('ws://localhost'); + socket.on('open', function(){ + socket.on('message', function(data){}); + socket.on('close', function(){}); + }); + ``` + +1. build your app bundle + + ```bash + $ browserify app.js > bundle.js + ``` + +1. include on your page + + ```html + + ``` + +### Sending and receiving binary + +```html + + +``` + +### Node.JS + +Add `engine.io-client` to your `package.json` and then: + +```js +var socket = require('engine.io-client')('ws://localhost'); +socket.on('open', function(){ + socket.on('message', function(data){}); + socket.on('close', function(){}); +}); +``` + +## Features + +- Lightweight +- Runs on browser and node.js seamlessly +- Transports are independent of `Engine` + - Easy to debug + - Easy to unit test +- Runs inside HTML5 WebWorker +- Can send and receive binary data + - Receives as ArrayBuffer or Blob when in browser, and Buffer or ArrayBuffer + in Node + - When XHR2 or WebSockets are used, binary is emitted directly. Otherwise + binary is encoded into base64 strings, and decoded when binary types are + supported. + - With browsers that don't support ArrayBuffer, an object { base64: true, + data: dataAsBase64String } is emitted on the `message` event. + +## API + +### Socket + +The client class. Mixes in [Emitter](http://github.com/component/emitter). +Exposed as `eio` in the browser standalone build. + +#### Properties + +- `protocol` _(Number)_: protocol revision number +- `binaryType` _(String)_ : can be set to 'arraybuffer' or 'blob' in browsers, + and `buffer` or `arraybuffer` in Node. Blob is only used in browser if it's + supported. + +#### Events + +- `open` + - Fired upon successful connection. +- `message` + - Fired when data is received from the server. + - **Arguments** + - `String` | `ArrayBuffer`: utf-8 encoded data or ArrayBuffer containing + binary data +- `close` + - Fired upon disconnection. In compliance with the WebSocket API spec, this event may be + fired even if the `open` event does not occur (i.e. due to connection error or `close()`). +- `error` + - Fired when an error occurs. +- `flush` + - Fired upon completing a buffer flush +- `drain` + - Fired after `drain` event of transport if writeBuffer is empty +- `upgradeError` + - Fired if an error occurs with a transport we're trying to upgrade to. +- `upgrade` + - Fired upon upgrade success, after the new transport is set + +#### Methods + +- **constructor** + - Initializes the client + - **Parameters** + - `String` uri + - `Object`: optional, options object + - **Options** + - `agent` (`http.Agent`): `http.Agent` to use, defaults to `false` (NodeJS only) + - `upgrade` (`Boolean`): defaults to true, whether the client should try + to upgrade the transport from long-polling to something better. + - `forceJSONP` (`Boolean`): forces JSONP for polling transport. + - `forceBase64` (`Boolean`): forces base 64 encoding for polling transport even when XHR2 responseType is available and WebSocket even if the used standard supports binary. + - `timestampRequests` (`Boolean`): whether to add the timestamp with + each transport request. Note: this is ignored if the browser is + IE or Android, in which case requests are always stamped (`false`) + - `timestampParam` (`String`): timestamp parameter (`t`) + - `policyPort` (`Number`): port the policy server listens on (`843`) + - `path` (`String`): path to connect to, default is `/engine.io` + - `transports` (`Array`): a list of transports to try (in order). + Defaults to `['polling', 'websocket']`. `Engine` + always attempts to connect directly with the first one, provided the + feature detection test for it passes. + - `rememberUpgrade` (`Boolean`): defaults to false. + If true and if the previous websocket connection to the server succeeded, + the connection attempt will bypass the normal upgrade process and will initially + try websocket. A connection attempt following a transport error will use the + normal upgrade process. It is recommended you turn this on only when using + SSL/TLS connections, or if you know that your network does not block websockets. +- `send` + - Sends a message to the server + - **Parameters** + - `String` | `ArrayBuffer` | `ArrayBufferView` | `Blob`: data to send + - `Function`: optional, callback upon `drain` +- `close` + - Disconnects the client. + +### Transport + +The transport class. Private. _Inherits from EventEmitter_. + +#### Events + +- `poll`: emitted by polling transports upon starting a new request +- `pollComplete`: emitted by polling transports upon completing a request +- `drain`: emitted by polling transports upon a buffer drain + +## Tests + +`engine.io-client` is used to test +[engine](http://github.com/automattic/engine.io). Running the `engine.io` +test suite ensures the client works and vice-versa. + +Browser tests are run using [zuul](https://github.com/defunctzombie/zuul). You can +run the tests locally using the following command. + +``` +./node_modules/.bin/zuul --local 8080 -- test/index.js +``` + +Additionally, `engine.io-client` has a standalone test suite you can run +with `make test` which will run node.js and browser tests. You must have zuul setup with +a saucelabs account. + +## Support + +The support channels for `engine.io-client` are the same as `socket.io`: + - irc.freenode.net **#socket.io** + - [Google Groups](http://groups.google.com/group/socket_io) + - [Website](http://socket.io) + +## Development + +To contribute patches, run tests or benchmarks, make sure to clone the +repository: + +```bash +git clone git://github.com/automattic/engine.io-client.git +``` + +Then: + +```bash +cd engine.io-client +npm install +``` + +See the `Tests` section above for how to run tests before submitting any patches. + +## License + +MIT - Copyright (c) 2014 Automattic, Inc. + diff --git a/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/engine.io.js b/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/engine.io.js new file mode 100644 index 0000000..19e44d8 --- /dev/null +++ b/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/engine.io.js @@ -0,0 +1,3398 @@ +!function(e){if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.eio=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o